@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param ApplicationContracts $app |
| 24 | 24 | * @param $request |
| 25 | 25 | */ |
| 26 | - public function __construct(ApplicationContracts $app,$request) |
|
| 26 | + public function __construct(ApplicationContracts $app, $request) |
|
| 27 | 27 | {
|
| 28 | 28 | parent::__construct($app); |
| 29 | 29 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @throws \ReflectionException |
| 42 | 42 | */ |
| 43 | - public function annotation($method,$key) |
|
| 43 | + public function annotation($method, $key) |
|
| 44 | 44 | {
|
| 45 | 45 | //set annotation value with getting reflection |
| 46 | 46 | $reflection = $this->getReflection('reflection')->reflectionMethodParams($method);
|
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | * @param $key |
| 63 | 63 | * @param $data |
| 64 | 64 | */ |
| 65 | - private function catchException($key,$data) |
|
| 65 | + private function catchException($key, $data) |
|
| 66 | 66 | {
|
| 67 | - if(isset($this->exceptionParams[$key])){
|
|
| 67 | + if (isset($this->exceptionParams[$key])) {
|
|
| 68 | 68 | $keyParams = ($this->exceptionParams[$key]['params']) ?? []; |
| 69 | - exception($this->exceptionParams[$key]['name'],$keyParams)->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
|
| 69 | + exception($this->exceptionParams[$key]['name'], $keyParams)->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
|
| 70 | 70 | } |
| 71 | - else{
|
|
| 71 | + else {
|
|
| 72 | 72 | exception()->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
| 73 | 73 | } |
| 74 | 74 | } |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | private function getException($key) |
| 83 | 83 | {
|
| 84 | - if(preg_match('@exception\((.*?)\)\r\n@is',$this->annotation,$exception)){
|
|
| 84 | + if (preg_match('@exception\((.*?)\)\r\n@is', $this->annotation, $exception)) {
|
|
| 85 | 85 | |
| 86 | - $exceptionSpaceExplode = explode(" ",$exception[1]);
|
|
| 87 | - foreach ($exceptionSpaceExplode as $exceptions){
|
|
| 88 | - $exceptionsDotExplode = explode(":",$exceptions);
|
|
| 86 | + $exceptionSpaceExplode = explode(" ", $exception[1]);
|
|
| 87 | + foreach ($exceptionSpaceExplode as $exceptions) {
|
|
| 88 | + $exceptionsDotExplode = explode(":", $exceptions);
|
|
| 89 | 89 | $this->exceptionParams[$key][$exceptionsDotExplode[0]] = $exceptionsDotExplode[1]; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if(isset($this->exceptionParams[$key]['params'])){
|
|
| 93 | - $paramsCommaExplode = explode(",",$this->exceptionParams[$key]['params']);
|
|
| 92 | + if (isset($this->exceptionParams[$key]['params'])) {
|
|
| 93 | + $paramsCommaExplode = explode(",", $this->exceptionParams[$key]['params']);
|
|
| 94 | 94 | unset($this->exceptionParams[$key]['params']); |
| 95 | - foreach ($paramsCommaExplode as $params){
|
|
| 96 | - $paramsEqualExplode = explode("=",$params);
|
|
| 97 | - if(isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])){
|
|
| 95 | + foreach ($paramsCommaExplode as $params) {
|
|
| 96 | + $paramsEqualExplode = explode("=", $params);
|
|
| 97 | + if (isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])) {
|
|
| 98 | 98 | $this->exceptionParams[$key]['params'][$paramsEqualExplode[0]] = $paramsEqualExplode[1]; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -109,21 +109,21 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function getRegex($key) |
| 111 | 111 | {
|
| 112 | - if(preg_match('@regex\((.*?)\)\r\n@is',$this->annotation,$regex)){
|
|
| 113 | - if(isset($this->inputs[$key])){
|
|
| 112 | + if (preg_match('@regex\((.*?)\)\r\n@is', $this->annotation, $regex)) {
|
|
| 113 | + if (isset($this->inputs[$key])) {
|
|
| 114 | 114 | |
| 115 | - if(is_array($this->inputs[$key])){
|
|
| 115 | + if (is_array($this->inputs[$key])) {
|
|
| 116 | 116 | |
| 117 | - foreach ($this->inputs[$key] as $this->inputsKey=>$this->inputsValue){
|
|
| 118 | - if(!preg_match('@'.$regex[1].'@is',$this->inputsValue)){
|
|
| 119 | - $this->catchException($key,$regex[1]); |
|
| 117 | + foreach ($this->inputs[$key] as $this->inputsKey=>$this->inputsValue) {
|
|
| 118 | + if (!preg_match('@'.$regex[1].'@is', $this->inputsValue)) {
|
|
| 119 | + $this->catchException($key, $regex[1]); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | - else{
|
|
| 123 | + else {
|
|
| 124 | 124 | |
| 125 | - if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
|
|
| 126 | - $this->catchException($key,$regex[1]); |
|
| 125 | + if (!preg_match('@'.$regex[1].'@is', $this->inputs[$key])) {
|
|
| 126 | + $this->catchException($key, $regex[1]); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | private function getRemove($key) |
| 140 | 140 | {
|
| 141 | - if(preg_match('@remove\((.*?)\)\r\n@is',$this->annotation,$remove)){
|
|
| 142 | - if(isset($this->inputs[$key])){
|
|
| 143 | - if(preg_match('@'.$remove[1].'@is',$this->inputs[$key])){
|
|
| 141 | + if (preg_match('@remove\((.*?)\)\r\n@is', $this->annotation, $remove)) {
|
|
| 142 | + if (isset($this->inputs[$key])) {
|
|
| 143 | + if (preg_match('@'.$remove[1].'@is', $this->inputs[$key])) {
|
|
| 144 | 144 | unset($this->inputs[$key]); |
| 145 | 145 | } |
| 146 | 146 | } |