GinoPane /
oc-blogtaxonomy-plugin
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace GinoPane\BlogTaxonomy\Controllers; |
||
| 4 | |||
| 5 | use BackendMenu; |
||
| 6 | use Backend\Classes\Controller; |
||
| 7 | use GinoPane\BlogTaxonomy\Models\Series as SeriesModel; |
||
| 8 | use GinoPane\BlogTaxonomy\Plugin; |
||
| 9 | use Backend\Behaviors\FormController; |
||
| 10 | use Backend\Behaviors\ListController; |
||
| 11 | use Backend\Behaviors\RelationController; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Class Series |
||
| 15 | * |
||
| 16 | * @package GinoPane\BlogTaxonomy\Controllers |
||
| 17 | */ |
||
| 18 | class Series extends Controller |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * Behaviours implemented by the controller |
||
| 22 | * |
||
| 23 | * @var array |
||
| 24 | */ |
||
| 25 | public $implement = [ |
||
| 26 | FormController::class, |
||
| 27 | ListController::class, |
||
| 28 | RelationController::class |
||
| 29 | ]; |
||
| 30 | |||
| 31 | public $formConfig = 'config_form.yaml'; |
||
| 32 | public $listConfig = 'config_list.yaml'; |
||
| 33 | public $relationConfig = 'config_relation.yaml'; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Series constructor |
||
| 37 | */ |
||
| 38 | public function __construct() |
||
| 39 | { |
||
| 40 | parent::__construct(); |
||
| 41 | |||
| 42 | BackendMenu::setContext(Plugin::REQUIRED_PLUGIN_RAINLAB_BLOG, 'blog', 'series'); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Controller "update" action used for updating existing model records. |
||
| 47 | * This action takes a record identifier (primary key of the model) |
||
| 48 | * to locate the record used for sourcing the existing form values. |
||
| 49 | * |
||
| 50 | * @param int $recordId Record identifier |
||
|
0 ignored issues
–
show
|
|||
| 51 | * @param string $context Form context |
||
|
0 ignored issues
–
show
Should the type for parameter
$context not be string|null?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. Loading history...
|
|||
| 52 | * @return void |
||
| 53 | */ |
||
| 54 | View Code Duplication | public function update($recordId = null, $context = null) |
|
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 55 | { |
||
| 56 | $series = SeriesModel::whereId($recordId)->first(); |
||
| 57 | |||
| 58 | if ($series !== null) { |
||
| 59 | $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', ['series' => $series->title]); |
||
| 60 | } else { |
||
| 61 | $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.series_does_not_exist'); |
||
| 62 | } |
||
| 63 | |||
| 64 | return $this->asExtension('FormController')->update($recordId, $context); |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.