Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 200
Zeile 1... Zeile 1...
1
<?php
1
<?php
Zeile 2... Zeile 2...
2
 
2
 
3
/*
3
/*
4
 * This file is part of Psy Shell.
4
 * This file is part of Psy Shell.
5
 *
5
 *
6
 * (c) 2012-2022 Justin Hileman
6
 * (c) 2012-2023 Justin Hileman
7
 *
7
 *
8
 * For the full copyright and license information, please view the LICENSE
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
9
 * file that was distributed with this source code.
Zeile 46... Zeile 46...
46
    /**
46
    /**
47
     * Check whether this matcher can provide completions for $tokens.
47
     * Check whether this matcher can provide completions for $tokens.
48
     *
48
     *
49
     * @param array $tokens Tokenized readline input
49
     * @param array $tokens Tokenized readline input
50
     *
50
     *
51
     * @return bool
51
     * @return false
52
     */
52
     */
53
    public function hasMatched(array $tokens): bool
53
    public function hasMatched(array $tokens): bool
54
    {
54
    {
55
        return false;
55
        return false;
56
    }
56
    }
Zeile 57... Zeile 57...
57
 
57
 
58
    /**
58
    /**
59
     * Get current readline input word.
59
     * Get current readline input word.
60
     *
60
     *
61
     * @param array $tokens Tokenized readline input (see token_get_all)
-
 
62
     *
-
 
63
     * @return string
61
     * @param array $tokens Tokenized readline input (see token_get_all)
64
     */
62
     */
65
    protected function getInput(array $tokens): string
63
    protected function getInput(array $tokens): string
66
    {
64
    {
67
        $var = '';
65
        $var = '';
Zeile 75... Zeile 73...
75
 
73
 
76
    /**
74
    /**
77
     * Get current namespace and class (if any) from readline input.
75
     * Get current namespace and class (if any) from readline input.
78
     *
76
     *
79
     * @param array $tokens Tokenized readline input (see token_get_all)
-
 
80
     *
-
 
81
     * @return string
77
     * @param array $tokens Tokenized readline input (see token_get_all)
82
     */
78
     */
83
    protected function getNamespaceAndClass(array $tokens): string
79
    protected function getNamespaceAndClass(array $tokens): string
84
    {
80
    {
85
        $class = '';
81
        $class = '';
Zeile 110... Zeile 106...
110
    /**
106
    /**
111
     * Check whether $word starts with $prefix.
107
     * Check whether $word starts with $prefix.
112
     *
108
     *
113
     * @param string $prefix
109
     * @param string $prefix
114
     * @param string $word
110
     * @param string $word
115
     *
-
 
116
     * @return bool
-
 
117
     */
111
     */
118
    public static function startsWith(string $prefix, string $word): bool
112
    public static function startsWith(string $prefix, string $word): bool
119
    {
113
    {
120
        return \preg_match(\sprintf('#^%s#', $prefix), $word);
114
        return \preg_match(\sprintf('#^%s#', $prefix), $word);
121
    }
115
    }
Zeile 123... Zeile 117...
123
    /**
117
    /**
124
     * Check whether $token matches a given syntax pattern.
118
     * Check whether $token matches a given syntax pattern.
125
     *
119
     *
126
     * @param mixed  $token  A PHP token (see token_get_all)
120
     * @param mixed  $token  A PHP token (see token_get_all)
127
     * @param string $syntax A syntax pattern (default: variable pattern)
121
     * @param string $syntax A syntax pattern (default: variable pattern)
128
     *
-
 
129
     * @return bool
-
 
130
     */
122
     */
131
    public static function hasSyntax($token, string $syntax = self::VAR_SYNTAX): bool
123
    public static function hasSyntax($token, string $syntax = self::VAR_SYNTAX): bool
132
    {
124
    {
133
        if (!\is_array($token)) {
125
        if (!\is_array($token)) {
134
            return false;
126
            return false;
Zeile 142... Zeile 134...
142
    /**
134
    /**
143
     * Check whether $token type is $which.
135
     * Check whether $token type is $which.
144
     *
136
     *
145
     * @param mixed  $token A PHP token (see token_get_all)
137
     * @param mixed  $token A PHP token (see token_get_all)
146
     * @param string $which A PHP token type
138
     * @param string $which A PHP token type
147
     *
-
 
148
     * @return bool
-
 
149
     */
139
     */
150
    public static function tokenIs($token, string $which): bool
140
    public static function tokenIs($token, string $which): bool
151
    {
141
    {
152
        if (!\is_array($token)) {
142
        if (!\is_array($token)) {
153
            return false;
143
            return false;
Zeile 158... Zeile 148...
158
 
148
 
159
    /**
149
    /**
160
     * Check whether $token is an operator.
150
     * Check whether $token is an operator.
161
     *
151
     *
162
     * @param mixed $token A PHP token (see token_get_all)
-
 
163
     *
-
 
164
     * @return bool
152
     * @param mixed $token A PHP token (see token_get_all)
165
     */
153
     */
166
    public static function isOperator($token): bool
154
    public static function isOperator($token): bool
167
    {
155
    {
168
        if (!\is_string($token)) {
156
        if (!\is_string($token)) {
Zeile 180... Zeile 168...
180
    /**
168
    /**
181
     * Check whether $token type is present in $coll.
169
     * Check whether $token type is present in $coll.
182
     *
170
     *
183
     * @param array $coll  A list of token types
171
     * @param array $coll  A list of token types
184
     * @param mixed $token A PHP token (see token_get_all)
172
     * @param mixed $token A PHP token (see token_get_all)
185
     *
-
 
186
     * @return bool
-
 
187
     */
173
     */
188
    public static function hasToken(array $coll, $token): bool
174
    public static function hasToken(array $coll, $token): bool
189
    {
175
    {
190
        if (!\is_array($token)) {
176
        if (!\is_array($token)) {
191
            return false;
177
            return false;