@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | public function get() |
| 35 | 35 | {
|
| 36 | 36 | // The config process class should not be null. |
| 37 | - if(self::$configProcessInstance!==null){
|
|
| 37 | + if (self::$configProcessInstance!==null) {
|
|
| 38 | 38 | |
| 39 | 39 | //get config variables |
| 40 | 40 | $config = self::$config; |
| 41 | 41 | |
| 42 | 42 | // offset config variables to config process class |
| 43 | - self::$configProcessInstance->offsetSet('config',$config);
|
|
| 43 | + self::$configProcessInstance->offsetSet('config', $config);
|
|
| 44 | 44 | |
| 45 | 45 | //get config variable from config process class |
| 46 | 46 | return self::$configProcessInstance->get(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param null|string $config |
| 76 | 76 | * @return Config |
| 77 | 77 | */ |
| 78 | - public static function macro($config=null) |
|
| 78 | + public static function macro($config = null) |
|
| 79 | 79 | {
|
| 80 | 80 | /** @var Macro $macro */ |
| 81 | 81 | $macro = app()->get('macro');
|
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param null $config |
| 89 | 89 | * @return Config |
| 90 | 90 | */ |
| 91 | - public static function make($config=null) |
|
| 91 | + public static function make($config = null) |
|
| 92 | 92 | {
|
| 93 | 93 | self::$config = $config; |
| 94 | 94 | self::$configProcessInstance = app()->resolve(ConfigProcess::class); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param array $data |
| 102 | 102 | * @return bool|mixed |
| 103 | 103 | */ |
| 104 | - public function set($data=array()) |
|
| 104 | + public function set($data = array()) |
|
| 105 | 105 | {
|
| 106 | 106 | // receive the necessary config settings. |
| 107 | 107 | $configPath = path()->config(); |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | $setConfigPath = $configPath.''.DIRECTORY_SEPARATOR.''.ucfirst($configArray).'.php'; |
| 110 | 110 | $getConfigWrap = Arr::wrap(config($configArray)); |
| 111 | 111 | |
| 112 | - foreach ($data as $value){
|
|
| 112 | + foreach ($data as $value) {
|
|
| 113 | 113 | |
| 114 | 114 | // we check the config value not to be rewritten. |
| 115 | - if(!in_array($value,$getConfigWrap)){
|
|
| 116 | - $setData = '<?php return '.var_export(array_merge($getConfigWrap,$data), true).';'; |
|
| 117 | - return app()->resolve(FileProcess::class)->dumpFile($setConfigPath,$setData); |
|
| 115 | + if (!in_array($value, $getConfigWrap)) {
|
|
| 116 | + $setData = '<?php return '.var_export(array_merge($getConfigWrap, $data), true).';'; |
|
| 117 | + return app()->resolve(FileProcess::class)->dumpFile($setConfigPath, $setData); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @param null|string $path |
| 16 | 16 | */ |
| 17 | - public static function setPath($path=null) |
|
| 17 | + public static function setPath($path = null) |
|
| 18 | 18 | {
|
| 19 | - if(!is_null($path)){
|
|
| 19 | + if (!is_null($path)) {
|
|
| 20 | 20 | self::$requestPath = $path; |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param bool $static |
| 34 | 34 | * @return bool |
| 35 | 35 | */ |
| 36 | - protected function checkMacroConditions($static=false) |
|
| 36 | + protected function checkMacroConditions($static = false) |
|
| 37 | 37 | {
|
| 38 | 38 | return is_string($this->macro) && |
| 39 | 39 | Utils::isNamespaceExists($this->macro) && |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * @param bool $static |
| 47 | 47 | * @return bool |
| 48 | 48 | */ |
| 49 | - protected function checkMacroInstanceOf($static=false) |
|
| 49 | + protected function checkMacroInstanceOf($static = false) |
|
| 50 | 50 | {
|
| 51 | - if($static){
|
|
| 51 | + if ($static) {
|
|
| 52 | 52 | return true; |
| 53 | 53 | } |
| 54 | 54 | return $this->app->resolve($this->macro) instanceof MacroAbleContracts; |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | * @param callable $callback |
| 62 | 62 | * @return mixed |
| 63 | 63 | */ |
| 64 | - public function get($method,callable $callback) |
|
| 64 | + public function get($method, callable $callback) |
|
| 65 | 65 | {
|
| 66 | - if($this->isMacro){
|
|
| 66 | + if ($this->isMacro) {
|
|
| 67 | 67 | |
| 68 | - if(method_exists($resolve = $this->app->resolve($this->macro),$method)){
|
|
| 68 | + if (method_exists($resolve = $this->app->resolve($this->macro), $method)) {
|
|
| 69 | 69 | return $resolve->macro($this->class); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | * @param $class |
| 90 | 90 | * @return $this |
| 91 | 91 | */ |
| 92 | - public function isMacro($class,$static=false) |
|
| 92 | + public function isMacro($class, $static = false) |
|
| 93 | 93 | {
|
| 94 | 94 | // if the macro class is a valid object, |
| 95 | 95 | // then this macro will return a boolean value if it has the specified methode. |
| 96 | - if($this->checkMacroConditions($static)){
|
|
| 96 | + if ($this->checkMacroConditions($static)) {
|
|
| 97 | 97 | |
| 98 | 98 | $this->isMacro = true; |
| 99 | 99 | $this->class = $class; |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | * @param $method |
| 122 | 122 | * @return mixed |
| 123 | 123 | */ |
| 124 | - public function with($macro,$concrete,$method=null) |
|
| 124 | + public function with($macro, $concrete, $method = null) |
|
| 125 | 125 | {
|
| 126 | - if($this->macro === null){
|
|
| 127 | - return $this($macro)->isMacro($concrete)->get($method,function() use($concrete){
|
|
| 126 | + if ($this->macro===null) {
|
|
| 127 | + return $this($macro)->isMacro($concrete)->get($method, function() use($concrete){
|
|
| 128 | 128 | return $concrete; |
| 129 | 129 | }); |
| 130 | 130 | } |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | * @param $method |
| 139 | 139 | * @return mixed |
| 140 | 140 | */ |
| 141 | - public function withStatic($macro,$concrete) |
|
| 141 | + public function withStatic($macro, $concrete) |
|
| 142 | 142 | {
|
| 143 | - return $this($macro)->isMacro($concrete,true)->get(null,is_callable($concrete) ? |
|
| 143 | + return $this($macro)->isMacro($concrete, true)->get(null, is_callable($concrete) ? |
|
| 144 | 144 | $concrete : function() use($concrete){
|
| 145 | 145 | return $concrete; |
| 146 | 146 | }); |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | * @param null|string $macro |
| 153 | 153 | * @return $this |
| 154 | 154 | */ |
| 155 | - public function __invoke($macro=null) |
|
| 155 | + public function __invoke($macro = null) |
|
| 156 | 156 | {
|
| 157 | - if($macro!==null){
|
|
| 157 | + if ($macro!==null) {
|
|
| 158 | 158 | $this->macro = $macro; |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param null|string $msg |
| 30 | 30 | */ |
| 31 | - public function invalidArgument($msg=null) |
|
| 31 | + public function invalidArgument($msg = null) |
|
| 32 | 32 | {
|
| 33 | 33 | throw new InvalidArgumentException($msg); |
| 34 | 34 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @param null|string $msg |
| 40 | 40 | */ |
| 41 | - public function badFunctionCall($msg=null) |
|
| 41 | + public function badFunctionCall($msg = null) |
|
| 42 | 42 | {
|
| 43 | 43 | throw new BadFunctionCallException($msg); |
| 44 | 44 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param null|string $msg |
| 50 | 50 | */ |
| 51 | - public function badMethodCall($msg=null) |
|
| 51 | + public function badMethodCall($msg = null) |
|
| 52 | 52 | {
|
| 53 | 53 | throw new BadMethodCallException($msg); |
| 54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @param null|string $msg |
| 60 | 60 | */ |
| 61 | - public function domain($msg=null) |
|
| 61 | + public function domain($msg = null) |
|
| 62 | 62 | {
|
| 63 | 63 | throw new DomainException($msg); |
| 64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param null|string $msg |
| 70 | 70 | */ |
| 71 | - public function length($msg=null) |
|
| 71 | + public function length($msg = null) |
|
| 72 | 72 | {
|
| 73 | 73 | throw new LengthException($msg); |
| 74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param null|string $msg |
| 80 | 80 | */ |
| 81 | - public function logic($msg=null) |
|
| 81 | + public function logic($msg = null) |
|
| 82 | 82 | {
|
| 83 | 83 | throw new LogicException($msg); |
| 84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param null|string $msg |
| 90 | 90 | */ |
| 91 | - public function outOfRange($msg=null) |
|
| 91 | + public function outOfRange($msg = null) |
|
| 92 | 92 | {
|
| 93 | 93 | throw new OutOfRangeException($msg); |
| 94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @param null|string $msg |
| 100 | 100 | */ |
| 101 | - public function overflow($msg=null) |
|
| 101 | + public function overflow($msg = null) |
|
| 102 | 102 | {
|
| 103 | 103 | throw new OverflowException($msg); |
| 104 | 104 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @param null|string $msg |
| 110 | 110 | */ |
| 111 | - public function range($msg=null) |
|
| 111 | + public function range($msg = null) |
|
| 112 | 112 | {
|
| 113 | 113 | throw new RangeException($msg); |
| 114 | 114 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @param null|string $msg |
| 120 | 120 | */ |
| 121 | - public function runtime($msg=null) |
|
| 121 | + public function runtime($msg = null) |
|
| 122 | 122 | {
|
| 123 | 123 | throw new RuntimeException($msg); |
| 124 | 124 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @param null|string $msg |
| 130 | 130 | */ |
| 131 | - public function underflow($msg=null) |
|
| 131 | + public function underflow($msg = null) |
|
| 132 | 132 | {
|
| 133 | 133 | throw new UnderflowException($msg); |
| 134 | 134 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @param null|string $msg |
| 140 | 140 | */ |
| 141 | - public function unexpectedValue($msg=null) |
|
| 141 | + public function unexpectedValue($msg = null) |
|
| 142 | 142 | {
|
| 143 | 143 | throw new UnexpectedValueException($msg); |
| 144 | 144 | } |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | * @param null $name |
| 15 | 15 | * @param array $params |
| 16 | 16 | */ |
| 17 | - public function __construct($app,$name=null,$params=array()) |
|
| 17 | + public function __construct($app, $name = null, $params = array()) |
|
| 18 | 18 | {
|
| 19 | 19 | parent::__construct($app); |
| 20 | 20 | |
| 21 | 21 | // we help the user to pull a special message from |
| 22 | 22 | // the translate section to be specified by the user for the exception. |
| 23 | - $this->exceptionTranslate($name,$params); |
|
| 23 | + $this->exceptionTranslate($name, $params); |
|
| 24 | 24 | |
| 25 | 25 | // for real file path with |
| 26 | 26 | // debug backtrace method are doing follow. |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | * @param $name |
| 34 | 34 | * @param array $params |
| 35 | 35 | */ |
| 36 | - private function exceptionTranslate($name,$params=array()) |
|
| 36 | + private function exceptionTranslate($name, $params = array()) |
|
| 37 | 37 | {
|
| 38 | - if($name!==null){
|
|
| 39 | - if(count($params)){
|
|
| 40 | - $this->app->register('exceptionTranslateParams',$name,$params);
|
|
| 38 | + if ($name!==null) {
|
|
| 39 | + if (count($params)) {
|
|
| 40 | + $this->app->register('exceptionTranslateParams', $name, $params);
|
|
| 41 | 41 | } |
| 42 | - $this->app->register('exceptionTranslate',$name);
|
|
| 42 | + $this->app->register('exceptionTranslate', $name);
|
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function debugBackTrace() |
| 52 | 52 | {
|
| 53 | - foreach (debug_backtrace() as $key=>$value){
|
|
| 53 | + foreach (debug_backtrace() as $key=>$value) {
|
|
| 54 | 54 | |
| 55 | - if(isset(debug_backtrace()[$key],debug_backtrace()[$key]['file'])) |
|
| 55 | + if (isset(debug_backtrace()[$key], debug_backtrace()[$key]['file'])) |
|
| 56 | 56 | {
|
| 57 | - $this->app->register('exceptionFile',debug_backtrace()[$key]['file']);
|
|
| 58 | - $this->app->register('exceptionLine',debug_backtrace()[$key]['line']);
|
|
| 57 | + $this->app->register('exceptionFile', debug_backtrace()[$key]['file']);
|
|
| 58 | + $this->app->register('exceptionLine', debug_backtrace()[$key]['line']);
|
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | Dependencies::loadBootstrapperNeedsForException(); |
| 62 | 62 | |
| 63 | - if(isset($value['file']) && isset(core()->urlComponent)){
|
|
| 64 | - if(preg_match('@'.core()->urlComponent['project'].'|boot|providers@',$value['file'])){
|
|
| 63 | + if (isset($value['file']) && isset(core()->urlComponent)) {
|
|
| 64 | + if (preg_match('@'.core()->urlComponent['project'].'|boot|providers@', $value['file'])) {
|
|
| 65 | 65 | |
| 66 | 66 | $this->app->terminate('exceptionFile');
|
| 67 | 67 | $this->app->terminate('exceptionLine');
|
| 68 | - $this->app->register('exceptionFile',$value['file']);
|
|
| 69 | - $this->app->register('exceptionLine',$value['line']);
|
|
| 68 | + $this->app->register('exceptionFile', $value['file']);
|
|
| 69 | + $this->app->register('exceptionLine', $value['line']);
|
|
| 70 | 70 | |
| 71 | 71 | break; |
| 72 | 72 | } |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // first, you are looking for an exception |
| 88 | 88 | // in the application directory class. |
| 89 | - if(Utils::isNamespaceExists($nameNamespace)){
|
|
| 89 | + if (Utils::isNamespaceExists($nameNamespace)) {
|
|
| 90 | 90 | $callNamespace = new $nameNamespace; |
| 91 | 91 | } |
| 92 | - else{
|
|
| 92 | + else {
|
|
| 93 | 93 | |
| 94 | 94 | // if you do not have an exception in the application directory, |
| 95 | 95 | // this time we are looking for an exception in the core directory. |
| 96 | 96 | $nameNamespace = __NAMESPACE__.'\\'.$nameException; |
| 97 | - if(Utils::isNamespaceExists($nameNamespace)){
|
|
| 97 | + if (Utils::isNamespaceExists($nameNamespace)) {
|
|
| 98 | 98 | $callNamespace = new $nameNamespace; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | // if the callNamespace variable does not exist, |
| 103 | 103 | // the exception is not found. |
| 104 | 104 | // and no action is taken. |
| 105 | - if(!isset($callNamespace)) return; |
|
| 105 | + if (!isset($callNamespace)) return; |
|
| 106 | 106 | |
| 107 | 107 | // we will set the information about the exception trace, |
| 108 | 108 | // and then bind it specifically to the event method. |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | // we register the custom exception trace value with the global kernel object. |
| 117 | - $this->app->register('exceptiontrace',$customExceptionTrace);
|
|
| 117 | + $this->app->register('exceptiontrace', $customExceptionTrace);
|
|
| 118 | 118 | |
| 119 | 119 | //If the developer wants to execute an event when calling a special exception, |
| 120 | 120 | //we process the event method. |
| 121 | - if(method_exists($callNamespace,'event')){
|
|
| 121 | + if (method_exists($callNamespace, 'event')) {
|
|
| 122 | 122 | $callNamespace->event($customExceptionTrace); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -88,8 +88,7 @@ discard block |
||
| 88 | 88 | // in the application directory class. |
| 89 | 89 | if(Utils::isNamespaceExists($nameNamespace)){
|
| 90 | 90 | $callNamespace = new $nameNamespace; |
| 91 | - } |
|
| 92 | - else{
|
|
| 91 | + } else{
|
|
| 93 | 92 | |
| 94 | 93 | // if you do not have an exception in the application directory, |
| 95 | 94 | // this time we are looking for an exception in the core directory. |
@@ -102,7 +101,9 @@ discard block |
||
| 102 | 101 | // if the callNamespace variable does not exist, |
| 103 | 102 | // the exception is not found. |
| 104 | 103 | // and no action is taken. |
| 105 | - if(!isset($callNamespace)) return; |
|
| 104 | + if(!isset($callNamespace)) {
|
|
| 105 | + return; |
|
| 106 | + } |
|
| 106 | 107 | |
| 107 | 108 | // we will set the information about the exception trace, |
| 108 | 109 | // and then bind it specifically to the event method. |