Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 29 changed files with 163 additions and 163 deletions.
10 changes: 5 additions & 5 deletions src/Configuration.php
Expand Up @@ -19,7 +19,7 @@ class Configuration
* @var array
*/
protected $data = array();

/**
* Constructor
*
Expand Down Expand Up @@ -55,7 +55,7 @@ public function configure(Di $di)
if (isset($this->data['instance'])) {
$this->configureInstance($di, $this->data['instance']);
}

}

public function configureDefinition(Di $di, $definition)
Expand Down Expand Up @@ -136,11 +136,11 @@ public function configureDefinition(Di $di, $definition)
}

}

public function configureInstance(Di $di, $instanceData)
{
$im = $di->instanceManager();

foreach ($instanceData as $target => $data) {
switch (strtolower($target)) {
case 'aliases':
Expand Down Expand Up @@ -183,5 +183,5 @@ public function configureInstance(Di $di, $instanceData)

}


}
46 changes: 23 additions & 23 deletions src/Definition/ArrayDefinition.php
Expand Up @@ -12,9 +12,9 @@

class ArrayDefinition implements DefinitionInterface
{

protected $dataArray = array();

public function __construct(Array $dataArray)
{
foreach ($dataArray as $class => $value) {
Expand All @@ -23,79 +23,79 @@ public function __construct(Array $dataArray)
}
$this->dataArray = $dataArray;
}

public function getClasses()
{
return array_keys($this->dataArray);
}

public function hasClass($class)
{
return array_key_exists($class, $this->dataArray);
}

public function getClassSupertypes($class)
{
if (!isset($this->dataArray[$class])) {
return array();
}

if (!isset($this->dataArray[$class]['supertypes'])) {
return array();
}

return $this->dataArray[$class]['supertypes'];
}

public function getInstantiator($class)
{
if (!isset($this->dataArray[$class])) {
return null;
}

if (!isset($this->dataArray[$class]['instantiator'])) {
return '__construct';
}

return $this->dataArray[$class]['instantiator'];
}

public function hasMethods($class)
{
if (!isset($this->dataArray[$class])) {
return array();
}

if (!isset($this->dataArray[$class]['methods'])) {
return array();
}

return (count($this->dataArray[$class]['methods']) > 0);
}

public function hasMethod($class, $method)
{
if (!isset($this->dataArray[$class])) {
return false;
}

if (!isset($this->dataArray[$class]['methods'])) {
return false;
}

return array_key_exists($method, $this->dataArray[$class]['methods']);
}

public function getMethods($class)
{
if (!isset($this->dataArray[$class])) {
return array();
}

if (!isset($this->dataArray[$class]['methods'])) {
return array();
}

return $this->dataArray[$class]['methods'];
}

Expand All @@ -114,18 +114,18 @@ public function getMethodParameters($class, $method)
if (!isset($this->dataArray[$class])) {
return array();
}

if (!isset($this->dataArray[$class]['parameters'])) {
return array();
}

if (!isset($this->dataArray[$class]['parameters'][$method])) {
return array();
}

return $this->dataArray[$class]['parameters'][$method];
}

public function toArray()
{
return $this->dataArray;
Expand Down
12 changes: 6 additions & 6 deletions src/Definition/Builder/InjectionMethod.php
Expand Up @@ -13,21 +13,21 @@
class InjectionMethod
{
const PARAMETER_POSTION_NEXT = 'next';

protected $name = null;
protected $parameters = array();

public function setName($name)
{
$this->name = $name;
return $this;
}

public function getName()
{
return $this->name;
}

public function addParameter($name, $class = null, $isRequired = null)
{
$this->parameters[] = array(
Expand All @@ -37,10 +37,10 @@ public function addParameter($name, $class = null, $isRequired = null)
);
return $this;
}

public function getParameters()
{
return $this->parameters;
}

}
18 changes: 9 additions & 9 deletions src/Definition/Builder/PhpClass.php
Expand Up @@ -39,13 +39,13 @@ public function getName()
{
return $this->name;
}

public function setInstantiator($instantiator)
{
$this->instantiator = $instantiator;
return $this;
}

public function getInstantiator()
{
return $this->instantiator;
Expand Down Expand Up @@ -84,11 +84,11 @@ public function addInjectionMethod(InjectionMethod $injectionMethod)
*
* Optionally takes the method name.
*
* This method may be used in lieu of addInjectionMethod() in
* This method may be used in lieu of addInjectionMethod() in
* order to provide a more fluent interface for building classes with
* injection methods.
*
* @param null|string $name
*
* @param null|string $name
* @return InjectionMethod
*/
public function createInjectionMethod($name = null)
Expand All @@ -104,8 +104,8 @@ public function createInjectionMethod($name = null)

/**
* Override which class will be used by {@link createInjectionMethod()}
*
* @param string $class
*
* @param string $class
* @return PhpClass
*/
public function setMethodBuilder($class)
Expand All @@ -118,14 +118,14 @@ public function setMethodBuilder($class)
* Determine what class will be used by {@link createInjectionMethod()}
*
* Mainly to provide the ability to temporarily override the class used.
*
*
* @return string
*/
public function getMethodBuilder()
{
return $this->defaultMethodBuilder;
}

public function getInjectionMethods()
{
return $this->injectionMethods;
Expand Down
12 changes: 6 additions & 6 deletions src/Definition/BuilderDefinition.php
Expand Up @@ -57,7 +57,7 @@ public function createClassesFromArray(array $builderData)
$class->addInjectionMethod($injectionMethod);
}
break;

}
}
$this->addClass($class);
Expand All @@ -80,7 +80,7 @@ public function addClass(Builder\PhpClass $phpClass)
* Create a class builder object using default class builder class
*
* This method is a factory that can be used in place of addClass().
*
*
* @param null|string $name Optional name of class to assign
* @return Builder\PhpClass
*/
Expand All @@ -98,8 +98,8 @@ public function createClass($name = null)

/**
* Set the class to use with {@link createClass()}
*
* @param string $class
*
* @param string $class
* @return BuilderDefinition
*/
public function setClassBuilder($class)
Expand All @@ -111,9 +111,9 @@ public function setClassBuilder($class)
/**
* Get the class used for {@link createClass()}
*
* This is primarily to allow developers to temporarily override
* This is primarily to allow developers to temporarily override
* the builder strategy.
*
*
* @return string
*/
public function getClassBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/ClassDefinition.php
Expand Up @@ -75,7 +75,7 @@ public function addMethodParameter($method, $parameterName, array $parameterInfo
$this->methodParameters[$method][$fqName] = array(
$parameterName, $type, $required
);

return $this;
}

Expand Down
6 changes: 3 additions & 3 deletions src/DefinitionList.php
Expand Up @@ -119,7 +119,7 @@ public function hasClass($class)
}
return false;
}

public function getClassSupertypes($class)
{
$supertypes = array();
Expand All @@ -130,7 +130,7 @@ public function getClassSupertypes($class)
// @todo remove duplicates?
return $supertypes;
}

public function getInstantiator($class)
{
/** @var $definition Definition\DefinitionInterface */
Expand Down Expand Up @@ -228,5 +228,5 @@ public function getMethodParameters($class, $method)
}
return array();
}

}
2 changes: 1 addition & 1 deletion src/DependencyInjectionInterface.php
Expand Up @@ -17,7 +17,7 @@ interface DependencyInjectionInterface extends LocatorInterface
*
* Forces retrieval of a discrete instance of the given class, using the
* constructor parameters provided.
*
*
* @param mixed $name Class name or service alias
* @param array $params Parameters to pass to the constructor
* @return object|null
Expand Down
2 changes: 1 addition & 1 deletion src/Display/Console.php
Expand Up @@ -108,7 +108,7 @@ public function render()
}

echo PHP_EOL . ' Configurations:' . PHP_EOL;

foreach ($configuredTypes as $type) {
$info = $this->di->instanceManager()->getConfiguration($type);
echo ' ' . $type . PHP_EOL;
Expand Down

0 comments on commit 1b64e7d

Please sign in to comment.