import v2.0.0.0_RC3 | 2012-07-01

https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
2019-07-17 22:31:04 +02:00
parent 38c146901c
commit 2f397f01f7
2677 changed files with 296182 additions and 45159 deletions

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -44,7 +44,7 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
* @var Zend_Tool_Framework_Registry
*/
protected $_registry = null;
/**
* @var callback|null
*/
@ -54,19 +54,19 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
* @var bool
*/
protected $_isInitialized = false;
/**
* @var Zend_Log
*/
protected $_debugLogger = null;
public function __construct($options = array())
{
if ($options) {
$this->setOptions($options);
}
}
public function setOptions(Array $options)
{
foreach ($options as $optionName => $optionValue) {
@ -76,15 +76,15 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
}
}
}
/**
* getName() - Return the client name which can be used to
* getName() - Return the client name which can be used to
* query the manifest if need be.
*
* @return string The client name
*/
abstract public function getName();
/**
* initialized() - This will initialize the client for use
*
@ -95,15 +95,15 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
if ($this->_isInitialized) {
return;
}
// this might look goofy, but this is setting up the
// this might look goofy, but this is setting up the
// registry for dependency injection into the client
$registry = new Zend_Tool_Framework_Registry();
$registry->setClient($this);
// NOTE: at this moment, $this->_registry should contain
// the registry object
// run any preInit
$this->_preInit();
@ -113,27 +113,27 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
require_once 'Zend/Log/Writer/Null.php';
$this->_debugLogger = new Zend_Log(new Zend_Log_Writer_Null());
}
// let the loader load, then the repositories process whats been loaded
$this->_registry->getLoader()->load();
// process the action repository
$this->_registry->getActionRepository()->process();
// process the provider repository
$this->_registry->getProviderRepository()->process();
// process the manifest repository
$this->_registry->getManifestRepository()->process();
if ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface) {
require_once 'Zend/Tool/Framework/Client/Interactive/InputHandler.php';
}
if ($this instanceof Zend_Tool_Framework_Client_Interactive_OutputInterface) {
$this->_registry->getResponse()->setContentCallback(array($this, 'handleInteractiveOutput'));
}
}
@ -160,7 +160,7 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
protected function _postDispatch()
{
}
/**
* setRegistry() - Required by the Zend_Tool_Framework_Registry_EnabledInterface
* interface which ensures proper registry dependency resolution
@ -173,10 +173,10 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
$this->_registry = $registry;
return $this;
}
/**
* hasInteractiveInput() - Convienence method for determining if this
* client can handle interactive input, and thus be able to run the
* client can handle interactive input, and thus be able to run the
* promptInteractiveInput
*
* @return bool
@ -185,21 +185,21 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
{
return ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface);
}
public function promptInteractiveInput($inputRequest)
{
if (!$this->hasInteractiveInput()) {
require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('promptInteractive() cannot be called on a non-interactive client.');
}
$inputHandler = new Zend_Tool_Framework_Client_Interactive_InputHandler();
$inputHandler->setClient($this);
$inputHandler->setInputRequest($inputRequest);
return $inputHandler->handle();
}
/**
* This method should be called in order to "handle" a Tooling Client
* request that has come to the client that has been implemented.
@ -207,7 +207,7 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
public function dispatch()
{
$this->initialize();
try {
$this->_preDispatch();
@ -234,51 +234,51 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
$this->_postDispatch();
}
public function convertToClientNaming($string)
{
return $string;
}
public function convertFromClientNaming($string)
{
return $string;
}
protected function _handleDispatch()
{
// get the provider repository
$providerRepository = $this->_registry->getProviderRepository();
$request = $this->_registry->getRequest();
// get the dispatchable provider signature
$providerSignature = $providerRepository->getProviderSignature($request->getProviderName());
// get the actual provider
$provider = $providerSignature->getProvider();
// ensure that we can pretend if this is a pretend request
if ($request->isPretend() && (!$provider instanceof Zend_Tool_Framework_Provider_Pretendable)) {
require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - provider does not support pretend');
throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - provider does not support pretend');
}
// get the action name
$actionName = $this->_registry->getRequest()->getActionName();
if (!$actionableMethod = $providerSignature->getActionableMethodByActionName($actionName)) {
require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - actionable method not found');
throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - actionable method not found');
}
// get the actual method and param information
$methodName = $actionableMethod['methodName'];
$methodParameters = $actionableMethod['parameterInfo'];
// get the provider params
$requestParameters = $this->_registry->getRequest()->getProviderParameters();
// @todo This seems hackish, determine if there is a better way
$callParameters = array();
foreach ($methodParameters as $methodParameterName => $methodParameterValue) {
@ -299,11 +299,11 @@ abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framewor
$callParameters[] = (array_key_exists($methodParameterName, $requestParameters)) ? $requestParameters[$methodParameterName] : $methodParameterValue['default'];
}
}
if (($specialtyName = $this->_registry->getRequest()->getSpecialtyName()) != '_Global') {
$methodName .= $specialtyName;
}
if (method_exists($provider, $methodName)) {
call_user_func_array(array($provider, $methodName), $callParameters);
} elseif (method_exists($provider, $methodName . 'Action')) {

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Config.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Config.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -28,21 +28,21 @@
*/
class Zend_Tool_Framework_Client_Config
{
protected $_configFilepath = null;
/**
* @var Zend_Config
*/
protected $_config = null;
public function __config($options = array())
{
if ($options) {
$this->setOptions($options);
}
}
public function setOptions(Array $options)
{
foreach ($options as $optionName => $optionValue) {
@ -52,7 +52,7 @@ class Zend_Tool_Framework_Client_Config
}
}
}
public function setConfigFilepath($configFilepath)
{
if (!file_exists($configFilepath)) {
@ -61,9 +61,9 @@ class Zend_Tool_Framework_Client_Config
}
$this->_configFilepath = $configFilepath;
$suffix = substr($configFilepath, -4);
switch ($suffix) {
case '.ini':
require_once 'Zend/Config/Ini.php';
@ -83,23 +83,23 @@ class Zend_Tool_Framework_Client_Config
. $suffix . ' at location ' . $configFilepath
);
}
return $this;
}
public function getConfigFilepath()
{
return $this->_configFilepath;
}
public function get($name, $defaultValue)
{
return $this->_config->get($name, $defaultValue);
}
public function __get($name)
{
return $this->_config->{$name};
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Console.php 16972 2009-07-22 18:44:24Z ralph $
* @version $Id: Console.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -52,40 +52,40 @@ require_once 'Zend/Tool/Framework/Client/Response/ContentDecorator/Separator.php
/**
* Zend_Tool_Framework_Client_Console - the CLI Client implementation for Zend_Tool_Framework
*
*
* @category Zend
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Tool_Framework_Client_Console
class Zend_Tool_Framework_Client_Console
extends Zend_Tool_Framework_Client_Abstract
implements Zend_Tool_Framework_Client_Interactive_InputInterface,
Zend_Tool_Framework_Client_Interactive_OutputInterface
Zend_Tool_Framework_Client_Interactive_OutputInterface
{
/**
* @var array
*/
protected $_configOptions = null;
/**
* @var array
*/
protected $_storageOptions = null;
/**
* @var Zend_Filter_Word_CamelCaseToDash
*/
protected $_filterToClientNaming = null;
/**
* @var Zend_Filter_Word_DashToCamelCase
*/
protected $_filterFromClientNaming = null;
/**
* main() - This is typically called from zf.php. This method is a
* main() - This is typically called from zf.php. This method is a
* self contained main() function.
*
*/
@ -101,13 +101,13 @@ class Zend_Tool_Framework_Client_Console
$this->_configOptions = $configOptions;
return $this;
}
public function setStorageOptions($storageOptions)
{
$this->_storageOptions = $storageOptions;
return $this;
}
/**
* getName() - return the name of the client, in this case 'console'
*
@ -117,7 +117,7 @@ class Zend_Tool_Framework_Client_Console
{
return 'console';
}
/**
* _init() - Tasks processed before the constructor, generally setting up objects to use
*
@ -125,25 +125,25 @@ class Zend_Tool_Framework_Client_Console
protected function _preInit()
{
$config = $this->_registry->getConfig();
if ($this->_configOptions != null) {
$config->setOptions($this->_configOptions);
}
$storage = $this->_registry->getStorage();
if ($this->_storageOptions != null && isset($this->_storageOptions['directory'])) {
require_once 'Zend/Tool/Framework/Client/Storage/Directory.php';
$storage->setAdapter(
new Zend_Tool_Framework_Client_Storage_Directory($this->_storageOptions['directory'])
);
}
// support the changing of the current working directory, necessary for some providers
if (isset($_ENV['ZEND_TOOL_CURRENT_WORKING_DIRECTORY'])) {
chdir($_ENV['ZEND_TOOL_CURRENT_WORKING_DIRECTORY']);
}
// support setting the loader from the environment
if (isset($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS'])) {
if (class_exists($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS'])
@ -163,7 +163,7 @@ class Zend_Tool_Framework_Client_Console
protected function _preDispatch()
{
$response = $this->_registry->getResponse();
if (function_exists('posix_isatty')) {
require_once 'Zend/Tool/Framework/Client/Console/ResponseDecorator/Colorizer.php';
$response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Colorizer());
@ -171,12 +171,12 @@ class Zend_Tool_Framework_Client_Console
$response->addContentDecorator(new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator())
->setDefaultDecoratorOptions(array('separator' => true));
$optParser = new Zend_Tool_Framework_Client_Console_ArgumentParser();
$optParser->setArguments($_SERVER['argv'])
->setRegistry($this->_registry)
->parse();
return;
}
@ -188,7 +188,7 @@ class Zend_Tool_Framework_Client_Console
{
$request = $this->_registry->getRequest();
$response = $this->_registry->getResponse();
if ($response->isException()) {
require_once 'Zend/Tool/Framework/Client/Console/HelpSystem.php';
$helpSystem = new Zend_Tool_Framework_Client_Console_HelpSystem();
@ -199,17 +199,17 @@ class Zend_Tool_Framework_Client_Console
$request->getActionName()
);
}
echo PHP_EOL;
return;
}
/**
* handleInteractiveInputRequest() is required by the Interactive InputInterface
*
*
*
* @param Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest
* @return string
* @return string
*/
public function handleInteractiveInputRequest(Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest)
{
@ -217,10 +217,10 @@ class Zend_Tool_Framework_Client_Console
$inputContent = fgets(STDIN);
return rtrim($inputContent); // remove the return from the end of the string
}
/**
* handleInteractiveOutput() is required by the Interactive OutputInterface
*
*
* This allows us to display output immediately from providers, rather
* than displaying it after the provider is done.
*
@ -230,9 +230,9 @@ class Zend_Tool_Framework_Client_Console
{
echo $output;
}
/**
* getMissingParameterPromptString()
* getMissingParameterPromptString()
*
* @param Zend_Tool_Framework_Provider_Interface $provider
* @param Zend_Tool_Framework_Action_Interface $actionInterface
@ -244,14 +244,14 @@ class Zend_Tool_Framework_Client_Console
return 'Please provide a value for $' . $missingParameterName;
}
/**
* convertToClientNaming()
*
*
* Convert words to client specific naming, in this case is lower, dash separated
*
* Filters are lazy-loaded.
*
*
* @param string $string
* @return string
*/
@ -264,20 +264,20 @@ class Zend_Tool_Framework_Client_Console
$filter = new Zend_Filter();
$filter->addFilter(new Zend_Filter_Word_CamelCaseToDash());
$filter->addFilter(new Zend_Filter_StringToLower());
$this->_filterToClientNaming = $filter;
}
return $this->_filterToClientNaming->filter($string);
}
/**
* convertFromClientNaming()
*
* Convert words from client specific naming to code naming - camelcased
*
*
* Filters are lazy-loaded.
*
*
* @param string $string
* @return string
*/
@ -287,7 +287,7 @@ class Zend_Tool_Framework_Client_Console
require_once 'Zend/Filter/Word/DashToCamelCase.php';
$this->_filterFromClientNaming = new Zend_Filter_Word_DashToCamelCase();
}
return $this->_filterFromClientNaming->filter($string);
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ArgumentParser.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: ArgumentParser.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -31,9 +31,9 @@ require_once 'Zend/Console/Getopt.php';
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Framework_Registry_EnabledInterface
class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Framework_Registry_EnabledInterface
{
/**
* @var Zend_Tool_Framework_Registry_Interface
*/
@ -63,8 +63,8 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
protected $_helpKnownAction = false;
protected $_helpKnownProvider = false;
protected $_helpKnownSpecialty = false;
/**
* setArguments
*
@ -76,7 +76,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_argumentsOriginal = $this->_argumentsWorking = $arguments;
return $this;
}
/**
* setRegistry()
*
@ -87,14 +87,14 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
{
// get the client registry
$this->_registry = $registry;
// set manifest repository, request, response for easy access
$this->_manifestRepository = $this->_registry->getManifestRepository();
$this->_request = $this->_registry->getRequest();
$this->_response = $this->_registry->getResponse();
return $this;
}
/**
* Parse() - This method does the work of parsing the arguments into the enpooint request,
* this will also (during help operations) fill the response in with information as needed
@ -108,10 +108,10 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('The client registry must have both a request and response registered.');
}
// setup the help options
$helpResponseOptions = array();
// check to see if the first cli arg is the script name
if ($this->_argumentsWorking[0] == $_SERVER['SCRIPT_NAME' ]) {
array_shift($this->_argumentsWorking);
@ -128,7 +128,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
// ensure there are arguments left
if (count($this->_argumentsWorking) == 0) {
$this->_request->setDispatchable(false); // at this point request is not dispatchable
// check to see if this was a help request
if ($this->_help) {
$this->_createHelpResponse();
@ -149,17 +149,17 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
if ($this->_helpKnownAction) {
$helpResponseOptions = array_merge(
$helpResponseOptions,
$helpResponseOptions,
array('actionName' => $this->_request->getActionName())
);
}
/* @TODO Action Parameter Requirements */
// make sure there are more "words" on the command line
if (count($this->_argumentsWorking) == 0) {
$this->_request->setDispatchable(false); // at this point request is not dispatchable
// check to see if this is a help request
if ($this->_help) {
$this->_createHelpResponse($helpResponseOptions);
@ -169,7 +169,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
return;
}
// process the provider part of the command line
try {
$this->_parseProviderPart();
@ -178,21 +178,21 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_createHelpResponse(array('error' => $exception->getMessage()));
return;
}
if ($this->_helpKnownProvider) {
$helpResponseOptions = array_merge(
$helpResponseOptions,
$helpResponseOptions,
array('providerName' => $this->_request->getProviderName())
);
}
if ($this->_helpKnownSpecialty) {
$helpResponseOptions = array_merge(
$helpResponseOptions,
$helpResponseOptions,
array('specialtyName' => $this->_request->getSpecialtyName())
);
}
// if there are arguments on the command line, lets process them as provider options
if (count($this->_argumentsWorking) != 0) {
$this->_parseProviderOptionsPart();
@ -234,7 +234,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$getoptOptions['pretend|p'] = 'PRETEND';
$getoptOptions['debug|d'] = 'DEBUG';
$getoptParser = new Zend_Console_Getopt($getoptOptions, $this->_argumentsWorking, array('parseAll' => false));
// @todo catch any exceptions here
$getoptParser->parse();
@ -247,7 +247,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_request->setVerbose(true);
} else {
$property = '_'.$option;
$this->{$property} = true;
$this->{$property} = true;
}
}
@ -313,7 +313,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_help = true;
return;
}
// get the cli provider names from the manifest
$providerMetadata = $this->_manifestRepository->getMetadata(array(
'type' => 'Tool',
@ -331,15 +331,15 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_helpKnownProvider = true;
$this->_request->setProviderName($providerMetadata->getProviderName());
if ($consoleSpecialtyName == '?') {
$this->_help = true;
return;
}
$providerSpecialtyMetadata = $this->_manifestRepository->getMetadata(array(
'type' => 'Tool',
'name' => 'specialtyName',
'type' => 'Tool',
'name' => 'specialtyName',
'value' => $consoleSpecialtyName,
'providerName' => $providerMetadata->getProviderName(),
'clientName' => 'console'
@ -368,7 +368,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_help = true;
return;
}
$searchParams = array(
'type' => 'Tool',
'providerName' => $this->_request->getProviderName(),
@ -399,10 +399,10 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
// process ParameterInfo into array for command line option matching
if ($parameterInfo['type'] == 'string' || $parameterInfo['type'] == 'bool') {
$optionConfig .= $paramNameShortValues[$parameterNameLong]
$optionConfig .= $paramNameShortValues[$parameterNameLong]
. (($parameterInfo['optional']) ? '-' : '=') . 's';
} elseif (in_array($parameterInfo['type'], array('int', 'integer', 'float'))) {
$optionConfig .= $paramNameShortValues[$parameterNameLong]
$optionConfig .= $paramNameShortValues[$parameterNameLong]
. (($parameterInfo['optional']) ? '-' : '=') . 'i';
} else {
$optionConfig .= $paramNameShortValues[$parameterNameLong] . '-s';
@ -467,7 +467,7 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
$this->_metadataProviderOptionsLong = $actionableMethodLongParamsMetadata;
$this->_metadataProviderOptionsShort = $actionableMethodShortParamsMetadata;
*/
$this->_argumentsWorking = $getoptParser->getRemainingArgs();
return;
@ -483,11 +483,11 @@ class Zend_Tool_Framework_Client_Console_ArgumentParser implements Zend_Tool_Fra
require_once 'Zend/Tool/Framework/Client/Console/HelpSystem.php';
$helpSystem = new Zend_Tool_Framework_Client_Console_HelpSystem();
$helpSystem->setRegistry($this->_registry);
if (isset($options['error'])) {
$helpSystem->respondWithErrorMessage($options['error']);
}
if (isset($options['actionName']) && isset($options['providerName'])) {
$helpSystem->respondWithSpecialtyAndParamHelp($options['providerName'], $options['actionName']);
} elseif (isset($options['actionName'])) {

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: HelpSystem.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: HelpSystem.php 18305 2009-09-19 16:31:16Z beberlei $
*/
/**
@ -297,7 +297,9 @@ class Zend_Tool_Framework_Client_Console_HelpSystem
'clientName' => 'console'
));
$this->_respondWithCommand($providerMetadata, $actionMetadata, $specialtyMetadata, $actionableSpecialtyLongMetadata);
if($actionableSpecialtyLongMetadata) {
$this->_respondWithCommand($providerMetadata, $actionMetadata, $specialtyMetadata, $actionableSpecialtyLongMetadata);
}
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Manifest.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Manifest.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -58,7 +58,7 @@ require_once 'Zend/Tool/Framework/Registry/EnabledInterface.php';
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Tool_Framework_Client_Console_Manifest
implements Zend_Tool_Framework_Registry_EnabledInterface,
implements Zend_Tool_Framework_Registry_EnabledInterface,
Zend_Tool_Framework_Manifest_MetadataManifestable
{
@ -66,7 +66,7 @@ class Zend_Tool_Framework_Client_Console_Manifest
* @var Zend_Tool_Framework_Registry_Interface
*/
protected $_registry = null;
/**
* setRegistry() - Required for the Zend_Tool_Framework_Registry_EnabledInterface interface
*
@ -78,12 +78,12 @@ class Zend_Tool_Framework_Client_Console_Manifest
$this->_registry = $registry;
return $this;
}
/**
* getMetadata() is required by the Manifest Interface.
*
*
* These are the following metadatas that will be setup:
*
*
* actionName
* - metadata for actions
* - value will be a dashed name for the action named in 'actionName'
@ -102,17 +102,17 @@ class Zend_Tool_Framework_Client_Console_Manifest
public function getMetadata()
{
$metadatas = array();
// setup the camelCase to dashed filter to use since cli expects dashed named
$ccToDashedFilter = new Zend_Filter();
$ccToDashedFilter
->addFilter(new Zend_Filter_Word_CamelCaseToDash())
->addFilter(new Zend_Filter_StringToLower());
// get the registry to get the action and provider repository
$actionRepository = $this->_registry->getActionRepository();
$providerRepository = $this->_registry->getProviderRepository();
// loop through all actions and create a metadata for each
foreach ($actionRepository->getActions() as $action) {
// each action metadata will be called
@ -140,7 +140,7 @@ class Zend_Tool_Framework_Client_Console_Manifest
// create the metadatas for the per provider specialites in providerSpecaltyNames
foreach ($providerSignature->getSpecialties() as $specialty) {
$metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array(
'name' => 'specialtyName',
'value' => $ccToDashedFilter->filter($specialty),
@ -149,25 +149,25 @@ class Zend_Tool_Framework_Client_Console_Manifest
'providerName' => $providerSignature->getName(),
'specialtyName' => $specialty,
'clientReference' => $this->_registry->getClient()
));
));
}
// $actionableMethod is keyed by the methodName (but not used)
foreach ($providerSignature->getActionableMethods() as $actionableMethodData) {
$methodLongParams = array();
$methodShortParams = array();
// $actionableMethodData get both the long and short names
foreach ($actionableMethodData['parameterInfo'] as $parameterInfoData) {
// filter to dashed
$methodLongParams[$parameterInfoData['name']] = $ccToDashedFilter->filter($parameterInfoData['name']);
// simply lower the character, (its only 1 char after all)
$methodShortParams[$parameterInfoData['name']] = strtolower($parameterInfoData['name'][0]);
}
// create metadata for the long name cliActionableMethodLongParameters
@ -181,7 +181,7 @@ class Zend_Tool_Framework_Client_Console_Manifest
'reference' => &$actionableMethodData,
'clientReference' => $this->_registry->getClient()
));
// create metadata for the short name cliActionableMethodShortParameters
$metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array(
'name' => 'actionableMethodShortParams',
@ -197,13 +197,13 @@ class Zend_Tool_Framework_Client_Console_Manifest
}
}
return $metadatas;
}
public function getIndex()
{
return 10000;
}
}

View File

@ -16,7 +16,7 @@
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: InputHandler.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: InputHandler.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -27,20 +27,20 @@
*/
class Zend_Tool_Framework_Client_Interactive_InputHandler
{
/**
* @var Zend_Tool_Framework_Client_Interactive_InputInterface
*/
protected $_client = null;
protected $_inputRequest = null;
public function setClient(Zend_Tool_Framework_Client_Interactive_InputInterface $client)
{
$this->_client = $client;
return $this;
}
public function setInputRequest($inputRequest)
{
if (is_string($inputRequest)) {
@ -50,25 +50,25 @@ class Zend_Tool_Framework_Client_Interactive_InputHandler
require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('promptInteractive() requires either a string or an instance of Zend_Tool_Framework_Client_Interactive_InputRequest.');
}
$this->_inputRequest = $inputRequest;
return $this;
}
public function handle()
{
$inputResponse = $this->_client->handleInteractiveInputRequest($this->_inputRequest);
if (is_string($inputResponse)) {
require_once 'Zend/Tool/Framework/Client/Interactive/InputResponse.php';
$inputResponse = new Zend_Tool_Framework_Client_Interactive_InputResponse($inputResponse);
$inputResponse = new Zend_Tool_Framework_Client_Interactive_InputResponse($inputResponse);
} elseif (!$inputResponse instanceof Zend_Tool_Framework_Client_Interactive_InputResponse) {
require_once 'Zend/Tool/Framework/Client/Exception.php';
throw new Zend_Tool_Framework_Client_Exception('The registered $_interactiveCallback for the client must either return a string or an instance of Zend_Tool_Framework_Client_Interactive_InputResponse.');
}
return $inputResponse;
}
}

View File

@ -16,7 +16,7 @@
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: InputInterface.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: InputInterface.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -27,7 +27,7 @@
*/
interface Zend_Tool_Framework_Client_Interactive_InputInterface
{
/**
* Handle Interactive Input Request
*
@ -35,7 +35,7 @@ interface Zend_Tool_Framework_Client_Interactive_InputInterface
* @return Zend_Tool_Framework_Client_Interactive_InputResponse|string
*/
public function handleInteractiveInputRequest(Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest);
public function getMissingParameterPromptString(Zend_Tool_Framework_Provider_Interface $provider, Zend_Tool_Framework_Action_Interface $actionInterface, $missingParameterName);
}

View File

@ -16,7 +16,7 @@
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: InputRequest.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: InputRequest.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -28,20 +28,20 @@
class Zend_Tool_Framework_Client_Interactive_InputRequest
{
protected $_content = null;
public function __construct($content = null)
{
if ($content) {
$this->setContent($content);
}
}
public function setContent($content)
{
$this->_content = $content;
return $this;
}
public function getContent()
{
return $this->_content;

View File

@ -16,7 +16,7 @@
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: InputResponse.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: InputResponse.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -27,26 +27,26 @@
*/
class Zend_Tool_Framework_Client_Interactive_InputResponse
{
protected $_content = null;
public function __construct($content = null)
{
if ($content) {
$this->setContent($content);
}
}
public function setContent($content)
{
$this->_content = $content;
return $this;
}
public function getContent()
{
return $this->_content;
}
}

View File

@ -16,7 +16,7 @@
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: OutputInterface.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: OutputInterface.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -27,7 +27,7 @@
*/
interface Zend_Tool_Framework_Client_Interactive_OutputInterface
{
public function handleInteractiveOutput($string);
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Request.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Request.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -28,47 +28,47 @@
*/
class Zend_Tool_Framework_Client_Request
{
/**
* @var string
*/
protected $_providerName = null;
/**
* @var string
*/
protected $_specialtyName = null;
/**
* @var string
*/
protected $_actionName = null;
/**
* @var array
*/
protected $_actionParameters = array();
/**
* @var array
*/
protected $_providerParameters = array();
/**
* @var bool
*/
protected $_isPretend = false;
/**
* @var bool
*/
protected $_isDebug = false;
/**
* @var bool
*/
protected $_isVerbose = false;
/**
* @var bool
*/
@ -85,7 +85,7 @@ class Zend_Tool_Framework_Client_Request
$this->_providerName = $providerName;
return $this;
}
/**
* getProviderName()
*
@ -95,7 +95,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_providerName;
}
/**
* setSpecialtyName()
*
@ -107,17 +107,17 @@ class Zend_Tool_Framework_Client_Request
$this->_specialtyName = $specialtyName;
return $this;
}
/**
* getSpecialtyName()
*
*
* @return string
*/
public function getSpecialtyName()
{
return $this->_specialtyName;
}
/**
* setActionName()
*
@ -126,10 +126,10 @@ class Zend_Tool_Framework_Client_Request
*/
public function setActionName($actionName)
{
$this->_actionName = $actionName;
$this->_actionName = $actionName;
return $this;
}
/**
* getActionName()
*
@ -139,7 +139,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_actionName;
}
/**
* setActionParameter()
*
@ -152,7 +152,7 @@ class Zend_Tool_Framework_Client_Request
$this->_actionParameters[$parameterName] = $parameterValue;
return $this;
}
/**
* getActionParameters()
*
@ -162,7 +162,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_actionParameters;
}
/**
* getActionParameter()
*
@ -173,7 +173,7 @@ class Zend_Tool_Framework_Client_Request
{
return (isset($this->_actionParameters[$parameterName])) ? $this->_actionParameters[$parameterName] : null;
}
/**
* setProviderParameter()
*
@ -186,7 +186,7 @@ class Zend_Tool_Framework_Client_Request
$this->_providerParameters[$parameterName] = $parameterValue;
return $this;
}
/**
* getProviderParameters()
*
@ -196,7 +196,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_providerParameters;
}
/**
* getProviderParameter()
*
@ -207,7 +207,7 @@ class Zend_Tool_Framework_Client_Request
{
return (isset($this->_providerParameters[$parameterName])) ? $this->_providerParameters[$parameterName] : null;
}
/**
* setPretend()
*
@ -219,7 +219,7 @@ class Zend_Tool_Framework_Client_Request
$this->_isPretend = (bool) $pretend;
return $this;
}
/**
* isPretend() - Whether or not this is a pretend request
*
@ -229,7 +229,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_isPretend;
}
/**
* setDebug()
*
@ -241,7 +241,7 @@ class Zend_Tool_Framework_Client_Request
$this->_isDebug = (bool) $debug;
return $this;
}
/**
* isDebug() - Whether or not this is a debug enabled request
*
@ -251,7 +251,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_isDebug;
}
/**
* setVerbose()
*
@ -263,7 +263,7 @@ class Zend_Tool_Framework_Client_Request
$this->_isVerbose = (bool) $verbose;
return $this;
}
/**
* isVerbose() - Whether or not this is a verbose enabled request
*
@ -273,7 +273,7 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_isVerbose;
}
/**
* setDispatchable()
*
@ -285,7 +285,7 @@ class Zend_Tool_Framework_Client_Request
$this->_isDispatchable = (bool) $dispatchable;
return $this;
}
/**
* isDispatchable() Is this request Dispatchable?
*
@ -295,5 +295,5 @@ class Zend_Tool_Framework_Client_Request
{
return $this->_isDispatchable;
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Response.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Response.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -32,22 +32,22 @@ class Zend_Tool_Framework_Client_Response
* @var callback|null
*/
protected $_callback = null;
/**
* @var array
*/
protected $_content = array();
/**
* @var Zend_Tool_Framework_Exception
*/
protected $_exception = null;
/**
* @var null|array
*/
protected $_decorators = null;
/**
* @var array
*/
@ -68,7 +68,7 @@ class Zend_Tool_Framework_Client_Response
$this->_callback = $callback;
return $this;
}
/**
* setContent()
*
@ -78,7 +78,7 @@ class Zend_Tool_Framework_Client_Response
public function setContent($content, Array $decoratorOptions = array())
{
$this->_applyDecorators($content, $decoratorOptions);
$this->_content = array();
$this->appendContent($content);
return $this;
@ -93,7 +93,7 @@ class Zend_Tool_Framework_Client_Response
public function appendContent($content, Array $decoratorOptions = array())
{
$content = $this->_applyDecorators($content, $decoratorOptions);
if ($this->_callback !== null) {
call_user_func($this->_callback, $content);
}
@ -119,7 +119,7 @@ class Zend_Tool_Framework_Client_Response
$this->_defaultDecoratorOptions = array_merge($this->_defaultDecoratorOptions, $decoratorOptions);
return $this;
}
/**
* getContent()
*
@ -174,7 +174,7 @@ class Zend_Tool_Framework_Client_Response
$this->_decorators[$decoratorName] = $contentDecorator;
return $this;
}
/**
* getContentDecorators()
*
@ -184,7 +184,7 @@ class Zend_Tool_Framework_Client_Response
{
return $this->_decorators;
}
/**
* __toString() to cast to a string
*
@ -194,7 +194,7 @@ class Zend_Tool_Framework_Client_Response
{
return (string) implode('', $this->_content);
}
/**
* _applyDecorators() apply a group of decorators
*
@ -205,9 +205,9 @@ class Zend_Tool_Framework_Client_Response
protected function _applyDecorators($content, Array $decoratorOptions)
{
$options = array_merge($this->_defaultDecoratorOptions, $decoratorOptions);
$options = array_change_key_case($options, CASE_LOWER);
if ($options) {
foreach ($this->_decorators as $decoratorName => $decorator) {
if (array_key_exists($decoratorName, $options)) {
@ -215,9 +215,9 @@ class Zend_Tool_Framework_Client_Response
}
}
}
return $content;
}
}

View File

@ -16,7 +16,7 @@
* @package Zend_Tool
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -27,9 +27,9 @@
*/
interface Zend_Tool_Framework_Client_Response_ContentDecorator_Interface
{
public function getName();
public function decorate($content, $decoratorValue);
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Separator.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Separator.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -31,15 +31,15 @@ require_once 'Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Tool_Framework_Client_Response_ContentDecorator_Separator
implements Zend_Tool_Framework_Client_Response_ContentDecorator_Interface
class Zend_Tool_Framework_Client_Response_ContentDecorator_Separator
implements Zend_Tool_Framework_Client_Response_ContentDecorator_Interface
{
/**
* @var string
*/
protected $_separator = PHP_EOL;
/**
* getName() - name of the decorator
*
@ -61,7 +61,7 @@ class Zend_Tool_Framework_Client_Response_ContentDecorator_Separator
$this->_separator = $separator;
return $this;
}
/**
* getSeparator()
*
@ -71,23 +71,23 @@ class Zend_Tool_Framework_Client_Response_ContentDecorator_Separator
{
return $this->_separator;
}
public function decorate($content, $decoratorValue)
{
$run = 1;
if (is_bool($decoratorValue) && $decoratorValue === false) {
return $content;
}
if (is_int($decoratorValue)) {
$run = $decoratorValue;
}
for ($i = 0; $i < $run; $i++) {
$content .= $this->_separator;
}
return $content;
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Storage.php 16972 2009-07-22 18:44:24Z ralph $
* @version $Id: Storage.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -33,19 +33,19 @@ require_once 'Zend/Tool/Framework/Client/Storage/AdapterInterface.php';
*/
class Zend_Tool_Framework_Client_Storage
{
/**
* @var Zend_Tool_Framework_Client_Storage_AdapterInterface
*/
protected $_adapter = null;
public function __construct($options = array())
{
if (isset($options['adapter'])) {
$this->setAdapter($options['adapter']);
}
}
public function setAdapter($adapter)
{
if (is_string($adapter)) {
@ -55,29 +55,29 @@ class Zend_Tool_Framework_Client_Storage
}
$this->_adapter = $adapter;
}
public function isEnabled()
{
return ($this->_adapter instanceof Zend_Tool_Framework_Client_Storage_AdapterInterface);
}
public function put($name, $value)
{
if (!$this->_adapter) {
return false;
}
$this->_adapter->put($name, $value);
return $this;
}
public function get($name, $defaultValue = false)
{
if (!$this->_adapter) {
return false;
}
if ($this->_adapter->has($name)) {
return $this->_adapter->get($name);
} else {
@ -85,33 +85,33 @@ class Zend_Tool_Framework_Client_Storage
}
}
public function has($name)
{
if (!$this->_adapter) {
return false;
}
return $this->_adapter->has($name);
}
public function remove($name)
{
if (!$this->_adapter) {
return false;
}
$this->_adapter->remove($name);
return $this;
}
public function getStreamUri($name)
{
if (!$this->_adapter) {
return false;
}
return $this->_adapter->getStreamUri($name);
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: AdapterInterface.php 16972 2009-07-22 18:44:24Z ralph $
* @version $Id: AdapterInterface.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -28,15 +28,15 @@
*/
interface Zend_Tool_Framework_Client_Storage_AdapterInterface
{
public function put($name, $value);
public function get($name);
public function has($name);
public function remove($name);
public function getStreamUri($name);
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Directory.php 16972 2009-07-22 18:44:24Z ralph $
* @version $Id: Directory.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -32,11 +32,11 @@ require_once 'Zend/Tool/Framework/Client/Storage/AdapterInterface.php';
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Tool_Framework_Client_Storage_Directory
implements Zend_Tool_Framework_Client_Storage_AdapterInterface
implements Zend_Tool_Framework_Client_Storage_AdapterInterface
{
protected $_directoryPath = null;
public function __construct($directoryPath)
{
if (!file_exists($directoryPath)) {
@ -44,30 +44,30 @@ class Zend_Tool_Framework_Client_Storage_Directory
}
$this->_directoryPath = $directoryPath;
}
public function put($name, $value)
{
return file_put_contents($this->_directoryPath . DIRECTORY_SEPARATOR . $name, $value);
}
public function get($name)
{
return file_get_contents($this->_directoryPath . DIRECTORY_SEPARATOR . $name);
}
public function has($name)
{
return file_exists($this->_directoryPath . DIRECTORY_SEPARATOR . $name);
}
public function remove($name)
{
return unlink($this->_directoryPath . DIRECTORY_SEPARATOR . $name);
}
public function getStreamUri($name)
{
return $this->_directoryPath . DIRECTORY_SEPARATOR . $name;
}
}