original_string: protected function fireCallbacks($path, array $callbacks)
      {
          $namespaceStr = '';
          $namespaces   = $this->namespaces;
          $matches      = array();
          $pathData     = $this->pathData[$path];
          $regex        = '/xmlns:(?P<namespace>[^=]+)="[^\"]+"/sm';
  
          // Make sure any namespaces already defined in this element are not
          // defined again
          if (preg_match_all($regex, $pathData, $matches)) {
              foreach ($matches['namespace'] as $key => $value) {
                  unset($namespaces[$value]);
              }
          }
  
          // Define all remaining namespaces on the root element
          foreach ($namespaces as $key => $val) {
              $namespaceStr .= ' xmlns:'.$key.'="'.$val.'"';
          }
  
          //Build the SimpleXMLElement object. As this is a partial XML
          //document suppress any warnings or errors that might arise
          //from invalid namespaces
          $data = new SimpleXMLElement(
              preg_replace('/^(<[^\s>]+)/', '$1'.$namespaceStr, $pathData),
              LIBXML_COMPACT | LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NOCDATA
          );
  
          //Loop through each callback. If one of them stops the parsing
          //then cease operation immediately
          foreach ($callbacks as $callback) {
              call_user_func_array($callback, array($this, $data));
  
              if (!$this->parse) {
                  return false;
              }
          }
  
          return true;
      }
code: protected function fireCallbacks($path, array $callbacks)
      {
          $namespaceStr = '';
          $namespaces   = $this->namespaces;
          $matches      = array();
          $pathData     = $this->pathData[$path];
          $regex        = '/xmlns:(?P<namespace>[^=]+)="[^\"]+"/sm';
  
          // Make sure any namespaces already defined in this element are not
          // defined again
          if (preg_match_all($regex, $pathData, $matches)) {
              foreach ($matches['namespace'] as $key => $value) {
                  unset($namespaces[$value]);
              }
          }
  
          // Define all remaining namespaces on the root element
          foreach ($namespaces as $key => $val) {
              $namespaceStr .= ' xmlns:'.$key.'="'.$val.'"';
          }
  
          //Build the SimpleXMLElement object. As this is a partial XML
          //document suppress any warnings or errors that might arise
          //from invalid namespaces
          $data = new SimpleXMLElement(
              preg_replace('/^(<[^\s>]+)/', '$1'.$namespaceStr, $pathData),
              LIBXML_COMPACT | LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NOCDATA
          );
  
          //Loop through each callback. If one of them stops the parsing
          //then cease operation immediately
          foreach ($callbacks as $callback) {
              call_user_func_array($callback, array($this, $data));
  
              if (!$this->parse) {
                  return false;
              }
          }
  
          return true;
      }
code_tokens: protected function fireCallbacks ( $ path , array $ callbacks ) { $ namespaceStr = '' ; $ namespaces = $ this -> namespaces ; $ matches = array ( ) ; $ pathData = $ this -> pathData [ $ path ] ; $ regex = '/xmlns:(?P<namespace>[^=]+)="[^\"]+"/sm' ; // Make sure any namespaces already defined in this element are not // defined again if ( preg_match_all ( $ regex , $ pathData , $ matches ) ) { foreach ( $ matches [ 'namespace' ] as $ key => $ value ) { unset ( $ namespaces [ $ value ] ) ; } } // Define all remaining namespaces on the root element foreach ( $ namespaces as $ key => $ val ) { $ namespaceStr .= ' xmlns:' . $ key . '="' . $ val . '"' ; } //Build the SimpleXMLElement object. As this is a partial XML //document suppress any warnings or errors that might arise //from invalid namespaces $ data = new SimpleXMLElement ( preg_replace ( '/^(<[^\s>]+)/' , '$1' . $ namespaceStr , $ pathData ) , LIBXML_COMPACT | LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NOCDATA ) ; //Loop through each callback. If one of them stops the parsing //then cease operation immediately foreach ( $ callbacks as $ callback ) { call_user_func_array ( $ callback , array ( $ this , $ data ) ) ; if ( ! $ this -> parse ) { return false ; } } return true ; }
docstring: Generates a SimpleXMLElement and passes it to each of the callbacks
  
  @param string $path      The path to create the SimpleXMLElement from
  @param array  $callbacks An array of callbacks to be fired.
  
  @return boolean
docstring_tokens: Generates a SimpleXMLElement and passes it to each of the callbacks