Permalink
Browse files

rename the Feature class Attribute

  • Loading branch information...
1 parent 9fb6b44 commit 66640e07cf3a8c34e2371ed86ff33bf605d6d711 @iampersistent iampersistent committed Oct 17, 2012
@@ -8,12 +8,12 @@
namespace Vespolina\Entity\Product;
-use Vespolina\Entity\Product\FeatureInterface;
+use Vespolina\Entity\Product\AttributeInterface;
/**
* @author Richard D Shank <develop@zestic.com>
*/
-class Feature implements FeatureInterface
+class Attribute implements AttributeInterface
{
protected $name;
protected $searchTerm;
@@ -10,47 +10,47 @@
/**
* @author Richard D Shank <develop@zestic.com>
*/
-interface FeatureInterface
+interface AttributeInterface
{
/**
- * Set the name of this feature. ie: Sling Blade, Miramax, R
+ * Set the name of this attribute. ie: Sling Blade, Miramax, R
*
* @param $name
*/
function setName($name);
/**
- * Get the name of this feature
+ * Get the name of this attribute
*
- * @return string name of node
+ * @return string
*/
function getName();
/**
- * Set the search term for this feature
+ * Set the search term for this attribute
*
* @param $term
*/
function setSearchTerm($term);
/**
- * Return the search term for this feature
+ * Return the search term for this attribute
*
- * @return string term
+ * @return string
*/
function getSearchTerm();
/**
- * Set the type of feature. ie: title, studio, rated
+ * Set the type of attribute. ie: title, studio, rated
*
* @param $type
*/
function setType($type);
/**
- * Return the type of feature
+ * Return the type of attribute
*
- * @return string type
+ * @return string
*/
function getType();
}
@@ -28,7 +28,7 @@
const SERVICE = 16;
protected $description;
- protected $features;
+ protected $attributes;
protected $media;
protected $name;
protected $optionGroups;
@@ -53,37 +53,37 @@ public function getDescription()
/**
* @inheritdoc
*/
- public function addFeature(FeatureInterface $feature)
+ public function addAttribute(AttributeInterface $attribute)
{
- $type = $feature->getType();
- $this->features[$type] = $feature;
+ $type = $attribute->getType();
+ $this->attributes[$type] = $attribute;
}
/**
* @inheritdoc
*/
- public function addFeatures(array $features)
+ public function addAttributes(array $attributes)
{
- foreach($features as $feature) {
- $this->addFeature($feature);
+ foreach($attributes as $attribute) {
+ $this->addAttribute($attribute);
}
}
/**
* @inheritdoc
*/
- public function clearFeatures()
+ public function clearAttributes()
{
- $this->features = array();
+ $this->attributes = array();
}
/**
* @inheritdoc
*/
- public function getFeature($type)
+ public function getAttribute($type)
{
- if (isset($this->features[$type])) {
- return $this->features[$type];
+ if (isset($this->attributes[$type])) {
+ return $this->attributes[$type];
}
return null;
@@ -92,30 +92,30 @@ public function getFeature($type)
/**
* @inheritdoc
*/
- public function getFeatures()
+ public function getAttributes()
{
- return $this->features;
+ return $this->attributes;
}
/**
* @inheritdoc
*/
- function removeFeature($feature)
+ function removeAttribute($attribute)
{
- if ($feature instanceof FeatureInterface) {
- $feature = $feature->getType();
+ if ($attribute instanceof AttributeInterface) {
+ $attribute = $attribute->getType();
}
- unset($this->features[$feature]);
+ unset($this->attributes[$attribute]);
}
/**
* @inheritdoc
*/
- public function setFeatures($features)
+ public function setAttributes($attributes)
{
- $this->features = array();
- foreach ($features as $feature) {
- $this->addFeature($feature);
+ $this->attributes = array();
+ foreach ($attributes as $attribute) {
+ $this->addAttribute($attribute);
}
}
@@ -154,7 +154,7 @@ public function getName()
/**
* @inheritdoc
*/
-/** remove for now to get feature tests to pass
+/** remove for now to get attribute tests to pass
public function addOptionGroup(OptionGroupInterface $optionGroup)
{
$this->options[] = $optionGroup;
@@ -9,8 +9,8 @@
namespace Vespolina\Entity\Product;
use Vespolina\Entity\Asset\MediaInterface;
-use Vespolina\Entity\Product\FeatureInterface;
use Vespolina\Entity\Identifier\IdentifierInterface;
+use Vespolina\Entity\Product\AttributeInterface;
use Vespolina\Entity\Product\OptionInterface;
use Vespolina\Entity\Product\OptionGroupInterface;
use Vespolina\Entity\Taxonomy\TaxonomyInterface;
@@ -38,21 +38,21 @@ function getDescription();
/**
* Remove all features from the product
*/
- function clearFeatures();
+ function clearAttributes();
/**
* Return the features of the product
*
- * @return \Vespolina\Entity\Product\FeatureInterface
+ * @return \Vespolina\Entity\Product\AttributeInterface
*/
- function getFeatures();
+ function getAttributes();
/**
* Set the features of the product to a feature set
*
* @param $features
*/
- function setFeatures($features);
+ function setAttributes($features);
/**
* Set the name of the product
@@ -80,14 +80,14 @@ function addOptionGroup(OptionGroupInterface $optionGroup);
/**
* Remove an options set from the product
*
- * @param string name of group $name
+ * @param string
*/
function removeOptionGroup($name);
/**
* Set the options of the product to an option set
*
- * @param array of Vespolina\ProductBundle\Node\OptionGroupInterface $optionGroup
+ * @param array
*/
function setOptions($options);
@@ -118,7 +118,7 @@ function getIdentifiers();
*
* @param array (optional) option set or null returns primary
*
- * @return Vespolina\ProductBundle\Identifier\ProductIdentifierSetInterface
+ * @return \Vespolina\ProductBundle\Identifier\ProductIdentifierSetInterface
*/
function getIdentifierSet($target = null);
@@ -238,7 +238,8 @@ function setType($type);
/**
* Get the product type.
- * @return type
+ *
+ * @return string
*/
function getType();
@@ -252,7 +253,7 @@ function getCreatedAt();
/**
* Set the cart creation date
*
- * @param DateTime $createdAt
+ * @param \DateTime $createdAt
*/
function setCreatedAt(\DateTime $createdAt);
@@ -266,7 +267,7 @@ function getUpdatedAt();
/**
* Set the cart update date
*
- * @param DateTime $updatedAt
+ * @param \DateTime $updatedAt
*/
function setUpdatedAt(\DateTime $updatedAt);
}
@@ -10,7 +10,7 @@
use Vespolina\Entity\Identifier\IdentifierInterface;
use Vespolina\Entity\Product\BaseProductInterface;
-use Vespolina\Entity\Product\FeatureInterface;
+use Vespolina\Entity\Product\AttributeInterface;
use Vespolina\Entity\Product\OptionInterface;
use Vespolina\Entity\Product\OptionGroupInterface;
@@ -21,34 +21,34 @@
interface ProductInterface extends BaseProductInterface
{
/**
- * Add a single feature to the product
+ * Add a single attribute to the product
*
- * @param FeatureInterface $feature
+ * @param AttributeInterface $attribute
*/
- function addFeature(FeatureInterface $feature);
+ function addAttribute(AttributeInterface $attribute);
/**
- * Add an array of feature to the product
+ * Add an array of attribute to the product
*
- * @param array of Vespolina\Entity\Product\FeatureInterface $features
+ * @param array of Vespolina\Entity\Product\AttributeInterface $attributes
*/
- function addFeatures(array $features);
+ function addAttributes(array $attributes);
/**
- * Return a feature by its type
+ * Return a attribute by its type
*
* @param $type
*
- * @return \Vespolina\Entity\Product\FeatureInterface
+ * @return \Vespolina\Entity\Product\AttributeInterface
*/
- function getFeature($type);
+ function getAttribute($type);
/**
- * Remove a feature by its type
+ * Remove a attribute by its type
*
* @param $type
*/
- function removeFeature($type);
+ function removeAttribute($type);
/**
* Return a new instance of the ProductIdentifierSet, based on the class passed into the Product from the constructor
@@ -6,41 +6,41 @@
* with this source code in the file LICENSE.
*/
-use Vespolina\Entity\Feature;
+use Vespolina\Entity\Product\Attribute;
-class FeatureTest extends \PHPUnit_Framework_TestCase
+class AttributeTest extends \PHPUnit_Framework_TestCase
{
public function testSetSearchTerm()
{
- $feature = new Feature();
+ $feature = new Attribute();
$feature->setSearchTerm('MIxEd cAsE');
$this->assertSame('mixed case', $feature->getSearchTerm(), 'the search term should be converted to lower case before setting');
- $titleFeature = new Feature();
- $titleFeature->setType('title');
- $titleFeature->setName('EIGHT53');
+ $titleAttribute = new Attribute();
+ $titleAttribute->setType('title');
+ $titleAttribute->setName('EIGHT53');
$this->assertEquals(
'eight53',
- $titleFeature->getSearchTerm(),
+ $titleAttribute->getSearchTerm(),
'the search term should be a lowercase version of the name'
);
- $titleFeature->setSearchTerm('different search term');
+ $titleAttribute->setSearchTerm('different search term');
$this->assertEquals(
'different search term',
- $titleFeature->getSearchTerm(),
+ $titleAttribute->getSearchTerm(),
'setting search term overrides previous set term'
);
- $titleFeature->setName('eight53');
+ $titleAttribute->setName('eight53');
$this->assertEquals(
'different search term',
- $titleFeature->getSearchTerm(),
+ $titleAttribute->getSearchTerm(),
'if a term is already set, it should not be overwritten by setting the name'
);
- $titleFeature->setSearchTerm(21);
- $this->assertInternalType('string', $titleFeature->getSearchTerm(), 'make sure the search is type cast as a string');
+ $titleAttribute->setSearchTerm(21);
+ $this->assertInternalType('string', $titleAttribute->getSearchTerm(), 'make sure the search is type cast as a string');
}
}
Oops, something went wrong.

0 comments on commit 66640e0

Please sign in to comment.