Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
Namespace shuffle.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Oct 17, 2013
1 parent d033124 commit d3f182e
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameInterface;
use Eloquent\Cosmos\ClassName\QualifiedClassNameInterface;
use Eloquent\Cosmos\ClassName\ResolutionContext;
use Eloquent\Cosmos\ClassName\ResolutionContextInterface;

/**
* Resolves class names against a bound context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameInterface;
use Eloquent\Cosmos\ClassName\QualifiedClassNameInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameInterface;
use Eloquent\Cosmos\ClassName\QualifiedClassNameInterface;
use Eloquent\Cosmos\ClassName\ResolutionContextInterface;

/**
* Resolves class names against a supplied context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameInterface;
use Eloquent\Cosmos\ClassName\QualifiedClassNameInterface;
use Eloquent\Cosmos\ClassName\ResolutionContextInterface;

/**
* The interface implemented by class name resolvers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver\Consumer;
namespace Eloquent\Cosmos\Resolution\Consumer;

use Eloquent\Cosmos\ClassName\Resolver\ClassNameResolver;
use Eloquent\Cosmos\ClassName\Resolver\ClassNameResolverInterface;
use Eloquent\Cosmos\Resolution\ClassNameResolver;
use Eloquent\Cosmos\Resolution\ClassNameResolverInterface;

/**
* A trait for classes that take a class name resolver as a dependency.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameReference;
use Eloquent\Cosmos\ClassName\ClassNameReferenceInterface;
use Eloquent\Cosmos\ClassName\Factory\ClassNameFactory;
use Eloquent\Cosmos\ClassName\Factory\ClassNameFactoryInterface;
use Eloquent\Cosmos\ClassName\QualifiedClassNameInterface;

/**
* Represents a combined namespace and set of use statements.
Expand All @@ -19,17 +25,17 @@ class ResolutionContext implements ResolutionContextInterface
/**
* Construct a new class name resolution context.
*
* @param QualifiedClassNameInterface|null $primaryNamespace The namespace.
* @param array<UseStatementInterface>|null $useStatements The use statements.
* @param Factory\ClassNameFactoryInterface|null $factory The class name factory to use.
* @param QualifiedClassNameInterface|null $primaryNamespace The namespace.
* @param array<UseStatementInterface>|null $useStatements The use statements.
* @param ClassNameFactoryInterface|null $factory The class name factory to use.
*/
public function __construct(
QualifiedClassNameInterface $primaryNamespace = null,
array $useStatements = null,
Factory\ClassNameFactoryInterface $factory = null
ClassNameFactoryInterface $factory = null
) {
if (null === $factory) {
$factory = new Factory\ClassNameFactory;
$factory = new ClassNameFactory;
}
if (null === $primaryNamespace) {
$primaryNamespace = $factory->createFromAtoms(array(), true);
Expand Down Expand Up @@ -103,7 +109,7 @@ public function resolve(ClassNameReferenceInterface $reference)
/**
* Get the class name factory.
*
* @return Factory\ClassNameFactoryInterface The class name factory.
* @return ClassNameFactoryInterface The class name factory.
*/
public function factory()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameReferenceInterface;

/**
* The interface implemented by class name resolution contexts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\ClassNameReferenceInterface;
use Eloquent\Cosmos\ClassName\Exception\InvalidClassNameAtomException;
use Eloquent\Cosmos\ClassName\QualifiedClassName;
use Eloquent\Cosmos\ClassName\QualifiedClassNameInterface;

/**
* Represents a use statement.
Expand All @@ -22,7 +27,7 @@ class UseStatement implements UseStatementInterface
* @param QualifiedClassNameInterface $className The class name.
* @param ClassNameReferenceInterface|null $alias The alias for the class name.
*
* @throws Exception\InvalidClassNameAtomException If an invalid alias is supplied.
* @throws InvalidClassNameAtomException If an invalid alias is supplied.
*/
public function __construct(
QualifiedClassNameInterface $className,
Expand All @@ -39,9 +44,7 @@ public function __construct(
QualifiedClassName::SELF_ATOM === $aliasAtoms[0] ||
QualifiedClassName::PARENT_ATOM === $aliasAtoms[0]
) {
throw new Exception\InvalidClassNameAtomException(
$alias->string()
);
throw new InvalidClassNameAtomException($alias->string());
}

$this->alias = $normalizedAlias;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName;
namespace Eloquent\Cosmos\Resolution;

/**
* The interface implemented by use statements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\Factory\ClassNameFactory;
use Eloquent\Cosmos\ClassName\ResolutionContext;
use PHPUnit_Framework_TestCase;

class BoundClassNameResolverTest extends PHPUnit_Framework_TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\Factory\ClassNameFactory;
use Eloquent\Cosmos\ClassName\ResolutionContext;
use PHPUnit_Framework_TestCase;

class ClassNameResolverTest extends PHPUnit_Framework_TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName\Resolver\Consumer;
namespace Eloquent\Cosmos\Resolution\Consumer;

use Phake;
use PHPUnit_Framework_TestCase;
Expand All @@ -29,7 +29,7 @@ protected function setUp()

public function testSetClassNameResolver()
{
$classNameResolver = Phake::mock('Eloquent\Cosmos\ClassName\Resolver\ClassNameResolverInterface');
$classNameResolver = Phake::mock('Eloquent\Cosmos\Resolution\ClassNameResolverInterface');
$this->consumer->setClassNameResolver($classNameResolver);

$this->assertSame($classNameResolver, $this->consumer->classNameResolver());
Expand All @@ -39,7 +39,7 @@ public function testClassNameResolver()
{
$classNameResolver = $this->consumer->classNameResolver();

$this->assertInstanceOf('Eloquent\Cosmos\ClassName\Resolver\ClassNameResolverInterface', $classNameResolver);
$this->assertInstanceOf('Eloquent\Cosmos\Resolution\ClassNameResolverInterface', $classNameResolver);
$this->assertSame($classNameResolver, $this->consumer->classNameResolver());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\Factory\ClassNameFactory;
use Eloquent\Cosmos\ClassName\QualifiedClassName;
use PHPUnit_Framework_TestCase;

class ResolutionContextTest extends PHPUnit_Framework_TestCase
Expand All @@ -19,7 +21,7 @@ protected function setUp()
{
parent::setUp();

$this->factory = new Factory\ClassNameFactory;
$this->factory = new ClassNameFactory;
$this->primaryNamespace = $this->factory->create('\VendorA\PackageA');
$this->useStatements = array(
new UseStatement($this->factory->create('\VendorB\PackageB')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
* file that was distributed with this source code.
*/

namespace Eloquent\Cosmos\ClassName;
namespace Eloquent\Cosmos\Resolution;

use Eloquent\Cosmos\ClassName\Factory\ClassNameFactory;
use PHPUnit_Framework_TestCase;

class UseStatementTest extends PHPUnit_Framework_TestCase
Expand All @@ -19,7 +20,7 @@ protected function setUp()
{
parent::setUp();

$this->factory = new Factory\ClassNameFactory;
$this->factory = new ClassNameFactory;
$this->className = $this->factory->create('\\Namespace\\Class');
$this->alias = $this->factory->create('Alias');
$this->useStatement = new UseStatement($this->className, $this->alias);
Expand Down

0 comments on commit d3f182e

Please sign in to comment.