substringAfter() public static method

public static substringAfter ( $haystack, $needle )
Esempio n. 1
0
function extract_doc_annotations($comment, $annotation)
{
    $values = [];
    foreach (explode("\n", $comment) as $line) {
        if (!Str::startsWith(trim($line), '* ' . $annotation)) {
            continue;
        }
        $value = Str::substringAfter($line, $annotation);
        if ($value !== '') {
            $values[] = trim($value);
        }
    }
    return $values;
}
Esempio n. 2
0
function get_insert_position($lines)
{
    $docPositions = array_filter($lines, function ($line) {
        return Str::contains($line, '{% lang_operator');
    });
    $documentedLibraries = array_map(function ($line) {
        return Str::firstWord(Str::substringAfter($line, 'lang_operator'));
    }, $docPositions);
    foreach ($documentedLibraries as $position => $library) {
        if (strcmp($library, 'RxPHP') <= 0) {
            continue;
        }
        return $position;
    }
    return count($lines) - 2;
    // at the end of the file by default
}