Fill object with values from $args

@param $args
198093
public function fill($args)
    {
        foreach (get_object_vars($this) as $key => $value) {
            foreach ($args as $argKey => $argValue) {
                if ($key == $argKey || $key == $argKey . "Name") {
                    $this->$key = $argValue;
                }
            }
        }
    }
763849
private function _resolveArgs(array $args)
        {
            $resolved = array();
            foreach ($args as $argDefinition) {
                switch ($argDefinition['type']) {
                    case 'lookup':
                        $resolved[] = $this->_lookupRecursive($argDefinition['item']);
                        break;
                    case 'value':
                        $resolved[] = $argDefinition['item'];
                        break;
                }
            }

            return $resolved;
        }
1244854
public function init($args)
    {
        if (empty($args)) {
            return;
        }

        // Special case
        if (is_bool($args) && $args) {
            $args = $this->available;
        }

        // Iterate on all
        foreach ($args as $plugin => $settings) {
            $plugin = strtolower($plugin);

            if (!array_key_exists($plugin, $this->available)) {
                continue;
            }

            $plugin = str_replace('_', '-', $plugin);

            $function = Helpers::toFunctionFormat($plugin);
            $function = 'plugin'.ucfirst($function);
            $this->$function($settings);
        }
    }
34956
public function add(array $args)
    {
        # Establish args.

        $default_args = [
            'auto_prefix'        => true,
            'include_post_types' => [],
            'exclude_post_types' => [],
            'slug'               => '',
            'title'              => '',
            'class'              => '',
            'template_file'      => '',
            'template_dir'       => '',
            'callback'           => null,
            'on_save'            => null,
            'screen'             => null,
            'context'            => 'advanced',
            'priority'           => 'default',
        ];
        $cfg = (object) array_merge($default_args, $args);

        $cfg->auto_prefix        = (bool) $cfg->auto_prefix;
        $cfg->include_post_types = (array) $cfg->include_post_types;
        $cfg->exclude_post_types = (array) $cfg->exclude_post_types;
        $cfg->slug               = (string) $cfg->slug;
        $cfg->title              = (string) $cfg->title;
        $cfg->class              = (string) $cfg->class;
        $cfg->template_file      = (string) $cfg->template_file;
        $cfg->template_dir       = (string) $cfg->template_dir;
        $cfg->context            = (string) $cfg->context;
        $cfg->priority           = (string) $cfg->priority;

        if ($cfg->slug && $cfg->auto_prefix) {
            $cfg->slug = $this->App->Config->©brand['©slug'].'-'.$cfg->slug;
        } elseif (!$cfg->slug) {
            $cfg->slug = $this->App->Config->©brand['©slug'];
        }
        if (!$cfg->title) {
            $cfg->title = $this->App->Config->©brand['©name'];
        }
        $cfg->class .= $cfg->class ? ' ' : '';
        $cfg->class .= $this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-post-meta-box-wrapper';
        $cfg->class .= ' '.$this->App->Config->©brand['©slug'].'-post-meta-box-wrapper';
        $cfg->class .= $cfg->slug !== $this->App->Config->©brand['©slug'] ? ' '.$cfg->slug.'-post-meta-box-wrapper' : '';

        $cfg->nonce['action'] = $cfg->slug.'-save'; // Nonce action ID.
        $cfg->nonce['name']   = '_'.$this->c::slugToVar($cfg->slug).'_nonce';

        $cfg = $this->s::applyFilters('post_meta_box', $cfg, $args, $default_args);

        if (!$cfg->template_file) {
            throw $this->c::issue('Missing template file.');
        }
        $cfg->callback = $cfg->callback ?: function (\WP_Post $WP_Post) use ($cfg) {
            $post_id = (int) $WP_Post->ID;
            $vars    = compact('post_id', 'WP_Post', 'cfg');
            wp_nonce_field($cfg->nonce['action'], $cfg->nonce['name']);
            echo $this->c::getTemplate('s-core/admin/menu-pages/post-meta-box/template.php')->parse($vars);
        };
        # Build meta box sub-routines via closures.

        $on_load_maybe_do_setup = function () use ($cfg) {
            $current_post_type = $this->s::currentMenuPagePostType();

            if ($cfg->include_post_types && !in_array($current_post_type, $cfg->include_post_types, true)) {
                return; // Does not apply to this post type.
            } elseif ($cfg->exclude_post_types && in_array($current_post_type, $cfg->exclude_post_types, true)) {
                return; // Does not apply to this post type.
            }
            $on_add_meta_boxes = function () use ($cfg) {
                add_meta_box($cfg->slug, $cfg->title, $cfg->callback, $cfg->screen, $cfg->context, $cfg->priority);
            };
            $on_save_post = function ($post_id, \WP_Post $WP_Post) use ($cfg) {
                if (!($post_id = (int) $post_id)) {
                    return; // Not possible.
                }
                $_r = $this->c::unslash($_REQUEST);
                $_r = $this->c::mbTrim($_r);

                $nonce_action = $cfg->nonce['action'];
                $nonce_value  = $_r[$cfg->nonce['name']] ?? null;

                $data = $_r[$this->c::slugToVar($cfg->slug)] ?? [];
                $data = is_array($data) ? $data : []; // Force array.
                $data = $this->c::removeKey($data, '___ignore');

                if (!isset($nonce_value)) {
                    return; // Nonce is missing.
                } elseif (!wp_verify_nonce($nonce_value, $nonce_action)) {
                    return; // Nonce is unverifiable.
                } elseif (!current_user_can('edit_post', $post_id)) {
                    return; // Current user not allowed.
                } elseif (wp_is_post_autosave($post_id)) {
                    return; // Not applicable.
                } elseif (wp_is_post_revision($post_id)) {
                    return; // Not applicable.
                }
                foreach ($data as $_key => $_value) {
                    if ($_key && is_string($_key)) {
                        // Slash, because WP will unslash.
                        // This allows for `\` in form submissions.
                        $this->s::updatePostMeta($post_id, $_key, wp_slash($_value));
                    }
                }
                if (($on_save = $cfg->on_save)) {
                    $on_save($post_id, $data);
                }
            };
            add_action('add_meta_boxes', $on_add_meta_boxes);
            add_action('save_post', $on_save_post, 10, 2);
        };
        add_action('load-post.php', $on_load_maybe_do_setup);
        add_action('load-post-new.php', $on_load_maybe_do_setup);
    }
732920
public function dump(...$args)
    {
        $values = $this->handleValues($args);

        $data = (new VarCloner())->cloneVar($values);

        if ($this->connection->write($data) === false) {
            dump($values);
        }
    }
1108498
public function setArguments(array $args): PostTypeInterface
    {
        $this->args = array_merge($this->args, $args);

        return $this;
    }
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());
    }
600725
public function setResponseArray(array $args = [])
    {
        foreach ($args as $name => $text) {
            return $this->response[$name] = $text;
        }
        return $this;
    }
1236845
public function input($arg,...$args){
        /** $args != null */
        if($args) {
            if(is_array($args[0])) {
                //$this->input('get',['name','pass']);
                $args = [$arg,$args[0]];
            }
            else {
                //$this->input('name','pass');
                array_unshift($args,$arg);
                $args = [$this->method,$args];
            }
        }
        else {
            /** $args == null */
            //$this->input('name');
            //$this->input(['name','pass']);
            $args = [$this->method,$arg];
        }

        $input = call_user_func_array([$this,'form'],$args);

        if(is_array($input) === false) {
            return null;
        }

        if(count($input) == 1) {
            return current($input);
        }

        return array_values($input);
    }
266660
private function _get_value($args){
    if ( $this->id ){
      $var =& $this->data;
      foreach ( $args as $a ){
        if ( !isset($var[$a]) ){
          return null;
        }
        $var =& $var[$a];
      }
      return $var;
    }
  }
142469
public function merge($arg)
	{
		$arguments = array_map(function ($array)
		{
			if ($array instanceof DataContainer)
			{
				return $array->getContents();
			}

			return $array;

		}, func_get_args());

		$data = call_user_func_array('Arr::merge', $arguments);

		$this->set($data);

		return $this;
	}
1367330
protected function setupArguments($args) {
    $this->upload_path = (isset($args['base_dir']) ? $args['base_dir'] : $this->public_path . $this->upload_uri);
    $this->class = (isset($args['class']) ? $args['class'] : NULL);
    $this->alt = isset($args['alt']) ? $args['alt'] : $this->parseAlt();
    $this->title = isset($args['title']) ? $args['title'] : $this->parseTitle();
  }
326314
public function beforeInsert(array &$args) {
        $data = &$args[1];
        if (!$output = $this->_fillFields($data)) {
            throw new Garp_Model_Behavior_Exception(self::EXCEPTION_NO_API_DATA);
        }
        $data = $output + $data;
    }
1010563
public function setConfigs(array $args) {
        if (!is_array(current($args))) {
            $args = [
                $this->currentName => $args
            ];
        }
        foreach ($args as $key => $item) {
            if (array_key_exists($key, $this->configs)) {
                $this->configs[$key] = array_merge($this->configs[$key], $item);
            } else {
                $this->configs[$key] = $item;
            }
        }
        return $this;
    }
1178671
public function allocate($args)
    {
        $data = Ensure::Input($args);
        $url = URIResource::Make($this->path);
        $id = Locator::Find($this->client->post($url, $data->get()));

        $data->add("id", $id);
        return Constructor::Make($this, $data->get());
    }
751276
private function prepare($args)
    {
        $bindings = array();

        // Two parameters (key, value).
        if (count($args) == 2) {
            $bindings[$args[0]] = $args[1];
        }
        // Array of parameters.
        elseif (is_array($args[0])) {
            $bindings = $args[0];
        }

        return $bindings;
    }
63049
public function beforeInsert(array &$args) {
        $data = &$args[1];
        foreach ($this->_fields as $field) {
            if (array_key_exists($field, $data)) {
                $data[$field] = $this->filter($data[$field], $this->getConfig());
            }
        }
    }