Skip to content

Commit

Permalink
Merge pull request #1 from php-fig/provider
Browse files Browse the repository at this point in the history
Rename collection to provider
  • Loading branch information
Crell authored Oct 17, 2016
2 parents d856112 + 0fceacf commit 1a07821
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 29 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"repositories": [
{ "type": "path", "url": "../link" }
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace Fig\Link;

use Psr\Link\LinkInterface;
use Psr\Link\EvolvableLinkCollectionInterface;
use Psr\Link\EvolvableLinkProviderInterface;

/**
* Class EvolvableLinkCollectionTrait
* Class EvolvableLinkProviderTrait
*
* @implements EvolvableLinkCollectionInterface
* @implements EvolvableLinkProviderInterface
*/
trait EvolvableLinkCollectionTrait
trait EvolvableLinkProviderTrait
{
use LinkCollectionTrait;
use LinkProviderTrait;

/**
* {@inheritdoc}
Expand Down
10 changes: 5 additions & 5 deletions src/GenericLinkCollection.php → src/GenericLinkProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

namespace Fig\Link;

use Psr\Link\EvolvableLinkCollectionInterface;
use Psr\Link\EvolvableLinkProviderInterface;
use Psr\Link\LinkInterface;

class GenericLinkCollection implements EvolvableLinkCollectionInterface
class GenericLinkProvider implements EvolvableLinkProviderInterface
{
use EvolvableLinkCollectionTrait;
use EvolvableLinkProviderTrait;

/**
* Constructs a new link collection.
* Constructs a new link provider.
*
* @param LinkInterface[] $links
* Optionally, specify an initial set of links for this collection.
* Optionally, specify an initial set of links for this provider.
* Note that the keys of the array will be ignored.
*/
public function __construct(array $links = [])
Expand Down
10 changes: 5 additions & 5 deletions src/LinkCollectionTrait.php → src/LinkProviderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

namespace Fig\Link;

use Psr\Link\LinkCollectionInterface;
use Psr\Link\LinkProviderInterface;
use Psr\Link\LinkInterface;

/**
* Class LinkCollectionTrait
* Class LinkProviderTrait
*
* @implements LinkCollectionInterface
* @implements LinkProviderInterface
*/
trait LinkCollectionTrait
trait LinkProviderTrait
{
/**
* A collection of the links in this collection.
* An array of the links in this provider.
*
* The keys of the array MUST be the spl_object_hash() of the object being stored.
* That helps to ensure uniqueness.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace Fig\Link\Tests;

use Fig\Link\GenericLinkCollection;
use Fig\Link\GenericLinkProvider;
use Fig\Link\Link;

class GenericLinkCollectionTest extends \PHPUnit_Framework_TestCase
class GenericLinkProviderTest extends \PHPUnit_Framework_TestCase
{

public function test_can_add_links_by_method()
Expand All @@ -17,10 +17,10 @@ public function test_can_add_links_by_method()
->withAttribute('me', 'you')
;

$collection = (new GenericLinkCollection())
$provider = (new GenericLinkProvider())
->withLink($link);

$this->assertContains($link, $collection->getLinks());
$this->assertContains($link, $provider->getLinks());
}


Expand All @@ -32,10 +32,10 @@ public function test_can_add_links_by_constructor()
->withAttribute('me', 'you')
;

$collection = (new GenericLinkCollection())
$provider = (new GenericLinkProvider())
->withLink($link);

$this->assertContains($link, $collection->getLinks());
$this->assertContains($link, $provider->getLinks());
}

public function test_can_get_links_by_rel()
Expand All @@ -51,11 +51,11 @@ public function test_can_get_links_by_rel()
->withAttribute('me', 'you')
;

$collection = (new GenericLinkCollection())
$provider = (new GenericLinkProvider())
->withLink($link1)
->withLink($link2);

$links = $collection->getLinksByRel('home');
$links = $provider->getLinksByRel('home');
$this->assertContains($link2, $links);
$this->assertFalse(in_array($link1, $links));
}
Expand All @@ -68,10 +68,10 @@ public function test_can_remove_links()
->withAttribute('me', 'you')
;

$collection = (new GenericLinkCollection())
$provider = (new GenericLinkProvider())
->withLink($link)
->withoutLink($link);

$this->assertFalse(in_array($link, $collection->getLinks()));
$this->assertFalse(in_array($link, $provider->getLinks()));
}
}

0 comments on commit 1a07821

Please sign in to comment.