Skip to content

Commit

Permalink
Revert "Merge pull request #7 from fromYukki/master"
Browse files Browse the repository at this point in the history
This reverts commit eca8097, reversing
changes made to adc4db7.
  • Loading branch information
gnugat committed Dec 1, 2015
1 parent e188e3e commit 1dee0ef
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 53 deletions.
4 changes: 2 additions & 2 deletions spec/Memio/Model/ContractSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

class ContractSpec extends ObjectBehavior
{
const FULLY_QUALIFIED_NAME = '\Vendor\Project\MyInterface';
const FULLY_QUALIFIED_NAME = 'Vendor\Project\MyInterface';
const NAME = 'MyInterface';
const NAMESPACE_ = '\Vendor\Project';
const NAMESPACE_ = 'Vendor\Project';

function let()
{
Expand Down
4 changes: 2 additions & 2 deletions spec/Memio/Model/FullyQualifiedNameSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function let()

function it_has_fully_qualified_classname()
{
$this->getFullyQualifiedName()->shouldBe('\Vendor\Project\MyClass');
$this->getFullyQualifiedName()->shouldBe('Vendor\Project\MyClass');
}

function it_has_name()
Expand All @@ -32,7 +32,7 @@ function it_has_name()

function it_has_namespace()
{
$this->getNamespace()->shouldBe('\Vendor\Project');
$this->getNamespace()->shouldBe('Vendor\Project');
}

function it_can_have_an_alias()
Expand Down
4 changes: 2 additions & 2 deletions spec/Memio/Model/ObjectSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

class ObjectSpec extends ObjectBehavior
{
const FULLY_QUALIFIED_NAME = '\Vendor\Project\MyClass';
const FULLY_QUALIFIED_NAME = 'Vendor\Project\MyClass';
const NAME = 'MyClass';
const NAMESPACE_ = '\Vendor\Project';
const NAMESPACE_ = 'Vendor\Project';

function let()
{
Expand Down
1 change: 0 additions & 1 deletion src/Memio/Model/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function __construct($name, $value)
/**
* @param string $name
* @param string $value
* @return Constant
*
* @api
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Memio/Model/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class File
private $fullyQualifiedNames = array();

/**
* @var Structure
* @var Strucutre
*/
private $structure;

Expand Down Expand Up @@ -106,7 +106,7 @@ public function removeLicensePhpdoc()
public function getNamespace()
{
if (null === $this->structure) {
return null;
return;
}

return $this->structure->getNamespace();
Expand Down
52 changes: 9 additions & 43 deletions src/Memio/Model/FullyQualifiedName.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@ class FullyQualifiedName
/**
* @var string
*/
private $qualifiedName;

/**
* @var string
*/
private $unqualifiedName;
private $fullyQualifiedName;

/**
* @var string
*/
private $fullyQualifiedName;
private $name;

/**
* @var string
*/
private $namespace;
private $namepace;

/**
* @var string
Expand All @@ -48,24 +43,11 @@ class FullyQualifiedName
*/
public function __construct($fullyQualifiedName)
{
// Lets say that we have 'Foo\Bar' here
$parts = explode('\\', trim($fullyQualifiedName, '\\'));
$namespaces = explode('\\', $fullyQualifiedName);

// Bar
$this->unqualifiedName = end($parts);

// Foo\Bar
$this->qualifiedName = implode('\\', $parts);

// \Foo\Bar
$this->fullyQualifiedName = '\\' . $this->qualifiedName;

// Build namespace (Foo)
array_pop($parts);

if (count($parts)) {
$this->namespace = self::make(implode('\\', $parts));
}
$this->name = array_pop($namespaces);
$this->namepace = implode('\\', $namespaces);
$this->fullyQualifiedName = trim($fullyQualifiedName, '\\');
}

/**
Expand All @@ -88,36 +70,20 @@ public function getFullyQualifiedName()
return $this->fullyQualifiedName;
}

/**
* @return string
*/
public function getQualifiedName()
{
return $this->qualifiedName;
}

/**
* @return string
*/
public function getUnqualifiedName()
{
return $this->unqualifiedName;
}

/**
* @return string
*/
public function getName()
{
return (null === $this->alias) ? $this->getUnqualifiedName() : $this->alias;
return (null === $this->alias) ? $this->name : $this->alias;
}

/**
* @return string
*/
public function getNamespace()
{
return (null === $this->namespace) ? '' : $this->namespace->getFullyQualifiedName();
return $this->namepace;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Memio/Model/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function removeFinal()
}

/**
* @param \Memio\Model\Object $parent
* @param Object $parent
*
* @return self
*
Expand Down

0 comments on commit 1dee0ef

Please sign in to comment.