尝试获取锁

@return boolean
181132
protected function __tryLock()
    {
        return PoolManager::use($this->poolName, function($resource, $redis){
            return 1 == $redis->evalEx(<<<SCRIPT
local key     = KEYS[1]
local content = KEYS[2]
local ttl     = ARGV[2]
local db      = ARGV[1]
redis.call('select', db)
local lockSet = redis.call('setnx', key, content)
if lockSet == 1 then
redis.call('pexpire', key, ttl)
else 
local value = redis.call('get', key)
if(value == content) then
lockSet = 1;
redis.call('pexpire', key, ttl)
end
end
return lockSet
SCRIPT
            , [
                $this->key,
                $this->guid,
                $this->db,
                $this->lockExpire,
            ], 2);
        });
    }
219164
public function valid(): bool
    {
        if (!$this->isUsed) {
            $this->call
                ->addIterableEvent($this->callEventFactory->createUsed());
            $this->isUsed = true;
        }

        $key = key($this->array);
        $isValid = null !== $key;

        if ($this->isConsumed) {
            return $isValid;
        }

        if ($isValid) {
            $this->call->addIterableEvent(
                $this->callEventFactory
                    ->createProduced($key, current($this->array))
            );
        } else {
            $this->call->setEndEvent($this->callEventFactory->createConsumed());
            $this->isConsumed = true;
        }

        return $isValid;
    }
433333
public function isFromKeyword()
    {
        // 未加载,说明未匹配到任何关键字
        if (!$this->loaded) {
            return false;
        }

        // 已加载,但id为空,说明未匹配到任何关键字
        if ($this->loaded && !$this['id']) {
            return false;
        }

        // 如果是默认回复,说明未匹配到任何关键字
        if ($this['id'] == 'default') {
            return false;
        }

        return true;
    }
651316
public function execute()
    {
        $aggregate = $this->aggregate;
        $entity = $aggregate->getEntityObject();
        $mapper = $aggregate->getMapper();
        $entityMap = $mapper->getEntityMap();

        if ($mapper->fireEvent('restoring', $entity) === false) {
            return false;
        }

        $keyName = $entityMap->getKeyName();

        $query = $this->query->where($keyName, '=', $aggregate->getEntityAttribute($keyName));

        $deletedAtColumn = $entityMap->getQualifiedDeletedAtColumn();

        $query->update([$deletedAtColumn => null]);

        $aggregate->setEntityAttribute($deletedAtColumn, null);

        $mapper->fireEvent('restored', $entity, false);

        $mapper->getEntityCache()->refresh($aggregate);

        return $entity;
    }
1138809
public function valid()
    {
        return isset($this->base['value'][$this->position]) && is_array($this->base['value'][$this->position]);
    }
545675
public function isValid()
	{
		$isValid = true;

		$form = $this->getForm();

		foreach($this->recordColumnsGet() as $column => $value)
		{
			$element = $form->getElement($column);
			if($element && !$element->isValid($value))
			{
				$isValid = false;
				$this->_validationErrors[$element->getId()] = $element->getErrors();
			}
		}

		return $isValid;
	}
1251400
public function initLoad(): bool
    {
        $tasks = $this->getTasks();

        if (\count($tasks) <= 0) {
            return false;
        }

        foreach ($tasks as $tasksIndex => $task) {
            $this->checkTaskCount();
            $time = time();
            $key = $this->getKey($task['cron'], $task['task'], $task['method']);
            // 防止重复写入任务
            if (! $this->getOriginTable()->exist($key)) {
                $this->getOriginTable()->set($key, [
                    'rule'       => $task['cron'],
                    'taskClass'  => $task['task'],
                    'taskMethod' => $task['method'],
                    'add_time'   => $time
                ]);
            }
        }

        return true;
    }
696799
public function current()
    {
        return isset($this->rows[$this->rowsCounter]) ? $this->rows[$this->rowsCounter] : false;
    }
1087488
public function isSuccess()
	{
		$data = $this->getData();

		if (!$data) {
			return false;
		}

		if (isset($data['error'])) {
			return false;
		}

		return true;
	}
1345189
public function process()
    {
        $value = $this->value();
        if ($value === null) {
            return false;
        }

        $isMultiValue = is_array($value);
        if ($isMultiValue &&
            empty($value)
        ) {
            return false;
        }

        if (!$this->manager()->getRepository() instanceof Table) {
            foreach ($this->fields() as $field) {
                $this->getQuery()->where([
                    $field => $value,
                ]);
            }

            return true;
        }

        $expressions = [];
        foreach ($this->fields() as $field) {
            $expressions[] = function (QueryExpression $e) use ($field, $value, $isMultiValue) {
                if ($isMultiValue) {
                    return $e->in($field, $value);
                }

                return $e->eq($field, $value);
            };
        }

        $this->getQuery()->andWhere([$this->getConfig('mode') => $expressions]);

        return true;
    }
472150
public static function isSuperUser()
    {
        $authInfo = self::getLoginInfo();
        if (!$authInfo) {//登录超时
            return false;
        }
        $admin = Config::get('administratorid');
        return is_array($admin) ? in_array($authInfo['id'], $admin) : ($authInfo['id'] === $admin);
    }
20882
function save()
    {
        $this->_save = false;
        if ($this->_change == 0 or $this->_change == 1)
        {
            if ($this->db->insert($this->_data, $this->table) === false)
            {
                return false;
            }
            //改变状态
            $this->_change = 1;
            $this->_current_id = $this->db->lastInsertId();
        }
        elseif ($this->_change == 2)
        {
            $update = $this->_update;
            unset($update[$this->primary]);
            if ($this->db->update($this->_current_id, $update, $this->table, $this->primary) === false)
            {
                return false;
            }
        }
        $this->notify();
        return true;
    }
6290
public function isValid()
    {
        $row = $this->getActulRow();
        return ($row[$this->column] > $this->value) ? true : false;
    }
919560
public function validate()
    {
        $contacts = $this->getContactsCollection();
        if (!$contacts->validate()) {
            return $contacts->getFirstError();
        }

        if ($this->getContract() !== null) {
            if (!$this->getContract()->validate()) {
                return reset($this->getContract()->getFirstErrors());
            }
        }

        return true;
    }
1146104
public function validate(): bool
    {
        $pathItemValid = $this->_pathItem === null || $this->_pathItem->validate();
        return $pathItemValid && empty($this->_errors);
    }
1156491
public function validate() {
        if ($this->file->validate() === false) {
            $this->errors = $this->file->getErrors();
            return false;
        }

        return true;
    }
749884
public function valid()
	{
		// Check the current position.
		if (!is_scalar($this->current) || !isset($this->objects[$this->current]))
		{
			return false;
		}

		return true;
	}