| Conditions | 6 |
| Paths | 7 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 3 |
| Ratio | 11.11 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function exists($params, $condition = 'AND', $returnAllRecords = false) |
||
| 31 | { |
||
| 32 | if (empty($params)) { |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | |||
| 36 | $query = 'SELECT Id, OwnerId, Salutation, FirstName, LastName FROM ' . $this->getType() . ' WHERE RecordTypeId = \'' . config('laravel-salesforce.record_type.account') . '\''; |
||
| 37 | |||
| 38 | $paramsWithKeys = []; |
||
| 39 | View Code Duplication | foreach ($params as $fieldName => $fieldValue) { |
|
| 40 | $paramsWithKeys[] = $fieldName . ' = \'' . addslashes(trim($fieldValue)) . '\''; |
||
| 41 | } |
||
| 42 | |||
| 43 | $query .= ' AND (' . implode(' ' . $condition . ' ', $paramsWithKeys) . ')'; |
||
| 44 | |||
| 45 | $response = $this->query($query); |
||
| 46 | |||
| 47 | if ($response && $response->totalSize > 0) { |
||
| 48 | if ($returnAllRecords) { |
||
| 49 | return $response->records; |
||
| 50 | } else { |
||
| 51 | return array_shift($response->records); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | return false; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$irelandis not defined by the methodfinale(...).The most likely cause is that the parameter was changed, but the annotation was not.