Skip to content

Commit 6b5df2b

Browse files
committed
Fix add properties
1 parent 3ea5fb9 commit 6b5df2b

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

src/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Configuration implements ConfigurationInterface
5151
/**
5252
* @var array references to external elemental properties that are set as references
5353
*/
54-
protected $properties = [];
54+
public $properties = [];
5555

5656
/**
5757
* @var array methods that are automatically invoked within all elements that feature method

src/Element/AbstractElement.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ abstract class AbstractElement
5555
*/
5656
public $search_index = true;
5757

58-
/**
59-
* @var string maximum results of data pulled
60-
*/
61-
public $max_results = '240';
62-
6358
/**
6459
* @var array ancestor public variable updated live
6560
*/
@@ -88,7 +83,7 @@ final public function __construct(ArgumentArray $args = null, array &$dynamic_pr
8883
if(property_exists($this, $property_name)){
8984
throw Exception('Property already exists.');
9085
}
91-
$this->$property_name &= $property_value;
86+
$this->$property_name = &$property_value;
9287
}
9388
}
9489

src/Engine.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use DOMElement;
1616
use DOMNodeList;
1717
use DOMXPath;
18+
use Ouxsoft\PHPMarkup\Contract\ConfigurationInterface;
1819
use Ouxsoft\PHPMarkup\Contract\DocumentInterface;
1920
use Ouxsoft\PHPMarkup\Contract\ElementPoolInterface;
2021
use Ouxsoft\PHPMarkup\Contract\EngineInterface;
@@ -48,9 +49,10 @@ class Engine implements EngineInterface
4849
public $element_pool;
4950

5051
/**
51-
* @var array contains additional Element construction parameters that are loaded as properties
52+
* @var ConfigurationInterface
53+
* contains array with dditional Element construction parameters that are loaded as properties
5254
*/
53-
private $element_properties = [];
55+
private $config;
5456

5557
/**
5658
* EngineInterface constructor.
@@ -61,13 +63,13 @@ class Engine implements EngineInterface
6163
public function __construct(
6264
DocumentInterface &$document,
6365
ElementPoolInterface &$element_pool,
64-
Configuration &$config
66+
ConfigurationInterface &$config
6567
){
6668
$this->dom = &$document;
6769

6870
$this->element_pool = &$element_pool;
6971

70-
$this->element_properties = $config->getProperties();
72+
$this->config = &$config;
7173
}
7274

7375
/**
@@ -325,7 +327,7 @@ private function instantiateElement(DOMElement $element, string $class_name): bo
325327
$element_args = $this->getElementArgs($element);
326328

327329
// instantiate element
328-
$element_object = new $class_name($element_args, $this->element_properties);
330+
$element_object = new $class_name($element_args, $this->config->properties);
329331

330332
// set element object placeholder
331333
$element->setAttribute(self::INDEX_ATTRIBUTE, $element_object->element_id);

src/Processor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function addElements(array $elements): void
142142
* @param string $property_name
143143
* @param $property_value
144144
*/
145-
public function addProperty(string $property_name, $property_value): void
145+
public function addProperty(string $property_name, &$property_value): void
146146
{
147147
$this->config->addProperty($property_name, $property_value);
148148
}
@@ -152,7 +152,7 @@ public function addProperty(string $property_name, $property_value): void
152152
*
153153
* @param array $properties
154154
*/
155-
public function addProperties(array $properties) : void
155+
public function addProperties(array &$properties) : void
156156
{
157157
$this->config->addProperties($properties);
158158
}

0 commit comments

Comments
 (0)