PageRenderTime 50ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/src/FluentDOM/Loader/DOMNode.php

http://github.com/ThomasWeinert/FluentDOM
PHP | 41 lines | 11 code | 4 blank | 26 comment | 2 complexity | 8226242496412ab2b45dc938d5a6e4c5 MD5 | raw file
  1. <?php
  2. /**
  3. * Load FluentDOM from DOMNode
  4. *
  5. * @version $Id$
  6. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  7. * @copyright Copyright (c) 2009 Bastian Feder, Thomas Weinert
  8. *
  9. * @package FluentDOM
  10. * @subpackage Loaders
  11. */
  12. /**
  13. * include interface
  14. */
  15. require_once(dirname(__FILE__).'/../Loader.php');
  16. /**
  17. * Load FluentDOM from DOMDocument
  18. *
  19. * @package FluentDOM
  20. * @subpackage Loaders
  21. */
  22. class FluentDOMLoaderDOMNode implements FluentDOMLoader {
  23. /**
  24. * attach existing DOMNode->ownerdocument and select the DOMNode
  25. *
  26. * @param DOMNode $source
  27. * @param string $contentType
  28. * @return DOMNode|NULL
  29. */
  30. public function load($source, &$contentType) {
  31. if ($source instanceof DOMNode && !empty($source->ownerDocument)) {
  32. return $source;
  33. }
  34. return NULL;
  35. }
  36. }
  37. ?>