2016-06-30
@override
@see \Df\Framework\IValidator::check()
@used-by \Df\Framework\Plugin\Data\Form\Element\AbstractElement::afterGetComment()
@used-by check()
@param AE $e
@return true|Phrase|Phrase[]
420319
function check(AE $e) {return
		dfa_flatten(array_map(function(R $r) use($e) {
			/** @var true|Phrase|Phrase[] $messages */
			$messages = $r->check($e);
			return true === $messages ? [] : df_array($messages);
		}, $this->_children)) ?: true
	;}
776746
public function check()
    {
        return $this->expressionIsOk()
            ? $this->makeHealthyResult()
            : $this->makeResult(false, $this->target->getErrorMessage());
    }
602102
function after_process() {
    global $insert_id, $db;
    $sql = "insert into " . TABLE_ORDERS_STATUS_HISTORY . " (comments, orders_id, orders_status_id, date_added) values (:orderComments, :orderID, :orderStatus, now() )";
    $sql = $db->bindVars($sql, ':orderComments', 'eCheck payment.  AUTH: ' . $this->auth_code . '. TransID: ' . $this->transaction_id . '.', 'string');
    $sql = $db->bindVars($sql, ':orderID', $insert_id, 'integer');
    $sql = $db->bindVars($sql, ':orderStatus', $this->order_status, 'integer');
    $db->Execute($sql);
    return false;
  }
460738
protected function checkDocHints($docComment, $model)
    {
        // Check if we never follow this relation
        if (preg_match('/@follow\s+NEVER/', $docComment)) return false;

        // Check if we follow the relation from the 'base' model
        if (preg_match('/@follow\s+UNLESS\s+' . str_replace('\\', '\\\\', get_class($model)) . '\b/', $docComment))
        {
            return false;
        }

        if (preg_match('/@follow\s+FROM\b/', $docComment) && !preg_match('/@follow\s+FROM\s+' . str_replace('\\', '\\\\', get_class($model)) . '\b/', $docComment))
        {
            return false;
        }

        // We follow the relation
        return true;
    }
577620
public function check()
    {
        IlluminateRedis::set(
            $key = $this->target->key,
            $number = random_bytes(80)
        );

        $result = IlluminateRedis::get($key);

        return $this->makeResult(
            $number == $result,
            $number !== $result ? $this->target->key : ''
        );
    }
573787
public function getReply()
    {
        if (!empty($this->reply)) {
            $reply = '';
            if (!empty($this->reply[1])) {
                $reply .= $this->addEncodeTag('"' . $this->reply[1] . '"') . ' ';
            }
            $reply .= '<' . $this->reply[0] . '>';
            return $reply;
        } else {
            return false;
        }
    }
1064419
public function iShouldSeeRegex($regex)
    {
        $actual = $this->getSession()->getPage()->getText();
        $actual = preg_replace('/\s+/u', ' ', $actual);
        
        if (0 === preg_match(ReformatRegex::spaceTabsEqual(sprintf('/%s/', $regex)), $actual)) {
            // No matches meaning we haven't found what were looking for
            throw new ExpectationException(
                sprintf(
                    'The content %s can not be found on %s',
                    $regex,
                    $this->getSession()->getCurrentUrl()
                ),
                $this->getSession()->getDriver()
            );
        }
    }
560597
private function translateExceptionCode($e)
    {
        if (! in_array($e->getCode(), [0, -1, null, ''])) {
            return $e->getCode();
        }

        if (method_exists($e, 'getStatusCode')) {
            if (! in_array($e->getStatusCode(), [0, -1, null, ''])) {
                return $e->getStatusCode();
            }

            if (($statusCode = $this->getStatusCode()) != StatusCode::OK) {
                return $statusCode;
            }
        }

        if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException
            or $e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
        ) {
            return StatusCode::NOT_FOUND;
        }

        return StatusCode::BAD_REQUEST;
    }
612524
public static function extErrorMessage($e)
    {
        if ($e instanceof Exception\CMS) {
            return $e->getExtMessage();
        } else {
            return 'In file <b>'.$e->getFile().'</b> on line: '.$e->getLine()."<br /><br /><b>Stack trace:</b><br />".nl2br($e->getTraceAsString());
        }
    }
1030035
private boolean containsComment(GHPullRequest ghPullRequest, String expectedBody) {
        List<GHIssueComment> prComments;
        try {
            prComments = ghPullRequest.getComments();
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to get comments for PR " + ghPullRequest, e);
            // return false in case of an error - probably safer to have multiple comments than possibly none
            return false;
        }
        for (GHIssueComment comment : prComments) {
            if (comment.getBody() != null && comment.getBody().equals(expectedBody)) {
                return true;
            }
        }
        return false;
    }
989397
private static function _eolInComment($line, $inComment)
    {
        while (strlen($line)) {
            if ($inComment) {
                // only "*/" can end the comment
                $index = self::_find($line, '*/');
                if ($index === false) {
                    return true;
                }

                // stop comment and keep walking line
                $inComment = false;
                @$line = (string)substr($line, $index + 2);
                continue;
            }

            // look for "//" and "/*"
            $single = self::_find($line, '//');
            $multi = self::_find($line, '/*');
            if ($multi === false) {
                return false;
            }

            if ($single === false || $multi < $single) {
                // start comment and keep walking line
                $inComment = true;
                @$line = (string)substr($line, $multi + 2);
                continue;
            }

            // a single-line comment preceeded it
            return false;
        }

        return $inComment;
    }
174226
public function add($e)
    {
        if ($this->message) {
            $this->message .= "\n";
        }

        if ($e instanceof self) {
            $this->message .= '(' . get_class($e) . ")";
            foreach (explode("\n", $e->getMessage()) as $message) {
                $this->message .= "\n    {$message}";
            }
        } elseif ($e instanceof \Exception) {
            $this->exceptions[] = $e;
            $this->message .= '(' . get_class($e) . ') ' . $e->getMessage();
        }

        return $this;
    }
525738
@Override
	public CheckResult check() {
		try {
			post(new byte[] { '[', ']' });
			return CheckResult.OK;
		}
		catch (Exception e) {
			return CheckResult.failed(e);
		}
	}
885377
public function handleDbEvent($e) {
    $statement = $e->getParam('statement', null);
    if ($statement != null) {
      $this->statements[] = [$statement->getSql(), $statement->getParameterContainer()->getNamedArray()];
    }
  }
826840
protected boolean recursiveCheckForCode(Throwable e, int code) {
    GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e);
    if (jsonException != null) {
      return getHttpStatusCode(jsonException) == code;
    }
    return false;
  }
207313
public function SelectClause()
    {
        $isDistinct = false;
        $this->match(Lexer::T_SELECT);

        // Check for DISTINCT
        if ($this->lexer->isNextToken(Lexer::T_DISTINCT)) {
            $this->match(Lexer::T_DISTINCT);

            $isDistinct = true;
        }

        // Process SelectExpressions (1..N)
        $selectExpressions = array();
        $selectExpressions[] = $this->SelectExpression();

        while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
            $this->match(Lexer::T_COMMA);

            $selectExpressions[] = $this->SelectExpression();
        }

        return new AST\SelectClause($selectExpressions, $isDistinct);
    }
653941
public function afterExecuteRoute() {
        /** @var \Bullhorn\FastRest\Api\Services\Output\OutputInterface $output */
        $output = $this->getDI()->get(OutputInterface::DI_NAME);
        if(!($output instanceof OutputInterface)) {
            throw new \Exception('The Output must implement: ' . OutputInterface::class);
        }
        $object = $this->getOutputObject();
        $errors = $this->getErrors();
        $code = $this->getStatusCode();

        $object = $this->addErrorsAndStatus($errors, $code, $object);
        $this->response->setStatusCode($object->statusCode, 'Check Document Body For More Details');
        $output->output($object, $this->response);
        $this->view->disable();
    }