Skip to content

Commit

Permalink
Zend\Tool\Project cleanup
Browse files Browse the repository at this point in the history
- Renamed/reorganized orphaned classes, duplicate names, etc.
- Updated all code and tests to reflect the above
  • Loading branch information
weierophinney committed Jul 6, 2010
1 parent dce59bc commit 724ac6a
Show file tree
Hide file tree
Showing 34 changed files with 219 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* @namespace
*/
namespace Zend\Tool\Project\Context;
namespace Zend\Tool\Project;

/**
* Interface for contexts
Expand All @@ -35,7 +35,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ContextInterface
interface Context
{

public function getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @namespace
*/
namespace Zend\Tool\Project\Context\Content\Engine;
namespace Zend\Tool\Project\Context\Content;

/**
* This class is the front most class for utilizing Zend_Tool_Project
Expand Down Expand Up @@ -64,20 +64,20 @@ public function __construct(\Zend\Tool\Framework\Client\Storage $storage)
{
$this->_storage = $storage;
$this->_engines = array(
new CodeGenerator($storage, $this->_keyInStorage),
new Phtml($storage, $this->_keyInStorage),
new Engine\CodeGenerator($storage, $this->_keyInStorage),
new Engine\Phtml($storage, $this->_keyInStorage),
);
}

/**
* getContent()
*
* @param \Zend\Tool\Project\Context\ContextInterface $context
* @param \Zend\Tool\Project\Context $context
* @param string $methodName
* @param mixed $parameters
* @return string
*/
public function getContent(\Zend\Tool\Project\Context\ContextInterface $context, $methodName, $parameters)
public function getContent(\Zend\Tool\Project\Context $context, $methodName, $parameters)
{
$content = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ public function __construct(\Zend\Tool\Framework\Client\Storage $storage, $conte
/**
* hasContent()
*
* @param \Zend\Tool\Project\Context\ContextInterface $context
* @param \Zend\Tool\Project\Context $context
* @param string $method
* @return string
*/
public function hasContent(Context\ContextInterface $context, $method)
public function hasContent(Context $context, $method)
{
return $this->_storage->has($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.php');
}

/**
* getContent()
*
* @param \Zend\Tool\Project\Context\ContextInterface $context
* @param \Zend\Tool\Project\Context $context
* @param string $method
* @param mixed $parameters
* @return string
*/
public function getContent(Context\ContextInterface $context, $method, $parameters)
public function getContent(Context $context, $method, $parameters)
{
$streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.php');

Expand Down
8 changes: 4 additions & 4 deletions library/Zend/Tool/Project/Context/Content/Engine/Phtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ public function __construct(\Zend\Tool\Framework\Client\Storage $storage, $conte
/**
* hasContext()
*
* @param \Zend\Tool\Project\Context\ContextInterface $context
* @param \Zend\Tool\Project\Context $context
* @param string $method
* @return string
*/
public function hasContent(Context\ContextInterface $context, $method)
public function hasContent(Context $context, $method)
{
return $this->_storage->has($this->_contentPrefix . '/' . $context . '/' . $method . '.phtml');
}

/**
* getContent()
*
* @param \Zend\Tool\Project\Context\ContextInterface $context
* @param \Zend\Tool\Project\Context $context
* @param string $method
* @param mixed $parameters
*/
public function getContent(Context\ContextInterface $context, $method, $parameters)
public function getContent(Context $context, $method, $parameters)
{
$streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.phtml');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
* A profile is a hierarchical set of resources that keep track of
* items within a specific project.
*
* @uses \Zend\Tool\Project\Context\ContextInterface
* @uses \Zend\Tool\Project\Context
* @category Zend
* @package Zend_Tool
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class AbstractFilesystem implements \Zend\Tool\Project\Context\ContextInterface
abstract class AbstractFilesystem implements \Zend\Tool\Project\Context
{

/**
* @var \Zend\Tool\Project\Profile\Resource\Resource
* @var \Zend\Tool\Project\Profile\Resource
*/
protected $_resource = null;

Expand Down Expand Up @@ -70,10 +70,10 @@ public function init()
/**
* setResource()
*
* @param \Zend\Tool\Project\Profile\Resource\Resource $resource
* @param \Zend\Tool\Project\Profile\Resource $resource
* @return \Zend\Tool\Project\Context\Filesystem\AbstractFilesystem
*/
public function setResource(\Zend\Tool\Project\Profile\Resource\Resource $resource)
public function setResource(\Zend\Tool\Project\Profile\Resource $resource)
{
$this->_resource = $resource;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Tool/Project/Context/Filesystem/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getName()
public function create()
{
// check to ensure the parent exists, if not, call it and create it
if (($parentResource = $this->_resource->getParentResource()) instanceof \Zend\Tool\Project\Profile\Resource\Resource) {
if (($parentResource = $this->_resource->getParentResource()) instanceof \Zend\Tool\Project\Profile\Resource) {
if ((($parentContext = $parentResource->getContext()) instanceof AbstractFilesystem)
&& (!$parentContext->exists())) {
$parentResource->create();
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Tool/Project/Context/Filesystem/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function getPersistentAttributes()
*
* @param unknown_type $resource
*/
public function setResource(Resource\Resource $resource)
public function setResource(Resource $resource)
{
$this->_resource = $resource;
$this->_resource->setAppendable(false);
Expand All @@ -107,7 +107,7 @@ public function setResource(Resource\Resource $resource)
/**
* getResource()
*
* @return \Zend\Tool\Project\Profile\Resource\Resource
* @return \Zend\Tool\Project\Profile\Resource
*/
public function getResource()
{
Expand All @@ -122,7 +122,7 @@ public function getResource()
public function create()
{
// check to ensure the parent exists, if not, call it and create it
if (($parentResource = $this->_resource->getParentResource()) instanceof Resource\Resource) {
if (($parentResource = $this->_resource->getParentResource()) instanceof Resource) {
if ((($parentContext = $parentResource->getContext()) instanceof AbstractFilesystem)
&& (!$parentContext->exists())) {
$parentResource->create();
Expand Down
10 changes: 6 additions & 4 deletions library/Zend/Tool/Project/Context/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
*/
namespace Zend\Tool\Project\Context;

use Zend\Tool\Project\Context;

/**
* @uses Countable
* @uses DirectoryIterator
* @uses ReflectionClass
* @uses \Zend\Loader
* @uses \Zend\Tool\Project\Context\Exception
* @uses \Zend\Tool\Project\Context\System\SystemInterface
* @uses \Zend\Tool\Project\Context\System
* @uses \Zend\Tool\Project\Context\System\NotOverwritable
* @uses \Zend\Tool\Project\Context\System\TopLevelRestrictable
* @category Zend
Expand Down Expand Up @@ -106,12 +108,12 @@ public function addContextClass($contextClass)
/**
* Enter description here...
*
* @param \Zend\Tool\Project\Context\ContextInterface $context
* @param \Zend\Tool\Project\Context $context
* @return \Zend\Tool\Project\Context\Repository
*/
public function addContext(ContextInterface $context)
public function addContext(Context $context)
{
$isSystem = ($context instanceof System\SystemInterface);
$isSystem = ($context instanceof System);
$isTopLevel = ($context instanceof System\TopLevelRestrictable);
$isOverwritable = !($context instanceof System\NotOverwritable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @namespace
*/
namespace Zend\Tool\Project\Context\System;
namespace Zend\Tool\Project\Context;

/**
* This class is the front most class for utilizing Zend_Tool_Project
Expand All @@ -36,7 +36,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface SystemInterface
interface System
{

}
5 changes: 3 additions & 2 deletions library/Zend/Tool/Project/Context/System/ProjectDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @namespace
*/
namespace Zend\Tool\Project\Context\System;
use Zend\Tool\Project\Context\System;

/**
* This class is the front most class for utilizing Zend_Tool_Project
Expand All @@ -32,7 +33,7 @@
* items within a specific project.
*
* @uses \Zend\Tool\Project\Context\Filesystem\Directory
* @uses \Zend\Tool\Project\Context\System\SystemInterface
* @uses \Zend\Tool\Project\Context\System
* @uses \Zend\Tool\Project\Context\System\NotOverwritable
* @uses \Zend\Tool\Project\Context\System\TopLevelRestrictable
* @uses \Zend\Tool\Project\Exception
Expand All @@ -43,7 +44,7 @@
*/
class ProjectDirectory
extends \Zend\Tool\Project\Context\Filesystem\Directory
implements SystemInterface,
implements System,
NotOverwritable,
TopLevelRestrictable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @namespace
*/
namespace Zend\Tool\Project\Context\System;
use Zend\Tool\Project\Context\System;

/**
* This class is the front most class for utilizing Zend_Tool_Project
Expand All @@ -32,7 +33,7 @@
* items within a specific project.
*
* @uses \Zend\Tool\Project\Context\Filesystem\File
* @uses \Zend\Tool\Project\Context\System\SystemInterface
* @uses \Zend\Tool\Project\Context\System
* @uses \Zend\Tool\Project\Context\System\NotOverwritable
* @uses \Zend\Tool\Project\Profile\FileParser\Xml
* @category Zend
Expand All @@ -42,7 +43,7 @@
*/
class ProjectProfileFile
extends \Zend\Tool\Project\Context\Filesystem\File
implements SystemInterface,
implements System,
NotOverwritable
{

Expand All @@ -52,7 +53,7 @@ class ProjectProfileFile
protected $_filesystemName = '.zfproject.xml';

/**
* @var \Zend\Tool\Project\Profile\Profile
* @var \Zend\Tool\Project\Profile
*/
protected $_profile = null;

Expand All @@ -69,7 +70,7 @@ public function getName()
/**
* setProfile()
*
* @param \Zend\Tool\Project\Profile\Profile $profile
* @param \Zend\Tool\Project\Profile $profile
* @return \Zend\Tool\Project\Context\System\ProjectProfileFile
*/
public function setProfile($profile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @namespace
*/
namespace Zend\Tool\Project\Context\System;
use Zend\Tool\Project\Context\System;

/**
* This class is the front most class for utilizing Zend_Tool_Project
Expand All @@ -33,7 +34,7 @@
*
* @uses DirectoryIterator
* @uses \Zend\Tool\Project\Context\Filesystem\Directory
* @uses \Zend\Tool\Project\Context\System\SystemInterface
* @uses \Zend\Tool\Project\Context\System
* @uses \Zend\Tool\Project\Context\System\NotOverwritable
* @category Zend
* @package Zend_Tool
Expand All @@ -42,7 +43,7 @@
*/
class ProjectProvidersDirectory
extends \Zend\Tool\Project\Context\Filesystem\Directory
implements SystemInterface,
implements System,
NotOverwritable
{

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Tool/Project/Context/Zf/AbstractClassFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getFullClassName($localClassName, $classContextName = null)
$containingResource = $currentResource;
break;
}
} while ($currentResource instanceof \Zend\Tool\Project\Profile\Resource\Resource
} while ($currentResource instanceof \Zend\Tool\Project\Profile\Resource
&& $currentResource = $currentResource->getParentResource());

$fullClassName = '';
Expand Down
12 changes: 6 additions & 6 deletions library/Zend/Tool/Project/Context/Zf/ActionMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@
* @uses \Zend\CodeGenerator\PHP\PHPFile
* @uses \Zend\Reflection\ReflectionFile
* @uses \Zend\Tool\Project\Context\Exception
* @uses \Zend\Tool\Project\Context\ContextInterface
* @uses \Zend\Tool\Project\Context
* @category Zend
* @package Zend_Tool
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ActionMethod implements Context\ContextInterface
class ActionMethod implements Context
{

/**
* @var \Zend\Tool\Project\Profile\Resource\Resource
* @var \Zend\Tool\Project\Profile\Resource
*/
protected $_resource = null;

/**
* @var \Zend\Tool\Project\Profile\Resource\Resource
* @var \Zend\Tool\Project\Profile\Resource
*/
protected $_controllerResource = null;

Expand Down Expand Up @@ -112,10 +112,10 @@ public function getName()
/**
* setResource()
*
* @param \Zend\Tool\Project\Profile\Resource\Resource $resource
* @param \Zend\Tool\Project\Profile\Resource $resource
* @return \Zend\Tool\Project\Context\Zf\ActionMethod
*/
public function setResource(\Zend\Tool\Project\Profile\Resource\Resource $resource)
public function setResource(\Zend\Tool\Project\Profile\Resource $resource)
{
$this->_resource = $resource;
return $this;
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Tool/Project/Context/Zf/BootstrapFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ class BootstrapFile extends \Zend\Tool\Project\Context\Filesystem\File
protected $_filesystemName = 'Bootstrap.php';

/**
* @var \Zend\Tool\Project\Profile\Resource\Resource
* @var \Zend\Tool\Project\Profile\Resource
*/
protected $_applicationConfigFile = null;

/**
* @var \Zend\Tool\Project\Profile\Resource\Resource
* @var \Zend\Tool\Project\Profile\Resource
*/
protected $_applicationDirectory = null;

Expand Down
Loading

0 comments on commit 724ac6a

Please sign in to comment.