/** * * @param string $policyName * @return JsonPolicyDecisionPoint */ public function loadPolicy($policyName) { $policyFileSpec = call_user_func($this->fileNameResolver, $policyName); if (strpos($policyFileSpec, '*') === FALSE) { $policyFiles = array($policyFileSpec); } else { $policyFiles = $this->phpWrapper->glob($policyFileSpec); if ($policyFiles === FALSE) { $this->getLog()->warning(sprintf('%s: invalid policy file specification `%s`', __CLASS__, $policyFileSpec)); $policyFiles = array(); } } foreach ($policyFiles as $policyFile) { $data = $this->phpWrapper->file_get_contents($policyFile); $this->loadJsonString(basename($policyFile), $data); } return $this; }
private function fetchDumpFile($dumpPath) { if (!$this->phpWrapper->file_exists($dumpPath)) { throw new \RuntimeException(sprintf("%s: could not open dump file %s", __CLASS__, $dumpPath), 1405613538); } $tmp = json_decode($this->phpWrapper->file_get_contents($dumpPath), TRUE); if (!is_array($tmp)) { throw new \RuntimeException(sprintf("%s: dump file decode error", __CLASS__), 1405613539); } return $tmp; }