Exemple #1
0
 /**
  * Given a DOMNode representing an attribute, tries to map the data into
  * instance members.  If no mapping is defined, the name and value are
  * stored in an array.
  *
  * @param DOMNode $attribute The DOMNode attribute needed to be handled
  */
 protected function takeAttributeFromDOM($attribute)
 {
     switch ($attribute->localName) {
         case 'errorCode':
             $this->_errorCode = $attribute->nodeValue;
             break;
         case 'reason':
             $this->_reason = $attribute->nodeValue;
             break;
         case 'invalidInput':
             $this->_invalidInput = $attribute->nodeValue;
             break;
         default:
             parent::takeAttributeFromDOM($attribute);
     }
 }
Exemple #2
0
 public function testLookupNamespaceObeysParentBehavior()
 {
     $prefix = 'test';
     $testString10 = 'TEST-v1-0';
     $testString20 = 'TEST-v2-0';
     $testString11 = 'TEST-v1-1';
     $testString21 = 'TEST-v2-1';
     $testString12 = 'TEST-v1-2';
     $testString22 = 'TEST-v2-2';
     App\AbstractBase::flushNamespaceLookupCache();
     $entry = $this->service->newEntry();
     $entry->registerNamespace($prefix, $testString10, 1, 0);
     $entry->registerNamespace($prefix, $testString20, 2, 0);
     $entry->registerNamespace($prefix, $testString11, 1, 1);
     $entry->registerNamespace($prefix, $testString21, 2, 1);
     $entry->registerNamespace($prefix, $testString12, 1, 2);
     $entry->registerNamespace($prefix, $testString22, 2, 2);
     // Assumes default version (1)
     $result = $entry->lookupNamespace($prefix, 1, null);
     $this->assertEquals($testString12, $result);
     $result = $entry->lookupNamespace($prefix, 2, null);
     $this->assertEquals($testString22, $result);
     $result = $entry->lookupNamespace($prefix, 1, 1);
     $this->assertEquals($testString11, $result);
     $result = $entry->lookupNamespace($prefix, 2, 1);
     $this->assertEquals($testString21, $result);
     $result = $entry->lookupNamespace($prefix, null, null);
     $this->assertEquals($testString12, $result);
     $result = $entry->lookupNamespace($prefix, null, 1);
     $this->assertEquals($testString11, $result);
     // Override to retrieve latest version
     $entry->setMajorProtocolVersion(null);
     $result = $entry->lookupNamespace($prefix, null, null);
     $this->assertEquals($testString22, $result);
     $result = $entry->lookupNamespace($prefix, null, 1);
     $this->assertEquals($testString21, $result);
 }
 /**
  * Get the full version of a namespace prefix
  *
  * Looks up a prefix (atom:, etc.) in the list of registered
  * namespaces and returns the full namespace URI if
  * available. Returns the prefix, unmodified, if it's not
  * registered.
  *
  * The current entry or feed's version will be used when performing the
  * namespace lookup unless overridden using $majorVersion and
  * $minorVersion. If the entry/fee has a null version, then the latest
  * protocol version will be used by default.
  *
  * @param string $prefix The namespace prefix to lookup.
  * @param integer $majorVersion The major protocol version in effect.
  *        Defaults to null (auto-select).
  * @param integer $minorVersion The minor protocol version in effect.
  *        Defaults to null (auto-select).
  * @return string
  */
 public function lookupNamespace($prefix, $majorVersion = null, $minorVersion = null)
 {
     // Auto-select current version
     if ($majorVersion === null) {
         $majorVersion = $this->getMajorProtocolVersion();
     }
     if ($minorVersion === null) {
         $minorVersion = $this->getMinorProtocolVersion();
     }
     // Perform lookup
     return parent::lookupNamespace($prefix, $majorVersion, $minorVersion);
 }