Assert that data have been property loaded

@param array|false|mixed $data
@param string            $file
@throws LoadException
179003
protected function assertData($data, string $file): void
    {
        if ($data === false && error_get_last() !== null) {
            $err = preg_replace('/^yaml_\w+\(\): /', '', error_get_last()["message"]);
            throw new LoadException("Failed to load settings from '$file': $err");
        }

        if (!is_array($data) || !is_associative_array($data)) {
            throw new LoadException("Failed to load settings from '$file': data should be key/value pairs");
        }
    }
275731
function _load()
    {
        $file = $this->_getFilePath();
        if (! file_exists($file) )
            ## nothing to import, no data written yet!
            return;

        ErrorStack::handleError(E_ALL);
        ##  \\\\\
        $data = include $file;
        $data = $this->getDataInterchange()->retrieveBackward($data);
        ##  /////
        if ( $exception = ErrorStack::handleDone() )
            throw new exReadError('Error While Read Data.', $exception->getCode(), $exception);


        if (! is_array($data) )
            throw new exDataMalformed('Error Data Structure, it must be array.');

        $this->data = $data;
    }
524665
public static function partial($file, $data = [])
    {
        $path = self::load('views.partials.' . $file);

        extract($data, EXTR_SKIP);

        include $path;
    }
350981
public function load($data, $dataType = 'json')
        {
            $this->_data = ($dataType != 'json') ? $this->dataToJson($data) : $data;
        }
1052078
public function load($data)
    {
        foreach ($data as $index => $value) {
            if (property_exists($this, $index)) {
                $this->$index = trim($value);
            }
        }
        return true;
    }
894850
function load(string $file = null)
    {
        if ($file == null) {
            $file = static::$configFile;
        }
        if (!file_exists($file)) {
            return false;
        }

        $a = json_decode(file_get_contents($file));

        if (isset($a->css)) {
            $this->css = $a->css;
        }

        if (isset($a->js)) {
            $this->js = $a->js;
        }
        
        if (isset($a->jss)) {
            $this->jss = $a->jss;
        }
        
        return true;
    }
337763
protected static function getData(string $file)
    {
        $file = __DIR__ . '/data/' . $file . '.php';
        if (\file_exists($file)) {
            /** @noinspection PhpIncludeInspection */
            return require $file;
        }

        return false;
    }
1047782
public function load($file,$context)
	{
		if(!($fr=@fopen($file,'rb')))
			throw new CException(Yii::t('yii','Unable to read file "{file}".',
				array('{file}'=>$file)));

		if(!@flock($fr,LOCK_SH))
			throw new CException(Yii::t('yii','Unable to lock file "{file}" for reading.',
				array('{file}'=>$file)));

		$array=unpack('c',$this->readByte($fr,4));
		$magic=current($array);
		if($magic==-34)
			$this->useBigEndian=false;
		elseif($magic==-107)
			$this->useBigEndian=true;
		else
			throw new CException(Yii::t('yii','Invalid MO file: {file} (magic: {magic}).',
				array('{file}'=>$file,'{magic}'=>$magic)));

		if(($revision=$this->readInteger($fr))!=0)
			throw new CException(Yii::t('yii','Invalid MO file revision: {revision}.',
				array('{revision}'=>$revision)));

		$count=$this->readInteger($fr);
		$sourceOffset=$this->readInteger($fr);
		$targetOffset=$this->readInteger($fr);

		$sourceLengths=array();
		$sourceOffsets=array();
		fseek($fr,$sourceOffset);
		for($i=0;$i<$count;++$i)
		{
			$sourceLengths[]=$this->readInteger($fr);
			$sourceOffsets[]=$this->readInteger($fr);
		}

		$targetLengths=array();
		$targetOffsets=array();
		fseek($fr,$targetOffset);
		for($i=0;$i<$count;++$i)
		{
			$targetLengths[]=$this->readInteger($fr);
			$targetOffsets[]=$this->readInteger($fr);
		}

		$messages=array();
		for($i=0;$i<$count;++$i)
		{
			$id=$this->readString($fr,$sourceLengths[$i],$sourceOffsets[$i]);
			$pos = strpos($id,chr(4));

			if(($context && $pos!==false && substr($id,0,$pos)===$context) || (!$context && $pos===false))
			{
				if($pos !== false)
					$id=substr($id,$pos+1);

				$message=$this->readString($fr,$targetLengths[$i],$targetOffsets[$i]);
				$messages[$id]=$message;
			}
		}

		@flock($fr,LOCK_UN);
		@fclose($fr);

		return $messages;
	}
1119081
protected function fileLoading($file)
    {
        if (class_exists($file, true))
        {
            $listener = new $file();
            $object   = new \ReflectionClass($file);

            if ($object->implementsInterface('Distilleries\Expendable\Contracts\ListenerContract'))
            {
                $listener->listen();
                $this->loaded[$file] = $listener;
            }

        }
    }
957777
public static function process($file = NULL){

        $exists = isset( self::$data[ self::$level ] );

        if( $exists ){
            $variables = self::$data[ self::$level ];

            foreach( $variables as $key => $value ){
                global $$key;
                $$key = $value;
            }
        }

        if( $file ){
            require $file;
        }

    }
959842
public static function load($file = false, $data = false) {

        if ($file && !Text::contains($file, '.php')) {
            $file .= '.php';
        }

        $path = DOC_ROOT . Config::get('paths', 'modules');

        if ($file && File::isFile($path . $file)) {

            require $path . $file;
            return true;
        }

        return false;
    }
240670
public function loadFile($file, $data = array(), $process = true)
    {
        //tracks the recursive paths
        $this->_load_stack[] = $file;

        $data['__FILE__'] = $file;
        $data['__DIR__'] = dirname($file);

        // get the file contents
        $contents = file_get_contents($file);
        
        // load the contents
        $this->loadString($contents, $data, $process);

        array_pop($this->_load_stack);
        //the path
        $this->_path = end($this->_load_stack);

        return $this;
    }
990425
private static function parse($file, $data)
    {
        $file = file_get_contents($file, FILE_USE_INCLUDE_PATH);

        // Go through each variable and replace the values
        foreach($data as $key => $value)
        {
            $pattern = '{{{' . $key . '}}}';
            $file = preg_replace($pattern, $value, $file);
        }

        if(!!$file)
        {
            return $file;
        }

        return false;
    }
720162
public function loadFile($file)
    {
        if (!file_exists($file)) {
            throw new LoaderException("Requested YAML file '{$file}' doesn't exist");
        }

        $contents = file_get_contents($file);

        if ($this->useSymfony) {
            try {
                // Apparently parser keeps references to the things it parses? As such, we want to create a new parser
                // each time (uch)
                $parser = new Parser();
                return $parser->parse($contents);
            } catch (ParseException $e) {
                throw new LoaderException("Could not load the YAML file '{$file}': ".$e->getMessage());
            }
        }

        $data = yaml_parse($contents);
        if (!is_array($data)) {
            throw new LoaderException("Requested YAML file '{$file}' does not parse to an array");
        }

        return $data;
    }
351646
protected function checkFileReadable($file)
    {
        if (!file_exists($file)) {
            throw new \RuntimeException("File [$file] does not exist");
        }
        if (!is_file($file)) {
            throw new \RuntimeException("File [$file] is not a file");
        }
        if (!is_readable($file)) {
            throw new \RuntimeException("File [$file] is not readable");
        }
    }
38580
public function init($file)
	{
		try {
			
			$this->load($file);

		} catch (Exceptions\FileNotExists $e) {

			$this->create($file);
		}
	}
142661
private T loadFileValue(final File file)
	{
		final boolean reload;

		// First time / first time with this file
		if (cached == null || lastFile == null || lastFileModified == null || !lastFile.equals(file))
		{
			lastFile = file;
			lastFileModified = file.lastModified();
			reload = true;
		}
		else // Same file, so check timestamp to decide on reload
		{
			final long modified = file.lastModified();

			reload = modified > lastFileModified;

			if (reload)
				lastFileModified = modified;
		}

		if (reload)
		{
			cached = null; // Prevent the old value from being used

			setCached(clazz.cast(factory.getInstance(clazz).deserialise(file)));
		}

		return cached;
	}