Пример #1
0
    /**
     * Prototype getErrors
     *
     * This method is not used. It is currently a prototype, a holder
     * for reverse engineering the actions and finding the errors
     * in each of the actions and creating them in the database associating
     * them with actions.
     *
     * @param  Iterator $it  The iterator to fetch the parameters from
     * @param  string   $methodName The original method name to parse.
     * @return mixed    Either an array of error or false.
     */
    private function getErrors($it, $methodName)
    {
        $error  = array();
        $i = 0;
        while ($it->valid()) {
            $it->next();
            $mainKey = $key = $it->key();
            $current = $it->current();

            if ((double)$current[0] == T_CONSTANT_ENCAPSED_STRING) {

                $error[$methodName][$key][$i] = array();
                $error[$methodName][$key][$i]['name'] = $current[1];

                while ($it->valid()) {
                    $it->next();
                    $current = $it->current();

                    if ((double)$current[0] == T_CONSTANT_ENCAPSED_STRING) {
                        $error[$methodName][$key]['message'] = $current[1];

                        while ($it->valid()) {

                            $it->next();
                            $current = $it->current();
                            if ((double)$current[0] == T_LNUMBER) {
                                $error[$methodName][$key]['code'] = $current[1];

                            }
                        }
                    } else {
                        if ($it->offsetExists($mainKey)) {
                            $it->seek($mainKey);
                        }
                    }
                }

                ++$i;
            } else {

            }
        }

        return !empty($error) ? $error : false;
    }