We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 5 | trait FakeFields |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Update the request input array to something that can be passed to the model's create or update function. |
||
| 9 | * The resulting array will only include the fields that are stored in the database and their values, |
||
| 10 | * plus the '_token' and 'redirect_after_save' variables. |
||
| 11 | * |
||
| 12 | * @param array $requestInput The request input. |
||
| 13 | * @param string $form The CRUD form. Can be 'create' or 'update' . Default is 'create'. |
||
| 14 | * @param int|bool $id The CRUD entry id in the case of the 'update' form. |
||
| 15 | * |
||
| 16 | * @see \Illuminate\Http\Request::all() For an example on how to get the request input. |
||
| 17 | * |
||
| 18 | * @return array The updated request input. |
||
| 19 | */ |
||
| 20 | public function compactFakeFields($requestInput, $form = 'create', $id = false) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Compact a fake field in the request input array. |
||
| 51 | * |
||
| 52 | * @param array $requestInput The request input. |
||
| 53 | * @param string $fakeFieldName The fake field name. |
||
| 54 | * @param string $fakeFieldKey The fake field key. |
||
| 55 | */ |
||
| 56 | private function addCompactedField(&$requestInput, $fakeFieldName, $fakeFieldKey) |
||
| 63 | } |
||
| 64 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.