Skip to content

Commit

Permalink
Consistent documentation and no return value for removeAttribute()
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Oct 2, 2015
1 parent 9d48cfc commit 4c0a334
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 38 deletions.
5 changes: 3 additions & 2 deletions src/Attribute/AttributeAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public function getAttribute($name, $default = null);
public function setAttribute($name, $value);

/**
* @param $name
* @return mixed
* Removes a single attribute with the given $name
*
* @param string $name
*/
public function removeAttribute($name);

Expand Down
1 change: 1 addition & 0 deletions src/Attribute/AttributeBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface AttributeBag extends AttributeAware
{
// public function getAttribute($name, $default);
// public function setAttribute($name, $value);
// public function removeAttribute();
// public function getAttributeBag();

/**
Expand Down
11 changes: 3 additions & 8 deletions src/Attribute/AttributeBagContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,13 @@ public function setAttribute($name, $value)
}

/**
* remove a single attribute with the given $name
* Removes a single attribute with the given $name
*
* @param $name
* @return $this
* @param string $name
*/
public function removeAttribute($name)
{
if (isset($this->attributes[$name]) === true) {
unset($this->attributes[$name]);
}

return $this;
unset($this->attributes[$name]);
}

/**
Expand Down
11 changes: 3 additions & 8 deletions src/Attribute/AttributeBagNamespaced.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,13 @@ public function setAttribute($name, $value)
}

/**
* remove a single attribute with the given $name
* Removes a single attribute with the given $name
*
* @param $name
* @return $this
* @param string $name
*/
public function removeAttribute($name)
{
if (isset($this->attributes[$name]) === true) {
unset($this->attributes[$name]);
}

return $this;
$this->bag->removeAttribute($this->prefix . $name);
}

/**
Expand Down
11 changes: 3 additions & 8 deletions src/Attribute/AttributeBagReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,13 @@ public function setAttribute($name, $value)
}

/**
* remove a single attribute with the given $name
* Removes a single attribute with the given $name
*
* @param $name
* @return $this
* @param string $name
*/
public function removeAttribute($name)
{
if (isset($this->attributes[$name]) === true) {
unset($this->attributes[$name]);
}

return $this;
unset($this->attributes[$name]);
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Edge/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,7 @@ public function setAttribute($name, $value)

public function removeAttribute($name)
{
if (isset($this->attributes[$name]) === true) {
unset($this->attributes[$name]);
}
unset($this->attributes[$name]);
}

public function getAttributeBag()
Expand Down
4 changes: 1 addition & 3 deletions src/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,7 @@ public function setAttribute($name, $value)

public function removeAttribute($name)
{
if (isset($this->attributes[$name]) === true) {
unset($this->attributes[$name]);
}
unset($this->attributes[$name]);
}

public function getAttributeBag()
Expand Down
4 changes: 1 addition & 3 deletions src/Vertex.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,7 @@ public function setAttribute($name, $value)

public function removeAttribute($name)
{
if (isset($this->attributes[$name]) === true) {
unset($this->attributes[$name]);
}
unset($this->attributes[$name]);
}

public function getAttributeBag()
Expand Down
7 changes: 6 additions & 1 deletion tests/Attribute/AttributeBagContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

use Fhaculty\Graph\Attribute\AttributeBagContainer;

class AttributeBagContainerTest extends TestCase
class AttributeBagContainerTest extends AbstractAttributeAwareTest
{
protected function createAttributeAware()
{
return new AttributeBagContainer();
}

public function testEmpty()
{
$bag = new AttributeBagContainer();
Expand Down
7 changes: 6 additions & 1 deletion tests/Attribute/AttributeBagNamespacedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Attribute\AttributeBagContainer;

class AtributeBagNamespacedTest extends TestCase
class AtributeBagNamespacedTest extends AbstractAttributeAwareTest
{
protected function createAttributeAware()
{
return new AttributeBagNamespaced(new AttributeBagContainer(), 'test.');
}

public function testBagContainer()
{
$container = new AttributeBagContainer();
Expand Down
9 changes: 8 additions & 1 deletion tests/Attribute/AttributeBagReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

use Fhaculty\Graph\Attribute\AttributeBagReference;

class AttributeBagReferenceTest extends TestCase
class AttributeBagReferenceTest extends AbstractAttributeAwareTest
{
protected function createAttributeAware()
{
$attributes = array();

return new AttributeBagReference($attributes);
}

public function testEmpty()
{
$attributes = array();
Expand Down

0 comments on commit 4c0a334

Please sign in to comment.