comparison vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php 1 <?php
2 /* 2 /*
3 * This file is part of the PHP_TokenStream package. 3 * This file is part of php-token-stream.
4 * 4 *
5 * (c) Sebastian Bergmann <sebastian@phpunit.de> 5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6 * 6 *
7 * For the full copyright and license information, please view the LICENSE 7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code. 8 * file that was distributed with this source code.
9 */ 9 */
10 10
11 /** 11 /**
12 * A caching factory for token stream objects. 12 * A caching factory for token stream objects.
13 *
14 * @author Sebastian Bergmann <sebastian@phpunit.de>
15 * @copyright Sebastian Bergmann <sebastian@phpunit.de>
16 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
17 * @link http://github.com/sebastianbergmann/php-token-stream/tree
18 * @since Class available since Release 1.0.0
19 */ 13 */
20 class PHP_Token_Stream_CachingFactory 14 class PHP_Token_Stream_CachingFactory
21 { 15 {
22 /** 16 /**
23 * @var array 17 * @var array
24 */ 18 */
25 protected static $cache = array(); 19 protected static $cache = [];
26 20
27 /** 21 /**
28 * @param string $filename 22 * @param string $filename
23 *
29 * @return PHP_Token_Stream 24 * @return PHP_Token_Stream
30 */ 25 */
31 public static function get($filename) 26 public static function get($filename)
32 { 27 {
33 if (!isset(self::$cache[$filename])) { 28 if (!isset(self::$cache[$filename])) {
43 public static function clear($filename = null) 38 public static function clear($filename = null)
44 { 39 {
45 if (is_string($filename)) { 40 if (is_string($filename)) {
46 unset(self::$cache[$filename]); 41 unset(self::$cache[$filename]);
47 } else { 42 } else {
48 self::$cache = array(); 43 self::$cache = [];
49 } 44 }
50 } 45 }
51 } 46 }