src/Bandolier/Type/Strings.php
public static function stripOuterQuotes($value = "")
    {
        // if value passed as empty or is not a string then return false
        if (!$value) {
            return false;
        }

        /** @var string $cache Cache Value */
        $cache = self::cacheString($value);

        // check for cache
        if (isset(static::$stripOuterQuotesCache[$cache])) {
            return static::$stripOuterQuotesCache[$cache];
        }

        $start = (strlen($value) > 1 && self::startsWith($value, '"'))
            || (strlen($value) > 1 && self::startsWith($value, '\''));

        $end = (strlen($value) > 1 && self::endsWith($value, '"'))
            || (strlen($value) > 1 && self::endsWith($value, '\''));

        if ($start && $end) {
            return static::$stripOuterQuotesCache[$cache] = substr($value, 1, -1);
        }
        return static::$stripOuterQuotesCache[$cache] = $value;
    }
public static function stripOuterQuotes($value = "")
    {
        // if value passed as empty or is not a string then return false
        if (!$value) {
            return false;
        }

        /** @var string $cache Cache Value */
        $cache = self::cacheString($value);

        // check for cache
        if (isset(static::$stripOuterQuotesCache[$cache])) {
            return static::$stripOuterQuotesCache[$cache];
        }

        $start = (strlen($value) > 1 && self::startsWith($value, '"'))
            || (strlen($value) > 1 && self::startsWith($value, '\''));

        $end = (strlen($value) > 1 && self::endsWith($value, '"'))
            || (strlen($value) > 1 && self::endsWith($value, '\''));

        if ($start && $end) {
            return static::$stripOuterQuotesCache[$cache] = substr($value, 1, -1);
        }
        return static::$stripOuterQuotesCache[$cache] = $value;
    }
public static function stripOuterQuotes ( $ value = "" ) { // if value passed as empty or is not a string then return false if ( ! $ value ) { return false ; } /** @var string $cache Cache Value */ $ cache = self :: cacheString ( $ value ) ; // check for cache if ( isset ( static :: $ stripOuterQuotesCache [ $ cache ] ) ) { return static :: $ stripOuterQuotesCache [ $ cache ] ; } $ start = ( strlen ( $ value ) > 1 && self :: startsWith ( $ value , '"' ) ) || ( strlen ( $ value ) > 1 && self :: startsWith ( $ value , '\'' ) ) ; $ end = ( strlen ( $ value ) > 1 && self :: endsWith ( $ value , '"' ) ) || ( strlen ( $ value ) > 1 && self :: endsWith ( $ value , '\'' ) ) ; if ( $ start && $ end ) { return static :: $ stripOuterQuotesCache [ $ cache ] = substr ( $ value , 1 , - 1 ) ; } return static :: $ stripOuterQuotesCache [ $ cache ] = $ value ; }
Strip outer quotes from a string
@param string $value
@return bool|string
@throws \Exception
Strip outer quotes from a string