示例#1
0
 /**
  * Default constructor
  *
  * @throws ErrorNotFoundException
  * @return \Codersquad\Pennephp\Exception\Exception
  */
 public function __construct()
 {
     if (!Collection::existsKey(self::$errorCodes, $this->errorCode)) {
         throw new ErrorNotFoundException();
     }
     $errorMessage = [];
     $errorMessage[] = 'Error ' . $this->errorCode . ' occured: ' . self::$errorCodes[$this->errorCode];
     $this->message = Collection::implode($errorMessage, '<br />');
 }
示例#2
0
 /**
  *
  */
 public function testExistKeyWithWrongDatatype()
 {
     $this->assertFalse(Collection::existsKey('abc', 'a'));
 }
示例#3
0
 /**
  * @param $className
  */
 private static function createInstance($className)
 {
     if (!Collection::existsKey(self::$instances, $className)) {
         self::$instances[$className] = new $className();
     }
 }