mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-05 09:19:56 +00:00
6213f2fb75
- Optimised Input-classes. - `get` and `getObject` methods on `Input` now supports filtering on multiple method-types when using the `$method` parameter. - Input classes now know how to parse that stupid nested $_FILES array. - It's now possible to change method-names on ResourceControllers. - Removed `getValue` and `setValue` from `InputFile` classes. - Ensured that request-method are only parsed from $_POST or $_SERVER. - Fixed minor parameter-issues with subdomain routing. - Added PHPDocs. - Added even more unit-tests. - Many small optimisations tweaks.
79 lines
1.3 KiB
PHP
79 lines
1.3 KiB
PHP
<?php
|
|
namespace Pecee\Http\Input;
|
|
|
|
class InputItem implements IInputItem
|
|
{
|
|
public $index;
|
|
public $name;
|
|
public $value;
|
|
|
|
public function __construct($index, $value = null)
|
|
{
|
|
$this->index = $index;
|
|
$this->value = $value;
|
|
|
|
// Make the name human friendly, by replace _ with space
|
|
$this->name = ucfirst(str_replace('_', ' ', $this->index));
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getIndex()
|
|
{
|
|
return $this->index;
|
|
}
|
|
|
|
public function setIndex($index)
|
|
{
|
|
$this->index = $index;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* Set input name
|
|
* @param string $name
|
|
* @return static $this
|
|
*/
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getValue()
|
|
{
|
|
return $this->value;
|
|
}
|
|
|
|
/**
|
|
* Set input value
|
|
* @param string $value
|
|
* @return static $this
|
|
*/
|
|
public function setValue($value)
|
|
{
|
|
$this->value = $value;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
return (string)$this->value;
|
|
}
|
|
|
|
} |