Get/Set protection.

@param null|bool $protect True or false
@return mixed
195670
public function protect($protect = null)
    {
        if ($protect === null) {
            return $this->_protect;
        }
        $this->_protect = $protect;

        return $this;
    }
1360708
public function acquire(bool $blocker = false): bool
    {
        if (!is_resource($this->lock)) {
            return false;
        }

        return flock($this->lock, ($blocker) ? LOCK_EX : LOCK_EX | LOCK_NB);
    }
894744
public function get($modified = true) 
    {
        //argument 1 must be a bool
        Eden_Array_Argument::i()->test(1, 'bool');

        return $modified ? $this->data : $this->original;
    }
680617
public function getDevice($refresh = false)
    {
        if (empty($this->detection['device']) || $refresh) {
            $this->detectDevice($this->userAgent);
        }

        return $this->device;
    }
1251608
public function get(string $alias = null)
    {
        if (is_null($alias)) {
            return $this->aliases;
        }

        return $this->has($alias) ? $this->aliases[$alias] : false;
    }
571919
protected function currentUserInfo($guard = null)
    {
        $response = $this->visit("/_dusk/user/{$guard}");

        return json_decode(strip_tags($response->driver->getPageSource()), true);
    }
703205
public static function getInstance(bool $normalize = null): Filesystem
    {
        if ($normalize === true) {
            $instance = &static::$safe;
        } elseif ($normalize === false) {
            $instance = &static::$unsafe;
        } else {
            $instance = &static::$default;
        }

        if (null === $instance) {
            $instance = new static($normalize);
        }

        return $instance;
    }
65958
public function &__get($property)
    {
        $value = null;
        switch ($property) {
            case 'url':
                if (isset($this->settings['url']))
                    return $this->settings['url'];
                break;
            case 'frequency':
                if (isset($this->settings['frequency']))
                    return $this->settings['frequency'];
                break;
            case 'nextCheck':
                if (isset($this->settings['next_check']))
                    return $this->settings['next_check'];
                break;
            case 'request':
                return $this->request;
            case 'data':
                return $this->data;
            case 'isOffline':
                $value = isset($this->settings['offline']);
                break;
            case 'isOfflineValid':
                $value = $this->isOffline
                    && ($this->settings['offline'] === true
                        || time() < $this->settings['offline']
                    );
                break;
            case 'isValid':
                $value = false;
                if (isset($this->settings['frequency'])
                    && !empty($this->settings['frequency'])
                    && isset($this->data)
                    && !empty($this->data)
                    && is_numeric($this->data['activation_id'])
                ) {
                    $value = $this->data['expire'] === null || time() < $this->data['expire'];
                }
                break;
            case 'isEmpty':
                $value = empty($this->data);
                break;
            case 'version':
                if (isset($this->settings['version']))
                    return $this->settings['version'];
                break;
            case 'retries':
                if (isset($this->settings['retries']))
                    return $this->settings['retries'];
                break;
        }
        return $value;
    }
314753
protected function fromGuard()
    {
        $auth = $this->laravel['auth'];
        $user = $auth->user();

        return is_null($user) === true ? [] : [
            'id' => $user->getAuthIdentifier(),
            'rows' => $user->toArray(),
        ];
    }
158994
public function set_locked(bool $locked) {
        global $DB;

        if ($this->_locked == $locked) {
            return $this;
        }

        $this->_locked = $locked;
        $DB->set_field('context', 'locked', (int) $locked, ['id' => $this->id]);
        $this->mark_dirty();
        self::reset_caches();

        return $this;
    }
1368226
public function getProtectedProperty(...$params)
    {
        if (is_string($params[0])) {
            list($className, $object, $name) = $params;
        } elseif (is_object($params[0])) {
            list($object, $name) = $params;
            $className = get_class($object);
        }

        /** @var string $className */
        /** @var object $object */
        /** @var string $name */

        $this->checkOnObject($object);
        $this->checkOnMemberName($name);

        $reflector = new \ReflectionProperty($className, $name);
        $isProtected = $reflector->isProtected() || $reflector->isPrivate();

        if ($isProtected) {
            $reflector->setAccessible(true);
        }
        $value = $reflector->getValue($object);
        if ($isProtected) {
            $reflector->setAccessible(false);
        }

        return $value;
    }
1302887
protected function currentUserInfo($guard = null)
    {
        $response = $this->visitWithResponse("/_behat/user/$guard");

        return json_decode(strip_tags($response), true);
    }
1033799
final protected function getBool(string $key, bool $default = false): bool
    {
        if (!isset($this->env[$key]) or !is_string($this->env[$key])) {
            return $default;
        }

        $t = strtolower(trim($this->env[$key]));

        $allowed = [
            'true' => true,
            'on' => true,
            '1' => true,
            'false' => false,
            'off' => false,
            '0' => false,
        ];
        if (isset($allowed[$t])) {
            return $allowed[$t];
        }

        if (is_numeric($t)) {
            // if $t == 0, false is already returned.
            return true;
        }

        throw new InvalidConfigException($key, static::class);
    }
1246058
public static function getGuardsProviders($guards)
    {
        return collect($guards)->mapWithKeys(function ($guard) {
            return [GuardChecker::defaultGuardProvider($guard) => $guard];
        });
    }
986403
public function offsetGet($offset)
    {
        //argument 1 must be scalar, null or bool
        Argument::i()->test(1, 'scalar', 'null', 'bool');

        return isset($_COOKIE[$offset]) ? $_COOKIE[$offset] : null;
    }
800740
public function ifGuest($guard = null)
    {
        $this->hideCallbacks->push(function () use ($guard) {
            return auth()->guard($guard)->user();
        });

        return $this;
    }
1259102
protected function getData($check = false)
    {
        $data = parent::getData($check);
        $data['login'] = UserHelper::getUserLogin(\common_session_SessionManager::getSession()->getUser());

        if ($this->hasRequestParameter('workstation')) {
            $data[PaginatedSqlStorage::DIAGNOSTIC_WORKSTATION] = \tao_helpers_Display::sanitizeXssHtml(trim($this->getRequestParameter('workstation')));
        }

        return $data;
    }