function testArrayExtractFailsWhenIsScalar() { $data = array('b' => 1); $cage = new T_Cage_Array($data); try { $test = $cage->asArray('b'); $this->fail(); } catch (T_Exception_Cage $e) { } }
/** * Whether the field is submitted in a particular array cage. * * @param T_Cage_Array $source source array to check * @return bool whether a non-zero length value has been submitted */ function isSubmitted(T_Cage_Array $source) { $submitted = $source->exists($this->getFieldname()); if ($submitted) { if ($this->as_scalar) { $cage = $source->asScalar($this->getFieldname()); $submitted = strlen($cage->uncage()) > 0; } else { $cage = $source->asArray($this->getFieldname()); $submitted = count($cage->uncage()) > 0; } } return $submitted; }