Gets a clean subject line from the commit message

@param $context
@return string
356700
private function getSubjectLine($context)
    {
        $commitMessage = $context->getCommitMessage();
        $lines = $this->getCommitMessageLinesWithoutComments($commitMessage);
        return (string) $lines[0];
    }
225974
public function getCommitMessage()
    {
        $rtn = parent::getCommitMessage($this->data['commit_message']);

        $project = $this->getProject();

        if (!is_null($project)) {
            $reference = $project->getReference();
            $commitLink = '<a target="_blank" href="https://github.com/' . $reference . '/issues/$1">#$1</a>';
            $rtn = preg_replace('/\#([0-9]+)/', $commitLink, $rtn);
            $rtn = preg_replace('/\@([a-zA-Z0-9_]+)/', '<a target="_blank" href="https://github.com/$1">@$1</a>', $rtn);
        }

        return $rtn;
    }
595403
public function getLineIndentation()
    {
        $first = $this->getFirstTokenOnLine();
        if ( ! $first->matches(T_WHITESPACE)) {
            return '';
        }

        return $first->getContentUntil($first->findNextToken('NO_WHITESPACE')->get());
    }
844255
protected function getParser($context = null)
    {
        $parser = $this->getComponent('parser');

        $parser->registeredVars['context'] = $context;

        return $parser;
    }
112130
private function getLine():string
	{
		$line= fgets( $this->handle );

		$this->raw.= $line;

		return trim( $line );
	}
1015708
public function render($context)
    {
        if ($this->place || $this->place == self::RESET_CONTEXT) {
            return sprintf('<img src="%s" alt="%s" />', $this->path, $this->alt);
        } elseif ($this->place == self::PRE_CONTEXT) {
            return sprintf('<img src="%s" alt="%s" />', $this->path, $this->alt) . $context;
        } else {
            return $context . sprintf('<img src="%s" alt="%s" />', $this->path, $this->alt);
        }
    }
335070
public function getVisitor(ValidationContext $context)
    {
        return [
            NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ($context) {
                if ($node->operation === 'subscription') {
                    if (count($node->selectionSet->selections) !== 1) {
                        $context->reportError(
                            new Error(
                                $this->singleFieldOnlyMessage($node->name ? $node->name->value : null),
                                array_slice($node->selectionSet->selections, 1)
                            )
                        );
                    }
                }
            }
        ];
    }
128924
protected function getFullPath($contextPath, $targetPath): string
    {
        if ($this->filesystem->isAbsolutePath($targetPath)) {
            return $targetPath;
        }

        return rtrim($contextPath, '/\\').DIRECTORY_SEPARATOR.$targetPath;
    }
1197732
public function getCauseMessage(&$causes)
    {
        $trace = $this->getTraceSafe();
        $cause = array('class'   => get_class($this),
                       'message' => $this->message,
                       'file' => 'unknown',
                       'line' => 'unknown');
        if (isset($trace[0])) {
            if (isset($trace[0]['file'])) {
                $cause['file'] = $trace[0]['file'];
                $cause['line'] = $trace[0]['line'];
            }
        }
        $causes[] = $cause;
        if ($this->cause instanceof PEAR_Exception) {
            $this->cause->getCauseMessage($causes);
        } elseif ($this->cause instanceof Exception) {
            $causes[] = array('class'   => get_class($this->cause),
                              'message' => $this->cause->getMessage(),
                              'file' => $this->cause->getFile(),
                              'line' => $this->cause->getLine());
        } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {
            $causes[] = array('class' => get_class($this->cause),
                              'message' => $this->cause->getMessage(),
                              'file' => 'unknown',
                              'line' => 'unknown');
        } elseif (is_array($this->cause)) {
            foreach ($this->cause as $cause) {
                if ($cause instanceof PEAR_Exception) {
                    $cause->getCauseMessage($causes);
                } elseif ($cause instanceof Exception) {
                    $causes[] = array('class'   => get_class($cause),
                                   'message' => $cause->getMessage(),
                                   'file' => $cause->getFile(),
                                   'line' => $cause->getLine());
                } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) {
                    $causes[] = array('class' => get_class($cause),
                                      'message' => $cause->getMessage(),
                                      'file' => 'unknown',
                                      'line' => 'unknown');
                } elseif (is_array($cause) && isset($cause['message'])) {
                    // PEAR_ErrorStack warning
                    $causes[] = array(
                        'class' => $cause['package'],
                        'message' => $cause['message'],
                        'file' => isset($cause['context']['file']) ?
                                            $cause['context']['file'] :
                                            'unknown',
                        'line' => isset($cause['context']['line']) ?
                                            $cause['context']['line'] :
                                            'unknown',
                    );
                }
            }
        }
    }
945772
function findMessage( $context, $source, $comment = null )
    {
        $num = $this->pick( $context, $source, $comment );
        if ( $num >=0 and $num <= count( $this->Handlers ) )
        {
            $handler = $this->Handlers[$num];
            return $handler->findMessage( $context, $source, $comment );
        }
        $retValue = null;
        return $retValue;
    }
844853
public function getStatusLine() : string
    {
        return sprintf('HTTP/%s %s %s', self::HTTP_VERSION, $this->statusCode, self::getStatusText($this->statusCode));
    }
39227
protected function buildMessage(array $context): string
    {
        $message = $this->message ?: '{name} took {lapse} seconds.';

        return Str::replace($message, $context);
    }
403452
public function asResponseMessage($context = null)
    {
        return $this->messages->response(
            '1.1',
            $this->mergeContextHeaders($context),
            $this->body,
            $this->statusCode,
            $this->reasonPhrase
        );
    }
689411
public function createSubject($context)
    {
        global $logger;
        //$copyContext = $this->copy($context);
        //$copyContext = $this->_ensureSecurityMgr($copyContext);
        //$copyContext = $this->_resolveSession($copyContext);
        //$copyContext = $this->_resolvePrincipals($copyContext);
        $subject     = $this->doCreateSubject($context);
        $this->_save($subject);

        return $subject;

    }
1176712
protected function _actionBrowse(AnCommandContext $context)
    {
        if (! $context->query) {
            $context->query = $this->getRepository()->getQuery();
        }

        $query = $context->query;

        if ($this->filter) {
            if ($this->filter['usertype'] && in_array($this->filter['usertype'], $this->_allowed_user_types)) {
                $query->filterUsertype($this->getService('anahita:filter.cmd')
                      ->sanitize($this->filter['usertype']));
            }

            if ($this->filter['disabled']) {
                $query->filterDisabledAccounts(true);
            }
        }

        if ($this->getService('anahita:filter.email')->validate($this->q)) {
            $query->filterEmail($this->q);
        }

        if ($this->getService('com:people.filter.username')->validate($this->q)) {
            $query->filterUsername($this->q);
        }

        if ($this->q) {
            $query->keyword = $this->getService('anahita:filter.term')->sanitize($this->q);
        }

        if ($this->ids) {
            $ids = AnConfig::unbox($this->ids);
            $query->id($ids);
        } else {
            $query->limit($this->limit, $this->start);
        }

        $entities = $this->getState()->setList($query->toEntityset())->getList();

        return $entities;
    }
1229667
private function getCurrentClassName(Context $context)
    {
        $class = null;
        /** @var PropertyMetadata $metadata */
        if (null !== ($metadata = $context->getMetadataStack()->top())) {
            if ($metadata->class) {
                $class = $metadata->class;
            }
        }

        return $class;
    }
105092
protected function getPattern()/*# : string */
    {
        if (is_null($this->reference_pattern)) {
            if ('' === $this->reference_start ||
                is_null($this->reference_end)) {
                $this->reference_pattern = '';
            } else {
                $this->reference_pattern = '~('  .
                    preg_quote($this->reference_start) .
                    '([a-zA-Z_][a-zA-Z0-9._]*+)' .
                    preg_quote($this->reference_end) . ')~';
            }
        }
        return $this->reference_pattern;
    }