setData() public method

Setter for data
public setData ( array $data )
$data array
Beispiel #1
0
 /**
  * @see \Bolt\Storage\Migration\Input\InputFileInterface::readFile()
  */
 public function readFile()
 {
     $filename = (string) $this->file;
     if ($this->file->isReadable()) {
         try {
             $data = $this->parser->parse(file_get_contents($filename) . "\n");
             $this->import->setData($data);
             return true;
         } catch (ParseException $e) {
             $this->import->setError(true)->setErrorMessage("File '{$filename}' has invalid YAML!");
             return false;
         }
     } else {
         $this->import->setError(true)->setErrorMessage("File '{$filename}' not readable!");
         return false;
     }
 }
Beispiel #2
0
 /**
  * @see \Bolt\Storage\Migration\Input\InputFileInterface::readFile()
  */
 public function readFile()
 {
     $filename = (string) $this->file;
     if ($this->file->isReadable()) {
         try {
             $data = $this->parser->parse(file_get_contents($filename));
             $this->import->setData($data);
             return true;
         } catch (ParsingException $e) {
             $this->import->setError(true)->setErrorMessage("File '{$filename}' has invalid JSON!");
             $details = $e->getDetails();
             foreach ($details as $detail) {
                 $this->import->setErrorMessage($detail);
             }
             return false;
         }
     } else {
         $this->import->setError(true)->setErrorMessage("File '{$filename}' not readable!");
         return false;
     }
 }