本文整理匯總了PHP中Sabre\VObject\Reader::readJSON方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reader::readJSON方法的具體用法?PHP Reader::readJSON怎麽用?PHP Reader::readJSON使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sabre\VObject\Reader
的用法示例。
在下文中一共展示了Reader::readJSON方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Constructor
*
* The splitter should receive an readable file stream as it's input.
*
* @param string|resource|array $input
* @param int $options Parser options, see the OPTIONS constants.
*/
public function __construct($input, $options = 0)
{
$data = Reader::readJSON($input, $options);
$vtimezones = array();
$components = array();
foreach ($data->children() as $component) {
if (!$component instanceof Component) {
continue;
}
// Get all timezones
if ($component->name === 'VTIMEZONE') {
$this->vtimezones[(string) $component->TZID] = $component;
continue;
}
// Get component UID for recurring Events search
if (!$component->UID) {
$component->UID = sha1(microtime()) . '-vobjectimport';
}
$uid = (string) $component->UID;
// Take care of recurring events
if (!array_key_exists($uid, $this->objects)) {
$this->objects[$uid] = new VCalendar();
}
$this->objects[$uid]->add(clone $component);
}
}