Post

@param array $input
@return array
548111
public function post(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_POST] = true;
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
91420
public function readyToPost(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_READY_TO_POST] = true;
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
1006208
public static function clearInput($input)
    {
        if (is_array($input)) {
            foreach ($input as $key => $value) {
                if (!isset($value) || $value === '') {
                    unset($input[$key]);
                }
            }

            return $input;
        }

        return $input;
    }
1125187
public function preparePeoplesDataForInsert($input) {

        $data = [];

        $data['user_id']       = null;  // Set users up as PEOPLES in the admin
        $data['title']         = $input['first_name']." ".$input['surname'];
        $data['salutation']    = "";
        $data['first_name']    = $input['first_name'];
        $data['middle_name']   = "";
        $data['surname']       = $input['surname'];
        $data['position']      = "";
        $data['description']   = "";
        $data['comments']      = "Created by front-end subscription to an email list";

        $data['birthday']      = null;
        $data['anniversary']   = null;

        $data['created_at']    = Carbon::now();
        $data['created_by']    = $this->userRepository->getFirstAmongEqualsUserID();
        $data['updated_at']    = Carbon::now();
        $data['updated_by']    = $this->userRepository->getFirstAmongEqualsUserID();

        $data['profile']       = null;
        $data['featured_image'] = null;

        return $data;
    }
770850
public function convert(array $input) {
        //Convert to objects
        if (isSet($input['XDEBUG_SESSION_START'])) unset($input['XDEBUG_SESSION_START']);
        $returnVar = new \stdClass();
        foreach($input as $name => $value) {
            $parts = explode($this->getDelimiter(), $name);
            $currentPart = $returnVar;
            $count = sizeOf($parts);
            foreach($parts as $key => $part) {
                //Ignore all that have a blank part
                if($part == '') {
                    break;
                }
                if($key + 1 == $count) {
                    $currentPart->{$part} = $value;
                } else {
                    $part = ucfirst($part);
                    if(!isset($currentPart->{$part})) {
                        $item = new \stdClass();
                        $currentPart->{$part} = $item;
                    } else {
                        //Account for the url of ?employeeType&employeeType.name=1099 with employeeType and employeeType.name
                        if(!is_object($currentPart->{$part})) {
                            throw new Exception('You cannot pass in both ' . $part . ', and ' . implode('.', $parts), 400);
                        }
                    }
                    $currentPart = $currentPart->{$part};
                }
            }
        }
        return $returnVar;
    }
755018
private function cleanKeysForXml(array $input): array
    {
        $return = [];
        foreach ($input as $key => $value) {
            // first remove the line return because the regex using "." pattern prevent to include the line return in the preg_replace.
            $key = str_replace("\n", '_', $key);
            $startCharacterPattern =
                '[A-Z]|_|[a-z]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\x{2FF}]|[\x{370}-\x{37D}]|[\x{37F}-\x{1FFF}]|'
                . '[\x{200C}-\x{200D}]|[\x{2070}-\x{218F}]|[\x{2C00}-\x{2FEF}]|[\x{3001}-\x{D7FF}]|[\x{F900}-\x{FDCF}]'
                . '|[\x{FDF0}-\x{FFFD}]|[\x{10000}-\x{EFFFF}]';
            $characterPattern = $startCharacterPattern . '|\-|\.|[0-9]|\xB7|[\x{300}-\x{36F}]|[\x{203F}-\x{2040}]';
            $key = preg_replace('/(?!' . $characterPattern . ')./u', '_', $key);
            $key = preg_replace('/^(?!' . $startCharacterPattern . ')./u', '_', $key);
            if (is_array($value)) {
                $value = $this->cleanKeysForXml($value);
            }
            $return[$key] = $value;
        }

        return $return;
    }
879099
protected function convertArgumentsAndOptionsArrayToRows(array $input): array
	{
		$rows = [];

		foreach($input as $name => $info)
		{
			$rows[] = [$name, $info['description'], var_export($info['optional'], true)];
		}

		return $rows;
	}
1260270
public function create(array $input)
	{
    unset($input['_token']);

    $loggedUserId = $this->AuthenticationManager->getLoggedUserId();
    $organizationId = $this->AuthenticationManager->getCurrentUserOrganizationId();

    $input = eloquent_array_filter_for_insert($input);
		$input = array_add($input, 'organization_id', $organizationId);
    // $input['date'] = $this->Carbon->createFromFormat($this->Lang->get('form.phpShortDateFormat'), $input['date'])->format('Y-m-d');

    $this->DB->transaction(function() use ($input, $loggedUserId, $organizationId)
		{
      $VoucherType = $this->VoucherType->create($input);

      $Journal = $this->Journal->create(array('journalized_id' => $VoucherType->id, 'journalized_type' => $this->VoucherType->getTable(), 'user_id' => $loggedUserId, 'organization_id' => $organizationId));
      $this->Journal->attachDetail($Journal->id, array('note' => $this->Lang->get('decima-accounting::voucher-type-management.addedJournal', array('VoucherType' => $VoucherType->name)), $Journal));
    });

    return json_encode(array('success' => $this->Lang->get('form.defaultSuccessSaveMessage'), 'voucherTypes' => $this->getVoucherTypes()));
  }
532798
public function trim(array $input)
    {
        $out = [];
        foreach ($input as $line) {
            $chunk = $this->chunk($line);
            $out[] = reset($chunk);
        }
        return $out;
    }
1346136
protected function newSelfs(array $input)
    {
        $strObjects = [];

        foreach ($input as $key => $value)
        {
            if (is_string($value))
            {
                // Convert the scalar string to a Str Object
                $strObjects[$key] = $this->newSelf($value);
            }
            elseif (is_array($value))
            {
                // Recurse into the array
                $strObjects[$key] = $this->newSelfs($value);
            }
            else
            {
                // We don't know what it is do do nothing to it
                $strObjects[$key] = $value;
            }
        }

        return $strObjects;
    }
282239
private function arrayAnalyzer($input)
    {
        $result = [];
        foreach ($input as $key => $value) {
            if ($key == 'Field') {
                $result[] = $value;
            } elseif ($key == 'Type') {
                if (str_contains($value, 'int')) {
                    $result[] = 'text';
                } elseif (str_contains($value, 'char')) {
                    $result[] = 'text';
                } elseif ($value = 'date') {
                    $result[] = 'date';
                }
            }
        }

        return $result;
    }
63527
public function delete(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_DELETE] = true;
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
796964
public function validate(array $input = []): ValidationResult
    {
        $results = [];

        foreach ($this->rules as $key => $definition) {

            $rules = $this->parser->parseRulesDefinition($definition);

            $results[$key] = $rules->validate($key, $input);

        }

        return new ValidationResult($results, $this->translator);
    }
939596
protected function authenticate(array $input)
    {
        $remember = (($input['remember'] ?? 'no') === 'yes');

        $data = Arr::except($input, ['remember']);

        // We should now attempt to login the user using Auth class. If this
        // failed simply return false.
        return $this->auth->attempt($data, $remember);
    }
1066741
private function processPageParams(array $input)
    {
        if (!empty($input['page']) && is_numeric($input['page'])) {
            $this->page = $input['page'];
        }
        if (!empty($input['per_page']) && is_numeric($input['per_page'])) {
            $this->perPage = $input['per_page'];
        }
        return $input;
    }
1061009
public function insertRSS($input = [])
    {
        $stmt = $this->db->prepare("INSERT INTO  " . $this->table . " (TITLE, LINK, DESCRIPTION, CREATED) VALUES (?, ?, ?, datetime('now', 'localtime'))");
        $stmt->execute([$input['TITLE'], $input['LINK'], $input['DESCRIPTION']]);
    }
912576
protected function _unserialize($input)
	{
		$data = @unserialize($input);

		if (is_array($data))
		{
			foreach ($data as $key => $val)
			{
				if (is_string($val))
				{
					$data[$key] = str_replace('{{slash}}', '\\', $val);
				}
			}

			return $data;
		}

		elseif ($data === false)
		{
			is_string($input) and $data = array($input);
		}

		return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data;
	}