/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection */ public function read($path = null) { $file = $this->file; $reader = function () use($file) { return include $file; }; $collection = $reader(); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection */ public function read($path = null) { $buffer = file_get_contents($this->file); if ($this->metadata['bom']) { $buffer = preg_replace('/^' . pack('H*', 'EFBBBF') . '/', '', $buffer); } $collection = unserialize($buffer); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection */ public function read($path = null) { $buffer = file_get_contents($this->file); if ($this->metadata['bom']) { $buffer = preg_replace('/^' . pack('H*', 'EFBBBF') . '/', '', $buffer); } $prefix = isset($this->metadata['prefix']) ? $this->metadata['prefix'] : ''; $suffix = isset($this->metadata['suffix']) ? $this->metadata['suffix'] : ''; $start = strlen($prefix); $length = strlen($buffer) - ($start + strlen($suffix)); if ($length >= 0) { $buffer = substr($buffer, $start, $length); } $collection = json_decode($buffer, $this->metadata['assoc'], $this->metadata['depth']); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection * @throws Throwable\Parse\Exception indicates that an invalid record was * encountered */ public function read($path = null) { $collection = new Common\Mutable\HashMap(); $this->each(function (Common\Mutable\HashMap $record) use($collection) { $collection->putEntries($record); }); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection * @throws Throwable\Runtime\Exception indicates that an invalid record was * encountered */ public function read($path = null) { $list = $this->metadata['list_type']; $collection = new $list(); $this->each(function (Common\Mutable\HashMap $record) use($collection) { $collection->addValue($record); }); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection */ public function read($path = null) { $buffer = file_get_contents($this->file); if ($this->metadata['bom']) { $buffer = preg_replace('/^' . pack('H*', 'EFBBBF') . '/', '', $buffer); } if (!preg_match('/^<\\?xml\\s+.+\\?>/', $buffer)) { $buffer = Core\Data\XML::declaration(Core\Data\Charset::UTF_8_ENCODING) . "\n" . $buffer; } $document = new \DOMDocument(); $document->substituteEntities = false; $document->loadXML($buffer); $collection = $this->parseWDDXPacketElement($document); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection */ public function read($path = null) { $xml = Core\Data\XML::load($this->file); $directives = $xml->getProcessingInstruction('php-marshal'); if (isset($directives['expandableProperties'])) { $this->directives->putEntry('expandableProperties', new Common\HashSet(preg_split('/\\s+/', $directives['expandableProperties']))); } $collection = $this->parseRootElement($xml); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }
/** * This method returns the processed resource as a collection. * * @access public * @param string $path the path to the value to be returned * @return mixed the resource as a collection */ public function read($path = null) { $root = Spring\Data\XML::load($this->file); $collection = $this->parseOuterObjectElements($root, $root); if ($path !== null) { $collection = Config\Helper::factory($collection)->getValue($path); } return $collection; }