Mercurial > packages > magicforger
comparison src/Replacer/Replacer.php @ 14:c969ed13c570 main-dev
Changes for various files
| author | luka |
|---|---|
| date | Mon, 23 Sep 2024 20:35:14 -0400 |
| parents | 3426c7e91c24 |
| children | 19b7a8de0019 |
comparison
equal
deleted
inserted
replaced
| 13:7ee152c22478 | 14:c969ed13c570 |
|---|---|
| 50 ); | 50 ); |
| 51 | 51 |
| 52 return $target; | 52 return $target; |
| 53 } | 53 } |
| 54 | 54 |
| 55 public function get_available_replacements() | 55 public function get_available_replacements(): array |
| 56 { | 56 { |
| 57 $table_name = $this->getTableInput(); | 57 $table_name = $this->getTableInput(); |
| 58 $replacements = [ | 58 $replacements = [ |
| 59 '{{ class }}' => $this->getClassName($table_name), | 59 '{{ class }}' => $this->getClassName($table_name), |
| 60 '{{ controllerName }}' => $this->controller_name($table_name), | 60 '{{ controllerName }}' => $this->controller_name($table_name), |
| 116 | 116 |
| 117 // ////////////////////////////////////////// | 117 // ////////////////////////////////////////// |
| 118 // Namespaces // | 118 // Namespaces // |
| 119 // ////////////////////////////////////////// | 119 // ////////////////////////////////////////// |
| 120 | 120 |
| 121 public function getRootNamespace() | 121 public function getRootNamespace(): string |
| 122 { | 122 { |
| 123 return $this->laravel->getNamespace(); | 123 return $this->laravel->getNamespace(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 public function getModelNamespace(string $name = '') | 126 public function getModelNamespace(string $name = ''): string |
| 127 { | 127 { |
| 128 return $this->getRootNamespace().'Models'; | 128 return $this->getRootNamespace().'Models'; |
| 129 } | 129 } |
| 130 | 130 |
| 131 public function getNamespacedModel(string $name = '') | 131 public function getNamespacedModel(string $name = ''): string |
| 132 { | 132 { |
| 133 return $this->getModelNamespace().'\\'.$this->model_name($name); | 133 return $this->getModelNamespace().'\\'.$this->model_name($name); |
| 134 } | 134 } |
| 135 | 135 |
| 136 public function getControllerNamespace(string $name = '') | 136 public function getControllerNamespace(string $name = ''): string |
| 137 { | 137 { |
| 138 return $this->getRootNamespace().'Http\\Controllers'; | 138 return $this->getRootNamespace().'Http\\Controllers'; |
| 139 } | 139 } |
| 140 | 140 |
| 141 public function getRequestNamespace(string $name) | 141 public function getRequestNamespace(string $name): string |
| 142 { | 142 { |
| 143 return $this->getRootNamespace().'Http\\Requests\\'.$this->model_name($name); | 143 return $this->getRootNamespace().'Http\\Requests\\'.$this->model_name($name); |
| 144 } | 144 } |
| 145 | 145 |
| 146 public function getStoreRequestNamespace(string $name) | 146 public function getStoreRequestNamespace(string $name): string |
| 147 { | 147 { |
| 148 return $this->getRequestNamespace($name); | 148 return $this->getRequestNamespace($name); |
| 149 } | 149 } |
| 150 | 150 |
| 151 public function getUpdateRequestNamespace(string $name) | 151 public function getUpdateRequestNamespace(string $name): string |
| 152 { | 152 { |
| 153 return $this->getRequestNamespace($name); | 153 return $this->getRequestNamespace($name); |
| 154 } | 154 } |
| 155 | 155 |
| 156 public function getRequestUses(string $name) | 156 public function getRequestUses(string $name): string |
| 157 { | 157 { |
| 158 return implode("\n", [ | 158 return implode("\n", [ |
| 159 'use '.$this->getRequestNamespace($name).'\\'.$this->store_request_name($name).';', | 159 'use '.$this->getRequestNamespace($name).'\\'.$this->store_request_name($name).';', |
| 160 'use '.$this->getRequestNamespace($name).'\\'.$this->update_request_name($name).';', | 160 'use '.$this->getRequestNamespace($name).'\\'.$this->update_request_name($name).';', |
| 161 ]); | 161 ]); |
| 162 } | 162 } |
| 163 | 163 |
| 164 public function getRouteNamespace(string $name = '') | 164 public function getRouteNamespace(string $name = ''): string |
| 165 { | 165 { |
| 166 return $this->getRootNamespace().'Http\\Controllers'; | 166 return $this->getRootNamespace().'Http\\Controllers'; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // ////////////////////////////////////////// | 169 // ////////////////////////////////////////// |
