Performs a call for currently batched requests.

@param bool $debug Whether make a call in a debug mode

@throws \Exception

@return array|string|false Array of results (or query string in debug mode)
554213
public function execute($debug = false)
    {
        if (count($this->requests) === 0) {
            return false;
        }

        $curl = curl_init();

        if (!$curl) {
            return false;
        }

        $query = "api_key={$this->key}&api_action=batch&api_requestArray=" . json_encode($this->requests);

        $this->requests = [];

        if ($debug) {
            return $query;
        }

        curl_setopt($curl, CURLOPT_URL, 'https://api.linode.com/');
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);

        $result = curl_exec($curl);

        curl_close($curl);

        $json = json_decode($result, true);

        if (!$json) {
            throw new \RuntimeException('Empty response');
        }

        return $json;
    }
939769
public static function debug($msg = 'test')
    {
        try {
            if (function_exists('log_message')) {
                log_message('debug', $msg);
            } else {
                if (self::USE_DEBUG === TRUE) {
                    $logger = new Logger('imageCache');
                    $logger->pushHandler(new StreamHandler(__DIR__ . '/../storage/logs/Log-' . date('Y-m-d') . '.log', Logger::DEBUG));
                    $logger->debug($msg);
                }
            }
        }
        catch (\Exception $e) {
            if (function_exists('log_message')) {
                $message = 'Error Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
                log_message('error', $message);
            }

            return;
        }
    }
602181
final public function setDebug($callback = true)
    {
        if ($callback === true) {
            if (php_sapi_name() === 'cli') {
                $callback = new DebuggerOutConsole();
            } else {
                $callback = new DebuggerOutHtml();
            }
        }
        $this->debugCallback = $callback;
    }
1231892
public function getQueue(Debugger $debugger)
    {
        /** @var \Indatus\Dispatcher\Queue $queue */
        $queue = App::make('Indatus\Dispatcher\Queue');

        /** @var \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $command */
        foreach ($this->getScheduledCommands() as $command) {
            /** @var \Indatus\Dispatcher\Scheduling\Schedulable $scheduler */
            $scheduler = App::make('Indatus\Dispatcher\Scheduling\Schedulable');

            //could be multiple schedules based on arguments
            $schedules = $command->schedule($scheduler);
            if (!is_array($schedules)) {
                $schedules = [$schedules];
            }

            $willBeRun = false;
            foreach ($schedules as $schedule) {
                if (($schedule instanceof Schedulable) === false) {
                    $msg = 'Schedule for "'.$command->getName().'" is not an instance of Schedulable';
                    throw new \InvalidArgumentException($msg);
                }

                if ($this->isDue($schedule)) {
                    /** @var \Indatus\Dispatcher\QueueItem $queueItem */
                    $queueItem = App::make('Indatus\Dispatcher\QueueItem');

                    $queueItem->setCommand($command);
                    $queueItem->setScheduler($schedule);

                    if ($queue->add($queueItem)) {
                        $willBeRun = true;
                    }
                }
            }

            //it didn't run, so record that it didn't run
            if ($willBeRun === false) {
                $debugger->commandNotRun($command, 'No schedules were due');
            }
        }

        return $queue;
    }
299098
public function getConfigArray(array $APIs, $debug = false, $beta = false)
    {
        return $this->config($APIs, $debug, $beta, false);
    }
1017889
protected static function initializeHttpClient($serviceUrl, $debug = false)
    {
        $client = new Client(
            [
                'base_uri' => $serviceUrl,
                'debug' => $debug,
                'headers' => [
                    'User-Agent' => vsprintf(
                        '%s/%s %s %s',
                        [
                            self::getCurrentClientId(),
                            self::getCurrentClientVersion(),
                            self::getCurrentClientUserAgentExtension(),
                            GuzzleHttp\default_user_agent()
                        ]
                    ),
                ],
            ]
        );

        return $client;
    }
84918
public static function bootstrap(bool $debug, int $depth = 2)
    {
        self::$debug = $debug;
        self::$depth = $depth;
    }
1276701
public function handleException(\Throwable $throwable, bool $debug = false): ResponseInterface
    {
        $apiError = Error::createFrom($throwable, $debug);

        $document = $this->singleResourceDocument();
        $document->errors()->add($apiError);


        return new DocumentResponse($document, null, $apiError->status());
    }
812122
public function setDebugging(string $debugging = "F") : CNabuDataObject
    {
        if ($debugging === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$debugging")
            );
        }
        $this->setValue('nb_site_module_debugging', $debugging);
        
        return $this;
    }
1328398
public static function getInstance($lang, $debug = false)
	{
		if (!isset(self::$languages[$lang . $debug]))
		{
			$language = new self($lang, $debug);

			self::$languages[$lang . $debug] = $language;

			// Check if Language was instantiated with a null $lang param;
			// if so, retrieve the language code from the object and store
			// the instance with the language code as well
			if (is_null($lang))
			{
				self::$languages[$language->getLanguage() . $debug] = $language;
			}
		}

		return self::$languages[$lang . $debug];
	}
127091
public function debug($flag)
    {
        $this->debug = (in_array($flag, [true, false])) ? $flag : false;

        return $this;
    }
1180561
public function set_debug($enable)
    {
        if ($enable === true || $enable === false) {
            $this->debug = $enable;

            return true;
        }

        trigger_error('Error: the parameter for set_debug() must be boolean');

        return false;
    }
853725
public function throwValidationExceptionsOnDispatch($bool = null)
    {
        if ($bool === null) {
            return $this->throwValidationExceptionsOnDispatch;
        } else {
            $this->throwValidationExceptionsOnDispatch = $bool;
        }
    }
301866
public function deleteData( $debug = 1 )
	{
		if( $this->isFocused() )
		{
			$conditions	= $this->getConditionQuery( array() );
			$query	= "DELETE FROM ".$this->getTableName()." WHERE ".$conditions;
			return $this->dbc->Execute( $query, $debug );
		}
		return FALSE;
	}
439080
public function debug($allDetails = false)
    {
        $className = get_class($this);
        $msg = "{$className} ({$this->getHttpCode()}) {$this->request->getMethod()}={$this->getUrl()} IN {$this->getTotalTime()}s";

        if ($allDetails) {
            if ($this->headersText != null) {
                $msg .= " with response HEADERS:\n";
                foreach (explode("\n", $this->headersText) as $line) {
                    $msg .= "\t{$line}\n";
                }
            } else {
                $msg .= "\n";
            }

            $body = $this->getBody();
            if (mb_strlen($body, Application::getEncoding()) > 255) {
                $body = mb_substr($body, 0, 252, Application::getEncoding()) . '...';
            }

            $msg .= "\n";
            $msg .= "RESPONSE BODY:----------------------------\n";
            $msg .= $body . "\n";
            $msg .= '------------------------------------------';
        }

        return $msg;
    }
355260
private function request($url)
    {
        $url = $this->makeRequestUrl($url);

        try {
            $cliMulti  = $this->makeCliMulti();
            $responses = $cliMulti->request(array($url));

            $response  = !empty($responses) ? array_shift($responses) : null;
        } catch (Exception $e) {
            return $this->logNetworkError($url, $e->getMessage());
        }
        if ($this->checkResponse($response, $url)) {
            return $response;
        }
        return false;
    }
22342
public function execute( $query, $debug = 1 )
	{
		if( !$this->dbc )
			throw new RuntimeException( 'Database not conntected' );

		$result = FALSE;
		if( $query )
		{
			if( $debug > 0 )
			{
				$bits = $this->getBits( $debug, 5 );
				if( $bits[0] )
				{
					$this->countQueries++;
					$start = $this->getMicroTime();
				}
				if( $bits[1] )
					echo $query;
				if( $bits[2] )
					remark( $query );
				if( $bits[3] )
					die();
			}
			if( preg_match( '/^INSERT/i', ltrim( $query ) ) )
			{
				if( mysql_query( $query, $this->dbc ) )
				{
					$this->insertId = (int) mysql_insert_Id( $this->dbc );
					$result	= $this->insertId;
				}
			}
			else if( preg_match( '/^(SELECT|SHOW)/i', ltrim( $query ) ) )
			{
				$result = new DB_Result();
				if( $q = mysql_query( $query, $this->dbc ) )
				{
					while( $d = mysql_fetch_array( $q ) )
					{
						$row = new DB_Row();
						foreach( $d as $key => $value )
							$row->$key = $value;
						$result->rows[] = $row;
					}
				}
			}
			else
			{
				$result = mysql_query( $query, $this->dbc );
			}
			if( mysql_errno() )
				$this->handleError( mysql_errno(), mysql_error(), $query );
			if( $debug > 0 )
			{
				if( $bits[0] )
					$this->countTime += $this->getTimeDifference( $start );
				if( $bits[4] )
					die();
			}
			return $result;
		}
	}