コード例 #1
0
ファイル: Node.php プロジェクト: nodefortytwo/lp-test
 /**
  * Initialize a Taxonomy Node
  *
  * @param  string 	$id
  * @param  string 	$name
  * @param  array 	$children
  * @param  string  	$parent
  */
 public function __construct($id, $name, $children = [], $parent = null)
 {
     $this->id = (int) $id;
     $this->name = $name;
     $this->children = $children;
     $this->parent = (int) $parent;
     $this->slug = Utils::strSlug($name);
 }
コード例 #2
0
ファイル: Destination.php プロジェクト: nodefortytwo/lp-test
 /**
  * Construct the Class, takes a single xml fragment containing a single destination 
  *
  * @param  string  $xml
  */
 public function __construct($xml)
 {
     $xml = simplexml_load_string($xml, null, LIBXML_NOCDATA);
     $json = json_encode($xml);
     $xml = json_decode($json, TRUE);
     //flatten the data to make the mapping schema simple
     $dotnotated_array = Utils::arrayDot($xml);
     $this->id = $dotnotated_array['@attributes.atlas_id'];
     $this->title = $dotnotated_array['@attributes.title'];
     $this->slug = Utils::strSlug($dotnotated_array['@attributes.title-ascii']);
     $this->map($dotnotated_array);
 }