public static function arrayValue($annotation)
    {
        $annotation = trim($annotation);
        $openingBrace = substr($annotation, 0, 1);

        // json-style data format
        if (in_array($openingBrace, ['{', '['])) {
            return json_decode($annotation, true);
        }

        // doctrine-style data format
        if ($openingBrace === '(') {
            preg_match_all('~(\w+)\s*?=\s*?"(.*?)"\s*?[,)]~', $annotation, $matches, PREG_SET_ORDER);
            $data = [];
            foreach ($matches as $item) {
                $data[$item[1]] = $item[2];
            }
            return $data;
        }
        return null;
    }
public static function arrayValue($annotation)
    {
        $annotation = trim($annotation);
        $openingBrace = substr($annotation, 0, 1);

        // json-style data format
        if (in_array($openingBrace, ['{', '['])) {
            return json_decode($annotation, true);
        }

        // doctrine-style data format
        if ($openingBrace === '(') {
            preg_match_all('~(\w+)\s*?=\s*?"(.*?)"\s*?[,)]~', $annotation, $matches, PREG_SET_ORDER);
            $data = [];
            foreach ($matches as $item) {
                $data[$item[1]] = $item[2];
            }
            return $data;
        }
        return null;
    }
public static function arrayValue ( $ annotation ) { $ annotation = trim ( $ annotation ) ; $ openingBrace = substr ( $ annotation , 0 , 1 ) ; // json-style data format if ( in_array ( $ openingBrace , [ '{' , '[' ] ) ) { return json_decode ( $ annotation , true ) ; } // doctrine-style data format if ( $ openingBrace === '(' ) { preg_match_all ( '~(\w+)\s*?=\s*?"(.*?)"\s*?[,)]~' , $ annotation , $ matches , PREG_SET_ORDER ) ; $ data = [ ] ; foreach ( $ matches as $ item ) { $ data [ $ item [ 1 ] ] = $ item [ 2 ] ; } return $ data ; } return null ; }
Returns an associative array value of annotation
Either JSON or Doctrine-annotation style allowed
Returns null if not a valid array data

@param $annotation
@return array|mixed|string
Returns an associative array value of annotation Either JSON or Doctrine - annotation style allowed Returns null if not a valid array data