Binds an id and value into the container.

This simply adds them to the various properties, we don't want to instanciate anything yet to conserve memory

@param $id
@param null $concrete
@param bool|false $shared
511711
public function bind($id, $concrete = null, $shared = false)
    {
        if (null === $concrete) {
            $concrete = $id;
        }

        $id = $this->normalizeString($id);

        //if its an instance save is as shared regardless of variable
        if (is_object($concrete) && !$concrete instanceof \Closure) {
            //apply any extenders - may not be that useful with an instance but hey ho.
            $instance = $this->applyExtenders($id, $concrete);
            $this->sharedInstances[$id] = $instance;
            return;
        }

        $concrete = $this->normalizeString($concrete);

        //if its callable, or is array and first item is callable
        if (is_callable($concrete) || (is_array($concrete) && is_callable($concrete[0]))) {
            if (false === $shared) {
                $this->definitions[$id] = (array) $concrete;
                return;
            }
            $this->sharedDefinitions[$id] = (array) $concrete;
            return;
        }

        //if its a class string and it exists, or its an array and the first item is a class string
        if (is_string($concrete) && class_exists($concrete) || (is_array($concrete) && class_exists($concrete[0]))) {
            if (false === $shared) {
                $this->definitions[$id] = (array) $concrete;
                return;
            }
            $this->sharedDefinitions[$id] = (array) $concrete;
            return;
        }

        //if were here its arbitary data to assign on the container
        $this->sharedInstances[$id] = $concrete;
    }
929520
public function setId($id)
    {
        if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) {
            $this->id = $id;

            parent::setModel($model);
            $this->getButtons()->setModel($model);
            $this->setModelClass(get_class($model));
        }
    }
150859
protected function storeBinding($abstract, $concrete, $shared)
    {
        $this->bindings[$abstract] = [
            'concrete' => $this->checkAndReturnCallable($concrete),
            'shared'   => $shared,
        ];

        return $this;
    }
655424
public function setId( $id )
	{
		if ( $id === null ) {
			$this->_modified = true;
		}

		$this->_values['id'] = $id;
	}
1119470
public function set($id, $value, $lock = false)
    {
        parent::set($id, $value);

        if ((bool) $lock) {
            $this->lock($id);
        }
    }
863555
public function bindIf($abstract, $concrete = null, $shared = false)
    {
        if (! $this->bound($abstract)) {
            $this->bind($abstract, $concrete, $shared);
        }
    }
788836
public function bind($id, $concrete, $singleton = false)
    {

        $concrete = $concrete ?: $id;

        if (!$concrete instanceof Closure) {
            
            // If the factory (resolver) is NOT a closure we assume,
            // that it is a classname and wrap it into a closure so it' s
            // easier when resolving.

            $concrete = function (Container $container) use ($id, $concrete) {

                $method = ($id == $concrete) ? 'build' : 'resolve';

                return $container->$method($concrete, array());
            };
        }


        $this->binds[$id] = compact('concrete', 'singleton');
    }
459459
public function addRow($id, $cells = array(), $replace = false)
    {
        $returnValue = (bool) false;

        
		if(!$replace && isset($this->rows[$id])){
			throw new common_Exception('the row with the id '.$id.' already exists');
		}else{
			$this->rows[$id] = $cells;
			//@TODO: implement a sort funciton?

			$returnValue = true;
		}
        

        return (bool) $returnValue;
    }
424839
public function bind($abstract, $concrete = null) {
        if (is_array($abstract)) {
            $this->bind = array_merge($this->bind, $abstract);
        } else {
            $this->bind[$abstract] = $concrete;
        }
    }
1097706
public static function SetCache($ID = FALSE, $Data = FALSE) {
      $Categories = Gdn::Cache()->Get(self::CACHE_KEY);
      self::$Categories = NULL;
      
      if (!$Categories)
         return;
      
      if (!$ID || !is_array($Categories)) {
         Gdn::Cache()->Remove(self::CACHE_KEY);
         return;
      }
      
      if (!array_key_exists($ID, $Categories)) {
         Gdn::Cache()->Remove(self::CACHE_KEY);
         return;
      }
      
      $Category = $Categories[$ID];
      $Category = array_merge($Category, $Data);
      $Categories[$ID] = $Category;
      
      self::$Categories = $Categories;
      unset($Categories);
      self::BuildCache();
      self::JoinUserData(self::$Categories, TRUE);
   }
9904
public function register($alias, $binding, $shared = false)
    {
        $this->registry[$alias] = new Resolver(new Builder($binding), $shared);
    }
314538
private function load($id = null)
    {

        $this->initialize();
        $this->id = $id;
        $dataConnector = $this->getDataConnector();
        if (!is_null($dataConnector)) {
            return $dataConnector->loadUser($this);
        }

        return false;
    }
267013
public function bindIf($abstract, $concrete, $shared = false)
    {
        if ( ! isset($this->bindings[$abstract]) && ! isset($this->instances[$abstract])) {
            $this->bind($abstract, $concrete, $shared);
        }
    }
103332
public function haveServiceInDi($name, $definition, $shared = false)
    {
        return $this->addServiceToContainer($name, $definition, $shared);
    }
1126971
public function delete($id, $cascade = false) {
        
        // remove has one
        if (isset($this->one[$id])) {
            // iterate through all data
            foreach ($this->one[$id] as $class => $foreignId) {
                $object = $class::getInstance();
                // remove entry in many
                if (null !== ($key = array_search($id, $object->many[$foreignId][$this->class]))) {
                    unset($object->many[$foreignId][$this->class][$key]);
                    self::$dirty[$class] = true;
                }
            }
            unset($this->one[$id]);
        }
        
        // remove has many
        if (isset($this->many[$id])) {
            // iterate through many
            foreach ($this->many[$id] as $class => $foreignIds) {
                $object = $class::getInstance();
                if ($cascade) {
                    // delete objects
                    foreach ($foreignIds as $foreignId) {
                        $object->delete($foreignId, $cascade);
                    }
                } else {
                    // 'only' unset
                    foreach ($foreignIds as $foreignId) {
                        unset($object->one[$foreignId][$this->class][$id]);
                    }
                }
                self::$dirty[$class] = true;
            }
            unset($this->many[$id]);
        }
        
        // unset element
        unset($this->data[$id]);
        self::$dirty[$this->class] = true;
    }
844256
public function load($id = null)
    {
        if (!is_null($id)) {
            $this->setId($id);
        }

        $this->isLoaded = false;
        $data = $this->getDbGateway()->load($this->getId());
        if ($data) {
            $this->setData($data);
            $this->isLoaded = true;
        }

        return $this->isLoaded();
    }
273117
public static function setClientId($client_id){
      if (!isset(self::$_config)){
        self::initialize();
      }
      self::$_config->configure(['CLIENT_ID' => $client_id]); 
    }