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 199... Zeile 199...
199
 
199
 
200
    /**
200
    /**
201
     * Whether or not a docblock contains a given @tag.
201
     * Whether or not a docblock contains a given @tag.
202
     *
202
     *
203
     * @param string $tag The name of the @tag to check for
-
 
204
     *
-
 
205
     * @return bool
203
     * @param string $tag The name of the @tag to check for
206
     */
204
     */
207
    public function hasTag(string $tag): bool
205
    public function hasTag(string $tag): bool
208
    {
206
    {
209
        return \is_array($this->tags) && \array_key_exists($tag, $this->tags);
207
        return \is_array($this->tags) && \array_key_exists($tag, $this->tags);
Zeile 212... Zeile 210...
212
    /**
210
    /**
213
     * The value of a tag.
211
     * The value of a tag.
214
     *
212
     *
215
     * @param string $tag
213
     * @param string $tag
216
     *
214
     *
217
     * @return array
215
     * @return array|null
218
     */
216
     */
219
    public function tag(string $tag): array
217
    public function tag(string $tag)
220
    {
218
    {
-
 
219
        // TODO: Add proper null-type return values once the lowest PHP version supported is 7.1
-
 
220
 
221
        return $this->hasTag($tag) ? $this->tags[$tag] : null;
221
        return $this->hasTag($tag) ? $this->tags[$tag] : null;
222
    }
222
    }
Zeile 223... Zeile 223...
223
 
223
 
224
    /**
224
    /**
225
     * Whether or not a string begins with a @tag.
225
     * Whether or not a string begins with a @tag.
226
     *
226
     *
227
     * @param string $str
-
 
228
     *
-
 
229
     * @return bool
227
     * @param string $str
230
     */
228
     */
231
    public static function isTagged(string $str): bool
229
    public static function isTagged(string $str): bool
232
    {
230
    {
233
        return isset($str[1]) && $str[0] === '@' && !\preg_match('/[^A-Za-z]/', $str[1]);
231
        return isset($str[1]) && $str[0] === '@' && !\preg_match('/[^A-Za-z]/', $str[1]);