Skip to content

Commit

Permalink
Optim : array_push with single element
Browse files Browse the repository at this point in the history
  • Loading branch information
s-renier-taonix-fr authored and f3l1x committed Feb 13, 2023
1 parent 9971304 commit 822136a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ function schemaStartElement($parser, $name, $attrs)
$this->xdebug("do nothing for element $name");
break;
case 'complexType':
array_push($this->complexTypeStack, $this->currentComplexType);
$this->complexTypeStack[] = $this->currentComplexType;
if (isset($attrs['name'])) {
// TODO: what is the scope of named complexTypes that appear
// nested within other c complexTypes?
Expand Down Expand Up @@ -1473,7 +1473,7 @@ function schemaStartElement($parser, $name, $attrs)
$this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false';
break;
case 'element':
array_push($this->elementStack, $this->currentElement);
$this->elementStack[] = $this->currentElement;
if (!isset($attrs['form'])) {
if ($this->currentComplexType) {
$attrs['form'] = $this->schemaInfo['elementFormDefault'];
Expand Down Expand Up @@ -1599,7 +1599,7 @@ function schemaStartElement($parser, $name, $attrs)
}
break;
case 'simpleType':
array_push($this->simpleTypeStack, $this->currentSimpleType);
$this->simpleTypeStack[] = $this->currentSimpleType;
if (isset($attrs['name'])) {
$this->xdebug("processing simpleType for name " . $attrs['name']);
$this->currentSimpleType = $attrs['name'];
Expand Down Expand Up @@ -6836,7 +6836,7 @@ function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = tru
$this->attachments = array();
foreach(preg_split("/((\r?\n)|(\r\n?))/", $xml) as $line){
if(preg_match(("/^--(.*)/"), $line, $matches)) {
array_push($this->attachments, array());
$this->attachments[] = array ();
$this->attachments[count($this->attachments)-1]['boundaryStr'] = $matches[1];
} elseif(preg_match(("/Content-Type:(.*)/"), $line, $matches)) {
$this->attachments[count($this->attachments)-1]['Content-Type'] = $matches[1];
Expand Down

0 comments on commit 822136a

Please sign in to comment.