コード例 #1
0
ファイル: Exception.php プロジェクト: bluesnowman/fphp-saber
 /**
  * This method returns the object as a string.
  *
  * @access public
  * @final
  * @return string                                           the object as a string
  */
 public final function __toString()
 {
     return sprintf('%s [ %s ]: %s ~ %s [ %d ]', $this->__typeOf(), $this->exception->getCode(), strip_tags($this->exception->getMessage()), $this->exception->getFile(), $this->exception->getLine());
 }
コード例 #2
0
 /**
  * This method tests that a value is converted to a string.
  *
  * @dataProvider data_toString
  */
 public function test_toString(array $provided, array $expected)
 {
     $p0 = Throwable\Unknown\Exception::make($provided)->__toString();
     $e0 = $expected[0];
     $this->assertInternalType('string', $p0);
     $this->assertEquals($e0, substr($p0, 0, strlen($e0)));
 }