Skip to content
Commits on Source (5)
......@@ -16,9 +16,6 @@
/**
* Class ilAccessibilityDocumentCriterionAssignment
*/
//TODO PHP8-REVIEW: check undefined methods
//Method 'setAssignedTs' is undefined
//Method 'setModificationTs' is undefined
class ilAccessibilityDocumentCriterionAssignment extends ActiveRecord implements ilAccessibilityEvaluableCriterion, ilAccessibilityEquatable
{
public const TABLE_NAME = 'acc_criterion_to_doc';
......@@ -97,7 +94,6 @@ class ilAccessibilityDocumentCriterionAssignment extends ActiveRecord implements
public function create() : void
{
//TODO PHP8-REVIEW: check undefined method 'setAssignedTs'
$this->setAssignedTs(time());
parent::create();
......@@ -105,7 +101,6 @@ class ilAccessibilityDocumentCriterionAssignment extends ActiveRecord implements
public function update()
{
//TODO PHP8-REVIEW: check undefined method 'setModificationTs'
$this->setModificationTs(time());
parent::update();
......
......@@ -57,9 +57,7 @@ class ilAccessibilityDocumentCriterionAssignmentConstraint extends Constraint
return array_filter(
$otherValues,
function (ilAccessibilityDocumentCriterionAssignment $otherValue) use ($value) {
//TODO PHP8-REVIEW: check undefined method 'getId()'
$idCurrent = $otherValue->getId();
//TODO PHP8-REVIEW: check undefined method 'getId()'
$idNew = $value->getId();
$uniqueIdEquals = $idCurrent === $idNew;
......
......@@ -135,7 +135,6 @@ class ilAccessibilityDocument extends ActiveRecord implements ilAccessibilitySig
public function create() : void
{
//TODO PHP8-REVIEW: check undefined method 'setCreationTs'
$this->setCreationTs(time());
parent::create();
......
......@@ -22,14 +22,6 @@ use ILIAS\FileUpload\Location;
/**
* Class ilAccessibilityDocumentFormGUI
*/
//TODO PHP8-REVIEW: check undefined methods
//Method 'getId' is undefined
//Method 'getTitle' is undefined
//Method 'setText' is undefined
//Method 'setTitle' is undefined
//Method 'setLastModifiedUsrId' is undefined
//Method 'setOwnerUsrId' is undefined
//Method 'setSorting' is undefined
class ilAccessibilityDocumentFormGUI extends ilPropertyFormGUI
{
protected ilAccessibilityDocument $document;
......@@ -41,8 +33,7 @@ class ilAccessibilityDocumentFormGUI extends ilPropertyFormGUI
protected string $cancelCommand;
protected bool $isEditable = false;
protected string $translatedError = '';
//TODO PHP8-Review: Missing property's type declaration
protected $translatedInfo = '';
protected string $translatedInfo = '';
protected ilHtmlPurifierInterface $documentPurifier;
public function __construct(
......
......@@ -22,10 +22,6 @@ use ILIAS\UI\Renderer;
/**
* Class ilAccessibilityDocumentGUI
*/
//TODO PHP8-REVIEW: check undefined methods
//Method 'getId' is undefined
//Method 'getTitle' is undefined
//Method 'setSorting' is undefined
class ilAccessibilityDocumentGUI implements ilAccessibilityControllerEnabled
{
protected ilAccessibilityTableDataProviderFactory $tableDataProviderFactory;
......
......@@ -19,12 +19,6 @@ use ILIAS\UI\Renderer;
/**
* Class ilAccessibilityDocumentTableGUI
*/
//TODO PHP8-REVIEW: check undefined methods
//Method 'getTitle' is undefined
//Method 'getCreationTs' is undefined
//Method 'getModificationTs' is undefined
//Method 'getText' is undefined
//Method 'getId' is undefined
class ilAccessibilityDocumentTableGUI extends ilAccessibilityTableGUI
{
protected ILIAS\UI\Factory $uiFactory;
......
......@@ -29,10 +29,7 @@ class ilSaxController
* @var resource
*/
protected $handler_in_use = null;
/**
* @var ?ilSaxSubsetParser
*/
protected $current_handler;
protected ?ilSaxSubsetParser $current_handler;
/**
* Set handlers
......@@ -64,16 +61,6 @@ class ilSaxController
$this->handlers_in_use[$a_element] = false;
}
/**
* Set default element handler
*
* @access public
* @param string xml element that triggers the handler call
* @param object object that parses the xmlsubset
* @param string method name
*
*/
/**
* default handlerBeginTag
*
......@@ -82,8 +69,7 @@ class ilSaxController
* @param string $a_name element name
* @param array $a_attribs element attributes array
*/
public function handlerBeginTag($a_xml_parser, string $a_name, array
$a_attribs) :void
public function handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs) :void
{
if (isset($this->element_handlers[$a_name]) or $this->handler_in_use) {
if (!$this->handler_in_use) {
......
......@@ -128,7 +128,7 @@ abstract class ilSaxParser
}
/**
* @param $a_xml_parser
* @param XMLParser|resource $a_xml_parser
* @return void
*/
abstract public function setHandlers($a_xml_parser) : void;
......
......@@ -27,7 +27,7 @@
*/
class ilXmlWriter
{
private string $xmlStr = "";
private string $xmlStr;
private string $version;
......
<?php declare(strict_types=1);
/******************************************************************************
*
* This file is part of ILIAS, a powerful learning management system.
*
* ILIAS is licensed with the GPL-3.0, you should have received a copy
* of said license along with the source code.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*****************************************************************************/
use PHPUnit\Framework\TestSuite;
require_once 'libs/composer/vendor/autoload.php';
class ilServicesXmlSuite extends TestSuite
{
public static function suite() : self
{
$suite = new self();
require_once("./Services/Xml/test/ilServicesXmlTest.php");
$suite->addTestSuite("ilServicesXmlTest");
return $suite;
}
}
<?php declare(strict_types=1);
/******************************************************************************
*
* This file is part of ILIAS, a powerful learning management system.
*
* ILIAS is licensed with the GPL-3.0, you should have received a copy
* of said license along with the source code.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*****************************************************************************/
use PHPUnit\Framework\TestCase;
use ILIAS\DI\Container;
class ilServicesXmlTest extends TestCase
{
public function testHeader() : void
{
$writer = new ilXmlWriter();
$writer->xmlHeader();
$this->assertEquals(
$this->brutallyTrim("<?xml version=\"1.0\" encoding=\"utf-8\"?><!--Generated by ILIAS XmlWriter-->"),
$this->brutallyTrim($writer->xmlDumpMem())
);
}
public function testStartEndTag() : void
{
$writer = new ilXmlWriter();
$writer->xmlStartTag('lorem');
$writer->xmlEndTag('lorem');
$this->assertEquals(
$this->brutallyTrim("<lorem></lorem>"),
$this->brutallyTrim($writer->xmlDumpMem())
);
}
public function testElements() : void
{
$writer = new ilXmlWriter();
$writer->xmlStartTag('lorem');
$writer->xmlElement('ipsum', ['attr1' => 1], 'data1');
$writer->xmlElement('dolor', ['attr2' => 2, 'attr3' => 3], 'data2');
$writer->xmlEndTag('lorem');
$this->assertEquals(
$this->brutallyTrim(
"<lorem><ipsum attr1=\"1\"> data1</ipsum><dolor attr2=\"2\" attr3=\"3\"> data2</dolor></lorem>"
),
$this->brutallyTrim($writer->xmlDumpMem())
);
}
protected function brutallyTrim(string $string) : string
{
$string = str_replace(["\n", "\r", "\t"], "", $string);
$string = preg_replace('# {2,}#', " ", $string);
$string = preg_replace("/>(\s+)</", "><", $string);
$string = str_replace(" >", ">", $string);
$string = str_replace(" <", "<", $string);
return trim($string);
}
}