| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function handle() |
||
| 40 | { |
||
| 41 | // |
||
| 42 | $name = $this->argument('name'); |
||
| 43 | $file_path = app_path('Shortcodes'.'/'.$name.'.php'); |
||
| 44 | if(file_exists( $file_path ) === false){ |
||
| 45 | //create new shortcode file |
||
| 46 | $this->info("Creating new shortcoode ".$name); |
||
| 47 | $create_file = File::put($file_path, "<?php\nnamespace App\Shortcodes;\n\nclass ".$name." {\n\tpublic function register(\$shortcode, \$content, \$compiler, \$name, \$viewData)\n\t{\n\t\t//\n\t}\n}"); |
||
| 48 | if($create_file != false){ |
||
| 49 | $this->info('File Created'); |
||
| 50 | }else{ |
||
| 51 | $this->info('Unable to create file, please create manaully at '.$file_path); |
||
| 52 | } |
||
| 53 | }else{ |
||
| 54 | $this->info($name." already exists"); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 59 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.