comparison vendor/symfony/dependency-injection/Loader/IniFileLoader.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 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
9 * file that was distributed with this source code. 9 * file that was distributed with this source code.
10 */ 10 */
11 11
12 namespace Symfony\Component\DependencyInjection\Loader; 12 namespace Symfony\Component\DependencyInjection\Loader;
13 13
14 use Symfony\Component\Config\Resource\FileResource;
15 use Symfony\Component\Config\Util\XmlUtils; 14 use Symfony\Component\Config\Util\XmlUtils;
16 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; 15 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
17 16
18 /** 17 /**
19 * IniFileLoader loads parameters from INI files. 18 * IniFileLoader loads parameters from INI files.
27 */ 26 */
28 public function load($resource, $type = null) 27 public function load($resource, $type = null)
29 { 28 {
30 $path = $this->locator->locate($resource); 29 $path = $this->locator->locate($resource);
31 30
32 $this->container->addResource(new FileResource($path)); 31 $this->container->fileExists($path);
33 32
34 // first pass to catch parsing errors 33 // first pass to catch parsing errors
35 $result = parse_ini_file($path, true); 34 $result = parse_ini_file($path, true);
36 if (false === $result || array() === $result) { 35 if (false === $result || array() === $result) {
37 throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource)); 36 throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource));
50 /** 49 /**
51 * {@inheritdoc} 50 * {@inheritdoc}
52 */ 51 */
53 public function supports($resource, $type = null) 52 public function supports($resource, $type = null)
54 { 53 {
55 return is_string($resource) && 'ini' === pathinfo($resource, PATHINFO_EXTENSION); 54 if (!is_string($resource)) {
55 return false;
56 }
57
58 if (null === $type && 'ini' === pathinfo($resource, PATHINFO_EXTENSION)) {
59 return true;
60 }
61
62 return 'ini' === $type;
56 } 63 }
57 64
58 /** 65 /**
59 * Note that the following features are not supported: 66 * Note that the following features are not supported:
60 * * strings with escaped quotes are not supported "foo\"bar"; 67 * * strings with escaped quotes are not supported "foo\"bar";