/** * @param string $url * @param File $file */ public function __construct($url, File $file = null) { $this->url = $url; $this->file = $file; $this->failover = $file; parent::__construct(); }
/** * Create a new RSSFeed entry. * @param ViewableData $entry * @param string $titleField * @param string $descriptionField * @param string $authorField */ public function __construct($entry, $titleField, $descriptionField, $authorField) { $this->failover = $entry; $this->titleField = $titleField; $this->descriptionField = $descriptionField; $this->authorField = $authorField; parent::__construct(); }
/** * @param Object $obj * @param string $link * @param bool $isCurrent * @param string $numChildrenMethod * @param LeftAndMain_SearchFilter $filter */ public function __construct($obj, $link = null, $isCurrent = false, $numChildrenMethod = 'numChildren', $filter = null) { parent::__construct(); $this->obj = $obj; $this->link = $link; $this->isCurrent = $isCurrent; $this->numChildrenMethod = $numChildrenMethod; $this->filter = $filter; }
/** * Create a new version from a database row * * @param array $record */ public function __construct($record) { $this->record = $record; $record['ID'] = $record['RecordID']; $className = $record['ClassName']; $this->object = ClassInfo::exists($className) ? new $className($record) : new DataObject($record); $this->failover = $this->object; parent::__construct(); }
/** * @param object|array $value An associative array, or an object with simple properties. * Converts object properties to keys of an associative array. */ public function __construct($value) { if (is_object($value)) { $this->array = get_object_vars($value); } elseif (ArrayLib::is_associative($value)) { $this->array = $value; } elseif (is_array($value) && count($value) === 0) { $this->array = array(); } else { $message = 'Parameter to ArrayData constructor needs to be an object or associative array'; throw new InvalidArgumentException($message); } parent::__construct(); }
/** * Return debugging information, as XHTML. If a field name is passed, it will show debugging information on that * field, otherwise it will show information on all methods and fields. * * @param string $field the field name * @return string */ public function forTemplate($field = null) { // debugging info for a specific field if ($field) { return "<b>Debugging Information for {$this->class}->{$field}</b><br/>" . ($this->object->hasMethod($field) ? "Has method '{$field}'<br/>" : null) . ($this->object->hasField($field) ? "Has field '{$field}'<br/>" : null); } // debugging information for the entire class $reflector = new ReflectionObject($this->object); $debug = "<b>Debugging Information: all methods available in '{$this->object->class}'</b><br/><ul>"; foreach ($this->object->allMethodNames() as $method) { // check that the method is public if ($method[0] === strtoupper($method[0]) && $method[0] != '_') { if ($reflector->hasMethod($method) && ($method = $reflector->getMethod($method))) { if ($method->isPublic()) { $debug .= "<li>\${$method->getName()}"; if (count($method->getParameters())) { $debug .= ' <small>(' . implode(', ', $method->getParameters()) . ')</small>'; } $debug .= '</li>'; } } else { $debug .= "<li>\${$method}</li>"; } } } $debug .= '</ul>'; if ($this->object->hasMethod('toMap')) { $debug .= "<b>Debugging Information: all fields available in '{$this->object->class}'</b><br/><ul>"; foreach ($this->object->toMap() as $field => $value) { $debug .= "<li>\${$field}</li>"; } $debug .= "</ul>"; } // check for an extra attached data if ($this->object->hasMethod('data') && $this->object->data() != $this->object) { $debug .= ViewableData_Debugger::create($this->object->data())->forTemplate(); } return $debug; }
public function __construct($name = null) { $this->name = $name; parent::__construct(); }
public function __construct($objectClass) { $this->objectClass = $objectClass; parent::__construct(); }
/** * * @param array $items - an initial array to fill this object with */ public function __construct(array $items = array()) { $this->items = array_values($items); parent::__construct(); }
/** * Construct a DataDifferencer to show the changes between $fromRecord and $toRecord. * If $fromRecord is null, this will represent a "creation". * * @param DataObject $fromRecord * @param DataObject $toRecord */ public function __construct(DataObject $fromRecord = null, DataObject $toRecord = null) { $this->fromRecord = $fromRecord; $this->toRecord = $toRecord; parent::__construct(); }
/** * Create a new DataList. * No querying is done on construction, but the initial query schema is set up. * * @param string $dataClass - The DataObject class to query. */ public function __construct($dataClass) { $this->dataClass = $dataClass; $this->dataQuery = new DataQuery($this->dataClass); parent::__construct(); }
public function __construct($form) { $this->form = $form; parent::__construct(); }
/** * Constructor * * @param SS_List $entries RSS feed entries * @param string $link Link to the feed * @param string $title Title of the feed * @param string $description Description of the field * @param string $titleField Name of the field that should be used for the * titles for the feed entries * @param string $descriptionField Name of the field that should be used * for the description for the feed * entries * @param string $authorField Name of the field that should be used for * the author for the feed entries * @param int $lastModified Unix timestamp of the latest modification * (latest posting) * @param string $etag The ETag is an unique identifier that is changed * every time the representation does */ public function __construct(SS_List $entries, $link, $title, $description = null, $titleField = "Title", $descriptionField = "Content", $authorField = null, $lastModified = null, $etag = null) { $this->entries = $entries; $this->link = $link; $this->description = $description; $this->title = $title; $this->titleField = $titleField; $this->descriptionField = $descriptionField; $this->authorField = $authorField; $this->lastModified = $lastModified; $this->etag = $etag; parent::__construct(); }
/** * Create a new email. * * @param string|null $from * @param string|null $to * @param string|null $subject * @param string|null $body * @param string|null $bounceHandlerURL * @param string|null $cc * @param string|null $bcc */ public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null) { if ($from !== null) { $this->from = $from; } if ($to !== null) { $this->to = $to; } if ($subject !== null) { $this->subject = $subject; } if ($body !== null) { $this->body = $body; } if ($cc !== null) { $this->cc = $cc; } if ($bcc !== null) { $this->bcc = $bcc; } if ($bounceHandlerURL !== null) { Deprecation::notice('4.0', 'Use "emailbouncehandler" module'); } parent::__construct(); }
/** * Pass through any missed method calls to DOMDocument (if they exist) * so that HTMLValue can be treated mostly like an instance of DOMDocument * * @param string $method * @param array $arguments * @return mixed */ public function __call($method, $arguments) { $doc = $this->getDocument(); if (method_exists($doc, $method)) { return call_user_func_array(array($doc, $method), $arguments); } else { return parent::__call($method, $arguments); } }
public function __construct(SS_List $list) { $this->list = $list; $this->failover = $this->list; parent::__construct(); }
/** * Returns true if the given method/parameter has a value * (Uses the DBField::hasValue if the parameter is a database field) * * @param string $field The field name * @param array $arguments * @param bool $cache * @return boolean */ public function hasValue($field, $arguments = null, $cache = true) { // has_one fields should not use dbObject to check if a value is given $hasOne = static::getSchema()->hasOneComponent(static::class, $field); if (!$hasOne && ($obj = $this->dbObject($field))) { return $obj->exists(); } else { return parent::hasValue($field, $arguments, $cache); } }
public function __construct() { $this->brokenOnConstruct = false; $this->setRequest(new NullHTTPRequest()); // This will prevent bugs if setDataModel() isn't called. $this->model = DataModel::inst(); parent::__construct(); }