@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param $document |
| 24 | 24 | * @param array $class |
| 25 | 25 | */ |
| 26 | - public function __construct($app,$document,$class=array()) |
|
| 26 | + public function __construct($app, $document, $class = array()) |
|
| 27 | 27 | {
|
| 28 | 28 | parent::__construct($app); |
| 29 | 29 | |
@@ -46,25 +46,25 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | // if you have information about cache in |
| 48 | 48 | // the document section of the method, the cache process is executed. |
| 49 | - if(is_string($this->document) && preg_match('#@cache\((.*?)\)\r\n#is',$this->document,$cache)){
|
|
| 49 | + if (is_string($this->document) && preg_match('#@cache\((.*?)\)\r\n#is', $this->document, $cache)) {
|
|
| 50 | 50 | |
| 51 | 51 | // if the cache information |
| 52 | 52 | // with regular expression does not contain null data. |
| 53 | - if($cache!==null && isset($cache[1])){
|
|
| 53 | + if ($cache!==null && isset($cache[1])) {
|
|
| 54 | 54 | |
| 55 | 55 | //as static we inject the name value into the cache data. |
| 56 | 56 | $cacheData = ['cache'=>['name'=>Utils::encryptArrayData($this->class)]]; |
| 57 | 57 | |
| 58 | 58 | //cache data with the help of foreach data are transferred into the cache. |
| 59 | - foreach(array_filter(explode(" ",$cache[1]),'strlen') as $item){
|
|
| 59 | + foreach (array_filter(explode(" ", $cache[1]), 'strlen') as $item) {
|
|
| 60 | 60 | |
| 61 | - $items = explode("=",$item);
|
|
| 61 | + $items = explode("=", $item);
|
|
| 62 | 62 | $cacheData['cache'][$items[0]] = $items[1]; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //we save the data stored in the cacheData variable as methodCache. |
| 68 | - $this->app->register('containerReflection','methodCache',$cacheData);
|
|
| 68 | + $this->app->register('containerReflection', 'methodCache', $cacheData);
|
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * @throws \DI\DependencyException |
| 23 | 23 | * @throws \DI\NotFoundException |
| 24 | 24 | */ |
| 25 | - public static function resolve($class=null) |
|
| 25 | + public static function resolve($class = null) |
|
| 26 | 26 | {
|
| 27 | 27 | //class resolve |
| 28 | - if(!is_null($class)){
|
|
| 28 | + if (!is_null($class)) {
|
|
| 29 | 29 | $container = self::callBuild(); |
| 30 | 30 | return $container->get($class); |
| 31 | 31 | } |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * @throws \DI\DependencyException |
| 42 | 42 | * @throws \DI\NotFoundException |
| 43 | 43 | */ |
| 44 | - public static function make($class=null, $param=array()) |
|
| 44 | + public static function make($class = null, $param = array()) |
|
| 45 | 45 | {
|
| 46 | - if($class!==null){
|
|
| 46 | + if ($class!==null) {
|
|
| 47 | 47 | |
| 48 | 48 | $container = self::callBuild(); |
| 49 | - return $container->make($class,$param); |
|
| 49 | + return $container->make($class, $param); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | return null; |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @throws \DI\DependencyException |
| 60 | 60 | */ |
| 61 | - public static function injectOnBind($class=null) |
|
| 61 | + public static function injectOnBind($class = null) |
|
| 62 | 62 | {
|
| 63 | - if($class!==null){
|
|
| 63 | + if ($class!==null) {
|
|
| 64 | 64 | |
| 65 | 65 | $container = self::callBuild(); |
| 66 | 66 | return $container->injectOn($class); |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @param array $param |
| 75 | 75 | * @return mixed |
| 76 | 76 | */ |
| 77 | - public static function callBind($class=null, $param=array()) |
|
| 77 | + public static function callBind($class = null, $param = array()) |
|
| 78 | 78 | {
|
| 79 | - return (app()->resolve(ContainerResolve::class))->call($class,$param,function($call){
|
|
| 80 | - return self::callBuild()->call($call->class,$call->param); |
|
| 79 | + return (app()->resolve(ContainerResolve::class))->call($class, $param, function($call) {
|
|
| 80 | + return self::callBuild()->call($call->class, $call->param); |
|
| 81 | 81 | }); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -9,23 +9,23 @@ |
||
| 9 | 9 | * @param $param |
| 10 | 10 | * @return mixed |
| 11 | 11 | */ |
| 12 | - public function handle($parameter,$param) |
|
| 12 | + public function handle($parameter, $param) |
|
| 13 | 13 | {
|
| 14 | 14 | // We will use a custom bind for the repository classes |
| 15 | 15 | // and bind the repository contract with the repository adapter class. |
| 16 | 16 | $parameterName = $parameter->getType()->getName(); |
| 17 | 17 | $repository = app()->namespace()->repository(); |
| 18 | 18 | |
| 19 | - $parameterNameWord = str_replace('\\','',$parameterName);
|
|
| 20 | - $repositoryWord = str_replace('\\','',$repository);
|
|
| 19 | + $parameterNameWord = str_replace('\\', '', $parameterName);
|
|
| 20 | + $repositoryWord = str_replace('\\', '', $repository);
|
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | // if the submitted contract matches the repository class. |
| 24 | - if(preg_match('@'.$repositoryWord.'@is',$parameterNameWord)){
|
|
| 24 | + if (preg_match('@'.$repositoryWord.'@is', $parameterNameWord)) {
|
|
| 25 | 25 | |
| 26 | 26 | //we bind the contract as an adapter |
| 27 | - $repositoryName = str_replace('Contract','',$parameter->getName());
|
|
| 28 | - $getRepositoryAdapter = app()->get('appClass')::repository($repositoryName,true);
|
|
| 27 | + $repositoryName = str_replace('Contract', '', $parameter->getName());
|
|
| 28 | + $getRepositoryAdapter = app()->get('appClass')::repository($repositoryName, true);
|
|
| 29 | 29 | |
| 30 | 30 | $param[$parameter->getName()] = app()->resolve($getRepositoryAdapter)->adapter(); |
| 31 | 31 | } |