Storm\Core\Containers\Registrar::Register PHP Method

Register() public method

public Register ( $Instance )
    public function Register($Instance)
    {
        if ($this->RegistrableType !== null) {
            if (!$Instance instanceof $this->RegistrableType) {
                throw new \Storm\Core\Object\TypeMismatchException('Registered type does not match, expecting %s, supplied %s', $this->RegistrableType, \Storm\Core\Utilities::GetTypeOrClass($Instance));
            }
        }
        $this->Instances[] = $Instance;
    }

Usage Example

示例#1
0
 public final function LoadRegistrarFromProperties(Registrar $Registrar)
 {
     $RegisterableType = $Registrar->GetRegisterableType();
     foreach ($this->GetPublicPropertyValues() as $Value) {
         if ($Value instanceof $RegisterableType) {
             $Registrar->Register($Value);
         }
     }
 }
All Usage Examples Of Storm\Core\Containers\Registrar::Register