Valitron\Validator::getPart PHP Method

getPart() protected method

protected getPart ( $data, $identifiers )
    protected function getPart($data, $identifiers)
    {
        // Catches the case where the field is an array of discrete values
        if (is_array($identifiers) && count($identifiers) === 0) {
            return array($data, false);
        }
        $identifier = array_shift($identifiers);
        // Glob match
        if ($identifier === '*') {
            $values = array();
            foreach ($data as $row) {
                list($value, $multiple) = $this->getPart($row, $identifiers);
                if ($multiple) {
                    $values = array_merge($values, $value);
                } else {
                    $values[] = $value;
                }
            }
            return array($values, true);
        } elseif ($identifier === NULL || !isset($data[$identifier])) {
            return array(null, false);
        } elseif (count($identifiers) === 0) {
            return array($data[$identifier], false);
        } else {
            return $this->getPart($data[$identifier], $identifiers);
        }
    }