@@ -20,15 +20,15 @@ |
||
| 20 | 20 | interface RequiresDependencyMapInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @param EE_Dependency_Map $dependency_map |
|
| 25 | - */ |
|
| 26 | - public function setDependencyMap($dependency_map); |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @return EE_Dependency_Map |
|
| 30 | - */ |
|
| 31 | - public function dependencyMap(); |
|
| 23 | + /** |
|
| 24 | + * @param EE_Dependency_Map $dependency_map |
|
| 25 | + */ |
|
| 26 | + public function setDependencyMap($dependency_map); |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @return EE_Dependency_Map |
|
| 30 | + */ |
|
| 31 | + public function dependencyMap(); |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | // Location: RequiresDependencyMap.php |
@@ -32,115 +32,115 @@ |
||
| 32 | 32 | class CoreLoader implements LoaderDecoratorInterface |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var EE_Registry|CoffeeShop $generator |
|
| 37 | - */ |
|
| 38 | - private $generator; |
|
| 39 | - |
|
| 40 | - |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * CoreLoader constructor. |
|
| 44 | - * |
|
| 45 | - * @param EE_Registry|CoffeeShop $generator |
|
| 46 | - * @throws InvalidArgumentException |
|
| 47 | - */ |
|
| 48 | - public function __construct($generator) |
|
| 49 | - { |
|
| 50 | - if(!($generator instanceof EE_Registry || $generator instanceof CoffeeShop)) { |
|
| 51 | - throw new InvalidArgumentException( |
|
| 52 | - esc_html__( |
|
| 53 | - 'The CoreLoader class must receive an instance of EE_Registry or the CoffeeShop DI container.', |
|
| 54 | - 'event_espresso' |
|
| 55 | - ) |
|
| 56 | - ); |
|
| 57 | - } |
|
| 58 | - $this->generator = $generator; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Calls the appropriate loading method from the installed generator; |
|
| 65 | - * If EE_Registry is being used, then the additional parameters for the EE_Registry::create() method |
|
| 66 | - * can be added to the $arguments array and they will be extracted and passed to EE_Registry::create(), |
|
| 67 | - * but NOT to the class being instantiated. |
|
| 68 | - * This is done by adding the parameters to the $arguments array as follows: |
|
| 69 | - * array( |
|
| 70 | - * 'EE_Registry::create(from_db)' => true, // boolean value, default = false |
|
| 71 | - * 'EE_Registry::create(load_only)' => true, // boolean value, default = false |
|
| 72 | - * 'EE_Registry::create(addon)' => true, // boolean value, default = false |
|
| 73 | - * ) |
|
| 74 | - * |
|
| 75 | - * @param string $fqcn |
|
| 76 | - * @param array $arguments |
|
| 77 | - * @param bool $shared |
|
| 78 | - * @return mixed |
|
| 79 | - * @throws OutOfBoundsException |
|
| 80 | - * @throws ServiceExistsException |
|
| 81 | - * @throws InstantiationException |
|
| 82 | - * @throws InvalidIdentifierException |
|
| 83 | - * @throws InvalidDataTypeException |
|
| 84 | - * @throws InvalidClassException |
|
| 85 | - * @throws EE_Error |
|
| 86 | - * @throws ServiceNotFoundException |
|
| 87 | - * @throws ReflectionException |
|
| 88 | - */ |
|
| 89 | - public function load($fqcn, $arguments = array(), $shared = true) |
|
| 90 | - { |
|
| 91 | - $shared = filter_var($shared, FILTER_VALIDATE_BOOLEAN); |
|
| 92 | - if($this->generator instanceof EE_Registry) { |
|
| 93 | - // check if additional EE_Registry::create() arguments have been passed |
|
| 94 | - // from_db |
|
| 95 | - $from_db = isset($arguments['EE_Registry::create(from_db)']) |
|
| 96 | - ? filter_var($arguments['EE_Registry::create(from_db)'], FILTER_VALIDATE_BOOLEAN) |
|
| 97 | - : false; |
|
| 98 | - // load_only |
|
| 99 | - $load_only = isset($arguments['EE_Registry::create(load_only)']) |
|
| 100 | - ? filter_var($arguments['EE_Registry::create(load_only)'], FILTER_VALIDATE_BOOLEAN) |
|
| 101 | - : false; |
|
| 102 | - // addon |
|
| 103 | - $addon = isset($arguments['EE_Registry::create(addon)']) |
|
| 104 | - ? filter_var($arguments['EE_Registry::create(addon)'], FILTER_VALIDATE_BOOLEAN) |
|
| 105 | - : false; |
|
| 106 | - unset( |
|
| 107 | - $arguments['EE_Registry::create(from_db)'], |
|
| 108 | - $arguments['EE_Registry::create(load_only)'], |
|
| 109 | - $arguments['EE_Registry::create(addon)'] |
|
| 110 | - ); |
|
| 111 | - // addons need to be cached on EE_Registry |
|
| 112 | - $shared = $addon ? true : $shared; |
|
| 113 | - return $this->generator->create( |
|
| 114 | - $fqcn, |
|
| 115 | - $arguments, |
|
| 116 | - $shared, |
|
| 117 | - $from_db, |
|
| 118 | - $load_only, |
|
| 119 | - $addon |
|
| 120 | - ); |
|
| 121 | - } |
|
| 122 | - return $this->generator->brew( |
|
| 123 | - $fqcn, |
|
| 124 | - $arguments, |
|
| 125 | - $shared ? CoffeeMaker::BREW_SHARED : CoffeeMaker::BREW_NEW |
|
| 126 | - ); |
|
| 127 | - |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * calls reset() on generator if method exists |
|
| 134 | - * |
|
| 135 | - * @throws EE_Error |
|
| 136 | - * @throws ReflectionException |
|
| 137 | - */ |
|
| 138 | - public function reset() |
|
| 139 | - { |
|
| 140 | - if (method_exists($this->generator, 'reset')) { |
|
| 141 | - $this->generator->reset(); |
|
| 142 | - } |
|
| 143 | - } |
|
| 35 | + /** |
|
| 36 | + * @var EE_Registry|CoffeeShop $generator |
|
| 37 | + */ |
|
| 38 | + private $generator; |
|
| 39 | + |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * CoreLoader constructor. |
|
| 44 | + * |
|
| 45 | + * @param EE_Registry|CoffeeShop $generator |
|
| 46 | + * @throws InvalidArgumentException |
|
| 47 | + */ |
|
| 48 | + public function __construct($generator) |
|
| 49 | + { |
|
| 50 | + if(!($generator instanceof EE_Registry || $generator instanceof CoffeeShop)) { |
|
| 51 | + throw new InvalidArgumentException( |
|
| 52 | + esc_html__( |
|
| 53 | + 'The CoreLoader class must receive an instance of EE_Registry or the CoffeeShop DI container.', |
|
| 54 | + 'event_espresso' |
|
| 55 | + ) |
|
| 56 | + ); |
|
| 57 | + } |
|
| 58 | + $this->generator = $generator; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Calls the appropriate loading method from the installed generator; |
|
| 65 | + * If EE_Registry is being used, then the additional parameters for the EE_Registry::create() method |
|
| 66 | + * can be added to the $arguments array and they will be extracted and passed to EE_Registry::create(), |
|
| 67 | + * but NOT to the class being instantiated. |
|
| 68 | + * This is done by adding the parameters to the $arguments array as follows: |
|
| 69 | + * array( |
|
| 70 | + * 'EE_Registry::create(from_db)' => true, // boolean value, default = false |
|
| 71 | + * 'EE_Registry::create(load_only)' => true, // boolean value, default = false |
|
| 72 | + * 'EE_Registry::create(addon)' => true, // boolean value, default = false |
|
| 73 | + * ) |
|
| 74 | + * |
|
| 75 | + * @param string $fqcn |
|
| 76 | + * @param array $arguments |
|
| 77 | + * @param bool $shared |
|
| 78 | + * @return mixed |
|
| 79 | + * @throws OutOfBoundsException |
|
| 80 | + * @throws ServiceExistsException |
|
| 81 | + * @throws InstantiationException |
|
| 82 | + * @throws InvalidIdentifierException |
|
| 83 | + * @throws InvalidDataTypeException |
|
| 84 | + * @throws InvalidClassException |
|
| 85 | + * @throws EE_Error |
|
| 86 | + * @throws ServiceNotFoundException |
|
| 87 | + * @throws ReflectionException |
|
| 88 | + */ |
|
| 89 | + public function load($fqcn, $arguments = array(), $shared = true) |
|
| 90 | + { |
|
| 91 | + $shared = filter_var($shared, FILTER_VALIDATE_BOOLEAN); |
|
| 92 | + if($this->generator instanceof EE_Registry) { |
|
| 93 | + // check if additional EE_Registry::create() arguments have been passed |
|
| 94 | + // from_db |
|
| 95 | + $from_db = isset($arguments['EE_Registry::create(from_db)']) |
|
| 96 | + ? filter_var($arguments['EE_Registry::create(from_db)'], FILTER_VALIDATE_BOOLEAN) |
|
| 97 | + : false; |
|
| 98 | + // load_only |
|
| 99 | + $load_only = isset($arguments['EE_Registry::create(load_only)']) |
|
| 100 | + ? filter_var($arguments['EE_Registry::create(load_only)'], FILTER_VALIDATE_BOOLEAN) |
|
| 101 | + : false; |
|
| 102 | + // addon |
|
| 103 | + $addon = isset($arguments['EE_Registry::create(addon)']) |
|
| 104 | + ? filter_var($arguments['EE_Registry::create(addon)'], FILTER_VALIDATE_BOOLEAN) |
|
| 105 | + : false; |
|
| 106 | + unset( |
|
| 107 | + $arguments['EE_Registry::create(from_db)'], |
|
| 108 | + $arguments['EE_Registry::create(load_only)'], |
|
| 109 | + $arguments['EE_Registry::create(addon)'] |
|
| 110 | + ); |
|
| 111 | + // addons need to be cached on EE_Registry |
|
| 112 | + $shared = $addon ? true : $shared; |
|
| 113 | + return $this->generator->create( |
|
| 114 | + $fqcn, |
|
| 115 | + $arguments, |
|
| 116 | + $shared, |
|
| 117 | + $from_db, |
|
| 118 | + $load_only, |
|
| 119 | + $addon |
|
| 120 | + ); |
|
| 121 | + } |
|
| 122 | + return $this->generator->brew( |
|
| 123 | + $fqcn, |
|
| 124 | + $arguments, |
|
| 125 | + $shared ? CoffeeMaker::BREW_SHARED : CoffeeMaker::BREW_NEW |
|
| 126 | + ); |
|
| 127 | + |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * calls reset() on generator if method exists |
|
| 134 | + * |
|
| 135 | + * @throws EE_Error |
|
| 136 | + * @throws ReflectionException |
|
| 137 | + */ |
|
| 138 | + public function reset() |
|
| 139 | + { |
|
| 140 | + if (method_exists($this->generator, 'reset')) { |
|
| 141 | + $this->generator->reset(); |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | // End of file CoreLoader.php |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function __construct($generator) |
| 49 | 49 | { |
| 50 | - if(!($generator instanceof EE_Registry || $generator instanceof CoffeeShop)) { |
|
| 50 | + if ( ! ($generator instanceof EE_Registry || $generator instanceof CoffeeShop)) { |
|
| 51 | 51 | throw new InvalidArgumentException( |
| 52 | 52 | esc_html__( |
| 53 | 53 | 'The CoreLoader class must receive an instance of EE_Registry or the CoffeeShop DI container.', |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function load($fqcn, $arguments = array(), $shared = true) |
| 90 | 90 | { |
| 91 | 91 | $shared = filter_var($shared, FILTER_VALIDATE_BOOLEAN); |
| 92 | - if($this->generator instanceof EE_Registry) { |
|
| 92 | + if ($this->generator instanceof EE_Registry) { |
|
| 93 | 93 | // check if additional EE_Registry::create() arguments have been passed |
| 94 | 94 | // from_db |
| 95 | 95 | $from_db = isset($arguments['EE_Registry::create(from_db)']) |
@@ -25,19 +25,19 @@ |
||
| 25 | 25 | * @param int $code |
| 26 | 26 | * @param \Exception $previous |
| 27 | 27 | */ |
| 28 | - public function __construct( $file_path, $message = '', $code = 0, \Exception $previous = null ) { |
|
| 29 | - if ( empty( $message ) ) { |
|
| 28 | + public function __construct($file_path, $message = '', $code = 0, \Exception $previous = null) { |
|
| 29 | + if (empty($message)) { |
|
| 30 | 30 | $message = sprintf( |
| 31 | 31 | __( |
| 32 | 32 | 'The "%1$s" file is either missing or could not be read due to permissions. Please ensure that the following path is correct and verify that the file permissions are correct:%2$s %3$s', |
| 33 | 33 | 'event_espresso' |
| 34 | 34 | ), |
| 35 | - basename( $file_path ), |
|
| 35 | + basename($file_path), |
|
| 36 | 36 | '<br />', |
| 37 | 37 | $file_path |
| 38 | 38 | ); |
| 39 | 39 | } |
| 40 | - parent::__construct( $message, $code, $previous ); |
|
| 40 | + parent::__construct($message, $code, $previous); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | } |
@@ -25,14 +25,14 @@ |
||
| 25 | 25 | * @param int $code |
| 26 | 26 | * @param \Exception $previous |
| 27 | 27 | */ |
| 28 | - public function __construct( $interface_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
| 29 | - if ( empty( $message ) ) { |
|
| 28 | + public function __construct($interface_name, $message = '', $code = 0, \Exception $previous = null) { |
|
| 29 | + if (empty($message)) { |
|
| 30 | 30 | $message = sprintf( |
| 31 | - __( 'The "%1$s" Interface is either missing or invalid.', 'event_espresso' ), |
|
| 31 | + __('The "%1$s" Interface is either missing or invalid.', 'event_espresso'), |
|
| 32 | 32 | $interface_name |
| 33 | 33 | ); |
| 34 | 34 | } |
| 35 | - parent::__construct( $message, $code, $previous ); |
|
| 35 | + parent::__construct($message, $code, $previous); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | } |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param int $code |
| 30 | 30 | * @param Exception $previous |
| 31 | 31 | */ |
| 32 | - public function __construct( $var_name, $variable, $expected, $message = '', $code = 0, Exception $previous = null ) { |
|
| 33 | - if ( empty( $message ) ) { |
|
| 34 | - $expected = strpos( ' was expected.', $expected ) === false |
|
| 35 | - ? $this->addIndefiniteArticle( $expected ) . ' was expected.' |
|
| 32 | + public function __construct($var_name, $variable, $expected, $message = '', $code = 0, Exception $previous = null) { |
|
| 33 | + if (empty($message)) { |
|
| 34 | + $expected = strpos(' was expected.', $expected) === false |
|
| 35 | + ? $this->addIndefiniteArticle($expected).' was expected.' |
|
| 36 | 36 | : $expected; |
| 37 | 37 | $message = sprintf( |
| 38 | 38 | __( |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | 'event_espresso' |
| 41 | 41 | ), |
| 42 | 42 | $var_name, |
| 43 | - $this->addIndefiniteArticle( gettype( $variable ) ), |
|
| 43 | + $this->addIndefiniteArticle(gettype($variable)), |
|
| 44 | 44 | $expected |
| 45 | 45 | ); |
| 46 | 46 | } |
| 47 | - parent::__construct( $message, $code, $previous ); |
|
| 47 | + parent::__construct($message, $code, $previous); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | * @param $string |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - protected function addIndefiniteArticle( $string ) { |
|
| 57 | - if ( strtolower( $string ) === 'null' ) { |
|
| 56 | + protected function addIndefiniteArticle($string) { |
|
| 57 | + if (strtolower($string) === 'null') { |
|
| 58 | 58 | return $string; |
| 59 | 59 | } |
| 60 | - return ( stripos( 'aeiou', $string[0] ) !== false ? 'an ' : 'a ' ) . $string; |
|
| 60 | + return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ').$string; |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | // End of file InvalidDataTypeException.php |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | * @param int $code |
| 25 | 25 | * @param \Exception $previous |
| 26 | 26 | */ |
| 27 | - public function __construct( $class_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
| 28 | - if ( empty( $message ) ) { |
|
| 27 | + public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null) { |
|
| 28 | + if (empty($message)) { |
|
| 29 | 29 | $message = sprintf( |
| 30 | - __( 'The "%1$s" Class is either missing or invalid.', 'event_espresso' ), |
|
| 30 | + __('The "%1$s" Class is either missing or invalid.', 'event_espresso'), |
|
| 31 | 31 | $class_name |
| 32 | 32 | ); |
| 33 | 33 | } |
| 34 | - parent::__construct( $message, $code, $previous ); |
|
| 34 | + parent::__construct($message, $code, $previous); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
| 42 | 42 | { |
| 43 | - if (! isset($arguments[0], $arguments[1])) { |
|
| 43 | + if ( ! isset($arguments[0], $arguments[1])) { |
|
| 44 | 44 | throw new InvalidArgumentException( |
| 45 | 45 | esc_html__( |
| 46 | 46 | 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
| 52 | - if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
| 52 | + if ( ! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
| 53 | 53 | throw new DomainException( |
| 54 | 54 | sprintf( |
| 55 | 55 | esc_html__( |
@@ -24,44 +24,44 @@ |
||
| 24 | 24 | class DomainFactory |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
| 29 | - * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
| 30 | - * constructor. Must at least include the following two value objects: |
|
| 31 | - * array( |
|
| 32 | - * EventEspresso\core\domain\values\FilePath $plugin_file |
|
| 33 | - * EventEspresso\core\domain\values\Version $version |
|
| 34 | - * ) |
|
| 35 | - * @return mixed |
|
| 36 | - * @throws DomainException |
|
| 37 | - * @throws InvalidArgumentException |
|
| 38 | - * @throws InvalidDataTypeException |
|
| 39 | - * @throws InvalidInterfaceException |
|
| 40 | - */ |
|
| 41 | - public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
|
| 42 | - { |
|
| 43 | - if (! isset($arguments[0], $arguments[1])) { |
|
| 44 | - throw new InvalidArgumentException( |
|
| 45 | - esc_html__( |
|
| 46 | - 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
| 47 | - 'event_espresso' |
|
| 48 | - ) |
|
| 49 | - ); |
|
| 50 | - } |
|
| 51 | - $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
|
| 52 | - if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
| 53 | - throw new DomainException( |
|
| 54 | - sprintf( |
|
| 55 | - esc_html__( |
|
| 56 | - 'The requested Domain class "%1$s" could not be loaded.', |
|
| 57 | - 'event_espresso' |
|
| 58 | - ), |
|
| 59 | - $domain_fqcn |
|
| 60 | - ) |
|
| 61 | - ); |
|
| 62 | - } |
|
| 63 | - return $domain; |
|
| 64 | - } |
|
| 27 | + /** |
|
| 28 | + * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
| 29 | + * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
| 30 | + * constructor. Must at least include the following two value objects: |
|
| 31 | + * array( |
|
| 32 | + * EventEspresso\core\domain\values\FilePath $plugin_file |
|
| 33 | + * EventEspresso\core\domain\values\Version $version |
|
| 34 | + * ) |
|
| 35 | + * @return mixed |
|
| 36 | + * @throws DomainException |
|
| 37 | + * @throws InvalidArgumentException |
|
| 38 | + * @throws InvalidDataTypeException |
|
| 39 | + * @throws InvalidInterfaceException |
|
| 40 | + */ |
|
| 41 | + public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
|
| 42 | + { |
|
| 43 | + if (! isset($arguments[0], $arguments[1])) { |
|
| 44 | + throw new InvalidArgumentException( |
|
| 45 | + esc_html__( |
|
| 46 | + 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
| 47 | + 'event_espresso' |
|
| 48 | + ) |
|
| 49 | + ); |
|
| 50 | + } |
|
| 51 | + $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
|
| 52 | + if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
| 53 | + throw new DomainException( |
|
| 54 | + sprintf( |
|
| 55 | + esc_html__( |
|
| 56 | + 'The requested Domain class "%1$s" could not be loaded.', |
|
| 57 | + 'event_espresso' |
|
| 58 | + ), |
|
| 59 | + $domain_fqcn |
|
| 60 | + ) |
|
| 61 | + ); |
|
| 62 | + } |
|
| 63 | + return $domain; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -20,42 +20,42 @@ |
||
| 20 | 20 | class FilePath |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var string file_path |
|
| 25 | - */ |
|
| 26 | - private $file_path; |
|
| 27 | - |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * FilePath constructor. |
|
| 31 | - * |
|
| 32 | - * @param string $file_path |
|
| 33 | - * @throws InvalidDataTypeException |
|
| 34 | - * @throws InvalidFilePathException |
|
| 35 | - */ |
|
| 36 | - public function __construct($file_path) |
|
| 37 | - { |
|
| 38 | - if (! is_string($file_path)) { |
|
| 39 | - throw new InvalidDataTypeException( |
|
| 40 | - '$file_path', |
|
| 41 | - $file_path, |
|
| 42 | - 'string' |
|
| 43 | - ); |
|
| 44 | - } |
|
| 45 | - if (! is_readable($file_path)) { |
|
| 46 | - throw new InvalidFilePathException($file_path); |
|
| 47 | - } |
|
| 48 | - $this->file_path = $file_path; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @return string |
|
| 54 | - */ |
|
| 55 | - public function __toString() |
|
| 56 | - { |
|
| 57 | - return $this->file_path; |
|
| 58 | - } |
|
| 23 | + /** |
|
| 24 | + * @var string file_path |
|
| 25 | + */ |
|
| 26 | + private $file_path; |
|
| 27 | + |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * FilePath constructor. |
|
| 31 | + * |
|
| 32 | + * @param string $file_path |
|
| 33 | + * @throws InvalidDataTypeException |
|
| 34 | + * @throws InvalidFilePathException |
|
| 35 | + */ |
|
| 36 | + public function __construct($file_path) |
|
| 37 | + { |
|
| 38 | + if (! is_string($file_path)) { |
|
| 39 | + throw new InvalidDataTypeException( |
|
| 40 | + '$file_path', |
|
| 41 | + $file_path, |
|
| 42 | + 'string' |
|
| 43 | + ); |
|
| 44 | + } |
|
| 45 | + if (! is_readable($file_path)) { |
|
| 46 | + throw new InvalidFilePathException($file_path); |
|
| 47 | + } |
|
| 48 | + $this->file_path = $file_path; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @return string |
|
| 54 | + */ |
|
| 55 | + public function __toString() |
|
| 56 | + { |
|
| 57 | + return $this->file_path; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | } |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct($file_path) |
| 37 | 37 | { |
| 38 | - if (! is_string($file_path)) { |
|
| 38 | + if ( ! is_string($file_path)) { |
|
| 39 | 39 | throw new InvalidDataTypeException( |
| 40 | 40 | '$file_path', |
| 41 | 41 | $file_path, |
| 42 | 42 | 'string' |
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | - if (! is_readable($file_path)) { |
|
| 45 | + if ( ! is_readable($file_path)) { |
|
| 46 | 46 | throw new InvalidFilePathException($file_path); |
| 47 | 47 | } |
| 48 | 48 | $this->file_path = $file_path; |
@@ -21,45 +21,45 @@ |
||
| 21 | 21 | class FullyQualifiedName |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var string $fully_qualified_name |
|
| 26 | - */ |
|
| 27 | - private $fully_qualified_name; |
|
| 24 | + /** |
|
| 25 | + * @var string $fully_qualified_name |
|
| 26 | + */ |
|
| 27 | + private $fully_qualified_name; |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * FullyQualifiedName constructor. |
|
| 32 | - * |
|
| 33 | - * @param string $fully_qualified_name |
|
| 34 | - * @throws InvalidClassException |
|
| 35 | - * @throws InvalidInterfaceException |
|
| 36 | - * @throws InvalidDataTypeException |
|
| 37 | - */ |
|
| 38 | - public function __construct($fully_qualified_name) |
|
| 39 | - { |
|
| 40 | - if (! is_string($fully_qualified_name)) { |
|
| 41 | - throw new InvalidDataTypeException( |
|
| 42 | - '$fully_qualified_name', |
|
| 43 | - $fully_qualified_name, |
|
| 44 | - 'string' |
|
| 45 | - ); |
|
| 46 | - } |
|
| 47 | - if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
| 48 | - if (strpos($fully_qualified_name, 'Interface') !== false) { |
|
| 49 | - throw new InvalidInterfaceException($fully_qualified_name); |
|
| 50 | - } |
|
| 51 | - throw new InvalidClassException($fully_qualified_name); |
|
| 52 | - } |
|
| 53 | - $this->fully_qualified_name = $fully_qualified_name; |
|
| 54 | - } |
|
| 30 | + /** |
|
| 31 | + * FullyQualifiedName constructor. |
|
| 32 | + * |
|
| 33 | + * @param string $fully_qualified_name |
|
| 34 | + * @throws InvalidClassException |
|
| 35 | + * @throws InvalidInterfaceException |
|
| 36 | + * @throws InvalidDataTypeException |
|
| 37 | + */ |
|
| 38 | + public function __construct($fully_qualified_name) |
|
| 39 | + { |
|
| 40 | + if (! is_string($fully_qualified_name)) { |
|
| 41 | + throw new InvalidDataTypeException( |
|
| 42 | + '$fully_qualified_name', |
|
| 43 | + $fully_qualified_name, |
|
| 44 | + 'string' |
|
| 45 | + ); |
|
| 46 | + } |
|
| 47 | + if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
| 48 | + if (strpos($fully_qualified_name, 'Interface') !== false) { |
|
| 49 | + throw new InvalidInterfaceException($fully_qualified_name); |
|
| 50 | + } |
|
| 51 | + throw new InvalidClassException($fully_qualified_name); |
|
| 52 | + } |
|
| 53 | + $this->fully_qualified_name = $fully_qualified_name; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return string |
|
| 59 | - */ |
|
| 60 | - public function __toString() |
|
| 61 | - { |
|
| 62 | - return $this->fully_qualified_name; |
|
| 63 | - } |
|
| 57 | + /** |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 60 | + public function __toString() |
|
| 61 | + { |
|
| 62 | + return $this->fully_qualified_name; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | } |
@@ -37,14 +37,14 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct($fully_qualified_name) |
| 39 | 39 | { |
| 40 | - if (! is_string($fully_qualified_name)) { |
|
| 40 | + if ( ! is_string($fully_qualified_name)) { |
|
| 41 | 41 | throw new InvalidDataTypeException( |
| 42 | 42 | '$fully_qualified_name', |
| 43 | 43 | $fully_qualified_name, |
| 44 | 44 | 'string' |
| 45 | 45 | ); |
| 46 | 46 | } |
| 47 | - if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
| 47 | + if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
| 48 | 48 | if (strpos($fully_qualified_name, 'Interface') !== false) { |
| 49 | 49 | throw new InvalidInterfaceException($fully_qualified_name); |
| 50 | 50 | } |