Load the tool consumer from the database.

@param string  $key        The consumer key value
@param boolean $autoEnable True if the consumer should be enabled (optional, default if false)

@return boolean True if the consumer was successfully loaded
177188
private function load($key, $autoEnable = false)
    {

        $this->key = $key;
        $ok = $this->dataConnector->loadToolConsumer($this);
        if (!$ok) {
            $this->enabled = $autoEnable;
        }

        return $ok;

    }
573343
private function RequireConnection($auto = false)
	{
		if (!$this->dbopen)
		{
			if ($auto)
			{
				$this->Connect();
			}
			else
			{
				$this->handler->Crash(DatabaseException::$CONNECTION_ERROR, "DB is not connected.  Please call DBConnection->Connect() first.");
			}
		}
	}
822807
private function load($id)
    {

        $this->initialize();
        $this->id = $id;
        $ok = $this->dataConnector->loadToolProxy($this);
        if (!$ok) {
            $this->enabled = $autoEnable;
        }

        return $ok;

    }
217758
public static function selectDatabase($key) {
		if (self::$currentDB===$key) return false;
		self::configureFacadeWithToolbox(self::$toolboxes[$key]);
		self::$currentDB = $key;
		return true;
	}
234518
public function autoload($model, $offset = null)
    {
        if (isset($offset)) {
            if ($this->has($offset)) {
                return $this->get($offset);
            }

            // Try to load
            if (is_string($model)) {
                if ($this->has($model)) {
                    return $this->get($model);
                }

                $this->load($model, $offset);

                if ($this->has($offset)) {
                    return $this->get($offset);
                }
            }
        } elseif (is_string($model)) {
            if ($this->has($model)) {
                return $this->get($model);
            }

            // Try to load
            $this->load($model, $model);

            if ($this->has($model)) {
                return $this->get($model);
            }
        }

        return false;
    }
73771
public function get($key, $default = null)
    {
        if (! $this->operatingOnKeywords()) {
            $this->resetCurrentKeywords();
        }

        return parent::get($key, $default);
    }
389971
public function getCache($key) {
        if (!$this->__cacheEnabled) {
            return null;
        }

        $key = $this->createCacheKey($key);

        if ($this->hasCache($key)) {
            return $this->_cache[$key];
        }

        return null;
    }
968106
public function persist($key)
    {
        $this->init();
        $result = $this->driver->persist($key);
        return (bool)$result;
    }
328466
public function find( $key, $disableLateLoading = null )
    {

        // $disableLateLoading default value management
        if( !is_bool( $disableLateLoading ) ) {
            $disableLateLoading = false;
        }

        // empty key
        if( is_null( $key ) or !is_scalar( $key ) or strlen( trim( $key ) ) === 0 ) {
            return null;
        }

        $class = $this->entityClass;

        try {
            return $this->entityFactory( $key, $disableLateLoading );
        } catch( \Exception $e ) {
            return null;
        }

    }
1282851
public function input($key, $default = false)
    {
        $this->populateInput();

        if (isset($this->input[$key])) {
            return $this->input[$key];
        }

        return $default;
    }
575016
public function lookupConsumer($consumer_key)
    {
        return new Consumer(
            $this->tool_provider->consumer->getKey(),
            $this->tool_provider->consumer->secret
        );
    }
645042
public function get($key, $default = null)
    {
        is_array($key)
            ? self::validateKeys($key)
            : self::validateKey($key);

        $this->queriesCount++;

        return ($tmp = $this->memcache->get($key)) === false
            ? false
            : unserialize($tmp);
    }
1044874
public function pull($key, $default = null)
    {
        if (is_array($key)) {
            return $this->pullMany($key, $default);
        }

        return parent::pull($key, $default);
    }
453642
function lookup_consumer($consumerKey)
    {

        return new OAuth\OAuthConsumer($this->toolProvider->consumer->getKey(),
           $this->toolProvider->consumer->secret);

    }
1109212
public function loadToolConsumer($consumer) {
        global $DB;

        $id = $consumer->getRecordId();

        if (!empty($id)) {
            $result = $DB->get_record($this->consumertable, ['id' => $id]);
        } else {
            $key256 = DataConnector::getConsumerKey($consumer->getKey());
            $result = $DB->get_record($this->consumertable, ['consumerkey256' => $key256]);
        }

        if ($result) {
            if (empty($key256) || empty($result->consumerkey) || ($consumer->getKey() === $result->consumerkey)) {
                $this->build_tool_consumer_object($result, $consumer);
                return true;
            }
        }

        return false;
    }
1368869
public function get($key, $default = null)
    {
        $res = $this->retrieve($key);

        if (false === $res) {
            $this->forget($key);

            return false;
        }

        return $res;
    }
79218
public function get($key, $default = false)
    {
        $this->load();

        if ($this->has($key)) {
            return $this->config[$key];
        } else {
            return $default;
        }
    }