for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Borobudur-Config package.
*
* (c) Hexacodelabs <http://hexacodelabs.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Borobudur\Config\FileLoader;
use Borobudur\Config\Exception\InvalidArgumentException;
/**
* @author Iqbal Maulana <[email protected]>
* @created 8/12/15
abstract class AbstractFileLoader implements FileLoaderInterface
{
use FileTrait;
* @var array
protected $extensions = array();
* {@inheritdoc}
public function matchExtension($extension)
foreach($this->extensions as $ext) {
if ($extension === $ext) {
return true;
}
return false;
* Validate extensions.
* @param string $extension
protected function validateExtension($extension)
if (!in_array($extension, $this->extensions)) {
throw new InvalidArgumentException(sprintf(
'%s cannot process file with extension "%s". Accepted extension: "%s"',
get_called_class(),
$extension,
implode(', ', $this->extensions)
));