Overview

Namespaces

  • MOC
    • Adapter
    • Core
      • Changelog
      • Depending
      • Drive
        • Directory
        • File
      • Error
        • Register
        • Type
      • Journal
      • Proxy
      • Template
      • Xml
    • Extension
      • Excel
      • Flot
      • Mail
      • Pdf
      • Word
      • Xml
      • YUICompressor
      • Zip
    • Generic
      • Common
      • Device
        • Extension
        • Widget
    • Module
      • Database
        • Driver
      • Drive
      • Image
        • Font
      • Installer
      • Network
        • Ftp
          • Directory
          • File
          • Transport
        • Http
        • ParcelTracker
          • Carrier
      • Office
        • Chart
          • Axis
        • Document
          • Excel
            • Cell
              • Format
              • Style
                • Border
                  • Bottom
                  • Left
                  • Right
                  • Top
                • Font
            • Close
            • Page
            • Worksheet
          • Pdf
            • Close
            • Font
            • Page
              • Margin
              • Position
            • Text
          • Xml
            • Close
        • Image
        • Mail
          • Address
          • Content
      • Packer
        • Yui
        • Zip
      • Template
    • Plugin
      • Gateway
      • Repository
      • Shared
  • PHP

Classes

  • Instance
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * LICENSE (BSD)
  4:  *
  5:  * Copyright (c) 2013, Gerd Christian Kunze
  6:  * All rights reserved.
  7:  *
  8:  * Redistribution and use in source and binary forms, with or without
  9:  * modification, are permitted provided that the following conditions are
 10:  * met:
 11:  *
 12:  *  * Redistributions of source code must retain the above copyright
 13:  *    notice, this list of conditions and the following disclaimer.
 14:  *
 15:  *  * Redistributions in binary form must reproduce the above copyright
 16:  *    notice, this list of conditions and the following disclaimer in the
 17:  *    documentation and/or other materials provided with the distribution.
 18:  *
 19:  *  * Neither the name of Gerd Christian Kunze nor the names of the
 20:  *    contributors may be used to endorse or promote products derived from
 21:  *    this software without specific prior written permission.
 22:  *
 23:  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 24:  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 25:  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 26:  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 27:  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 28:  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 29:  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 30:  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 31:  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 32:  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 33:  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 34:  *
 35:  * Instance
 36:  * 14.02.2013 11:25
 37:  */
 38: namespace MOC\Extension\Xml;
 39: use \MOC\Api;
 40: use MOC\Core\Xml;
 41: use MOC\Generic\Device\Extension;
 42: 
 43: /**
 44:  *
 45:  */
 46: class Instance implements Extension {
 47: 
 48:     /** @var Instance $Singleton */
 49:     private static $Singleton = null;
 50: 
 51:     /**
 52:      * Get Singleton/Instance
 53:      *
 54:      * @static
 55:      * @return Instance
 56:      */
 57:     public static function InterfaceInstance() {
 58:         if( self::$Singleton === null ) {
 59:             self::$Singleton = new Instance();
 60:         } return self::$Singleton;
 61:     }
 62: 
 63:     /**
 64:      * Get Changelog
 65:      *
 66:      * @static
 67:      * @return \MOC\Core\Changelog
 68:      */
 69:     public static function InterfaceChangelog() {
 70:         return Api::Core()->Changelog();
 71:     }
 72: 
 73:     /**
 74:      * Get Dependencies
 75:      *
 76:      * @static
 77:      * @return \MOC\Core\Depending
 78:      */
 79:     public static function InterfaceDepending() {
 80:         return Api::Core()->Depending();
 81:     }
 82: 
 83:     /** @var [] $InstanceQueue */
 84:     private $InstanceQueue = array();
 85:     /** @var $InstanceCurrent */
 86:     private $InstanceCurrent = null;
 87: 
 88:     /**
 89:      * @return Instance
 90:      */
 91:     public function Create() {
 92:         $Instance = Api::Core()->Xml();
 93:         if( null === $this->InstanceCurrent ) {
 94:             $this->InstanceCurrent = $Instance;
 95:             return $this;
 96:         } else {
 97:             array_push( $this->InstanceQueue, $this->InstanceCurrent );
 98:             $this->InstanceCurrent = $Instance;
 99:             return $this;
100:         }
101:     }
102: 
103:     /**
104:      * @return null|Xml
105:      */
106:     public function Current() {
107:         return $this->InstanceCurrent;
108:     }
109: 
110:     /**
111:      * @return Instance
112:      */
113:     public function Destroy() {
114:         if( count( $this->InstanceQueue ) ) {
115:             $this->InstanceCurrent = array_pop( $this->InstanceQueue );
116:         } else {
117:             $this->InstanceCurrent = null;
118:         }
119:         return $this;
120:     }
121: 
122:     /**
123:      * Set external Extension-Instance
124:      *
125:      * Contains:
126:      * - Set new (external created) 3rdParty Instance to Current
127:      *
128:      * @param $Instance
129:      *
130:      * @return \MOC\Generic\Device\Extension
131:      */
132:     public function Define( $Instance ) {
133:         // TODO: Implement Define() method.
134:     }
135: 
136:     /**
137:      * Select Index as active 3rdParty Instance
138:      *
139:      * @param int $Index
140:      *
141:      * @return \MOC\Generic\Device\Extension
142:      */
143:     public function Select( $Index ) {
144:         // TODO: Implement Select() method.
145:     }
146: 
147:     /**
148:      * Get Index for Select() from Current() 3rdParty Instance
149:      *
150:      * @return int
151:      */
152:     public function Index() {
153:         // TODO: Implement Index() method.
154:     }
155: 
156: 
157: }
158: 
API documentation generated by ApiGen 2.8.0