@return bool

@throws Exception
426115
public function delete()
    {
        $sql = 'DELETE FROM '.$this->getTableName().' ';

        $pk_name = $this->getPkName();
        $params = [];

        if (is_array($pk_name)) {
            $pk_condition = [];
            foreach ($pk_name as $pk) {
                $pk_condition[] = "{$pk} = :_{$pk}";
                $params[":_{$pk}"] = $this->{$pk};
            }
            $pk_condition = implode(' AND ', $pk_condition);
        } else {
            $pk_condition = "`{$pk_name}` = :_{$pk_name}";
            $params[":_{$pk_name}"] = $this->{$pk_name};
        }

        $sql .= " WHERE {$pk_condition}";

        $stmt = $this->getDB()->prepare($sql);
        $stmt->execute($params);

        $stmt->closeCursor();

        return true;
    }
1099291
protected function checkParam()
    {
        if (empty($this->getHost()) && empty($this->getUnixSocket())) {
            $sErrorMessage = 'Connexion to Mysql must have an host or an unix socket defined';
            throw new \Exception($sErrorMessage);
            return false;
        } else {
            return true;
        }
    }
837226
public function connect()
    {
        list($host, $port) = explode(':', $this->getServer());
        if ($this->stream->open($host, $port, $this->getTimeout()) === false) {
            throw new Exception(sprintf('Cannot connect to server %s', $this->getServer()), Exception::SERVER_OFFLINE);
        }

        return true;
    }
142416
public function killSession() {
      $response = $this->request('get', 'killSession');
      if ($response->getStatusCode() != 200) {
         $body = json_decode($response->getBody()->getContents());
         throw new Exception(ErrorHandler::getMessage($body[0]));
      }
      return true;
   }
300666
public function valid() {
        $echoStr = app('request')->get('echostr');
        if (!is_null($echoStr)) {
            if ($this->checkSignature()) {
                exit($echoStr);
            }
            throw new \Exception('no access');
        }
        $encryptStr = '';
        if (app('request')->isPost()) {
            $data = (array)Xml::decode($this->xml, false);
            if ($this->encryptType != 'aes') {
                return $data;
            }
            $encryptStr = $data['Encrypt'];
        }
        if (!$this->checkSignature($encryptStr)) {
            throw new \Exception('no access');
        }
        return true;
    }
709134
public function execute()
    {
        // If the jobset is finished or failed
        // the jobset may need to be dispatched
        // so we return true
        if ($this->isFinished() || $this->isFailed()) {
            return true;
        }
        // Just return false to tell to terminate the process
        if (!$this->isInTime()) {
            return false;
        }
        // return false means the jobset is done
        // and the process should be terminated
        if ($this->isDispatched() || $this->isCanceled()) {
            return false;
        }

        try {
            if (!$this->jobs) {
                $this->initJobs();
            }

            $this->doUnorderedJobs();
            $this->doOrderedJobs();

            $status = $this->getJobsetExecutionStatus();
            if ($status === JobsConst::JOB_SET_STATUS_FAILED) {
                $this->failed();
            } else {
                $this->updateStatus($status);
            }
        } catch (\Exception $e) {
            // just throw it
            throw $e;
        }

        return true;
    }
751472
public function check()
    {
        try {
            $this->goodPools = getInstance()->sysCache->get($this->name) ?? [];

            if (empty($this->goodPools)) {
                return false;
            }

            $newMaster = $this->goodPools['master'];
            $newSlaves = $this->goodPools['slaves'];

            if (empty($newMaster)) {
                writeln('Redis Proxy No master redis server in master-slave config!');
                throw new Exception('No master redis server in master-slave config!');
            }

            if ($this->master !== $newMaster) {
                $this->master = $newMaster;
                writeln('Redis Proxy master node change to ' . $newMaster);
            }

            if (empty($newSlaves)) {
                writeln('Redis Proxy No slave redis server in master-slave config!');
                throw new Exception('No slave redis server in master-slave config!');
            }

            $loses = array_diff($this->slaves, $newSlaves);
            if ($loses) {
                $this->slaves = $newSlaves;
                writeln('Redis Proxy slave nodes change to ( ' . implode(
                    ',',
                    $newSlaves
                ) . ' ), lost ( ' . implode(',', $loses) . ' )');
            }

            $adds = array_diff($newSlaves, $this->slaves);
            if ($adds) {
                $this->slaves = $newSlaves;
                writeln('Redis Proxy slave nodes change to ( ' . implode(
                    ',',
                    $newSlaves
                ) . ' ), add ( ' . implode(',', $adds) . ' )');
            }

            return true;
        } catch (Exception $e) {
            writeln('Redis Proxy ' . $e->getMessage());
            return false;
        }
    }
586495
public function execute()
	{
		$query  = $this->factory->builder($this->insert)->process();
		$result = $this->pdo->query($query);
		if(!$result)
		{
			throw new \Exception('An error is while the insertion occurred! (query: "' . $query . '")');
		}

		return $this->pdo->lastInsertId();
	}
296727
public function check()
	{
		// Check if the db connector has been set.
		if (!($this->db instanceof MysqliDriver))
		{
			throw new \Exception('Database connection wrong type.');
		}

		// Check if the tables have been specified.
		if (empty($this->from))
		{
			throw new \Exception('ERROR: No Tables Specified');
		}

		return $this;
	}
1274749
public function execute()
    {
        
        if (null === $this->statement) {
            throw new Exception('The database statement resource is not currently set.');
        }
        if ($this->statement->execute()) {
            
            if (($metaData = $this->statement->result_metadata()) !== false) {
                foreach ($metaData->fetch_fields() as $col) {
                    ${$col->name}   = null;
                    $results[]      = &${$col->name};
                    $cols[]         = $col->name;
                }
                
                call_user_func_array([$this->statement, 'bind_result'], $results);
                
                $this->stmt_results = $results;
                $this->stmt_cols = $cols;
            }
            return true;
        }
        return false;
    }
930997
public function check(): bool
    {
        $auth = $this->parseAuthenticationConfiguration(\config('auth'));

        try {
            $this->description = Str::replace($this->description, ['model' => $auth['provider']['model']]);

            return $this->validateUserProvider($auth) && $this->validateUserInstance($auth);
        } catch (ReflectionException $e) {
            // Catch ReflectionException and return false.
        } finally {
            // Catch any exception.
        }

        return false;
    }
587198
function hasException()
    {
        if ( $this->exception )
            // Already has exception
            return $this->exception;


        ## Try to detect response include exception?
        #
        try
        {
            if (! $this->_isSuccess() ) {
                $this->doRecognizeErrorWithStatusCode( $this->getResponseCode() );

                $expected = $this->expected();
                $this->doRecognizeErrorFromExpected( $expected );
            }

        } catch (\Exception $e) {
            $this->exception = $e;
        }

        return $this->exception;
    }
1160715
public function process() {
		$job = $this->connection->pop();

		if ( ! $job ) {
			return false;
		}

		$exception = null;

		try {
			$job->handle();
		} catch ( Exception $exception ) {
			$job->release();
		}

		if ( $job->attempts() >= $this->attempts ) {
			if ( empty( $exception ) ) {
				$exception = new WorkerAttemptsExceededException();
			}
			
			$job->fail();
		}

		if ( $job->failed() ) {
			$this->connection->failure( $job, $exception );
		} else if ( $job->released() ) {
			$this->connection->release( $job );
		} else {
			$this->connection->delete( $job );
		}

		return true;
	}
210254
public function isInstalled()
    {
        if ($this->installed === null) {
            if (!$this->isShared('config')) {
                throw new Exception('Attempting to check install status before application initialization.');
            }

            $this->installed = $this->make('config')->get('concrete.installed');
        }

        return $this->installed;
    }
1283507
public function init()
    {
        //strip the / off the end to check for existence of a file
        //that has the same name as $this->dir
        if (!file_exists(substr($this->dir, 0, -1)) && is_writable(dirname($this->dir))) {
            mkdir($this->dir, 0777);
        } elseif (!is_dir($this->dir)) {
            throw new \Exception("'$this->dir' is not a directory");
        } elseif (!is_writable($this->dir)) {
            throw new \Exception("'$this->dir' is not writable");
        }

        return $this;
    }
725555
public function valid()
    {
        if (!self::$session) {
            Exception::i()->setMessage(self::ERROR_NOT_STARTED)->trigger();
        }

        return isset($_SESSION[$this->key()]);
    }
945308
public function insertModel(): bool
    {
        $this->getFromForm();
        if (!$this->insert()) {
            throw new Exception(\Yii::t('app', 'Ошибка при добавлении в БД'));
        }
        return true;
    }