original_string: public function fromXml(string $xml): array
      {
          if (!$this->isEmptyValue($xml)) {
  
              libxml_use_internal_errors(true);
  
              // convert string to xml object
              $result = simplexml_load_string("$xml", 'SimpleXMLElement', LIBXML_NOCDATA);
  
              if ($result) {
                  return $this->fromClass($result);
  
              } else {
  
                  foreach (libxml_get_errors() as $error) {
  
                      // if don`t have container add that`s
                      if ($error->code == 5) {
                          $this->errors = [];
  
                          // append container and parse again
                          return $this->fromXml("<DATA>$xml</DATA>");
  
                      } else
                          $this->setError($error->code, $error->message);
                  }
              }
          }
  
          return $this->result;
      }
code: public function fromXml(string $xml): array
      {
          if (!$this->isEmptyValue($xml)) {
  
              libxml_use_internal_errors(true);
  
              // convert string to xml object
              $result = simplexml_load_string("$xml", 'SimpleXMLElement', LIBXML_NOCDATA);
  
              if ($result) {
                  return $this->fromClass($result);
  
              } else {
  
                  foreach (libxml_get_errors() as $error) {
  
                      // if don`t have container add that`s
                      if ($error->code == 5) {
                          $this->errors = [];
  
                          // append container and parse again
                          return $this->fromXml("<DATA>$xml</DATA>");
  
                      } else
                          $this->setError($error->code, $error->message);
                  }
              }
          }
  
          return $this->result;
      }
code_tokens: public function fromXml ( string $ xml ) : array { if ( ! $ this -> isEmptyValue ( $ xml ) ) { libxml_use_internal_errors ( true ) ; // convert string to xml object $ result = simplexml_load_string ( "$xml" , 'SimpleXMLElement' , LIBXML_NOCDATA ) ; if ( $ result ) { return $ this -> fromClass ( $ result ) ; } else { foreach ( libxml_get_errors ( ) as $ error ) { // if don`t have container add that`s if ( $ error -> code == 5 ) { $ this -> errors = [ ] ; // append container and parse again return $ this -> fromXml ( "<DATA>$xml</DATA>" ) ; } else $ this -> setError ( $ error -> code , $ error -> message ) ; } } } return $ this -> result ; }
docstring: Convert xml to array
  
  @param string $xml
  @return array|mixed
docstring_tokens: Convert xml to array