Skip to content
Permalink
Browse files

ID#323:

- Introduced type declaration for various classes.
- Corrected implementation to comply w/ interface definition.
- Added fluent interface support.
  • Loading branch information...
Christian Achatz
Christian Achatz committed May 18, 2018
1 parent e5e22dd commit 231133af0076682920f556977984db79fcd6adda
Showing with 105 additions and 41 deletions.
  1. +1 −1 core/pagecontroller/Document.php
  2. +1 −0 extensions/form/client/taglib/AddFormControlClientValidatorTag.php
  3. +1 −0 extensions/form/client/taglib/ClientValidationListenerTag.php
  4. +1 −0 extensions/form/client/taglib/FormClientErrorDisplayTag.php
  5. +1 −0 extensions/form/client/taglib/GetClientFormValidationTag.php
  6. +2 −2 tools/form/FormControl.php
  7. +6 −6 tools/form/FormControlFinder.php
  8. +2 −0 tools/form/FormElement.php
  9. +2 −2 tools/form/FormMarker.php
  10. +2 −0 tools/form/HtmlForm.php
  11. +6 −6 tools/form/mixin/FormControlFinder.php
  12. +3 −3 tools/form/multifileupload/biz/MultiFileUploadManager.php
  13. +10 −8 tools/form/multifileupload/pres/taglib/MultiFileUploadTag.php
  14. +1 −1 tools/form/provider/csrf/CSRFHashProvider.php
  15. +1 −1 tools/form/provider/csrf/EncryptedSIDHashProvider.php
  16. +4 −2 tools/form/taglib/AbstractFormControl.php
  17. +1 −0 tools/form/taglib/ButtonTag.php
  18. +2 −0 tools/form/taglib/CheckBoxTag.php
  19. +2 −0 tools/form/taglib/DateSelectorTag.php
  20. +3 −2 tools/form/taglib/DynamicFormElementMarkerTag.php
  21. +2 −0 tools/form/taglib/FileUploadTag.php
  22. +1 −0 tools/form/taglib/FormControlObserverBase.php
  23. +1 −0 tools/form/taglib/FormErrorDisplayTag.php
  24. +2 −0 tools/form/taglib/FormGroupTag.php
  25. +3 −2 tools/form/taglib/FormLabelTag.php
  26. +1 −0 tools/form/taglib/FormSuccessDisplayTag.php
  27. +25 −1 tools/form/taglib/HtmlFormTag.php
  28. +2 −0 tools/form/taglib/RadioButtonTag.php
  29. +1 −0 tools/form/taglib/ResetButtonTag.php
  30. +2 −0 tools/form/taglib/SelectBoxGroupTag.php
  31. +3 −1 tools/form/taglib/SelectBoxOptionTag.php
  32. +2 −0 tools/form/taglib/SelectBoxTag.php
  33. +3 −1 tools/form/taglib/TextAreaTag.php
  34. +2 −0 tools/form/taglib/TimeSelectorTag.php
  35. +1 −0 tools/form/taglib/ValidationListenerTag.php
  36. +1 −1 tools/html/Iterator.php
  37. +1 −1 tools/html/taglib/HtmlIteratorTag.php
@@ -110,7 +110,7 @@ class Document extends APFObject implements DomNode {
protected $parent = null;
/**
* @var string[][] $attributes XML attributes of the current node.
* @var string[] $attributes XML attributes of the current node.
*/
protected $attributes = [];
@@ -112,6 +112,7 @@ public function onAfterAppend() {
public function reset() {
// nothing to do as client listeners cannot be reset
return $this;
}
}
@@ -113,6 +113,7 @@ public function transform() {
public function reset() {
// nothing to do as client listeners cannot be reset
return $this;
}
}
@@ -84,6 +84,7 @@ public function transform() {
public function reset() {
// nothing to do as client errors cannot be reset
return $this;
}
}
@@ -219,6 +219,7 @@ public function onAfterAppend() {
public function reset() {
// nothing to do as client validation rule generation takes no user input
return $this;
}
}
@@ -366,7 +366,7 @@ public function isFilled();
* @version
* Version 0.1, 03.02.2010<br />
*/
public function appendCssClass($class);
public function appendCssClass(string $class);
/**
* Adds an additional attribute to the white list of the control.
@@ -380,7 +380,7 @@ public function appendCssClass($class);
* @version
* Version 0.1, 21.07.2010<br />
*/
public function addAttributeToWhiteList($name);
public function addAttributeToWhiteList(string $name);
/**
* Adds a set of additional attributes to the white list of the control.
@@ -44,7 +44,7 @@ interface FormControlFinder {
* @version
* Version 0.1, 21.01.2007<br />
*/
public function getFormElementByID($id);
public function getFormElementByID(string $id);
/**
* Returns a list of form controls with the given name.
@@ -57,7 +57,7 @@ public function getFormElementByID($id);
* @version
* Version 0.1, 16.08.2010<br />
*/
public function getFormElementsByName($name);
public function getFormElementsByName(string $name);
/**
* Returns a list of form elements addressed by their tag name.
@@ -72,7 +72,7 @@ public function getFormElementsByName($name);
* Version 0.1, 14.06.2008 (API change: do use this function instead of getFormElementsByType()!)<br />
* Version 0.2, 12.12.2012 (Refactoring due to tag renaming)<br />
*/
public function getFormElementsByTagName($tagName);
public function getFormElementsByTagName(string $tagName);
/**
* Returns a list of form elements addressed by their implementation class name.
@@ -100,7 +100,7 @@ public function getFormElementsByType(string $class): array;
* @version
* Version 0.1, 03.09.2008<br />
*/
public function getMarker($markerName);
public function getMarker(string $markerName);
/**
* Returns a reference on the form element identified by the given name.
@@ -115,7 +115,7 @@ public function getMarker($markerName);
* Version 0.1, 07.01.2007<br />
* Version 0.2, 12.09.2009 (Corrected debug message)<br />
*/
public function getFormElementByName($name);
public function getFormElementByName(string $name);
/**
* Let's you retrieve an &lt;form:getstring /&gt; tag instance with the specified name.
@@ -129,6 +129,6 @@ public function getFormElementByName($name);
* @version
* Version 0.1, 17.01.2012<br />
*/
public function getLabel($name);
public function getLabel(string $name);
}
@@ -63,6 +63,8 @@ public function isValid();
* <p/>
* What happens when resetting a form control is up to the dedicated implementation.
*
* @return $this This instance for further usage.
*
* @author Christian Achatz
* @version
* Version 0.1, 06.09.2014 (ID#206: Added interface enhancement to allow resetting)<br />
@@ -41,7 +41,7 @@ interface FormMarker {
* @version
* Version 0.1, 23.08.2014<br />
*/
public function addContentAfter($content);
public function addContentAfter(string $content);
/**
* Allows you to add content (e.g. HTML, text) BEFORE the form marker.
@@ -54,5 +54,5 @@ public function addContentAfter($content);
* @version
* Version 0.1, 23.08.2014<br />
*/
public function addContentBefore($content);
public function addContentBefore(string $content);
}
@@ -110,6 +110,8 @@ public static function clearModelToFormControlMapper();
*
* @param string $action The action URL of the form.
*
* @return $this This instance for further usage.
*
* @author Christian Schäfer
* @version
* Version 0.1, 07.01.2007<br />
@@ -46,7 +46,7 @@ trait FormControlFinder {
* @return FormControl A reference on the form element.
* @throws FormException In case the form element cannot be found.
*/
public function getFormElementByID($id) {
public function getFormElementByID(string $id) {
if (count($this->children) > 0) {
foreach ($this->children as &$child) {
@@ -89,7 +89,7 @@ public function getFormElementByID($id) {
* @return DynamicFormElementMarkerTag|DomNode The marker.
* @throws FormException In case the marker cannot be found.
*/
public function getMarker($markerName) {
public function getMarker(string $markerName) {
return $this->getFormElementByName($markerName);
}
@@ -99,7 +99,7 @@ public function getMarker($markerName) {
* @return FormControl A reference on the form element.
* @throws FormException In case the form element cannot be found.
*/
public function getFormElementByName($name) {
public function getFormElementByName(string $name) {
if (count($this->children) > 0) {
foreach ($this->children as &$child) {
@@ -142,7 +142,7 @@ public function getFormElementByName($name) {
* @return LanguageLabelTag The instance of the desired label.
* @throws FormException In case no label can be found.
*/
public function getLabel($name) {
public function getLabel(string $name) {
if (count($this->children) > 0) {
foreach ($this->children as &$child) {
@@ -183,7 +183,7 @@ public function getLabel($name) {
*
* @return FormControl[] The list of form controls with the given name.
*/
public function getFormElementsByName($name) {
public function getFormElementsByName(string $name) {
$elements = [];
if (count($this->children) > 0) {
foreach ($this->children as &$child) {
@@ -209,7 +209,7 @@ public function getFormElementsByName($name) {
* @return FormControl[] A list of references on the form elements.
* @throws FormException In case the form element cannot be found or desired tag is not registered.
*/
public function getFormElementsByTagName($tagName) {
public function getFormElementsByTagName(string $tagName) {
/* @var $form HtmlFormTag */
if ($this instanceof HtmlForm) {
@@ -168,7 +168,7 @@ private function checkSessionFiles() {
* @param array $file
* @param boolean $js True, in case of java script upload, false otherwise.
*
* @return boolean
* @return boolean|array
* @throws FormException
*
* @author Werner Liemberger <wpublicmail@gmail.com>
@@ -311,7 +311,7 @@ private function getFileLink($uploadname) {
* @param string $dir - Zielverzeichnis
* @param string $name - Zieldateiname
*
* @return File::moveTo
* @return bool
*
* @author Werner Liemberger <wpublicmail@gmail.com>
* @version 1.0, 14.03.2011<br>
@@ -381,7 +381,7 @@ public function getFiles() {
*
* @param string $uploadname - Dateiname
*
* @return array
* @return mixed
*
* @author Werner Liemberger <wpublicmail@gmail.com>
* @version 1.0, 14.3.2011<br>
@@ -174,8 +174,8 @@ public function transform() {
*/
private function createUploadButton() {
return '<div id="' . $this->uploadFieldName . '_file_upload_container"><input type="file" name="' . $this->uploadFieldName . '" id="' . $this->uploadFieldName . '" multiple="multiple" /><button>'
. $this->languageConfig->getValue('upload.button.label') . '</button><div class="uploadlabel">'
. $this->languageConfig->getValue('upload.label') . '</div></div>';
. $this->languageConfig->getValue('upload.button.label') . '</button><div class="uploadlabel">'
. $this->languageConfig->getValue('upload.label') . '</div></div>';
}
/**
@@ -188,8 +188,8 @@ private function createUploadButton() {
*/
private function createDialogFileDelete() {
return '<div class="confirm_delete ui-dialog-content ui-widget-content dialog_confirm_delete" title="'
. $this->languageConfig->getValue('delete.title') . '">'
. $this->languageConfig->getValue('delete.message') . '</div>';
. $this->languageConfig->getValue('delete.title') . '">'
. $this->languageConfig->getValue('delete.message') . '</div>';
}
/**
@@ -202,8 +202,8 @@ private function createDialogFileDelete() {
*/
private function createDialogFileSize() {
return '<div class="filesize_dialog ui-dialog-content ui-widget-content" title="'
. $this->languageConfig->getValue('filesize.title') . '">'
. $this->languageConfig->getValue('filesize.message') . ' ' . $this->manager->getMaxFileSizeWithUnit() . '</div>';
. $this->languageConfig->getValue('filesize.title') . '">'
. $this->languageConfig->getValue('filesize.message') . ' ' . $this->manager->getMaxFileSizeWithUnit() . '</div>';
}
/**
@@ -216,8 +216,8 @@ private function createDialogFileSize() {
*/
private function createDialogFileType() {
return '<div class="filetype_dialog ui-dialog-content ui-widget-content" title="'
. $this->languageConfig->getValue('filetype.title') . '">'
. $this->languageConfig->getValue('filetype.message') . ' ' . $this->createFileExtensionFromMimeType($this->manager->getMimeTypes()) . '</div>';
. $this->languageConfig->getValue('filetype.title') . '">'
. $this->languageConfig->getValue('filetype.message') . ' ' . $this->createFileExtensionFromMimeType($this->manager->getMimeTypes()) . '</div>';
}
/**
@@ -566,6 +566,8 @@ public function reset() {
$this->manager->deleteFile($file);
$this->manager->deleteFileFromSession($file);
}
return $this;
}
}
@@ -41,6 +41,6 @@ interface CSRFHashProvider {
* @version
* Version 0.1, 06.11.2010
*/
public function generateHash($salt);
public function generateHash(string $salt);
}
@@ -42,7 +42,7 @@ class EncryptedSIDHashProvider extends APFObject implements CSRFHashProvider {
* @version
* Version 0.1, 29.10.2010
*/
public function generateHash($salt) {
public function generateHash(string $salt) {
if (!defined('SID')) {
session_start();
}
@@ -312,6 +312,8 @@ public function isSent() {
public function reset() {
// reset value attribute as basic implementation as it applies in several cases
$this->setAttribute('value', '');
return $this;
}
public function isChecked() {
@@ -391,7 +393,7 @@ public function addValidator(FormValidator $validator) {
return $this;
}
public function addAttributeToWhiteList($name) {
public function addAttributeToWhiteList(string $name) {
$this->attributeWhiteList[] = $name;
return $this;
@@ -403,7 +405,7 @@ public function addAttributesToWhiteList(array $names) {
return $this;
}
public function appendCssClass($class) {
public function appendCssClass(string $class) {
$this->addAttribute('class', $class, ' ');
return $this;
@@ -105,6 +105,7 @@ public function transform() {
public function reset() {
// nothing to do as buttons contain no user input.
return $this;
}
}
@@ -82,6 +82,8 @@ public function transform() {
public function reset() {
$this->uncheck();
return $this;
}
}
@@ -484,6 +484,8 @@ public function reset() {
$this->getYearControl()->reset();
$this->getMonthControl()->reset();
$this->getDayControl()->reset();
return $this;
}
}
@@ -40,7 +40,7 @@ public function transform() {
return '';
}
public function addContentBefore($content) {
public function addContentBefore(string $content) {
$objectId = $this->getObjectId();
$this->getParent()->setContent(str_replace(
'<' . $objectId . ' />',
@@ -51,7 +51,7 @@ public function addContentBefore($content) {
return $this;
}
public function addContentAfter($content) {
public function addContentAfter(string $content) {
$objectId = $this->getObjectId();
$this->getParent()->setContent(str_replace(
'<' . $objectId . ' />',
@@ -64,6 +64,7 @@ public function addContentAfter($content) {
public function reset() {
// nothing to do as markers don't generate output
return $this;
}
}
@@ -249,6 +249,8 @@ public function getFile() {
public function reset() {
unset($_FILES[$this->getAttribute('name')]);
return $this;
}
/**
@@ -66,6 +66,7 @@ public function transform() {
public function reset() {
// nothing to do as observer tags create no visible output
return $this;
}
/**
Oops, something went wrong.

0 comments on commit 231133a

Please sign in to comment.
You can’t perform that action at this time.