XML_XRD
[ class tree: XML_XRD ] [ index: XML_XRD ] [ all elements ]

Class: XML_XRD_Loader

Source Location: /XML_XRD-0.3.1/src/XML/XRD/Loader.php

Class Overview


File/string loading dispatcher.


Author(s):

Version:

  • Release: @package_version@

Methods


Inherited Variables

Inherited Methods


Class Details

[line 28]
File/string loading dispatcher.

Loads the correct loader for the type of XRD file (XML or JSON). Also provides type auto-detection.



[ Top ]


Method Detail

__construct (Constructor)   [line 35]

XML_XRD_Loader __construct( XML_XRD $xrd)

Create new instance
  • Access: public

Parameters:

XML_XRD   $xrd   —  XRD object to load

[ Top ]

detectTypeFromFile   [line 114]

string detectTypeFromFile( string $file)

Tries to detect the file type (xml or json) from the file content
  • Return: File type ('xml' or 'json')
  • Throws: XML_XRD_Loader_Exception When opening the file fails.
  • Access: public

Parameters:

string   $file   —  File name to check

[ Top ]

detectTypeFromString   [line 144]

string detectTypeFromString( string $str)

Tries to detect the file type from the content of the file
  • Return: File type ('xml' or 'json')
  • Throws: XML_XRD_Loader_Exception When the type cannot be detected
  • Access: public

Parameters:

string   $str   —  Content of XRD file

[ Top ]

getLoader   [line 90]

XML_XRD_Loader getLoader( string $type)

Creates a XRD loader object for the given type
  • Access: protected

Parameters:

string   $type   —  File type: xml or json

[ Top ]

loadFile   [line 54]

void loadFile( string $file, [string $type = null])

Loads the contents of the given file.

Note: Only use file type auto-detection for local files. Do not use it on remote files as the file gets requested several times.

  • Throws: XML_XRD_Loader_Exception When the file is invalid or cannot be loaded
  • Access: public

Parameters:

string   $file   —  Path to an XRD file
string   $type   —  File type: xml or json, NULL for auto-detection

[ Top ]

loadString   [line 74]

void loadString( string $str, [string $type = null])

Loads the contents of the given string
  • Throws: XML_XRD_Loader_Exception When the string is invalid or cannot be loaded
  • Access: public

Parameters:

string   $str   —  XRD string
string   $type   —  File type: xml or json, NULL for auto-detection

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:57:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.