コード例 #1
0
ファイル: Image.php プロジェクト: awakenweb/livedocx
 /**
  * @dataProvider filenamesProvider
  */
 public function test_setters_and_getters($filename, $dirname, $expectedName, $expectedFullName)
 {
     $mock = $this->scaffoldMock();
     $image = new LdxImage($mock);
     $image->setFilename($filename, $dirname);
     $this->string($image->getName())->isEqualTo($expectedName)->string($image->getName(true))->isEqualTo($expectedFullName);
 }
コード例 #2
0
ファイル: Container.php プロジェクト: awakenweb/livedocx
 /**
  * Register a set of values to be merged within the template.
  * You can either pass a Block, an array of values or a single value
  *
  * @param string|array|Block $fieldname
  * @param string|Image       $value
  *
  * @return Container
  *
  * @throws ContainerException
  */
 public function assign($fieldname, $value = null)
 {
     if ($fieldname instanceof Block) {
         $this->blocks[] = $fieldname;
         return $this;
     }
     if (is_array($fieldname) && !empty($fieldname)) {
         // bulk fields assignment
         foreach ($fieldname as $field => $val) {
             $this->fields[$field] = $val;
         }
         return $this;
     }
     if (is_string($fieldname) && $value instanceof Image) {
         $this->images['image:' . $fieldname] = $value->getName();
         return $this;
     }
     if (is_string($fieldname) && !is_null($value)) {
         $this->fields[$fieldname] = $value;
         return $this;
     }
     throw new ContainerException('Incorrect parameters for assignment');
 }