AbstractProvider::register

Register the object into the class container.
An alias of AbstractProvider::__set method.

@param object $object The object to be contained.
@param string $offset The object container array offset key.

@return void
974595
public function register($object, $offset = null)
    {
        if (is_object($object)) {
            if ($this instanceof ValidationInterface) {
                if ($this->validate($object) === false) {
                    return;
                }
            }

            if (is_null($offset)) {
                $offset = get_class($object);
                $offset = pathinfo($offset, PATHINFO_FILENAME);
            }

            if ( ! $this->__isset($offset)) {
                $this->registry[ $offset ] = $object;
            }
        }
    }
750811
public function add($service, $offset = null)
    {
        if (is_object($service)) {
            if ( ! $service instanceof SplServiceRegistry) {
                $service = new SplServiceRegistry($service);
            }
        }

        if (profiler() !== false) {
            profiler()->watch('Add New Service: ' . $service->getClassName());
        }

        $this->register($service, $offset);
    }
1331196
public static function set($identifier, $object)
    {
        $objIdentifier = self::getIdentifier($identifier);
        $strIdentifier = (string) $objIdentifier;

        self::$_services->offsetSet($strIdentifier, $object);
    }
1371275
private UUID registerObject(final Object object) {
        UUID id = UUID.randomUUID();
        registerObject(object, id);
        return id;
    }
1050023
public function add($object, $value) : void
    {
        $values = $this->get($object);
        $values[] = $value;
        $this->storage->set($object, $values);
    }
1256653
public function registerObjects($classmap)
    {
        foreach ($classmap as $service => $file) {
            $this->add($service);
            $component = $this->get($service);
        }
    }
276605
public function registerObject($object, $identifier)
    {
        $this->objectMap[$object] = $identifier;
        $this->identifierMap[$identifier] = $object;
    }
214463
public function register($key, $object)
	{
		$this->_registry[$key] = $this->_memoize($object);
		return $this;
	}
1068737
public function offsetSet($offset, $value)
    {
        if (true === is_null($offset)) {
            $this->className = $value;
        } else {
            $this->{$offset} = $value;
        }
    }
970813
public function setInfo(Threaded $object, $data)
    {
        foreach ($this->data as $key => $value) {
            if ($object->equals($value)) {
                $this->info[$key] = $data;
                break;
            }
        }
    }
1220258
public function persist(IdentifiableObject $object): void
    {
        $id = (string)$object->id();

        $allData = $this->loadAllObjects();
        $allData[$id] = $object;
        $this->saveAllObjects($allData);

        stdout(line(make_cyan('Persisted'), get_class($object), ':', $id));
    }
976769
public static function configure($object, array $options)
    {
        foreach ($options as $property => $value) {
            $object->$property = $value;
        }
    }
1065917
public static function persist(IdentifiableObject $object) : void
    {
        self::repositoryFor(\get_class($object))->persist($object);
    }
1198671
public function registerInstance($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('registerInstance(): Cannot pass primitive types, can only register an object instance; use registerVariable() instead');
        }

        $reflectionObject = new \ReflectionObject($object);
        $className = $reflectionObject->getName();

        // Register strong link in $instance
        $this->instances[$className] = $object;

        // Recursively determine and register weak links
        $determineParent = function (\ReflectionClass $class) use ($className, &$determineParent) {
            $parentClass = $class->getParentClass();

            if (!empty($parentClass)) {
                $this->weakLinks[$parentClass->getName()] = $className;
                $determineParent($parentClass);
            }
        };

        $determineParent($reflectionObject);
    }
74675
public function register($name, $object, $allowdups = false)
    {
        if (isset($this->registry[$name])) {
            if ($allowdups) {
                return;
            }
            throw new RegistryException('Object with name "'.$name.'" is already registered');
        }
        if (!is_a($object, $this->typeOf)) {
            throw new TypeMismatch(get_class($object), $this->typeOf);
        }

        $this->registry[$name] = $object;
    }
365252
public function offsetSet($offset, $value)
    {
        if (property_exists(get_class($this), $offset)) {
            $property = new ReflectionProperty(get_class($this), $offset);
            if ($property->isPublic()) {
                $this->$offset = $value;
            }

            return;
        }

        $this->$offset = $value;
    }
345266
public function set($object, $id = null)
    {
        if (is_array($object)) {
            return $this->setAll($object);
        }

        $this->objects[$object] = $id;
    }