Airship\Engine\State::instance PHP Method

instance() public static method

Return the sole instance of this singleton
public static instance ( ) : State
return State
    public static function instance()
    {
        if (self::$instance === null) {
            self::$instance = new State();
        }
        return self::$instance;
    }

Usage Example

Example #1
0
 /**
  * Do the update check,
  *
  * 1. Update all cabins
  * 2. Update all gadgets
  * 3. Update the core
  */
 public function doUpdateCheck()
 {
     $config = State::instance();
     // First, update each cabin
     foreach ($this->getCabins() as $cabin) {
         if ($cabin instanceof CabinUpdater) {
             $cabin->autoUpdate();
         }
     }
     // Next, update each gadget
     foreach ($this->getGadgets() as $gadget) {
         if ($gadget instanceof GadgetUpdater) {
             $gadget->autoUpdate();
         }
     }
     // Also, motifs:
     foreach ($this->getMotifs() as $motif) {
         if ($motif instanceof MotifUpdater) {
             $motif->autoUpdate();
         }
     }
     // Finally, let's update the core
     $s = $config->universal['airship']['trusted-supplier'];
     if (!empty($s)) {
         $ha = new AirshipUpdater($this->hail, $this->getSupplier($s));
         $ha->autoUpdate();
     }
 }
All Usage Examples Of Airship\Engine\State::instance