Return if $value starts with $start

@param array|string $value (objects with __toString() are also allowed)
@param mixed $start

@return bool
541000
public static function startsWith($value, $start)
    {

        if (is_array($value)) {
            return self::first($value) == $start;
        }

        return mb_strpos("$value", "$start") === 0;

    }
456256
public function fill($value, $start = null, $end = null)
    {
        $array = $this->getArrayCopy();
        $length = $this->length();

        if ($end <= 0) {
            $end = $length - $end;
        }

        if (is_null($start) === true) {
            $i = $end ?: $length;

            while ($i--) {
                $array[$i] = $value;
            }
        }

        if ($start <= 0) {
            $start = $length - $start;
        }

        $end = $end ?: $length;
        $i = $start;

        while ($i !== $end) {
            $array[$i] = $value;
            $i++;
        }

        return new static($array);
    }
300845
public function matches($value): bool
    {
        $left = $this->value;
        $right = $value;

        if ($this->useSubstitution) {
            if ($left instanceof IterableSpy) {
                $left = $left->iterable();
            } elseif (
                $left instanceof Generator &&
                isset($left->_phonySubject)
            ) {
                $left = $left->_phonySubject;
            } elseif ($left instanceof InstanceHandle) {
                $left = $left->get();
            }

            if ($right instanceof IterableSpy) {
                $right = $right->iterable();
            } elseif (
                $right instanceof Generator &&
                isset($right->_phonySubject)
            ) {
                $right = $right->_phonySubject;
            } elseif ($right instanceof InstanceHandle) {
                $right = $right->get();
            }
        }

        /*
         * @var array<string,bool> The set of object comparisons that have been made.
         *
         * Keys are of the format "<left spl hash>:<right spl hash>"; values are
         * always TRUE. This set is used to detect comparisons that have already
         * been made in order to avoid infinite recursion when comparing cyclic
         * data structures.
         */
        $visitedObjects = [];

        /*
         * @var array<string,bool> The set of array comparisons that have been made.
         *
         * Keys are of the format "<left id>:<right id>"; values are always
         * TRUE. This set is used to detect comparisons that have already been
         * made in order to avoid infinite recursion when comparing cyclic data
         * structures.
         */
        $visitedArrays = [];

        /*
         * @var array<&array> Arrays that have been marked with an internal ID.
         *
         * In order to detect cyclic arrays we need to mark them with an ID.
         * This ID must be removed upon completion of the comparison.
         */
        $markedArrays = [];

        /*
         * @var array<&array> Stacks of values that are currently being compared.
         *
         * We maintain our own stack in order to:
         *
         *  - make fewer function calls (much faster in PHP 5.*)
         *  - avoid stack-depth limits
         *  - allow for 'continuations'
         *  - avoid unwinding when comparison fails
         *
         * Separate stacks are used for left/right to avoid construction of
         * temporary arrays.
         */
        $leftStack = [];
        $rightStack = [];

        /*
         * @var int The number of elements on the stacks.
         */
        $stackSize = 0;

        // ---------------------------------------------------------
        // This is the main entry point of the comparison algorithm.
        // ---------------------------------------------------------
        compare:

        if (is_array($left) && is_array($right)) {

            // Fetch or generate a unique ID for the left-hand-side.
            if (isset($left[self::ARRAY_ID_KEY])) {
                $leftId = $left[self::ARRAY_ID_KEY];
            } else {
                reset($left);
                $leftId = count($markedArrays) + 1;
                $left[self::ARRAY_ID_KEY] = $leftId;
                $markedArrays[] = &$left;
            }

            // Fetch or generate a unique ID for the right-hand-side.
            if (isset($right[self::ARRAY_ID_KEY])) {
                $rightId = $right[self::ARRAY_ID_KEY];
            } else {
                reset($right);
                $rightId = count($markedArrays) + 1;
                $right[self::ARRAY_ID_KEY] = $rightId;
                $markedArrays[] = &$right;
            }

            // Left and right are references to the same array.
            if ($leftId === $rightId) {
                goto pass;
            }

            $comparisonId = $leftId . ':' . $rightId;

            // These two arrays have already been compared.
            if (isset($visitedArrays[$comparisonId])) {
                goto pass;
            }

            // Record the comparison.
            $visitedArrays[$comparisonId] = true;

            // ---------------------------------
            // Compare the next array key/value.
            // ---------------------------------
            compareNextArrayElement:

            // Get the current key for each array, skipping our internal ID
            // value.
            $leftKey = key($left);
            next($left);

            if ($leftKey === self::ARRAY_ID_KEY) {
                $leftKey = key($left);
                next($left);
            }

            $rightKey = key($right);
            next($right);

            if ($rightKey === self::ARRAY_ID_KEY) {
                $rightKey = key($right);
                next($right);
            }

            // Keys can only be string|int (or null, if end of array).
            // Compare them using regular PHP comparison.
            if ($leftKey !== $rightKey) {
                return false;

            // Both keys are null, which means that both array are the same
            // length.
            } elseif (null === $leftKey) {
                goto pass;
            }

            // Push the arrays we're comparing on to the stack and start
            // comparing the values of this element.
            $leftStack[$stackSize] = &$left;
            $rightStack[$stackSize] = &$right;
            ++$stackSize;

            $left = &$left[$leftKey];
            $right = &$right[$rightKey];

            goto compare;
        }

        // Objects and other non-arrays can be compared with ===, as it will
        // not recurse in either case.
        if ($left === $right) {
            goto pass;
        }

        // Non-objects are not identical.
        if (!is_object($left) || !is_object($right)) {
            return false;
        }

        $leftClass = get_class($left);
        $rightClass = get_class($right);

        // The class names do not match.
        if ($leftClass !== $rightClass) {
            return false;
        }

        $comparisonId = spl_object_hash($left) . ':' . spl_object_hash($right);

        // These two objects have already been compared.
        if (isset($visitedObjects[$comparisonId])) {
            goto pass;
        }

        // Record the comparison.
        $visitedObjects[$comparisonId] = true;

        /*
         * Cast the objects as arrays and start comparing them.
         *
         * Importantly, the array cast operator maintains private and protected
         * properties, as well as arbitrary properties added to the object after
         * construction.
         *
         * Some special properties are removed for the purposes of comparison.
         *
         * @see https://github.com/php/php-src/commit/5721132
         */

        $leftIsMock = $left instanceof Mock;
        $leftIsException = $left instanceof Throwable;

        $left = (array) $left;
        unset($left["\0gcdata"]);

        if ($leftIsMock) {
            $handleProperty = "\0" . $leftClass . "\0_handle";

            if ($left[$handleProperty]) {
                $left['phony.label'] = $left[$handleProperty]->label();
            }

            unset($left[$handleProperty]);
        }

        if ($leftIsException) {
            unset(
                $left["\0*\0file"],
                $left["\0*\0line"],
                $left["\0Exception\0trace"],
                $left["\0Exception\0string"],
                $left['xdebug_message']
            );
        }

        $rightIsMock = $right instanceof Mock;
        $rightIsException = $right instanceof Throwable;

        $right = (array) $right;
        unset($right["\0gcdata"]);

        if ($rightIsMock) {
            $handleProperty = "\0" . $rightClass . "\0_handle";

            if ($right[$handleProperty]) {
                $right['phony.label'] = $right[$handleProperty]->label();
            }

            unset($right[$handleProperty]);
        }

        if ($rightIsException) {
            unset(
                $right["\0*\0file"],
                $right["\0*\0line"],
                $right["\0Exception\0trace"],
                $right["\0Exception\0string"],
                $right['xdebug_message']
            );
        }

        goto compareNextArrayElement;

        // -----------------------------
        // The current values are equal!
        // -----------------------------
        pass:

        // The stack is not empty, pop some values and compare again.
        if ($stackSize--) {
            $left = &$leftStack[$stackSize];
            $right = &$rightStack[$stackSize];

            goto compareNextArrayElement;
        }

        // Stack is empty, there's nothing left to compare. Clean up the
        // injected array IDs and return
        foreach ($markedArrays as &$array) {
            unset($array[self::ARRAY_ID_KEY]);
        }

        return true;
    }
932
public function checkValue(&$value)
    {
        if (is_string($value)) {
            $value = Placeholder::replaceStringsAndComments($value);
            $value = Placeholder::removeCommentPlaceholders($value, true);
            $value = preg_replace('/[ ]+/', ' ', $value);
            $value = Placeholder::replaceStringPlaceholders($value, true);

            return true;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($value). "' for argument 'value' given."
            );
        }
    }
2359
public static function isTruthy($value)
    {
        if (!$value) {
            return $value === 0 || $value === '0';
        } elseif ($value instanceof \stdClass) {
            return (bool) get_object_vars($value);
        } else {
            return true;
        }
    }
767074
public static function startsWith($value, string $search, string $encoding = 'UTF-8'): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        $searchlen = (int) mb_strlen($search, $encoding);
        $start = mb_substr((string) $value, 0, $searchlen, $encoding);

        return $search === $start;
    }
33846
public function checkPlain($value)
    {
        if (!Type::isStringable($value)) {
            return false;
        }

        $string = "$value";

        return $string == strip_tags($string);
    }
1178409
private function parseList(array $lines, $value, $start)
    {
        $html = '';
        $minSpace = 99999;
        $secondMinSpace = 99999;
        $found = false;
        $secondFound = false;
        $rows = array();
        // count levels
        foreach ($lines as $key => $line) {
            if (preg_match("/^(\s*)((?:[0-9]+\.?)|\-|\+|\*)(\s+)(.*)$/i", $line, $matches)) {
                $space = strlen($matches[1]);
                $type = false !== strpos('+-*', $matches[2]) ? 'ul' : 'ol';
                $minSpace = min($space, $minSpace);
                $found = true;
                if ($space > 0) {
                    $secondMinSpace = min($space, $secondMinSpace);
                    $secondFound = true;
                }
                $rows[] = array($space, $type, $line, $matches[4]);
            } else {
                $rows[] = $line;
                if (preg_match("/^(\s*)/", $line, $matches)) {
                    $space = strlen($matches[1]);
                    
                    if ($space > 0) {
                        $secondMinSpace = min($space, $secondMinSpace);
                        $secondFound = true;
                    }
                }
            }
        }
        $minSpace = $found ? $minSpace : 0;
        $secondMinSpace = $secondFound ? $secondMinSpace : $minSpace;
        $lastType = '';
        $leftLines = array();
        $leftStart = 0;
        foreach ($rows as $key => $row) {
            if (is_array($row)) {
                list ($space, $type, $line, $text) = $row;
                if ($space != $minSpace) {
                    $leftLines[] = preg_replace("/^\s{" . $secondMinSpace . "}/", '', $line);
                } else {
                    if (!empty($leftLines)) {
                        $html .= "<li>" . $this->parse(implode("\n", $leftLines), true, $start + $leftStart) . "</li>";
                    }
                    if ($lastType != $type) {
                        if (!empty($lastType)) {
                            $html .= "</{$lastType}>";
                        }
                        $html .= "<{$type}>";
                    }
                    $leftStart = $key;
                    $leftLines = array($text);
                    $lastType = $type;
                }
            } else {
                $leftLines[] = preg_replace("/^\s{" . $secondMinSpace . "}/", '', $row);
            }
        }
        if (!empty($leftLines)) {
            $html .= "<li>" . $this->parse(implode("\n", $leftLines), true, $start + $leftStart) . "</li></{$lastType}>";
        }
        return $html;
    }
914166
public function whereStartsWith($field, $value, $length = null)
    {
        if ($value === '') {
            return $this;
        }

        if ($length === null) {
            return $this->_whereLike($field, '^' . $value);
        } else {
            return $this->_whereLike($field, '^' . str_pad($value, $length, '.') . '$');
        }
    }
1002341
protected function parsevalue($value)
    {
        //make sure the whole value can be mapped
        if (!is_array($value) && !$value instanceof \ArrayAccess && !is_object($value)) {
            return false;
        }

        return $this->rParseValue($value);
    }
231642
public function transform(string $value, int $start = 0, int $length = null): string {
        return $length === null ? substr($value, $start) : substr($value, $start, $length);
    }
1054896
public static function substring($string, $start = 0, $length = null)
    {
        if (!self::isValid($string)) {
            return false;
        }

        return mb_substr($string, $start, $length);
    }
252547
public function startsWith(Value $value, $insensitive = false)
    {
        $value = $value->getValue();
        $valueLength = strlen($value);

        if (!empty($this->value) && !empty($value) && strlen($this->value) >= $valueLength) {
            return substr_compare($this->value, $value, 0, $valueLength, $insensitive) === 0;
        }

        return false;
    }
88115
public function substring($start, $length = null)
    {

        if ($length == null) {
            $substring = substr($this->value, $start);
        } else {
            $substring = substr($this->value, $start, $length);
        }

        $this->value = $substring;

        return $this;


    }
1076713
private function _isStartWithSelector($node)
    {
        if ($node->hasAttribute($this->_attrName) && strlen($this->_value) > 0) {
            $attrValue = $node->getAttribute($this->_attrName);
            return strpos($attrValue, $this->_value) === 0;
        }
        return false;
    }
627331
protected function parseValue($value) {
		$value = trim($value);
		if ('' == $value) {
			//return as boolean
			return true;
		}
		return $this->valueParser->parse($value); 
	}
1130520
public static function match(string $str, string $start, string $end) {
		$start = preg_quote($start);
		$end = preg_quote($end);
		if (preg_match('/' . $start . '(.*)' . $end . '/', $str, $matches)) {
			return $matches[1] . '';
		}
		return false;
	}