コード例 #1
0
 public function testFromNonStringWithObject()
 {
     $exception = NotAString::fromNonString($this);
     $this->assertInstanceOf(NotAString::class, $exception);
     $this->assertSame(sprintf('Provided "%s" is not a string', __CLASS__), $exception->getMessage());
 }
コード例 #2
0
 /**
  * Checks whether this class implements the given interface.
  *
  * @link http://php.net/manual/en/reflectionclass.implementsinterface.php
  *
  * @param string $interfaceName
  *
  * @return bool
  */
 public function implementsInterface($interfaceName)
 {
     if (!is_string($interfaceName)) {
         throw NotAString::fromNonString($interfaceName);
     }
     return in_array(ltrim($interfaceName, '\\'), $this->getInterfaceNames(), true);
 }