for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Mage Scan
*
* PHP version 5
* @category MageScan
* @package MageScan
* @author Steve Robbins <[email protected]>
* @copyright 2015 Steve Robbins
* @license http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
* @link https://github.com/steverobbins/magescan
*/
namespace MageScan;
* Access the file system
class File
{
* Root directory of app
* @var string
private $root;
* This file's locations
* @var array
private $paths = [];
* Initialize the root dir and set the path
* @param string $filename
public function __construct($filename)
$this->root = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
$this->paths[] = $this->root . 'src' . DIRECTORY_SEPARATOR . 'MageScan'
. DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . $filename;
$homePath = getenv('HOME') . DIRECTORY_SEPARATOR . '.magescan' . DIRECTORY_SEPARATOR
. 'config' . DIRECTORY_SEPARATOR . $filename;
if (file_exists($homePath)) {
$this->paths[] = $homePath;
}
* Returns the json file contents as an array
* @return array
public function getJson()
$return = [];
foreach ($this->paths as $path) {
$pathData = json_decode(file_get_contents($path), true);
$return = array_merge($return, $pathData);
return $return;