Log a creation model success
@param string $path
@param string $method
@param int $line
436932
public function logModel($method = null, $line = null)
    {
        if (self::getConfig('log', 'model')) {
            $this->logMessage('MODEL', 'Model Created "' . $this->getDataPath() . '"', $method, $line);
        }
    }
1194699
public function call($method, $path, array $post = array())
    {
        $useCachedToken = true;
        $token = $this->tokenStorage->get($this->username);
        do {
            if ( ! $token) { // expired or no token
                $token = $this->getNewToken();
                $this->tokenStorage->set($this->username, $token);
                $useCachedToken = false;
            }
            try {
                return $this->http->call($method, $this->host.$path, $post, array(sprintf('Authorization: %s', $token)));
            } catch (TokenExpiredException $tokenExpired) {
                $token = null; // drop the cached token
            }
        } while ($useCachedToken); // retry if a cached token has been used
        throw $tokenExpired; // this means we have a fresh token just expired
    }
741117
public function send(string $method, string $path)
    {
        //extract the meta data
        $data = $this->data;
        $query = $this->query;
        $agent = $this->meta['agent'];
        $headers = $this->headers;

        //permutation groups
        $postable = $method === CurlHandler::METHOD_POST || $method === CurlHandler::METHOD_PUT;
        $custom = $method != CurlHandler::METHOD_GET && $method != CurlHandler::METHOD_POST;

        //resolve the data
        //if the method is a put or post
        if ($postable) {
            //figure out how to encode it
            switch ($this->meta['request']) {
                case CurlHandler::ENCODE_JSON:
                    $data = json_encode($data);
                    break;
                case CurlHandler::ENCODE_QUERY:
                default:
                    $data = http_build_query($data);
                    break;
            }
        //it's a get or delete
        } else {
            //let the data be the query
            $query = array_merge($data, $query);
        }

        //form the url
        $url = $this->host . $path;

        //if we have a query
        if (!empty($query)) {
            //add it on to the url
            $url .= '?' . http_build_query($query);
        }

        // send it into curl
        $request = CurlHandler::i($this->map)
            ->setUrl($url)
            // sets connection timeout to 10 sec.
            ->setConnectTimeout(10)
            // sets the follow location to true
            ->setFollowLocation(true)
            // set page timeout to 60 sec
            ->setTimeout(60)
            // verifying Peer must be boolean
            ->verifyPeer(false)
            //if the agent is set
            ->when($agent, function () use ($agent) {
                // set USER_AGENT
                $this->setUserAgent($agent);
            })
            //if there are headers
            ->when(!empty($headers), function () use ($headers) {
                // set headers
                $this->setHeaders($headers);
            })
            //set the custom request
            ->when($custom, function () use ($method) {
                $this->setCustomRequest($method);
            })
            //when post or put
            ->when($postable, function () use ($data) {
                if (empty($data)) {
                    return;
                }

                //set the post data
                $this->setPostFields($data);
            });

        //how should we return the data ?
        switch ($this->meta['response']) {
            case CurlHandler::ENCODE_QUERY:
                $response = $request->getQueryResponse(); // get the query response
                break;
            case CurlHandler::ENCODE_JSON:
                $response = $request->getJsonResponse(); // get the json response
                break;
            case CurlHandler::ENCODE_XML:
                $response = $request->getSimpleXmlResponse(); // get the xml response
                break;
            case CurlHandler::ENCODE_RAW:
            default:
                $response = $request->getResponse(); // get the raw response
                break;
        }

        //reset paths
        $this->paths = [];

        return $response;
    }
364652
public function add($method, $str)
  {
    $str = $this->cleanLine($str);
    
    $method = 'add'.ucfirst($method);
    
    $this->logger->$method($str);
  }
284079
public function logFeature(string $class, string $method, array $args) : void
    {
        if (!isset($this->logged[$class])) {
            $this->logged[$class] = [];
        }
        if (!isset($this->logged[$class][$method])) {
            $this->logged[$class][$method] = [];
        }
        if (!in_array($args, $this->logged[$class][$method])) {
            $this->logged[$class][$method][] = $args;
        }
    }
872042
public function logValidationError($validationType, $messageException = null, $method = null, $line = null)
    {
        if (self::getConfig('log', 'validation')) {
            $this->logMessage("VALIDATE][KO][{$validationType}", "{$messageException} --- " . $this->__toString() . "\n", $method, $line);
        }
        //file_put_contents('php://stderr', "[" . date('Y-m-d H:i:s') . "][VALIDATION][KO][{{$method}#{$line}][{$validationType}] : {$messageException} --- " . $this->__toString() . "\n");
    }
759299
protected function _graph($path, $method='GET', $params=array()) {
    if (is_array($method) && empty($params)) {
      $params = $method;
      $method = 'GET';
    }
    $params['method'] = $method; // method override as we always do a POST

    $result = json_decode($this->_oauthRequest(
      $this->getUrl('graph', $path),
      $params
    ), true);

    // results are returned, errors are thrown
    if (is_array($result) && isset($result['error'])) {
      $e = new FacebookApiException($result);
      if ($e->getType() === 'OAuthException') {
        $this->setSession(null);
      }
      throw $e;
    }
    return $result;
  }
818810
public function handler($number, $message, $file, $line, $context) {

		if(0 === error_reporting()) { 
			return;
		}

		$this -> error = new Error();
		$this -> error -> setFile($file); 
		$this -> error -> setMessage($message); 
		$this -> error -> setNumber($number); 
		$this -> error -> setLine($line); 
		$this -> error -> setDate(new DateTime()); 
		$this -> error -> setContext($context); 
		$this -> error -> setBacktrace(debug_backtrace(null, 5));
		$this -> error -> setIp(Request :: getIp());

		switch($this -> error -> getNumber()) {

			case E_ERROR :
			case E_CORE_ERROR :
			case E_COMPILE_ERROR :
			case E_PARSE :
				$this -> error -> setType('FATAL');
			break;
			
			case E_USER_ERROR :
			case E_RECOVERABLE_ERROR :
				$this -> error -> setType('ERROR');
			break;
		
			case E_WARNING :
			case E_CORE_WARNING :
			case E_COMPILE_WARNING :
			case E_USER_WARNING :
				$this -> error -> setType('WARNING');
			break;
		
			case E_NOTICE :
			case E_USER_NOTICE :
				$this -> error -> setType('INFO');
			break;
			
			case E_STRICT :
				$this -> error -> setType('STRICT');
			break;
		}

		$this -> action();
	}
1017767
public function addFrame($file, $line, $method, $class = null)
    {
        // Account for special "filenames" in eval'd code
        $matches = [];
        if (preg_match("/^(.*?)\((\d+)\) : (?:eval\(\)'d code|runtime-created function)$/", $file, $matches)) {
            $file = $matches[1];
            $line = $matches[2];
        }

        // Construct the frame
        $frame = [
            'lineNumber' => (int) $line,
            'method' => $class ? "$class::$method" : $method,
        ];

        // Attach some lines of code for context
        if ($this->config->shouldSendCode()) {
            $frame['code'] = $this->getCode($file, $line, static::NUM_LINES);
        }

        // Check if this frame is inProject
        $frame['inProject'] = $this->config->isInProject($file);

        // Strip out projectRoot from start of file path
        $frame['file'] = $this->config->getStrippedFilePath($file);

        $this->frames[] = $frame;
    }
125238
public function produce ($method, $path, $headers, $query, $postData, $secret) {

        $sign = array(
            $secret,
            $method,
            rawurlencode($path),
            rawurlencode($this->sign_headers($headers)),
            rawurlencode($this->sign_params($query)),
            rawurlencode($this->sign_params($postData)),
            $secret
        );

        $sign = implode('&', $sign);

        return strtoupper(md5($sign));
    }
529144
public static void generateLog(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
		SQLiteDaoDefinition daoDefinition = method.getParent();

		// log is enabled
		if (daoDefinition.isLogEnabled()) {
			// generate log section - BEGIN
			methodBuilder.addComment("log section BEGIN");
			methodBuilder.beginControlFlow("if (_context.isLogEnabled())");

			methodBuilder.addCode("// log for insert -- BEGIN \n");

			JQLChecker checker = JQLChecker.getInstance();
			final One<Boolean> inWhere = new One<Boolean>(false);

			String sql = checker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {

				@Override
				public String onBindParameter(String bindParameterName, boolean inStatement) {
					if (inWhere.value0) {
						return "?";
					}

					return null;
				}

				@Override
				public void onWhereStatementBegin(Where_stmtContext ctx) {
					super.onWhereStatementBegin(ctx);

					inWhere.value0 = true;
				}

				@Override
				public void onWhereStatementEnd(Where_stmtContext ctx) {
					super.onWhereStatementEnd(ctx);

					inWhere.value0 = false;
				}
			});

			if (method.jql.containsSelectOperation) {
				// log
				// manage log
				methodBuilder.addCode("\n");
				methodBuilder.addStatement("$T.info($S)", Logger.class, sql);
			} else {
				sql = checker.replaceVariableStatements(method, sql, new JQLReplaceVariableStatementListenerImpl() {

					@Override
					public String onColumnNameSet(String statement) {
						return "%s";
					}

					@Override
					public String onColumnValueSet(String statement) {
						return "%s";
					}
				});

				methodBuilder.addStatement("$T _columnNameBuffer=new $T()", StringBuffer.class, StringBuffer.class);
				methodBuilder.addStatement("$T _columnValueBuffer=new $T()", StringBuffer.class, StringBuffer.class);
				methodBuilder.addStatement("String _columnSeparator=$S", "");

				SqlBuilderHelper.forEachColumnInContentValue(methodBuilder, method, "_contentValues.keys()", false, new OnColumnListener() {

					@Override
					public void onColumnCheck(MethodSpec.Builder methodBuilder, String columNameVariable) {
						methodBuilder.addStatement("_columnNameBuffer.append(_columnSeparator+$L)", columNameVariable);
						methodBuilder.addStatement("_columnValueBuffer.append(_columnSeparator+$S+$L)", ":", columNameVariable);
						methodBuilder.addStatement("_columnSeparator=$S", ", ");

					}
				});

				methodBuilder.addStatement("$T.info($S, _columnNameBuffer.toString(), _columnValueBuffer.toString())", Logger.class, sql);
			}
			generateLogForContentValues(method, methodBuilder);

			methodBuilder.addCode("// log for insert -- END \n\n");
			SqlBuilderHelper.generateLogForWhereParameters(method, methodBuilder);

			// generate log section - END
			methodBuilder.endControlFlow();
			methodBuilder.addComment("log section END");
		}
	}
1347777
private function log($method, $sql = null, $params = null)
    {
        $this->_logger->info(
            str_pad('('.$method.')', 14, ' ', STR_PAD_RIGHT).'"'.$sql.'"',
            (array) $params
        );

        /*
        $arg1formatted = is_string($arg1) ? str_replace([
            'SELECT ',
            ', ',
            'FROM ',
            'LEFT JOIN ',
            'WHERE ',
            'LIMIT ',
        ], [
            'SELECT ',
            "\n".'                         , ',
            "\n".'                      FROM ',
            "\n".'                 LEFT JOIN ',
            "\n".'                     WHERE ',
            "\n".'                     LIMIT ',
        ], trim($arg1)) : json_encode($arg1);

        echo '<pre style="border:1px solid #9F6000;margin:0 0 1px 0;padding:2px 6px 3px 6px;color:#9F6000;background:#FEEFB3;">';
        echo '<strong>'.str_pad($method,12,' ',STR_PAD_LEFT).'</strong>'.($arg1?': #1 -> '.$arg1formatted:'');
        if (isset($arg2)) {
            echo "\n".str_pad('#2 -> ',20,' ',STR_PAD_LEFT).json_encode($arg2);
        }
        echo '</pre>';
        */
    }
1034787
protected function createOperation(
        \stdClass $definition,
        string $path,
        string $method,
        array $pathParameters = []
    ): Operation {

        /** @var Parameter[] $parameters */
        $parameters = array_merge($pathParameters, self::extractParameters($definition));
        $responses  = [];

        if (isset($definition->responses)) {
            $hasOkResponse = false;
            foreach ($definition->responses as $code => $responseDefinition) {
                $code = (string)$code;
                if ($code === 'default' || $code[0] === '2') {
                    $hasOkResponse = true;
                }
                $code             = (int)$code;
                $responses[$code] = $this->createResponse($code, $responseDefinition);
            }
            if (!$hasOkResponse) {
                $responses[200] = $this->createResponse(200, (object)[]);
            }
        }

        $schemaDefinition = (object)[];
        if (!isset($definition->parameters)) {
            $schemaDefinition->type = 'null';
            $requestSchema          = $this->schemaFactory->create($schemaDefinition);
        } else {
            $schemaDefinition->type       = 'object';
            $schemaDefinition->properties = (object)[];

            foreach ($parameters as $parameter) {
                if ($parameter->isRequired()) {
                    if (!isset($schemaDefinition->required)) {
                        $schemaDefinition->required = [];
                    }
                    $schemaDefinition->required[] = $parameter->getName();
                }
                $schemaDefinition->properties->{$parameter->getName()} = $parameter->getSchema()->getDefinition();
            }

            $requestSchema = $this->schemaFactory->create($schemaDefinition);
        }
        $id = isset($definition->operationId) ? $definition->operationId : "$path:$method";

        $isSecured = isset($definition->security);

        return new Operation(
            $id,
            $path,
            $method,
            $parameters,
            $requestSchema,
            $responses,
            $this->extractExtensions($definition),
            $isSecured
        );
    }
615181
public function logException($messageException = null, $method = null, $line = null)
    {
        if (self::getConfig('log', 'exception')) {
            $this->logMessage("EXCEPTION", "Exception find : {$messageException} --- " . $this->__toString(), $method, $line);
        }
    }
1133570
static void generateLogForContentProviderBeginning(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
		if (method.getParent().isLogEnabled()) {
			methodBuilder.addStatement("$T.info($S, uri.toString())", Logger.class, "Execute " + method.jql.operationType + " for URI %s");
		}

	}
35568
protected function registerRoute($method, $path, $callback, $middleware = null)
    {
        if ($this->debug) echo __METHOD__ . " : " . json_encode([$method, $path, $callback, $middleware]) . PHP_EOL;
        $path = preg_replace('/\//', '\/', $path);
        $matched = preg_match_all('/\{([^\/]+)\}/', $path, $matches);
        if ($this->debug) echo "Regex Route Variable Components Matched: " . json_encode($matches) . PHP_EOL;
        if ($matched) {
            $regex = preg_replace('/\{([^\/]+)\}/', '([^\/]+)', $path);
        } else {
            $regex = $path;
        }
        $regex = '/^\/' . $regex . '$/';
        $new_route = [
            self::ROUTE_PARAM_METHOD => $method,
            self::ROUTE_PARAM_PATH => $regex,
            self::ROUTE_PARAM_CALLBACK => $callback,
            self::ROUTE_PARAM_MIDDLEWARE => $middleware,
        ];
        if ($this->debug) echo "New Regex Route: " . json_encode($new_route) . PHP_EOL;
        array_unshift($this->routes, $new_route);
    }
1250184
protected function _do_request($method, $path, $headers = NULL, $body= NULL, $file_handle= NULL) {/*{{{*/
        $uri = "/{$this->_bucketname}{$path}";
        $ch = curl_init("http://{$this->endpoint}{$uri}");

        $_headers = array('Expect:');
        if (!is_null($headers) && is_array($headers)){
            foreach($headers as $k => $v) {
                array_push($_headers, "{$k}: {$v}");
            }
        }

        $length = 0;
		$date = gmdate('D, d M Y H:i:s \G\M\T');

        if (!is_null($body)) {
            if(is_resource($body)){
                fseek($body, 0, SEEK_END);
                $length = ftell($body);
                fseek($body, 0);

                array_push($_headers, "Content-Length: {$length}");
                curl_setopt($ch, CURLOPT_INFILE, $body);
                curl_setopt($ch, CURLOPT_INFILESIZE, $length);
            } else {
                $length = @strlen($body);
                array_push($_headers, "Content-Length: {$length}");
                curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
            }
        } else {
            array_push($_headers, "Content-Length: {$length}");
        }

        array_push($_headers, "Authorization: {$this->sign($method, $uri, $date, $length)}");
        array_push($_headers, "Date: {$date}");

        curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers);
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->_timeout);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);

        if ($method == 'PUT' || $method == 'POST') {
			curl_setopt($ch, CURLOPT_POST, 1);
        } else {
			curl_setopt($ch, CURLOPT_POST, 0);
        }

        if ($method == 'GET' && is_resource($file_handle)) {
            curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_FILE, $file_handle);
        }

        if ($method == 'HEAD') {
            curl_setopt($ch, CURLOPT_NOBODY, true);
        }

        $response = curl_exec($ch);
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);


        if ($http_code == 0) throw new UpYunException('Connection Failed', $http_code);

        curl_close($ch);

        $header_string = '';
        $body = '';

        if ($method == 'GET' && is_resource($file_handle)) {
            $header_string = '';
            $body = $response;
        } else {
            list($header_string, $body) = explode("\r\n\r\n", $response, 2);
        }
        $this->setXRequestId($header_string);
        if ($http_code == 200) {
            if ($method == 'GET' && is_null($file_handle)) {
                return $body;
            } else {
                $data = $this->_getHeadersData($header_string);
                return count($data) > 0 ? $data : true;
            }
        } else {
            $message = $this->_getErrorMessage($header_string);
            if (is_null($message) && $method == 'GET' && is_resource($file_handle)) {
                $message = 'File Not Found';
            }
            switch($http_code) {
                case 401:
                    throw new UpYunAuthorizationException($message);
                    break;
                case 403:
                    throw new UpYunForbiddenException($message);
                    break;
                case 404:
                    throw new UpYunNotFoundException($message);
                    break;
                case 406:
                    throw new UpYunNotAcceptableException($message);
                    break;
                case 503:
                    throw new UpYunServiceUnavailable($message);
                    break;
                default:
                    throw new UpYunException($message, $http_code);
            }
        }
    }