/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { // Try to set property switch ($name) { // IMediatable case 'Mediator': $result = $this->setMediator($value); break; case 'MediatorID': $result = $this->setMediatorID($value); break; // IOutput // IOutput case 'stdOut': case 'stdErr': $result = IDataMapper::READONLY; break; // Undefined property // Undefined property default: $result = IDataMapper::UNDEFINED; } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name Label of property to set. * @param mixed $value Value of property. */ public function __set($name, $value) { // Try to set property switch ($name) { // ISerializable case 'Status': case 'Serializer': // IIterable // IIterable case 'ID': $result = IDataMapper::READONLY; break; case 'Parent': $result = $this->setParent($value); break; // Undefined property // Undefined property default: $result = IDataMapper::UNDEFINED; } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { // Try to set property switch ($name) { // IRequest case 'RequestURI': $result = $this->setRequestURI($value); break; case 'URI': $result = $this->setURI($value); break; case 'Protocol': case 'Version': case 'Status': case 'Header': case 'Body': $result = IDataMapper::READONLY; break; // Undefined property // Undefined property default: $result = IDataMapper::UNDEFINED; } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { switch ($name) { // ISerializable case 'Status': case 'Serializer': // IIterable // IIterable case 'ID': $result = IDataMapper::READONLY; break; case 'Parent': $result = $this->setParent($value); break; // IMediatable // IMediatable case 'Mediator': $result = $this->setMediator($value); break; case 'MediatorID': // IComponentMapable // IComponentMapable case 'Component': // Page // Page case 'RequestHead': case 'ResponseHead': case 'Base': $result = IDataMapper::READONLY; break; case 'Created': $result = $this->setCreated($value); break; case 'Modified': $result = $this->setModified($value); break; case 'Document': case 'File': $result = IDataMapper::READONLY; break; default: // Try to set component property try { $this->_Component->{$name} = $value; $result = IDataMapper::UPDATED; } catch (\Exception $e) { $result = IDataMapper::UNDEFINED; } // @codeCoverageIgnoreEnd } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * @depends test_setField * @covers ::__loadFields */ public function test_loadFields() { $Valid = array(array('foo', ADataMapper::createRead($foo), ADataMapper::createWrite($foo)), array('bar', ADataMapper::createRead($bar), ADataMapper::createWrite($bar))); $Invalid = array(array(NULL, ADataMapper::createRead($foo), ADataMapper::createWrite($foo)), array(NULL, ADataMapper::createRead($bar), ADataMapper::createWrite($bar))); # Test valid arguments $this->assertTrue($this->DataMapper->__loadFields($Valid), 'IDataMapper::__loadFields() should return true.'); # Test invalid arguments try { $this->DataMapper->__loadFields($Invalid); $this->fail('Failed to generate exception with invalid parameter'); } catch (InvalidArgumentException $e) { } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { // Try to set property switch ($name) { // IMediatable case 'Mediator': $result = $value instanceof IMediator ? $this->setMediator($value) : IDataMapper::INVALID; break; case 'MediatorID': $result = IDataMapper::READONLY; break; // IAddressHandler // IAddressHandler case 'To': $result = $value instanceof IEmailAddress ? $this->addTo($value) : IDataMapper::INVALID; break; case 'From': $result = $value instanceof IEmailAddress ? $this->addFrom($value) : IDataMapper::INVALID; break; case 'ReplyTo': $result = $value instanceof IEmailAddress ? $this->addReplyTo($value) : IDataMapper::INVALID; break; case 'CC': $result = $value instanceof IEmailAddress ? $this->addCC($value) : IDataMapper::INVALID; break; case 'BCC': $result = $value instanceof IEmailAddress ? $this->addBCC($value) : IDataMapper::INVALID; break; // IMessage // IMessage case 'HTML': $result = $this->setHTML($value); break; case 'Text': $result = $this->setText($value); break; case 'Subject': $result = $this->setSubject($value); break; // IObject // IObject default: return parent::__set($name, $value); } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { // Try to set property switch ($name) { // IIterable case 'ID': $result = $this->setID($value); break; case 'Parent': $result = $this->setParent($value); break; // Element // Element case 'Document': $result = IDataMapper::READONLY; break; case 'innerHTML': $result = $this->setInnerHTML($value) ? IDataMapper::UPDATED : IDataMapper::INVALID; break; case 'outerHTML': $result = $this->setOuterHTML($value) ? IDataMapper::UPDATED : IDataMapper::INVALID; break; // Undefined property // Undefined property default: $result = IDataMapper::UNDEFINED; } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { switch ($name) { // ISerializable case 'Status': case 'Serializer': // IIterable // IIterable case 'ID': $result = IDataMapper::READONLY; break; case 'Parent': $result = $this->setParent($value); break; // IComponentMapable // IComponentMapable case 'Component': $result = IDataMapper::READONLY; break; default: // Try to set component property try { $this->_Component->{$name} = $value; $result = IDataMapper::UPDATED; } catch (\Exception $e) { $result = IDataMapper::UNDEFINED; } } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. * @return boolean Returns a <code>IDataMapper</code> status code. */ public function __set($name, $value) { // Try to set property switch ($name) { // IOption case 'Name': case 'Value': $result = IDataMapper::READONLY; break; // Undefined property // Undefined property default: $result = IDataMapper::UNDEFINED; } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { // Try to set property switch ($name) { // ISerializable case 'Status': case 'Serializer': // IIterable // IIterable case 'ID': $result = IDataMapper::READONLY; break; case 'Parent': $result = $this->setParent($value); break; // IComponentMapable // IComponentMapable case 'Component': // IBrowser // IBrowser case 'Client': case 'RequestFactory': case 'Plugins': case 'Engines': $result = IDataMapper::READONLY; break; case 'UserAgent': $result = $this->setUserAgent($value); break; // IWrapper // IWrapper default: // Try to set component property try { $this->_Component->{$name} = $value; $result = IDataMapper::UPDATED; // @codeCoverageIgnoreStart // Error } catch (\Exception $e) { $result = IDataMapper::UNDEFINED; } // @codeCoverageIgnoreEnd } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }
/** * Dynamic properties. * * @param string $name * Label of property to set. * @param mixed $value * Value of property. */ public function __set($name, $value) { switch ($name) { // ISerializable case 'Status': case 'Serializer': // IIterable // IIterable case 'ID': $result = IDataMapper::READONLY; break; case 'Parent': $result = $this->setParent($value); break; // IStream // IStream case 'fp': // IFileStream // IFileStream case 'File': case 'Flags': case 'Options': $result = IDataMapper::READONLY; break; default: $result = IDataMapper::UNDEFINED; break; } // Check results if (list($Message, $Level) = ADataMapper::getErrorInfo($result, get_class($this), $name)) { trigger_error($Message, $Level); } }