Example #1
0
 /**
  * ==============================================================
  *  EJECT
  * ==============================================================
  *
  * -- CODE: -----------------------------------------------------
  *
  *    Weapon::eject('bazooka');
  *
  * --------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter | Type   | Description
  *  --------- | ------ | ----------------------------------------
  *  $name     | string | Hook name
  *  $stack    | float  | Hook function priority
  *  --------- | ------ | ----------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function eject($name = null, $stack = null)
 {
     $name = !is_null($name) ? get_called_class() . '::' . $name : false;
     if ($name) {
         self::$armaments_e[$name . '->' . (!is_null($stack) ? $stack : 10)] = 1;
         if (!isset(self::$armaments[$name])) {
             return;
         }
         if (!is_null($stack)) {
             for ($i = 0, $count = count(self::$armaments[$name]); $i < $count; ++$i) {
                 if (self::$armaments[$name][$i]['stack'] === (double) $stack) {
                     unset(self::$armaments[$name][$i]);
                 }
             }
         } else {
             unset(self::$armaments[$name]);
         }
     } else {
         self::$armaments = array();
     }
 }