| Conditions | 5 |
| Paths | 8 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function getRequiredFields($use_field_labels = false) |
||
|
|
|||
| 18 | { |
||
| 19 | // Check if the import data is valid first |
||
| 20 | $class = $this->getOwner()->objectClass; |
||
| 21 | $obj = $class::singleton(); |
||
| 22 | $required = []; |
||
| 23 | $custom = []; |
||
| 24 | |||
| 25 | // If a "required_fields" config variable is set |
||
| 26 | // add it's fields |
||
| 27 | $config = $obj->config()->get("required_fields"); |
||
| 28 | |||
| 29 | if (isset($config) && is_array($config)) { |
||
| 30 | $required = array_merge( |
||
| 31 | $required, |
||
| 32 | $config |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 36 | // Get any fields required by CMS validator if available |
||
| 37 | if (method_exists($obj, "getCMSValidator")) { |
||
| 38 | $required = array_merge( |
||
| 39 | $required, |
||
| 40 | $obj->getCMSValidator()->getRequired() |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | // Ensure we use a field label that would have been exported |
||
| 45 | foreach ($required as $field) { |
||
| 46 | $custom[] = $field; |
||
| 47 | } |
||
| 48 | |||
| 49 | return $custom; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.