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\Exception;
/**
* @author Iqbal Maulana <[email protected]>
* @created 8/12/15
class FileLocator
{
* @var string
private $file;
* Constructor.
* @param string $file
public function __construct($file)
if (!file_exists($file)) {
throw new Exception(sprintf('File "%s" not found.', $file));
}
$this->file = $file;
* Read file content.
* @return string
public function readFile()
return file_get_contents($this->file);
* Get file.
public function getFile()
return $this->file;
* Get file extension.
public function getExtension()
return pathinfo($this->file, PATHINFO_EXTENSION);