@@ -45,7 +45,9 @@ |
||
45 | 45 | { |
46 | 46 | $cacheData = []; |
47 | 47 | |
48 | - if(!isset($this->class[1]) && !is_object($this->class[0])) return; |
|
48 | + if(!isset($this->class[1]) && !is_object($this->class[0])) { |
|
49 | + return; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | // if you have information about cache in |
51 | 53 | // the document section of the method, the cache process is executed. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param $reflection |
25 | 25 | * @param array $class |
26 | 26 | */ |
27 | - public function __construct($app,$reflection,$class=array()) |
|
27 | + public function __construct($app, $reflection, $class = array()) |
|
28 | 28 | { |
29 | 29 | parent::__construct($app); |
30 | 30 | |
@@ -45,27 +45,27 @@ discard block |
||
45 | 45 | { |
46 | 46 | $cacheData = []; |
47 | 47 | |
48 | - if(!isset($this->class[1]) && !is_object($this->class[0])) return; |
|
48 | + if (!isset($this->class[1]) && !is_object($this->class[0])) return; |
|
49 | 49 | |
50 | 50 | // if you have information about cache in |
51 | 51 | // the document section of the method, the cache process is executed. |
52 | - if($this->reflection->isAvailableMethodDocument($this->class[1],'cache')){ |
|
52 | + if ($this->reflection->isAvailableMethodDocument($this->class[1], 'cache')) { |
|
53 | 53 | |
54 | 54 | //as static we inject the name value into the cache data. |
55 | 55 | $cacheData = ['cache'=>['name' => Utils::encryptArrayData($this->class)]]; |
56 | 56 | |
57 | 57 | //cache data with the help of foreach data are transferred into the cache. |
58 | - foreach(array_filter(explode(" ",$this->reflection->getDocumentData()),'strlen') as $item){ |
|
58 | + foreach (array_filter(explode(" ", $this->reflection->getDocumentData()), 'strlen') as $item) { |
|
59 | 59 | |
60 | - $items = explode("=",$item); |
|
60 | + $items = explode("=", $item); |
|
61 | 61 | |
62 | 62 | $cacheData['cache'][$items[0]] = $items[1]; |
63 | 63 | |
64 | - if(in_array('query',$items)){ |
|
64 | + if (in_array('query', $items)) { |
|
65 | 65 | |
66 | - foreach(explode(':',$items[1]) as $queryValue){ |
|
67 | - $query = get($queryValue,null); |
|
68 | - if(!is_null($query)){ |
|
66 | + foreach (explode(':', $items[1]) as $queryValue) { |
|
67 | + $query = get($queryValue, null); |
|
68 | + if (!is_null($query)) { |
|
69 | 69 | $cacheData['cache']['name'] = md5(sha1( |
70 | 70 | $cacheData['cache']['name'].'_'.$queryValue.':'.$query |
71 | 71 | )); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | //we save the data stored in the cacheData variable as methodCache. |
80 | - $this->app->register('cache','methodCache',$cacheData); |
|
81 | - $this->app->register('cache','class',$this->class); |
|
80 | + $this->app->register('cache', 'methodCache', $cacheData); |
|
81 | + $this->app->register('cache', 'class', $this->class); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function cacheProcess($callback) |
19 | 19 | { |
20 | 20 | //we do cache key control for method cache container data. |
21 | - if(isset($this->app['cache']['methodCache']['cache'])){ |
|
21 | + if (isset($this->app['cache']['methodCache']['cache'])) { |
|
22 | 22 | |
23 | 23 | //get cache data |
24 | 24 | $cache = $this->app['cache']['methodCache']['cache']; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param null|string $alias |
12 | 12 | * @return mixed |
13 | 13 | */ |
14 | - public function bind($object=null,$callback=null,$alias=null); |
|
14 | + public function bind($object = null, $callback = null, $alias = null); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param $abstract |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param $container false |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function make($object=null,$callback=null,$container=false); |
|
41 | + public function make($object = null, $callback = null, $container = false); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param $key |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @param null $concrete |
47 | 47 | * @return mixed |
48 | 48 | */ |
49 | - public function register($key,$object,$concrete=null); |
|
49 | + public function register($key, $object, $concrete = null); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param null $object |
53 | 53 | * @param null $callback |
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | - public function share($object=null,$callback=null); |
|
56 | + public function share($object = null, $callback = null); |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @method singleton |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param array $bind |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | - public function resolve($class,$bind=array()); |
|
69 | + public function resolve($class, $bind = array()); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @param $class |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='model'; |
|
18 | + public $type = 'model'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var $commandRule |
34 | 34 | */ |
35 | - public $commandRule=['model','?table']; |
|
35 | + public $commandRule = ['model', '?table']; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @method create |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function create(){ |
|
41 | + public function create() { |
|
42 | 42 | |
43 | 43 | $this->argument['file'] = $this->argument['model']; |
44 | 44 | |
45 | - if(!isset($this->argument['table'])){ |
|
45 | + if (!isset($this->argument['table'])) { |
|
46 | 46 | $this->argument['table'] = $this->argument['file'].'s'; |
47 | 47 | } |
48 | 48 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $this->touch['model/builder'] = $this->directory['builderDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Builder.php'; |
67 | 67 | $this->touch['model/contract'] = $this->directory['contract'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Contract.php'; |
68 | 68 | |
69 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')){ |
|
69 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')) { |
|
70 | 70 | $this->touch['model/scope'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php'; |
71 | 71 | } |
72 | 72 | |
73 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')){ |
|
73 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')) { |
|
74 | 74 | $this->touch['model/event'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php'; |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $entityDir = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.'Entity'; |
80 | 80 | |
81 | - if(!file_exists($entityDir)){ |
|
81 | + if (!file_exists($entityDir)) { |
|
82 | 82 | files()->makeDirectory($entityDir); |
83 | 83 | } |
84 | 84 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | $entityClass = $entityDir.''.DIRECTORY_SEPARATOR.''.$entityTableName.''.DIRECTORY_SEPARATOR.''.$entityTableName; |
88 | 88 | |
89 | 89 | |
90 | - $generator = new Generator($entityDir,'EntityMap'); |
|
90 | + $generator = new Generator($entityDir, 'EntityMap'); |
|
91 | 91 | |
92 | - if(!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')){ |
|
92 | + if (!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')) { |
|
93 | 93 | |
94 | 94 | //$this->setAnnotations(); |
95 | 95 | $generator->createClass(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $entityMapNamespaceResolve = new $entityMapNamespace; |
101 | 101 | |
102 | - if(!method_exists($entityMapNamespaceResolve,strtolower($this->argument['table']))){ |
|
102 | + if (!method_exists($entityMapNamespaceResolve, strtolower($this->argument['table']))) { |
|
103 | 103 | |
104 | 104 | $generator->createClassUse([ |
105 | 105 | Utils::getNamespace($entityClass) |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | |
130 | 130 | |
131 | 131 | //set builder map |
132 | - $generator = new Generator($this->directory['builderDir'],'BuilderMap'); |
|
132 | + $generator = new Generator($this->directory['builderDir'], 'BuilderMap'); |
|
133 | 133 | |
134 | - if(!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')){ |
|
134 | + if (!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')) { |
|
135 | 135 | |
136 | 136 | $this->setAnnotations(); |
137 | 137 | $generator->createClass(); |
138 | 138 | } |
139 | 139 | |
140 | - if(!file_exists($this->touch['model/model'])){ |
|
140 | + if (!file_exists($this->touch['model/model'])) { |
|
141 | 141 | |
142 | 142 | $generator->createMethod([ |
143 | 143 | strtolower($this->argument['file']) |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | //set project touch |
161 | - $this->file->touch($this,[ |
|
161 | + $this->file->touch($this, [ |
|
162 | 162 | 'stub'=>'Model_Create' |
163 | 163 | ]); |
164 | 164 | |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | /** |
170 | 170 | * @return bool |
171 | 171 | */ |
172 | - private function setAnnotations(){ |
|
172 | + private function setAnnotations() { |
|
173 | 173 | |
174 | 174 | $entityMap = app()->path()->model().''.DIRECTORY_SEPARATOR.'Entity'.DIRECTORY_SEPARATOR.'EntityMap.php'; |
175 | 175 | |
176 | - if(file_exists($entityMap)){ |
|
176 | + if (file_exists($entityMap)) { |
|
177 | 177 | |
178 | 178 | Utils::changeClass(path()->serviceAnnotations().'.php', |
179 | 179 | [ |