Creates the passed params as a domain object if there are no
results in the collection.
@param $args array an array to be passed to the constructor via call_user_func_array
@chainable
181523
public function orCreate($args)
    {
        $query = clone $this->_queryForWrite();

        if(!$query->count())
            $this->_schema->newInstance(func_get_args())->save();

        return $this;
    }
514265
public void doMain(String[] args)
    {
        int firstFileIndex = processOptions(args);

        int fileCount = args.length - firstFileIndex;
        String[] files = new String[fileCount];
        System.arraycopy(args, firstFileIndex, files, 0, fileCount);

        if (optionsAreValid(files))
        {
            processFiles(files);
        }
    }
1027858
public static function init($args=null) {
    if(is_null(self::$instance)) {
      self::$instance = new ErrorClass($args);
    }
    return self::$instance;
  }
887906
public static function setInstance($args)
    {
        $name = array_shift($args);

        $name = self::getAccessor($name);

        $reflect = new \ReflectionClass($name);

        return $reflect->newInstanceArgs($args);
    }
703071
public function addError(...$args) {
        $args = func_get_args();
        if(func_num_args()>2){
            foreach ($args as $error) {
                array_push($this->errors, $error);
            }
        } else {
            if(func_get_args()==1) {
                $this->errors[] = $args[0];
            } else {
                $this->errors[$args[0]] = $args[1];
            }
        }
    }
583215
public function create($args)
    {
        $url = 'merchants';

        $api_response = $this->paylike->client->request('POST', $url, $args);

        return $api_response->json['merchant']['id'];
    }
316916
public static function sortArgs(array &$args) {
        ksort($args);
        foreach ($args as $key => $val) {
            if (is_array($val)) {
                ksort($val);
                $args [ $key ] = $val;
                self::sortArgs($val);
            }
        }
    }
686914
protected function serializeArguments(array $args)
    {
        // first we have to sort the args by key to avoid that different orders
        // lead to different cache entries!
        ksort($args);

        $result = '';
        $invalidKeys = array('userid', 'apikey', 'keyid', 'vcode');
        foreach ($args as $key => $value) {
            $key   = trim($key);
            $value = trim($value);
            if (empty($value) || in_array($key, $invalidKeys)) {
                // ignore the invalid keys...
                continue;
            }
            $result .= ';' . $key . '=' . $value;
        }

        return $result;
    }
955779
protected function set_pagination_args(array $args)
    {
        $args = wp_parse_args($args, array(
            'total_items' => 0,
            'total_pages' => 0,
            'per_page'    => 0
        ));

        if (!$args['total_pages'] && $args['per_page'] > 0) {
            $args['total_pages'] = ceil($args['total_items'] / $args['per_page']);
        }

        // Redirect if page number is invalid and headers are not already sent
        if (!headers_sent() && (!defined('DOING_AJAX') || !DOING_AJAX) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages']) {
            wp_redirect(add_query_arg('paged', $args['total_pages']));
            exit;
        }

        $this->pagination_args = $args;
    }
1290325
function parse($args = null)
    {
        if ($args === null) {
            $args = array_slice($_SERVER['argv'], 1);
        }

        foreach ($args as $pos => $arg) {
            // reset value
            $value = null;

            if (substr($arg, 0, 1) === '-') {
                if (preg_match('/^(.+)=(.+)$/', $arg, $matches)) {
                    $arg = $matches[1];
                    $value = $matches[2];
                }

                if (!$flag = @$this->flags[$arg]) {
                    throw new ParseException(sprintf('Flag "%s" is not defined.', $arg));
                }

                unset($args[$pos]);

                if ($flag->hasValue) {
                    if (!isset($value)) {
                        $value = $args[$pos + 1];
                        unset($args[$pos + 1]);
                    }
                } else {
                    $value = true;
                }

                if (null !== $flag->callback) {
                    call_user_func_array($flag->callback, array(&$value));
                }

                # Set the reference given as the flag's 'var'.
                $flag->var = $this->parsedFlags[$flag->name] = $value;
            }
        }

        # TODO: Refactor this so this fits into the above foreach
        foreach ($this->flags as $flag) {
            if (!array_key_exists($flag->name, $this->parsedFlags)) {
                $flag->var = $this->parsedFlags[$flag->name] = $flag->defaultValue;
            }
        }

        $this->parsedArgs = $args = array_values($args);

        $pos = 0;

        foreach ($this->args as $arg) {
            if ($arg->required and !isset($args[$pos])) {
                throw new ArgumentException(sprintf(
                    'Missing required argument "%s"', $arg->name
                ));
            }

            if (isset($args[$pos])) {
                if ($arg->vararg) {
                    $value = array_slice($args, $pos);
                    $pos += count($value);
                } else {
                    $value = $args[$pos];
                    $pos++;
                }
            } else {
                $value = $arg->defaultValue;
            }

            $this->parsedNamedArgs[$arg->name] = $value;
        }
    }
964250
public function build($args)
    {
        foreach ($this->fields as $field) {
            $args = Cuztom::merge($field, [
                'metaBox'  => $this->metaBox,
                'metaType' => $this->metaType,
                'object'   => $this->object,
            ]);

            $field = Field::create($args, $this->value);

            $data[$field->id] = $field;
        }

        return $data;
    }
831320
protected function initValues(array $args)
    {
        $uses = class_uses(get_class($this));
        foreach ($uses as $use) {
            $resetMethod = 'init' . basename(strtr($use, '\\', '/'));
            if (method_exists($this, $resetMethod)) {
                $this->$resetMethod($args);
            }
        }
        return $this;
    }
307858
public static function instance( $args = array() ) {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self( $args );
		}

		return self::$instance;
	}
139206
protected function _translateArgs($args) {
		foreach ((array)$args as $k => $arg) {
			if (is_string($arg)) {
				$args[$k] = __d($this->validationDomain, $arg);
			}
		}
		return $args;
	}
1152110
protected function _createObject( $args ) {
		$comment_id = wp_insert_comment( $this->_addSlashesDeep( $args ) );
		if ( $comment_id && ! is_wp_error( $comment_id ) ) {
			$this->_debug( 'Generated comment ID: ' . $comment_id );
		} elseif ( is_wp_error( $comment_id ) ) {
			$this->_debug(
				'Comment generation failed with message [%s] %s',
				$comment_id->get_error_code(),
				$comment_id->get_error_messages()
			);
		} else {
			$this->_debug( 'Comment generation failed' );
		}

		return $comment_id;
	}
647815
public function data(...$args)
    {
        $this->each(function ($item) use ($args) {
            $item->data(...$args);
        });

        return $this;
    }
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;
	}