Пример #1
0
 /**
  * creates a new errors collection
  * it can be instantiated with a first/single exception/error to start the collection with
  * (further) errors can be added via ->add_exception() or ->add_error() or ->fill_errors()
  * 
  * @note error message (if string) is only shown when debug mode is on (@see base::$debug)
  * 
  * @param mixed  $error_message    optional, can be exception, jsonapi\error object, or string
  * @param string $friendly_message optional, @see jsonapi\error->set_friendly_message()
  * @param string $about_link       optional, @see jsonapi\error->set_about_link()
  */
 public function __construct($error_message = null, $friendly_message = null, $about_link = null)
 {
     parent::__construct();
     if ($error_message instanceof \Exception) {
         $this->add_exception($error_message, $friendly_message, $about_link);
         return;
     }
     $this->add_error($error_message, $friendly_message, $about_link);
 }
Пример #2
0
 /**
  * creates a new collection
  * 
  * @param string $type typically the name of the endpoint or database table
  */
 public function __construct($type = null)
 {
     parent::__construct();
     $this->primary_type = $type;
 }