@codeCoverageIgnore
{@inheritdoc}
190678
public function getCurrentTitle()
    {
        foreach ($this->index as $menu) {
            foreach ($menu as $subMenu) {
                if ($subMenu['engine_service'] === $this->engineServiceId) {
                    return $subMenu['title'];
                }
            }
        }
    }
1183776
public function build(): SetIgnoreInputEventsRequest
	{
		$instance = new SetIgnoreInputEventsRequest();
		if ($this->ignore === null) {
			throw new BuilderException('Property [ignore] is required.');
		}
		$instance->ignore = $this->ignore;
		return $instance;
	}
535897
public function code ( $code = NULL ) {
      if ( $code === NULL )
        return $this->code;
      if ( ResponseCode::find( $code ) === NULL )
        throw new \InvalidArgumentException( "Response: no code $code" );
      $this->code = intval( $code );
      return $this;
    }
1371718
public function setCode($code)
    {
        if (!is_scalar($code)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([int|string $code]); %s given.',
                    __METHOD__,
                    is_object($code) ? get_class($code) : gettype($code)
                ),
                E_ERROR
            );
        }

        $this->code = $code;

        return $this;
    }
614616
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        if (null === $model['error_code']) {
            $request->markNew();
            return;
        }

        if (self::SUCCESS === $model['error_code']) {
            $request->markCaptured();
            return;
        }

        $request->markFailed();

    }
814833
public function createCode(TokenInterface $code): TokenInterface
    {
        try {
            $now    = $this->ignoreException(function (): DateTimeImmutable {
                return new DateTimeImmutable();
            });
            $schema = $this->getDatabaseSchema();
            $values = [
                $schema->getTokensClientIdentityColumn() => $code->getClientIdentifier(),
                $schema->getTokensUserIdentityColumn()   => $code->getUserIdentifier(),
                $schema->getTokensCodeColumn()           => $code->getCode(),
                $schema->getTokensIsScopeModified()      => $code->isScopeModified(),
                $schema->getTokensCodeCreatedAtColumn()  => $now,
            ];

            $tokenIdentifier = null;
            if (empty($scopeIdentifiers = $code->getScopeIdentifiers()) === false) {
                $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) {
                    $this->createResource($values);
                    $tokenIdentifier = $this->getLastInsertId();
                    $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers);
                });
            } else {
                $this->createResource($values);
                $tokenIdentifier = $this->getLastInsertId();
            }

            $code->setIdentifier($tokenIdentifier)->setCodeCreatedAt($now);

            return $code;
        } catch (RepositoryException $exception) {
            $message = 'Token code creation failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
874188
public function doSetValue($value)
    {
        $items = $value;
        if ($value instanceof PropertyValue) {
            $items = $value->getValue();
        }

        if (null == $items) {
            return;
        }

        // check value for single value
        if (array_keys($items) !== range(0, count($items) - 1)) {
            $items = [$items];
        }

        $this->properties = [];

        for ($i = 0; $i < count($items); ++$i) {
            $item = $items[$i];
            $type = $this->initProperties($i, $item['type']);

            /** @var PropertyInterface $subProperty */
            foreach ($type->getChildProperties() as $subProperty) {
                if (!isset($item[$subProperty->getName()])) {
                    continue;
                }

                $subName = $subProperty->getName();
                $subValue = $item[$subName];

                if ($subValue instanceof PropertyValue) {
                    $subValueProperty = new PropertyValue($subName, $subValue);
                    $subProperty->setPropertyValue($subValueProperty);
                    $item[$subName] = $subValueProperty;
                } else {
                    $subProperty->setValue($subValue);
                }
            }

            $items[$i] = $item;
        }

        if ($value instanceof PropertyValue) {
            $value->setValue($items);
        }
    }
188083
public static function add(CodeIssue $e)
    {
        $config = Config::getInstance();

        $fqcn_parts = explode('\\', get_class($e));
        $issue_type = array_pop($fqcn_parts);

        $project_analyzer = ProjectAnalyzer::getInstance();

        if (!$project_analyzer->show_issues) {
            return false;
        }

        $reporting_level = $config->getReportingLevelForIssue($e);

        if ($reporting_level === Config::REPORT_SUPPRESS) {
            return false;
        }

        $emitted_key = $issue_type . '-' . $e->getShortLocation() . ':' . $e->getLocation()->getColumn();

        if ($reporting_level === Config::REPORT_INFO) {
            if (!self::alreadyEmitted($emitted_key)) {
                self::$issues_data[] = $e->toArray(Config::REPORT_INFO);
            }

            return false;
        }

        if ($config->throw_exception) {
            throw new Exception\CodeException(
                $issue_type
                    . ' - ' . $e->getShortLocation()
                    . ':' . $e->getLocation()->getColumn()
                    . ' - ' . $e->getMessage()
            );
        }

        if (!self::alreadyEmitted($emitted_key)) {
            ++self::$error_count;
            self::$issues_data[] = $e->toArray(Config::REPORT_ERROR);
        }

        return true;
    }
992406
private function resolveObject($code)
    {
        $value = $this->resolveCode($code);

        if (!\is_object($value)) {
            throw new RuntimeException('Unable to inspect a non-object');
        }

        return $value;
    }
475220
public function _validate($code)
    {
        $oSession   = Factory::service('Session', 'nails/module-auth');
        $oConfig    = Factory::service('Config');
        $oView      = Factory::service('View');
        $oAuthModel = Factory::model('Auth', 'nails/module-auth');

        /**
         * Attempt to verify code, if two factor auth is enabled then don't generate a
         * new password, we'll need the user to jump through some hoops first.
         */

        $generateNewPw      = !$oConfig->item('authTwoFactorMode');
        $oUserPasswordModel = Factory::model('UserPassword', 'nails/module-auth');
        $newPw              = $oUserPasswordModel->validateToken($code, $generateNewPw);

        // --------------------------------------------------------------------------

        //  Determine outcome of validation
        if ($newPw === 'EXPIRED') {

            //  Code has expired
            $this->data['error'] = lang('auth_forgot_expired_code');

        } elseif ($newPw === false) {

            //  Code was invalid
            $this->data['error'] = lang('auth_forgot_invalid_code');

        } else {

            if ($oConfig->item('authTwoFactorMode') == 'QUESTION') {

                //  Show them a security question
                $this->data['question'] = $oAuthModel->mfaQuestionGet($newPw['user_id']);

                if ($this->data['question']) {

                    if ($this->input->post()) {

                        $isValid = $oAuthModel->mfaQuestionValidate(
                            $this->data['question']->id,
                            $newPw['user_id'],
                            $this->input->post('answer')
                        );

                        if ($isValid) {

                            //  Correct answer, reset password and render views
                            $newPw = $oUserPasswordModel->validateToken($code, true);

                            $this->data['new_password'] = $newPw['password'];

                            // --------------------------------------------------------------------------

                            //  Set some flashdata for the login page when they go to it; just a little reminder
                            $status  = 'notice';
                            $message = lang('auth_forgot_reminder', htmlentities($newPw['password']));

                            $oSession->setFlashData($status, $message);

                            // --------------------------------------------------------------------------

                            //  Load the views
                            $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/password/forgotten_reset.php');
                            $oView->load('structure/header/blank', $this->data);
                            $oView->load('auth/password/forgotten_reset', $this->data);
                            $oView->load('structure/footer/blank', $this->data);
                            return;

                        } else {
                            $this->data['error'] = lang('auth_twofactor_answer_incorrect');
                        }
                    }

                    $this->data['page']->title = lang('auth_title_forgotten_password_security_question');

                    $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/mfa/question/ask.php');
                    $oView->load('structure/header/blank', $this->data);
                    $oView->load('auth/mfa/question/ask', $this->data);
                    $oView->load('structure/footer/blank', $this->data);

                } else {

                    //  No questions, reset and load views
                    $newPw = $oUserPasswordModel->validateToken($code, true);

                    $this->data['new_password'] = $newPw['password'];

                    // --------------------------------------------------------------------------

                    //  Set some flashdata for the login page when they go to it; just a little reminder
                    $status  = 'notice';
                    $message = lang('auth_forgot_reminder', htmlentities($newPw['password']));

                    $oSession->setFlashData($status, $message);

                    // --------------------------------------------------------------------------

                    //  Load the views
                    $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/password/forgotten_reset.php');
                    $oView->load('structure/header/blank', $this->data);
                    $oView->load('auth/password/forgotten_reset', $this->data);
                    $oView->load('structure/footer/blank', $this->data);
                }

            } elseif ($oConfig->item('authTwoFactorMode') == 'DEVICE') {

                $secret = $oAuthModel->mfaDeviceSecretGet($newPw['user_id']);

                if ($secret) {

                    if ($this->input->post()) {

                        $mfaCode = $this->input->post('mfaCode');

                        //  Verify the inout
                        if ($oAuthModel->mfaDeviceCodeValidate($newPw['user_id'], $mfaCode)) {

                            //  Correct answer, reset password and render views
                            $newPw = $oUserPasswordModel->validateToken($code, true);

                            $this->data['new_password'] = $newPw['password'];

                            // --------------------------------------------------------------------------

                            //  Set some flashdata for the login page when they go to it; just a little reminder
                            $status  = 'notice';
                            $message = lang('auth_forgot_reminder', htmlentities($newPw['password']));

                            $oSession->setFlashData($status, $message);

                            // --------------------------------------------------------------------------

                            //  Load the views
                            $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/password/forgotten_reset.php');
                            $oView->load('structure/header/blank', $this->data);
                            $oView->load('auth/password/forgotten_reset', $this->data);
                            $oView->load('structure/footer', $this->data);
                            return;

                        } else {

                            $this->data['error'] = 'Sorry, that code failed to validate. Please try again. ';
                            $this->data['error'] .= $oAuthModel->lastError();
                        }
                    }

                    $this->data['page']->title = 'Please enter the code from your device';

                    $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/mfa/device/ask.php');
                    $oView->load('structure/header/blank', $this->data);
                    $oView->load('auth/mfa/device/ask', $this->data);
                    $oView->load('structure/footer', $this->data);

                } else {

                    //  No devices, reset and load views
                    $newPw = $oUserPasswordModel->validateToken($code, true);

                    $this->data['new_password'] = $newPw['password'];

                    // --------------------------------------------------------------------------

                    //  Set some flashdata for the login page when they go to it; just a little reminder
                    $status  = 'notice';
                    $message = lang('auth_forgot_reminder', htmlentities($newPw['password']));

                    $oSession->setFlashData($status, $message);

                    // --------------------------------------------------------------------------

                    //  Load the views
                    $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/password/forgotten_reset.php');
                    $oView->load('structure/header/blank', $this->data);
                    $oView->load('auth/password/forgotten_reset', $this->data);
                    $oView->load('structure/footer/blank', $this->data);
                }

            } else {

                //  Everything worked!
                $this->data['new_password'] = $newPw['password'];

                // --------------------------------------------------------------------------

                //  Set some flashdata for the login page when they go to it; just a little reminder
                $status  = 'notice';
                $message = lang('auth_forgot_reminder', htmlentities($newPw['password']));

                $oSession->setFlashData($status, $message);

                // --------------------------------------------------------------------------

                //  Load the views
                $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/password/forgotten_reset.php');
                $oView->load('structure/header/blank', $this->data);
                $oView->load('auth/password/forgotten_reset', $this->data);
                $oView->load('structure/footer/blank', $this->data);
            }

            return;
        }

        // --------------------------------------------------------------------------

        //  Load the views
        $this->loadStyles(NAILS_APP_PATH . 'application/modules/auth/views/password/forgotten.php');
        $oView->load('structure/header/blank', $this->data);
        $oView->load('auth/password/forgotten', $this->data);
        $oView->load('structure/footer/blank', $this->data);
    }
933534
public function & SetCode ($code, $codeMessage = NULL) {
		/** @var $this \MvcCore\Response */
		$this->code = $code;
		if ($codeMessage !== NULL) $this->codeMessage = $codeMessage;
		http_response_code($code);
		return $this;
	}
406340
public function asCode($value)
    {
        $topLevel = true;
        if (func_num_args() > 1 && false === func_get_arg(1)) {
            $topLevel = false;
        }

        $inlineList = false;
        if (func_num_args() > 2) {
            $inlineList = func_get_arg(2);
        }

        if ($value instanceof Annotation) {
            $value = (string) $value;
        } elseif (is_bool($value)) {
            $value = $value ? 'true' : 'false';
        } elseif (is_string($value)) {
            $value = '"'.$value.'"';
        } elseif (is_array($value)) {
            $tmp = array();
            $useKey = !$this->isKeysNumeric($value);
            foreach ($value as $k => $v) {
                // skip null value
                if (null === $v) {
                    continue;
                }
                $v = $this->asCode($v, false, true);
                if (false === $topLevel) {
                    $k = sprintf('"%s"', $k);
                }

                $tmp[] = $useKey ? sprintf("%s%s%s", $k, ($inlineList ? ':' : '='), $v) : $v;
            }
            $multiline = $this->getOption('multiline') && count($value) > 1;
            $value = implode($multiline ? ",\n" : ', ', $tmp).($multiline ? "\n" : '');
            if ($topLevel) {
                $value = sprintf('(%s)', $value);
            } else {
                $value = sprintf('{%s}', $value);
            }
            if ($multiline) {
                $value = $this->wrapLines($value, 1);
            }
        }

        return $value;
    }
750612
function Check($value)
    {
        $this->SetValue($value);
        $required = $this->GetRequiredValidator();
        if ($required && !$required->Check($value))
        {
            $this->checkFailed = true;
            return false;
        }
        return parent::Check($value);
    }
909602
public function error($error, $code = 0)
    {
        $this->_errors[] = $error instanceof Error ? $error : new Error($code, $error);
    }
605829
public function generateReport(\PHP_CodeCoverage $coverage)
    {
        $format = $this->config['report']['format'];
        $options = $this->config['report']['options'];

        $report = $this->factory->create($format, $options);
        $report->process($coverage);
    }
1169240
public function send()
    {
        if (headers_sent($file, $line)) {
            throw new RuntimeException("Headers already sent in {$file} on line {$line}."); // @codeCoverageIgnore
        }

        foreach ($this->headers() as $key => $value) {
            header("{$key}: {$value}", true);
        }
    }
879260
function validate($value, $key, $fields, $options, $exists, \CharlotteDunois\Validation\Validator $validator) {
        if(isset($_FILES[$key])) {
            if(!\file_exists($_FILES[$key]['tmp_name'])) {
                return 'formvalidator_make_invalid_file';
            }
            
            $size = \getimagesize($_FILES[$key]['tmp_name']);
        } else {
            if(!$exists) {
                return false;
            }
            
            $size = @\getimagesizefromstring($value);
        }
        
        if(!$size) {
            return 'formvalidator_make_invalid_file';
        }
        
        $n = \explode(',', $options);
        foreach($n as $x) {
            $k = \explode('=', $x);
            switch($k[0]) {
                case 'min_width': // @codeCoverageIgnore
                    if($k[1] > $size[0]) {
                        return array('formvalidator_make_min_width', array('{0}' => $options));
                    }
                break;
                case 'min_height': // @codeCoverageIgnore
                    if($k[1] > $size[1]) {
                        return array('formvalidator_make_min_height', array('{0}' => $options));
                    }
                break;
                case 'width': // @codeCoverageIgnore
                    if($k[1] != $size[0]) {
                        return array('formvalidator_make_width', array('{0}' => $options));
                    }
                break;
                case 'height': // @codeCoverageIgnore
                    if($k[1] != $size[1]) {
                        return array('formvalidator_make_height', array('{0}' => $options));
                    }
                break;
                case 'max_width': // @codeCoverageIgnore
                    if($k[1] < $size[0]) {
                        return array('formvalidator_make_max_width', array('{0}' => $options));
                    }
                break;
                case 'max_height': // @codeCoverageIgnore
                    if($k[1] < $size[1]) {
                        return array('formvalidator_make_max_height', array('{0}' => $options));
                    }
                break;
                case 'ratio': // @codeCoverageIgnore
                    if(\mb_strpos($k[1], '/') !== false) {
                        $k[1] = \explode('/', $k[1]);
                        $k[1] = $k[1][0] / $k[1][1];
                    }
                    
                    if(\number_format(($size[0] / $size[1]), 1) != \number_format($k[1], 1)) {
                        return array('formvalidator_make_ratio', array('{0}' => $options));
                    }
                break;
            }
        }
        
        return true;
    }