Creates expression for COUNT().

@param string|object $arg Typically fieldname or expression of a sub-query

@return DB_dsql clone of $this
439203
public function count($arg = null)
    {
        if (is_null($arg)) {
            $arg = '*';
        }

        return $this->expr('count([count])')->setCustom('count', $this->bt($arg));
    }
326470
protected static function createInstance(array $args = [])
    {
        if (!self::$reflection) {
            self::$reflection = new \ReflectionClass('IntlDateFormatter');
        }

        $instance = self::$reflection->newInstanceArgs($args);

        self::checkInternalClass($instance, '\IntlDateFormatter', $args);

        return $instance;
    }
1320553
public function with($arg)
    {
        $args = func_get_args();

        if (is_array($args[0])) {
            $this->setWith($args[0]);

            return $this;
        }

        foreach ($args as $arg) {
            if (is_string($arg)) {
                $this->addWith($arg);
            }

            return $this;
        }

        throw new DatabaseException('The arguments for with() don\'t fit');
    }
1189044
public function create($args)
    {
        $data = null;
        if (is_object($args)) {
            if ($args instanceof DataItem) {
                $data = $args;
            } else {
                $args = get_object_vars($args);
            }
        } elseif (is_numeric($args)) {
            $args = array($this->getUniqueId() => intval($args));
        }
        return $data ? $data : new DataItem($args, $this->getUniqueId());
    }
145548
public function setArgument(Argument $arg)
    {
        if ($this->mode == GetOpt::NO_ARGUMENT) {
            throw new \InvalidArgumentException("Option should not have any argument");
        }
        $this->argument = clone $arg; // he can reuse his arg but we need a unique arg
        $this->argument->multiple($this->mode === GetOpt::MULTIPLE_ARGUMENT);
        $this->argument->setOption($this);
        return $this;
    }
180479
private function handleSubfieldRanges($arg)
    {
        if (strlen($arg) < 3) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::SF.
                InvalidMARCspecException::LENGTH3,
                $arg
            );
        }

        if (preg_match('/[a-z]/', $arg[0]) && !preg_match('/[a-z]/', $arg[2])) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::SF.
                InvalidMARCspecException::RANGE,
                $arg
            );
        }
        if (preg_match('/[A-Z]/', $arg[0]) && !preg_match('/[A-Z]/', $arg[2])) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::SF.
                InvalidMARCspecException::RANGE,
                $arg
            );
        }
        if (preg_match('/[0-9]/', $arg[0]) && !preg_match('/[0-9]/', $arg[2])) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::SF.
                InvalidMARCspecException::RANGE,
                $arg
            );
        }
        if ($arg[0] > $arg[2]) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::SF.
                InvalidMARCspecException::RANGE,
                $arg
            );
        }

        return range((string) $arg[0], (string) $arg[2]);
    }
33376
protected function _createObject( $args ) {
		$user_id = wp_insert_user( $args );
		if ( $user_id && ! is_wp_error( $user_id ) ) {
			$this->_debug( 'Generated user with ID: ' . $user_id );
		} elseif ( is_wp_error( $user_id ) ) {
			$this->_debug(
				'User generation failed with message [%s] %s',
				$user_id->get_error_code(),
				$user_id->get_error_message()
			);
		} else {
			$this->_debug( 'User generation failed' );
		}


		return $user_id;
	}
610879
public function get(...$args)
    {
        $record = $this->fetchSingle($args);
        if (!$record)
            return null;
        $obj = new $this->model_class;
        $obj->assignRecord($record, $this->db);
        return $obj;
    }
668419
public function sql($query, $args = []) {
		if (!is_string($query) || empty($query))
			throw new \InvalidArgumentException("Query is not a valid string");
	
		//open connection
		$this->driver->connect();
			
		//build statement
		$stmt = $this->driver->buildStatement($this->typeManager);
	
		//build query
		$query = $stmt->format($query, $args, $this->config);
		
		//invoke debug callback
		if ($this->hasOption('callback.debug')) {
			$callback = $this->getOption('callback.debug');
			if ($callback instanceof \Closure)
				$callback->__invoke($query);
		}
		
		//run query
		$result = $this->driver->query($query);
	
		//check query execution
		if ($result === false)
			$this->driver->throwQueryException($stmt);
	
		return $result;
	}
708402
protected function doJoin($type, array $args)
    {
        if (count($args) === 0) {
            throw new QueryException('No arguments given');
        }

        $tableName = $args[0];
        $condition = '';

        if (count($args) == 2) {
            $condition = $args[1];
        } elseif (count($args) == 3) {
            $condition = $args[1] . ' = ' . $args[2];
        }

        $this->parts['from'][] = array(
            'table' => $tableName,
            'type' => $type,
            'condition' => $condition,
        );

        return $this;
    }
168440
public static function create(array $args)
    {
        $job = new Job($args['body']);

        if (isset($args['id'])) {
            $job->setId($args['id']);
            $job->setTtl(hexdec(substr($job->getId(), -4)));
        }

        if (isset($args['queue'])) {
            $job->setQueue($args['queue']);
        }

        if (isset($args['ttl'])) {
            $job->setTtl($args['ttl']);
        }

        if (isset($args['retry'])) {
            $job->setRetry($args['retry']);
        }

        return $job;
    }
550067
protected function fill(array $args): AbstractEdge
    {
        if( count($this->fields)<=0 ) {
            return $this;
        }
        $methods = array_keys($this->fields);
        $args_count = count($args);
        $fields_count = count($this->fields);
        $n = 0;
        while($n<$args_count) {
            $key = sprintf("set%s", $methods[$n]);
            $this->$key($args[$n++]);
        }
        for($n=$args_count; $n<$fields_count; $n++) {
            $method = $methods[$n];
            if(
                isset($this->fields[$method]["directives"]["now"])
                &&
                $this->fields[$method]["directives"]["now"]==true
            ) {
                    $key = sprintf("set%s", $method);
                    $this->$key(time());
            }
            elseif(
                isset($this->fields[$method]["directives"]["default"])
                &&
                $this->fields[$method]["directives"]["default"]!="|_~_~NO!-!VALUE!-!SET~_~_|" 
            ) {
                $key = sprintf("set%s", $method);
                $this->$key($this->fields[$method]["directives"]["default"]);
            }
        }
        return $this;
    }
202029
public function append($query, $args = null)
    {
        if ($query instanceof PDBquery) {
            $args = $query->getArgs();
            $query = $query->getQuery();
        };
        $this->_query .= ' ' . $query;
        if (is_array($args)) {
            foreach ($args as $arg) {
                $this->_args[] = $arg;  // Faster than array_merge() which copies
            };
        } elseif ($args !== null) {
            $this->_args[] = $args;
        };
        return $this;
    }
826242
public function andOnWhere(...$args)
    {
        $this->createToken(
            'AND',
            $args,
            $this->joinTokens[$this->activeJoin]['on'],
            $this->onWhereWrapper()
        );

        return $this;
    }
38179
private function buildQuery($pattern, $args)
    {

        if (count($args['parameters']) > 0) {

            $string = $pattern[0];
        } else {

            $string = $pattern[1];
        }

        if (preg_match_all("/:(\w+)/", $string, $match)) {

            $match = $match[0];
            $values = array_values($args);
            return str_replace($match, $values, $string);
        }
    }
733404
private function createArgs()
    {
        $args = array($this->db);

        if (is_object($this->paginator)) {
            array_push($args, $this->paginator);
        }

        array_push($args, $this->prefix);
        return $args;
    }
182350
public function prepare(...$args): \PDOStatement
    {
        $trimmed = trim($args[0]);
        if (empty($trimmed)) {
            throw new Issues\QueryError(
                "Empty query passed to prepare()"
            );
        }
        return $this->pdo->prepare(...$args);
    }