@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * Creates a proxy for the given class. |
| 23 | 23 | * Returned object dispatches method invocations to $methodHandler. |
| 24 | 24 | * @param $className |
| 25 | - * @param $methodHandler |
|
| 25 | + * @param \Ouzo\Tests\Mock\SimpleMock $methodHandler |
|
| 26 | 26 | * @return null |
| 27 | 27 | */ |
| 28 | 28 | public static function newInstance($className, $methodHandler) |
@@ -50,6 +50,9 @@ discard block |
||
| 50 | 50 | return $code; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + /** |
|
| 54 | + * @param ReflectionClass $class |
|
| 55 | + */ |
|
| 53 | 56 | private static function getClassMethods($class) |
| 54 | 57 | { |
| 55 | 58 | $methods = $class->getMethods(); |
@@ -53,14 +53,14 @@ |
||
| 53 | 53 | private static function getClassMethods($class) |
| 54 | 54 | { |
| 55 | 55 | $methods = $class->getMethods(); |
| 56 | - return Arrays::filter($methods, function (ReflectionMethod $method) { |
|
| 56 | + return Arrays::filter($methods, function(ReflectionMethod $method) { |
|
| 57 | 57 | return !$method->isConstructor(); |
| 58 | 58 | }); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | private static function getParameterDeclaration(ReflectionFunctionAbstract $method) |
| 62 | 62 | { |
| 63 | - return Joiner::on(', ')->join(Arrays::map($method->getParameters(), function (ReflectionParameter $param) { |
|
| 63 | + return Joiner::on(', ')->join(Arrays::map($method->getParameters(), function(ReflectionParameter $param) { |
|
| 64 | 64 | $result = ''; |
| 65 | 65 | if ($param->getClass()) { |
| 66 | 66 | $result .= $param->getClass()->getName() . ' '; |
@@ -16,6 +16,9 @@ discard block |
||
| 16 | 16 | }; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $name |
|
| 21 | + */ |
|
| 19 | 22 | public static function extractField($name, $accessPrivate = false) |
| 20 | 23 | { |
| 21 | 24 | return function ($object) use ($name, $accessPrivate) { |
@@ -23,6 +26,9 @@ discard block |
||
| 23 | 26 | }; |
| 24 | 27 | } |
| 25 | 28 | |
| 29 | + /** |
|
| 30 | + * @param string $names |
|
| 31 | + */ |
|
| 26 | 32 | public static function extractFieldRecursively($names, $accessPrivate = false) |
| 27 | 33 | { |
| 28 | 34 | return function ($object) use ($names, $accessPrivate) { |
@@ -149,7 +155,7 @@ discard block |
||
| 149 | 155 | * composition is defined as the function h such that h(a) == A(B(a)) for each a. |
| 150 | 156 | * @param $functionA |
| 151 | 157 | * @param $functionB |
| 152 | - * @return callable |
|
| 158 | + * @return \Closure |
|
| 153 | 159 | */ |
| 154 | 160 | public static function compose($functionA, $functionB) |
| 155 | 161 | { |
@@ -11,21 +11,21 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public static function extractId() |
| 13 | 13 | { |
| 14 | - return function ($object) { |
|
| 14 | + return function($object) { |
|
| 15 | 15 | return $object->getId(); |
| 16 | 16 | }; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public static function extractField($name, $accessPrivate = false) |
| 20 | 20 | { |
| 21 | - return function ($object) use ($name, $accessPrivate) { |
|
| 21 | + return function($object) use ($name, $accessPrivate) { |
|
| 22 | 22 | return Objects::getValue($object, $name, null, $accessPrivate); |
| 23 | 23 | }; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function extractFieldRecursively($names, $accessPrivate = false) |
| 27 | 27 | { |
| 28 | - return function ($object) use ($names, $accessPrivate) { |
|
| 28 | + return function($object) use ($names, $accessPrivate) { |
|
| 29 | 29 | return Objects::getValueRecursively($object, $names, null, $accessPrivate); |
| 30 | 30 | }; |
| 31 | 31 | } |
@@ -43,98 +43,98 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public static function identity() |
| 45 | 45 | { |
| 46 | - return function ($object) { |
|
| 46 | + return function($object) { |
|
| 47 | 47 | return $object; |
| 48 | 48 | }; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public static function constant($value) |
| 52 | 52 | { |
| 53 | - return function () use ($value) { |
|
| 53 | + return function() use ($value) { |
|
| 54 | 54 | return $value; |
| 55 | 55 | }; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public static function throwException(Exception $exception) |
| 59 | 59 | { |
| 60 | - return function () use ($exception) { |
|
| 60 | + return function() use ($exception) { |
|
| 61 | 61 | throw $exception; |
| 62 | 62 | }; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public static function trim() |
| 66 | 66 | { |
| 67 | - return function ($string) { |
|
| 67 | + return function($string) { |
|
| 68 | 68 | return trim($string); |
| 69 | 69 | }; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public static function not($predicate) |
| 73 | 73 | { |
| 74 | - return function ($object) use ($predicate) { |
|
| 74 | + return function($object) use ($predicate) { |
|
| 75 | 75 | return !$predicate($object); |
| 76 | 76 | }; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public static function isArray() |
| 80 | 80 | { |
| 81 | - return function ($object) { |
|
| 81 | + return function($object) { |
|
| 82 | 82 | return is_array($object); |
| 83 | 83 | }; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public static function isInstanceOf($type) |
| 87 | 87 | { |
| 88 | - return function ($object) use ($type) { |
|
| 88 | + return function($object) use ($type) { |
|
| 89 | 89 | return $object instanceof $type; |
| 90 | 90 | }; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public static function prepend($prefix) |
| 94 | 94 | { |
| 95 | - return function ($string) use ($prefix) { |
|
| 95 | + return function($string) use ($prefix) { |
|
| 96 | 96 | return $prefix . $string; |
| 97 | 97 | }; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public static function append($suffix) |
| 101 | 101 | { |
| 102 | - return function ($string) use ($suffix) { |
|
| 102 | + return function($string) use ($suffix) { |
|
| 103 | 103 | return $string . $suffix; |
| 104 | 104 | }; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public static function notEmpty() |
| 108 | 108 | { |
| 109 | - return function ($object) { |
|
| 109 | + return function($object) { |
|
| 110 | 110 | return !empty($object); |
| 111 | 111 | }; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public static function notBlank() |
| 115 | 115 | { |
| 116 | - return function ($string) { |
|
| 116 | + return function($string) { |
|
| 117 | 117 | return Strings::isNotBlank($string); |
| 118 | 118 | }; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public static function removePrefix($prefix) |
| 122 | 122 | { |
| 123 | - return function ($string) use ($prefix) { |
|
| 123 | + return function($string) use ($prefix) { |
|
| 124 | 124 | return Strings::removePrefix($string, $prefix); |
| 125 | 125 | }; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public static function startsWith($prefix) |
| 129 | 129 | { |
| 130 | - return function ($string) use ($prefix) { |
|
| 130 | + return function($string) use ($prefix) { |
|
| 131 | 131 | return Strings::startsWith($string, $prefix); |
| 132 | 132 | }; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public static function formatDateTime($format = Date::DEFAULT_TIME_FORMAT) |
| 136 | 136 | { |
| 137 | - return function ($date) use ($format) { |
|
| 137 | + return function($date) use ($format) { |
|
| 138 | 138 | return Date::formatDateTime($date, $format); |
| 139 | 139 | }; |
| 140 | 140 | } |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public static function compose($functionA, $functionB) |
| 155 | 155 | { |
| 156 | - return function ($input) use ($functionA, $functionB) { |
|
| 156 | + return function($input) use ($functionA, $functionB) { |
|
| 157 | 157 | return Functions::call($functionA, Functions::call($functionB, $input)); |
| 158 | 158 | }; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public static function toString() |
| 162 | 162 | { |
| 163 | - return function ($object) { |
|
| 163 | + return function($object) { |
|
| 164 | 164 | return Objects::toString($object); |
| 165 | 165 | }; |
| 166 | 166 | } |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public static function surroundWith($character) |
| 178 | 178 | { |
| 179 | - return function ($string) use ($character) { |
|
| 179 | + return function($string) use ($character) { |
|
| 180 | 180 | return $character . $string . $character; |
| 181 | 181 | }; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | public static function equals($object) |
| 185 | 185 | { |
| 186 | - return function ($value) use ($object) { |
|
| 186 | + return function($value) use ($object) { |
|
| 187 | 187 | return $value == $object; |
| 188 | 188 | }; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | public static function notEquals($object) |
| 192 | 192 | { |
| 193 | - return function ($value) use ($object) { |
|
| 193 | + return function($value) use ($object) { |
|
| 194 | 194 | return $value != $object; |
| 195 | 195 | }; |
| 196 | 196 | } |
@@ -24,6 +24,9 @@ discard block |
||
| 24 | 24 | ini_set("soap.wsdl_cache_enabled", 0); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $method |
|
| 29 | + */ |
|
| 27 | 30 | protected function method($method, $requestParams, $response) |
| 28 | 31 | { |
| 29 | 32 | $this->separator(); |
@@ -76,6 +79,9 @@ discard block |
||
| 76 | 79 | }, $this->soapClient->__getFunctions()); |
| 77 | 80 | } |
| 78 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $name |
|
| 84 | + */ |
|
| 79 | 85 | protected function serviceInfo($name) |
| 80 | 86 | { |
| 81 | 87 | $style = new OutputFormatterStyle('red', 'green', array('bold')); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $this->output->writeln('<comment>Request params:</comment>'); |
| 35 | 35 | $output = $this->output; |
| 36 | - array_walk($requestParams, function ($param, $key) use ($output) { |
|
| 36 | + array_walk($requestParams, function($param, $key) use ($output) { |
|
| 37 | 37 | $output->writeln('Param ' . ($key + 1) . ':'); |
| 38 | 38 | var_dump($param); |
| 39 | 39 | $output->writeln(''); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | private function _getRows() |
| 73 | 73 | { |
| 74 | - return array_map(function ($function) { |
|
| 74 | + return array_map(function($function) { |
|
| 75 | 75 | return array($function); |
| 76 | 76 | }, $this->soapClient->__getFunctions()); |
| 77 | 77 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @WebMethod |
| 53 | 53 | * @param string $name |
| 54 | 54 | * @param string $number |
| 55 | - * @return object $agentNameWithId @(wrapper $agent @className=Agent) @int=$id |
|
| 55 | + * @return stdClass $agentNameWithId @(wrapper $agent @className=Agent) @int=$id |
|
| 56 | 56 | */ |
| 57 | 57 | public function getAgentWithId($name, $number) |
| 58 | 58 | { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @WebMethod |
| 82 | - * @return object[] $companies @string=$name @int=$id |
|
| 82 | + * @return stdClass[] $companies @string=$name @int=$id |
|
| 83 | 83 | */ |
| 84 | 84 | public function getCompanies() |
| 85 | 85 | { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @WebMethod |
| 99 | - * @return object $listOfAgents @(wrapper[] $agents @className=Agent) @int=$id |
|
| 99 | + * @return stdClass $listOfAgents @(wrapper[] $agents @className=Agent) @int=$id |
|
| 100 | 100 | */ |
| 101 | 101 | public function getListOfAgentsWithId() |
| 102 | 102 | { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * @WebMethod |
| 132 | - * @return object[] $agentsWithPayment @(wrapper $agent @className=Agent) @float=$payment |
|
| 132 | + * @return stdClass[] $agentsWithPayment @(wrapper $agent @className=Agent) @float=$payment |
|
| 133 | 133 | */ |
| 134 | 134 | public function getAgentsWithPayment() |
| 135 | 135 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * @WebMethod |
| 151 | - * @return object[] $employeesList @(wrapper[] $agents @className=Agent) |
|
| 151 | + * @return stdClass[] $employeesList @(wrapper[] $agents @className=Agent) |
|
| 152 | 152 | */ |
| 153 | 153 | public function getEmployeesWithAgents() |
| 154 | 154 | { |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | * @param string $name |
| 71 | 71 | * @param string $age |
| 72 | 72 | * @param string $payment |
| 73 | - * @return wrapper $userReturn @className=User |
|
| 73 | + * @return User $userReturn @className=User |
|
| 74 | 74 | */ |
| 75 | 75 | public function getUser($name, $age, $payment) |
| 76 | 76 | { |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | * @param string $name |
| 85 | 85 | * @param string $age |
| 86 | 86 | * @param string $payment |
| 87 | - * @return wrapper $userReturn @className=User |
|
| 87 | + * @return User $userReturn @className=User |
|
| 88 | 88 | */ |
| 89 | 89 | public function getUser($name, $age, $payment) |
| 90 | 90 | { |
@@ -108,10 +108,10 @@ |
||
| 108 | 108 | $employee->id = 2 + $i + 1; |
| 109 | 109 | $employee->department = $departments[$i]; |
| 110 | 110 | |
| 111 | - if(mt_rand(0, 3) == 2) { |
|
| 111 | + if (mt_rand(0, 3) == 2) { |
|
| 112 | 112 | $address = new Address(); |
| 113 | 113 | $address->address = mt_rand(1000, 9999); |
| 114 | - $address->street = 'random string '. mt_rand(0, 99); |
|
| 114 | + $address->street = 'random string ' . mt_rand(0, 99); |
|
| 115 | 115 | |
| 116 | 116 | $employee->addresses[] = $address; |
| 117 | 117 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @WebMethod |
| 52 | 52 | * @param string $name |
| 53 | 53 | * @param string $number |
| 54 | - * @return object $agentNameWithId @(wrapper $agent @className=Agent) @int=$id |
|
| 54 | + * @return stdClass $agentNameWithId @(wrapper $agent @className=Agent) @int=$id |
|
| 55 | 55 | */ |
| 56 | 56 | public function getAgentWithId($name, $number) |
| 57 | 57 | { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @WebMethod |
| 80 | - * @return object[] $companies @string=$name @int=$id |
|
| 80 | + * @return stdClass[] $companies @string=$name @int=$id |
|
| 81 | 81 | */ |
| 82 | 82 | public function getCompanies() |
| 83 | 83 | { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @WebMethod |
| 96 | - * @return object $listOfAgents @(wrapper[] $agents @className=Agent) @int=$id |
|
| 96 | + * @return stdClass $listOfAgents @(wrapper[] $agents @className=Agent) @int=$id |
|
| 97 | 97 | */ |
| 98 | 98 | public function getListOfAgentsWithId() |
| 99 | 99 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * @WebMethod |
| 127 | - * @return object[] $agentsWithPayment @(wrapper $agent @className=Agent) @float=$payment |
|
| 127 | + * @return stdClass[] $agentsWithPayment @(wrapper $agent @className=Agent) @float=$payment |
|
| 128 | 128 | */ |
| 129 | 129 | public function getAgentsWithPayment() |
| 130 | 130 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @WebMethod |
| 145 | - * @return object[] $employeesList @(wrapper[] $agents @className=Agent) |
|
| 145 | + * @return stdClass[] $employeesList @(wrapper[] $agents @className=Agent) |
|
| 146 | 146 | */ |
| 147 | 147 | public function getEmployeesWithAgents() |
| 148 | 148 | { |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * @param string $name |
| 70 | 70 | * @param string $age |
| 71 | 71 | * @param string $payment |
| 72 | - * @return wrapper $userReturn @className=User |
|
| 72 | + * @return User $userReturn @className=User |
|
| 73 | 73 | */ |
| 74 | 74 | public function getUser($name, $age, $payment) |
| 75 | 75 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @WebMethod |
| 51 | 51 | * @param string $name |
| 52 | 52 | * @param string $number |
| 53 | - * @return object $agentNameWithId @(wrapper $agent @className=Agent) @int=$id |
|
| 53 | + * @return stdClass $agentNameWithId @(wrapper $agent @className=Agent) @int=$id |
|
| 54 | 54 | */ |
| 55 | 55 | public function getAgentWithId($name, $number) |
| 56 | 56 | { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @WebMethod |
| 79 | - * @return object[] $companies @string=$name @int=$id |
|
| 79 | + * @return stdClass[] $companies @string=$name @int=$id |
|
| 80 | 80 | */ |
| 81 | 81 | public function getCompanies() |
| 82 | 82 | { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @WebMethod |
| 95 | - * @return object $listOfAgents @(wrapper[] $agents @className=Agent) @int=$id |
|
| 95 | + * @return stdClass $listOfAgents @(wrapper[] $agents @className=Agent) @int=$id |
|
| 96 | 96 | */ |
| 97 | 97 | public function getListOfAgentsWithId() |
| 98 | 98 | { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @WebMethod |
| 129 | - * @return object[] $agentsWithPayment @(wrapper $agent @className=Agent) @float=$payment |
|
| 129 | + * @return stdClass[] $agentsWithPayment @(wrapper $agent @className=Agent) @float=$payment |
|
| 130 | 130 | */ |
| 131 | 131 | public function getAgentsWithPayment() |
| 132 | 132 | { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * @WebMethod |
| 148 | - * @return object[] $employeesList @(wrapper[] $agents @className=Agent) |
|
| 148 | + * @return stdClass[] $employeesList @(wrapper[] $agents @className=Agent) |
|
| 149 | 149 | */ |
| 150 | 150 | public function getEmployeesWithAgents() |
| 151 | 151 | { |