Beispiel #1
0
 public function save($filePath, $passWord = null)
 {
     $handler = new IPFFileHandler();
     if (substr($filePath, -4) !== '.ipf') {
         $filePath .= '.ipf';
     }
     $handler->writeTo($filePath, $this->rights, $passWord);
 }
Beispiel #2
0
 /**
  * Creates an IPRight document from a given IPRight file
  *
  * If a password is set the document will be encrypted
  *
  * @param        $filePath
  *
  * @param string $password
  *
  * @return IPF
  * @throws Exceptions\FileAccessException
  */
 public static function fromFile($filePath, $password = '')
 {
     $handler = new IPFFileHandler();
     $IPF = new IPF();
     //Get the data array from the IPF file
     $dataArray = json_decode($handler->readFrom($filePath, $password), true);
     foreach ($dataArray as $rightNumber => $right) {
         $IPRight = self::rightFromArray($right);
         $handler->appendDocumentsToIPFObject($IPRight, $rightNumber, $filePath, $password);
         $IPF->add($IPRight);
     }
     return $IPF;
 }