コード例 #1
0
 /**
  * Sets the text content of the credits
  *
  * @param string|string[]|Paragraph[] $credits - A list of paragraphs or a single string for the content of the credit.
  *
  * @return $this
  */
 public function withCredits($credits)
 {
     Type::enforce($credits, [Type::ARRAY_TYPE, Paragraph::getClassName(), Type::STRING]);
     // Checks if it is array to apply the enforce of param types as documented.
     if (Type::is($credits, Type::ARRAY_TYPE)) {
         if (!Type::isArrayOf($credits, Type::STRING) && !Type::isArrayOf($credits, Paragraph::getClassName())) {
             Type::enforceArrayOf($credits, Type::STRING);
             Type::enforceArrayOf($credits, Paragraph::getClassName());
         }
     }
     $this->credits = $credits;
     return $this;
 }
コード例 #2
0
 public function testIsNotArrayInInheritance()
 {
     $result = Type::isArrayOf([Image::create(), Video::create()], Image::getClassName());
     $this->assertFalse($result);
 }