@param string $source
@param int    $line
@param string $cssCodeCorrectLineClass
@param string $cssCodeIncorrectLineClass

@return string
509491
protected static function formatCode($source, $line, $cssCodeCorrectLineClass, $cssCodeIncorrectLineClass)
    {
        $array = self::formatXhtmlHighlight($source);
        $all = \sizeof($array);
        $len = \strlen($all);
        $page = '';
        for ($i = 0; $i < $all; ++$i) {
            $next = (string)($i + 1);
            $l = \strlen($next);
            $page .= '<span class="' . \htmlspecialchars($line == $next ? $cssCodeIncorrectLineClass : $cssCodeCorrectLineClass) . '">' . ($l < $len ? \str_repeat('&#160;', $len - $l) : '') . $next . '</span> ' . $array[$i] . "\n";
        }

        return $page;
    }
1159253
private function processLine(string $line): void
    {
        $iterator = new \ArrayIterator(explode(Tokens::SPACE, $line));

        if ($this->isControlEntry($iterator)) {
            $this->processControlEntry($iterator);

            return;
        }

        $resourceRecord = new ResourceRecord();

        $this->processResourceName($iterator, $resourceRecord);
        $this->processTtl($iterator, $resourceRecord);
        $this->processClass($iterator, $resourceRecord);
        $resourceRecord->setRdata($this->extractRdata($iterator));

        $this->zone->addResourceRecord($resourceRecord);
    }
376437
public static function getFormula(
        PhpParser\Node\Expr $conditional,
        $this_class_name,
        FileSource $source,
        Codebase $codebase = null,
        bool $inside_negation = false
    ) {
        if ($conditional instanceof PhpParser\Node\Expr\BinaryOp\BooleanAnd ||
            $conditional instanceof PhpParser\Node\Expr\BinaryOp\LogicalAnd
        ) {
            $left_assertions = self::getFormula(
                $conditional->left,
                $this_class_name,
                $source,
                $codebase,
                $inside_negation
            );

            $right_assertions = self::getFormula(
                $conditional->right,
                $this_class_name,
                $source,
                $codebase,
                $inside_negation
            );

            return array_merge(
                $left_assertions,
                $right_assertions
            );
        }

        if ($conditional instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr ||
            $conditional instanceof PhpParser\Node\Expr\BinaryOp\LogicalOr
        ) {
            // at the moment we only support formulae in CNF

            $left_clauses = self::getFormula(
                $conditional->left,
                $this_class_name,
                $source,
                $codebase,
                $inside_negation
            );

            $right_clauses = self::getFormula(
                $conditional->right,
                $this_class_name,
                $source,
                $codebase,
                $inside_negation
            );

            return self::combineOredClauses($left_clauses, $right_clauses);
        }

        if ($conditional instanceof PhpParser\Node\Expr\BooleanNot) {
            if ($conditional->expr instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr) {
                $and_expr = new PhpParser\Node\Expr\BinaryOp\BooleanAnd(
                    new PhpParser\Node\Expr\BooleanNot(
                        $conditional->expr->left,
                        $conditional->getAttributes()
                    ),
                    new PhpParser\Node\Expr\BooleanNot(
                        $conditional->expr->right,
                        $conditional->getAttributes()
                    ),
                    $conditional->expr->getAttributes()
                );

                return self::getFormula(
                    $and_expr,
                    $this_class_name,
                    $source,
                    $codebase,
                    $inside_negation
                );
            }

            if ($conditional->expr instanceof PhpParser\Node\Expr\BinaryOp\BooleanAnd) {
                $and_expr = new PhpParser\Node\Expr\BinaryOp\BooleanOr(
                    new PhpParser\Node\Expr\BooleanNot(
                        $conditional->expr->left,
                        $conditional->getAttributes()
                    ),
                    new PhpParser\Node\Expr\BooleanNot(
                        $conditional->expr->right,
                        $conditional->getAttributes()
                    ),
                    $conditional->expr->getAttributes()
                );

                return self::getFormula(
                    $and_expr,
                    $this_class_name,
                    $source,
                    $codebase,
                    $inside_negation
                );
            }
        }

        AssertionFinder::scrapeAssertions(
            $conditional,
            $this_class_name,
            $source,
            $codebase,
            $inside_negation
        );

        if (isset($conditional->assertions) && $conditional->assertions) {
            $assertions = $conditional->assertions;

            $clauses = [];

            foreach ($assertions as $var => $anded_types) {
                foreach ($anded_types as $orred_types) {
                    $clauses[] = new Clause(
                        [$var => $orred_types],
                        false,
                        true,
                        $orred_types[0][0] === '='
                            || $orred_types[0][0] === '~'
                            || (strlen($orred_types[0]) > 1
                                && ($orred_types[0][1] === '='
                                    || $orred_types[0][1] === '~'))
                    );
                }
            }

            return $clauses;
        }

        return [new Clause([], true)];
    }
50163
protected function stripCssExpressions($source)
    {
        // Strip any comments out (in the form of /*...*/)
        $test = preg_replace('#\/\*.*\*\/#U', '', $source);

        // Test for :expression
        if (!stripos($test, ':expression')) {
            // Not found, so we are done
            $return = $source;
        } else {
            // At this point, we have stripped out the comments and have found :expression
            // Test stripped string for :expression followed by a '('
            if (preg_match_all('#:expression\s*\(#', $test, $matches)) {
                // If found, remove :expression
                $test = str_ireplace(':expression', '', $test);
                $return = $test;
            }
        }

        return $return;
    }
433694
public static function fromPattern($source) {
        $source = preg_replace('/([\[\]\(\)\|]|\.\.\.)/', ' $1 ', $source);
        $source = preg_split('/\s+|(\S*<.*?'.'>)/', $source, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        return new static($source, DocoptFormatError::class);
    }
783822
public static function convertToInlineCss($strText, $strCssText = null)
    {
        // apply the css inliner
        $objCssInliner = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles();

        return $objCssInliner->convert($strText, $strCssText);
    }
1185797
public function convertToInlineCss(string $text, string $cssText = null)
    {
        // apply the css inliner
        $objCssInliner = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles();

        return $objCssInliner->convert($text, $cssText);
    }
416401
protected function findClassOrInterfaceName(File $phpCsFile, int $pointer): string
    {
        $classOrInterfaceNamePosition = $phpCsFile->findNext(T_STRING, $pointer);

        return $phpCsFile->getTokens()[$classOrInterfaceNamePosition]['content'];
    }
451069
public static function getLineSlices(string $line)
    {
        preg_match('/^(\d+) (\w+) ([a-z0-9]+) +(\d+|-)\t(.*)$/', $line, $matches);
        $permissions = $matches[1];
        $type = null;
        switch ($matches[2]) {
            case NodeObject::TYPE_TREE:
                $type = NodeObject::TYPE_TREE;
                break;
            case NodeObject::TYPE_BLOB:
                $type = NodeObject::TYPE_BLOB;
                break;
            case NodeObject::TYPE_LINK:
                $type = NodeObject::TYPE_LINK;
                break;
        }
        $sha = $matches[3];
        $size = $matches[4];
        $fullPath = $matches[5];

        return [
            'permissions' => $permissions,
            'type'        => $type,
            'sha'         => $sha,
            'size'        => $size,
            'fullPath'    => $fullPath,
        ];
    }
670774
static function simpleXmlToStdClass(SimpleXMLElement &$source)
  {
    $res = new StdClass;
    $children = false;
    foreach ($source as $key => $value) {
      if (isset($res->$key)) {
        if (!is_array($res->$key)) {
          $res->$key = array($res->$key);
        }
        $ref = &$res->$key;
        $ref[] = CPS_Response::simpleXmlToStdClass($value);
      } else {
        $res->$key = CPS_Response::simpleXmlToStdClass($value);
      }
      $children = true;
    }
    if (!$children)
      return (string)$source;
    return $res;
  }
1191481
public function load($source, $context)
    {
        $key = $this->getSpecificSourceCacheKey(
            $source,
            $context
        );

        if (isset($this->commentTree[$key]) && is_array($this->commentTree[$key])) {
            return $this->commentTree[$key];
        }

        /**
         * Fetch key from cache.
         */
        $commentTree = $this->loadCommentTreeFromCache($source, $context);

        /**
         * If cache key is empty, build it.
         */
        if (empty($commentTree)) {
            $commentTree = $this->buildCommentTreeAndSaveIntoCache($source, $context);
        }

        $this->commentTree[$key] = $commentTree;

        return $commentTree;
    }
834891
public function addLine(string $line): Source
    {
        if (strpos($line, "\n") !== false) {
            throw new MultilineException(
                "New line character is forbidden in addLine method argument"
            );
        }

        $this->lines[] = $line;

        return $this;
    }
1322597
private function buildHeaderLine(string $name, array $sources): string
    {
        $header = '';
        if (!empty($sources)) {
            $value = "";
            foreach ($sources as $source) {
                if (!empty($value)) {
                    $value .= ' ';
                }
                $value .= $source;
            }
            $header = ($name == "script-src" && !empty(self::$nonce))
                ? "$name $value 'nonce-" . self::$nonce . "';"
                : "$name $value;";
        }
        return $header;
    }
154772
protected function getClassName(File $phpCsFile): string
    {
        $fileName = $phpCsFile->getFilename();
        $fileNameParts = explode(DIRECTORY_SEPARATOR, $fileName);
        $sourceDirectoryPosition = array_search('src', array_values($fileNameParts));
        $classNameParts = array_slice($fileNameParts, $sourceDirectoryPosition + 1);
        $className = implode('\\', $classNameParts);
        $className = str_replace('.php', '', $className);

        return $className;
    }
263673
public function parsePoSource(string $source): void
    {
        /**
         * This is an incredibly ugly regex pattern that breaks a line of a po file into
         * pieces that can be analyzed and acted upon.
         *
         * The matches array in preg_match will break out like this:
         *  [0] full string
         *  [1] mostly useless broad match of initial token, including trailing space
         *  [2] bare token, or full msgstr[n] clause
         *  [3] 'n' of a msgstr[n] line
         *  [4] '"' if a data line
         *  [5] remaining line
         *  [6] a bare or malformed comment
         */
        $pattern = '/(^(#|#.|#;|#,|#\||msgid|msgid_plural|msgctxt|msgstr|msgstr\[([0-9]+)\])\s|(^"))(.+)|(^#.*)/';

        $source_lines = explode("\n", $source);

        $wsBreak = false;
        $inHeader = true;
        $headerEntry = new PoHeader;
        $entry = $headerEntry;
        $unrecognized = array();
        $lastKey = '';
        $currentPlural = 0;
        foreach ($source_lines as $line => $s) {
            $result = preg_match($pattern, $s, $matches);
            if (!$result) {
                $lastKey = '';
                if ($s=='' || ctype_space($s)) {
                    if ($inHeader) {
                        $this->setHeaderEntry($headerEntry);
                        $entry = null;
                        $inHeader = false;
                    }
                    if (!$wsBreak) {
                        if (!($entry === null)) {
                            $this->addEntry($entry);
                        }
                        $entry = null;
                        $wsBreak=true;
                    }
                } else {
                    $wsBreak=false;
                    $unrecognized[$line+1] = $s;
                }
            } else {
                if ($entry === null) {
                    $entry = new PoEntry;
                }
                $wsBreak=false;
                $currentKey = $matches[2];  // will be used to set last key
                switch ($matches[2]) {
                    case PoTokens::TRANSLATOR_COMMENTS:
                    case PoTokens::EXTRACTED_COMMENTS:
                    case PoTokens::REFERENCE:
                    case PoTokens::FLAG:
                    case PoTokens::OBSOLETE:
                    case PoTokens::PREVIOUS:
                        $entry->add($matches[2], $matches[5]);
                        break;
                    case PoTokens::CONTEXT:
                    case PoTokens::MESSAGE:
                    case PoTokens::PLURAL:
                    case PoTokens::TRANSLATED:
                        $entry->addQuoted($matches[2], $matches[5]);
                        break;
                    default:
                        if ($matches[4]==PoTokens::CONTINUED_DATA) {
                            $currentKey = $lastKey; // keep the previous key
                            if ($currentKey==PoTokens::TRANSLATED_PLURAL) {
                                $entry->addQuotedAtPosition(
                                    PoTokens::TRANSLATED,
                                    $currentPlural,
                                    '"' . $matches[5]
                                );
                            } else {
                                $entry->addQuoted($currentKey, '"' . $matches[5]);
                            }
                        } elseif (substr($matches[2], 0, 7)==PoTokens::TRANSLATED_PLURAL) {
                            $currentKey = PoTokens::TRANSLATED_PLURAL;
                            $currentPlural = $matches[3];
                            $entry->addQuotedAtPosition(
                                PoTokens::TRANSLATED,
                                $currentPlural,
                                $matches[5]
                            );
                        } elseif (isset($matches[6][0])
                            && $matches[6][0]==PoTokens::TRANSLATOR_COMMENTS) {
                            $value = substr($matches[6], 1);
                            $value = empty($value) ? '' : $value;
                            $entry->add(PoTokens::TRANSLATOR_COMMENTS, $value);
                        } else {
                            $unrecognized[$line+1] = $s;
                        }
                        break;
                }
                $lastKey = $currentKey;
            }
        }
        if (!($entry === null)) {
            $this->addEntry($entry);
        }

        // throw at the very end, anything recognized has been processed
        $this->unrecognizedInput = $unrecognized;
        if (count($unrecognized)) {
            throw new UnrecognizedInputException();
        }
    }
141789
protected function determineTargetModelFromSource($modelClass, $source)
    {
        if ( ! is_a($modelClass, Model::class, true)) {
            // @codeCoverageIgnoreStart
            throw new UnexpectedValueException("{$modelClass} is not an Eloquent model");
            // @codeCoverageIgnoreEnd
        }

        $model = new $modelClass;

        if ( ! ($relation = $this->getNestedRelation($model, $source))) {
            // @codeCoverageIgnoreStart
            $relation = $this->resolveModelSource($model, $source);
            // @codeCoverageIgnoreEnd
        }

        if ( ! ($relation instanceof Relation)) {
            // @codeCoverageIgnoreStart
            throw new UnexpectedValueException(
                "Source {$source} on {$modelClass} does not resolve to an Eloquent relation instance"
            );
            // @codeCoverageIgnoreEnd
        }

        /** @var Relation $relation */
        return $relation->getRelated();
    }
1368052
public static DZcs cs_load(InputStream in)
	{
		int i, j;
		double x[], x_re, x_im ;
		DZcs T;
		String line, tokens[] ;
		Reader r = new InputStreamReader(in);
		BufferedReader br = new BufferedReader(r);

		T = cs_spalloc(0, 0, 1, true, true) ;	/* allocate result */

		try
		{
			while ((line = br.readLine()) != null)
			{
				tokens = line.trim().split("\\s+") ;
				if (tokens.length != 4) return null ;
				i = Integer.parseInt(tokens [0]) ;
				j = Integer.parseInt(tokens [1]) ;
				x_re = Double.parseDouble(tokens [2]) ;
				x_im = Double.parseDouble(tokens [3]) ;
				x = new double[] {x_re, x_im} ;
				if (!cs_entry(T, i, j, x)) return (null) ;
			}
			r.close();
			br.close();
		}
		catch (IOException e)
		{
			return (null) ;
		}
		return (T) ;
	}