forked from phalcon/cphalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
/* | ||
+------------------------------------------------------------------------+ | ||
| Phalcon Framework | | ||
+------------------------------------------------------------------------+ | ||
| Copyright (c) 2011-2014 Phalcon Team (http://www.phalconphp.com) | | ||
+------------------------------------------------------------------------+ | ||
| This source file is subject to the New BSD License that is bundled | | ||
| with this package in the file docs/LICENSE.txt. | | ||
| | | ||
| If you did not receive a copy of the license and are unable to | | ||
| obtain it through the world-wide-web, please send an email | | ||
| to license@phalconphp.com so we can send you a copy immediately. | | ||
+------------------------------------------------------------------------+ | ||
| Authors: Andres Gutierrez <andres@phalconphp.com> | | ||
| Eduar Carvajal <eduar@phalconphp.com> | | ||
+------------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Phalcon\Config\Adapter; | ||
|
||
use Phalcon\Config; | ||
use Phalcon\Config\Exception; | ||
|
||
class Yaml extends Config | ||
{ | ||
|
||
/** | ||
* Phalcon\Config\Adapter\Yaml constructor | ||
* | ||
* @param string $filePath | ||
* @param array $callbacks | ||
* @throws \Phalcon\Config\Exception | ||
*/ | ||
public function __construct(string! filePath, array! callbacks = null) | ||
{ | ||
if (!extension_loaded("yaml")) { | ||
throw new Exception("Yaml extension not loaded"); | ||
} | ||
var yamlConfig; | ||
int ndocs = 0; | ||
if callbacks != null { | ||
let yamlConfig = yaml_parse_file(filePath, 0, ndocs, callbacks); | ||
} else { | ||
let yamlConfig = yaml_parse_file(filePath); | ||
} | ||
if yamlConfig === false { | ||
throw new Exception("Configuration file " . basename(filePath) . " can't be loaded"); | ||
} | ||
|
||
parent::__construct(yamlConfig); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters