/** * @inheritdoc */ public function handle(FormData $data) { $value = $data->get($this->getName()); $value = $value === null ? 0 : (int) $value; $this->setValue($value); return $this; }
/** * @inheritdoc */ public function handle(FormData $data) { $values = $data->get($this->getName()); if ($values === null) { $values = []; } else { $values = (array) $values; } $this->setValue($values); return $this; }
/** * @param FormData $data * @return $this */ public function handle(FormData $data) { $this->cleanValidationFlag(); $this->isSubmitted = false; if ($data->isMethod($this->getMethod()) and $data->has($this->getUid())) { $this->isSubmitted = true; foreach ($this->getElements() as $element) { $element->handle($data); } } return $this; }
public function testGetters() { $testData = ['name' => 'petro', 'email' => '*****@*****.**']; $data = new FormData(FormData::METHOD_POST, $testData); $this->assertEquals(FormData::METHOD_POST, $data->getMethod()); $this->assertFalse($data->isMethod(FormData::METHOD_GET)); $this->assertTrue($data->isMethod(FormData::METHOD_POST)); $this->assertEquals(['name' => 'petro', 'email' => '*****@*****.**'], $data->getData()); $this->assertEquals('petro', $data->get('name')); $this->assertNull($data->get('age')); $this->assertTrue($data->has('email')); $this->assertFalse($data->has('age')); }
/** * @return $this */ public function handle(FormData $request) { $this->isSubmitted = $request->get($this->getName()) !== null; return $this; }
/** * @inheritdoc */ public function handle(FormData $data) { $this->setValue($data->get($this->getName())); return $this; }
/** * @inheritdoc */ public function handle(FormData $data) { $this->isSubmitted = $data->get($this->getName()) !== null; }