Skip to content

Commit 7737c07

Browse files
committed
Remove useless AttributeBag::getNames()
1 parent df42153 commit 7737c07

7 files changed

Lines changed: 3 additions & 38 deletions

File tree

lib/Fhaculty/Graph/Attribute/AttributeBag.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,4 @@ public function setAttributes(array $attributes);
2424
* @return array
2525
*/
2626
public function getAttributes();
27-
28-
/**
29-
* get an array of the names of all existing attributes
30-
*
31-
* @return string[]
32-
*/
33-
public function getNames();
3427
}

lib/Fhaculty/Graph/Attribute/AttributeBagContainer.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ public function setAttributes(array $attributes)
3030
return $this;
3131
}
3232

33-
public function getNames()
34-
{
35-
return array_keys($this->attributes);
36-
}
37-
3833
public function getAttributeBag()
3934
{
4035
return $this;

lib/Fhaculty/Graph/Attribute/AttributeBagNamespaced.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,6 @@ public function setAttributes(array $attributes)
5050
}
5151
}
5252

53-
public function getNames()
54-
{
55-
$names = array();
56-
$len = strlen($this->prefix);
57-
58-
foreach ($this->bag->getAttributes() as $name => $value) {
59-
if (strpos($name, $this->prefix) === 0) {
60-
$names []= substr($name, $len);
61-
}
62-
}
63-
64-
return $names;
65-
}
66-
6753
public function getAttributeBag()
6854
{
6955
return $this;

lib/Fhaculty/Graph/Attribute/AttributeBagReference.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public function setAttributes(array $attributes)
3535
return $this;
3636
}
3737

38-
public function getNames()
39-
{
40-
return array_keys($this->attributes);
41-
}
42-
4338
public function getAttributeBag()
4439
{
4540
return $this;

tests/Fhaculty/Graph/Attribute/AttributeBagContainerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public function testEmpty()
1010

1111
$this->assertNull($bag->getAttribute('unknown'));
1212
$this->assertEquals(array(), $bag->getAttributes());
13-
$this->assertEquals(array(), $bag->getNames());
1413

1514
$this->assertSame($bag, $bag->getAttributeBag());
1615
}
@@ -24,7 +23,7 @@ public function testSome()
2423

2524
$this->assertSame(true, $bag->getAttribute('true'));
2625
$this->assertSame(2, $bag->getAttribute('two'));
27-
$this->assertEquals(array('true', 'two'), $bag->getNames());
26+
$this->assertEquals(array('true' => true, 'two' => 2), $bag->getAttributes());
2827

2928
$bag->setAttribute('float', '1.2');
3029
$bag->setAttributes(array('two' => 'two', 'three' => 3));

tests/Fhaculty/Graph/Attribute/AttributeBagNamespacedTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public function testBagContainer()
2525

2626
$bag->setAttributes(array('d' => 'd', 'e' => 'e'));
2727

28-
$this->assertEquals(array('d', 'e'), $bag->getNames());
29-
$this->assertEquals(array('a.b', 'test.d', 'test.e'), $container->getNames());
28+
$this->assertEquals(array('a.b' => 'c', 'test.d' => 'd', 'test.e' => 'e'), $container->getAttributes());
3029
}
3130

3231
/**
@@ -48,7 +47,6 @@ public function testReadableEntities(AttributeAware $entity)
4847
$this->assertNull($bag->getAttribute('test.d'));
4948

5049
$this->assertEquals(array('d' => 'e'), $bag->getAttributes());
51-
$this->assertEquals(array('d'), $bag->getNames());
5250
}
5351

5452
public function provideNamespacable()

tests/Fhaculty/Graph/Attribute/AttributeBagReferenceTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public function testEmpty()
1212

1313
$this->assertNull($bag->getAttribute('unknown'));
1414
$this->assertEquals(array(), $bag->getAttributes());
15-
$this->assertEquals(array(), $bag->getNames());
1615

1716
$this->assertSame($bag, $bag->getAttributeBag());
1817
}
@@ -28,7 +27,7 @@ public function testSome()
2827

2928
$this->assertSame(true, $bag->getAttribute('true'));
3029
$this->assertSame(2, $bag->getAttribute('two'));
31-
$this->assertEquals(array('true', 'two'), $bag->getNames());
30+
$this->assertEquals(array('true' => true, 'two' => 2), $bag->getAttributes());
3231

3332
$bag->setAttribute('float', '1.2');
3433
$bag->setAttributes(array('two' => 'two', 'three' => 3));

0 commit comments

Comments
 (0)