mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 11:00:40 +08:00
SuiteCRM 8 initial commit
This commit is contained in:
commit
c895877b7e
547 changed files with 40449 additions and 0 deletions
42
core/base/Config/Loader/YamlLoader.php
Normal file
42
core/base/Config/Loader/YamlLoader.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace SuiteCRM\Core\Base\Config\Loader;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\Config\Loader\FileLoader;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Class YamlLoader
|
||||
* @package SuiteCRM\Core\Base\Config\Loader
|
||||
*/
|
||||
class YamlLoader extends FileLoader
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mixed $resource The resource
|
||||
* @param string|null $type The resource type or null if unknown
|
||||
* @return mixed The YAML converted to a PHP value
|
||||
* @throws Exception
|
||||
*/
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
$contents = file_get_contents($resource);
|
||||
|
||||
return Yaml::parse($contents);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $resource
|
||||
* @param null $type
|
||||
* @return bool
|
||||
*/
|
||||
public function supports($resource, $type = null): bool
|
||||
{
|
||||
return is_string($resource) && 'yml' === pathinfo(
|
||||
$resource,
|
||||
PATHINFO_EXTENSION
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue