O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:"*hash";s:32:"d839075028e3268b4196350cae195bbc";s:7:"*path";s:20:"OaiPmh/SetLoader.php";s:9:"*source";s:3916:" * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/indexing:oai-pmh Wiki */ namespace VuFindHarvest\OaiPmh; use VuFindHarvest\ConsoleOutput\WriterAwareTrait; /** * OAI-PMH Harvest Tool * * @category VuFind * @package Harvest_Tools * @author Demian Katz * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/indexing:oai-pmh Wiki */ class SetLoader { use WriterAwareTrait; /** * Low-level OAI-PMH communicator * * @var Communicator */ protected $communicator; /** * Constructor. * * @param Communicator $communicator Low-level API client */ public function __construct(Communicator $communicator) { $this->communicator = $communicator; } /** * Make an OAI-PMH request. Die if there is an error; return a SimpleXML object * on success. * * @param string $verb OAI-PMH verb to execute. * @param array $params GET parameters for ListRecords method. * * @return object SimpleXML-formatted response. */ protected function sendRequest($verb, $params = []) { $result = $this->communicator->request($verb, $params); // Detect errors and die if one is found: if ($result->error) { $attribs = $result->error->attributes(); throw new \Exception( "OAI-PMH error -- code: {$attribs['code']}, " . "value: {$result->error}" ); } return $result; } /** * Load set list from the server. * * @return array */ public function getNames() { $this->write("Loading set list... "); // On the first pass through the following loop, we want to get the // first page of sets without using a resumption token: $params = []; $setNames = []; // Grab set information until we have it all (at which point we will // break out of this otherwise-infinite loop): do { // Process current page of results: $response = $this->sendRequest('ListSets', $params); if (isset($response->ListSets->set)) { foreach ($response->ListSets->set as $current) { $spec = (string)$current->setSpec; $name = (string)$current->setName; if (!empty($spec)) { $setNames[$spec] = $name; } } } // Is there a resumption token? If so, continue looping; if not, // we're done! $params['resumptionToken'] = !empty($response->ListSets->resumptionToken) ? (string)$response->ListSets->resumptionToken : ''; } while (!empty($params['resumptionToken'])); $this->writeLine("found " . count($setNames)); return $setNames; } } ";s:19:"*namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:16:"WriterAwareTrait";s:45:"\VuFindHarvest\ConsoleOutput\WriterAwareTrait";}}s:11:"*includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:12:"*constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:12:"*functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:10:"*classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:31:"\VuFindHarvest\OaiPmh\SetLoader";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:"*parent";s:0:"";s:13:"*implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:11:"*abstract";b:0;s:8:"*final";b:0;s:12:"*constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:13:"*properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:12:"communicator";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:"*parent";r:16;s:8:"*types";N;s:10:"*default";N;s:9:"*static";b:0;s:13:"*visibility";s:9:"protected";s:8:"*fqsen";s:45:"\VuFindHarvest\OaiPmh\SetLoader::communicator";s:7:"*name";s:12:"communicator";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:30:"Low-level OAI-PMH communicator";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:50;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:"*variableName";s:0:"";s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:34:"\VuFindHarvest\OaiPmh\Communicator";}}}s:7:"*name";s:3:"var";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:10:"*methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:3:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:16;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{s:13:"$communicator";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:"*method";r:59;s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:34:"\VuFindHarvest\OaiPmh\Communicator";}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:13:"$communicator";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:20:"Low-level API client";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:46:"\VuFindHarvest\OaiPmh\SetLoader::__construct()";s:7:"*name";s:11:"__construct";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:12:"Constructor.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:57;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:13:"$communicator";s:8:"*types";r:69;s:7:"*name";s:5:"param";s:14:"*description";s:20:"Low-level API client";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:11:"sendRequest";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:16;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:9:"protected";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"$verb";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:"*method";r:113;s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:"*default";N;s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:5:"$verb";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:24:"OAI-PMH verb to execute.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:7:"$params";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:"*method";r:113;s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"array";}}}s:10:"*default";s:7:"array()";s:14:"*byReference";b:0;s:13:"*isVariadic";b:0;s:8:"*fqsen";s:0:"";s:7:"*name";s:7:"$params";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:0:"";s:14:"*description";s:38:"GET parameters for ListRecords method.";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:8:"*fqsen";s:46:"\VuFindHarvest\OaiPmh\SetLoader::sendRequest()";s:7:"*name";s:11:"sendRequest";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:89:"Make an OAI-PMH request. Die if there is an error; return a SimpleXML object on success.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:71;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:5:"$verb";s:8:"*types";r:123;s:7:"*name";s:5:"param";s:14:"*description";s:24:"OAI-PMH verb to execute.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}i:1;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:"*variableName";s:7:"$params";s:8:"*types";r:144;s:7:"*name";s:5:"param";s:14:"*description";s:38:"GET parameters for ListRecords method.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:6:"object";}}}s:7:"*name";s:6:"return";s:14:"*description";s:29:"SimpleXML-formatted response.";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}s:8:"getNames";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:"*parent";r:16;s:11:"*abstract";b:0;s:8:"*final";b:0;s:9:"*static";b:0;s:13:"*visibility";s:6:"public";s:12:"*arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:8:"*fqsen";s:43:"\VuFindHarvest\OaiPmh\SetLoader::getNames()";s:7:"*name";s:8:"getNames";s:12:"*namespace";N;s:10:"*package";s:0:"";s:10:"*summary";s:30:"Load set list from the server.";s:14:"*description";s:0:"";s:17:"*fileDescriptor";N;s:7:"*line";i:90;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:"*types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:"*name";s:5:"array";}}}s:7:"*name";s:6:"return";s:14:"*description";s:0:"";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:13:"*usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;s:45:"\VuFindHarvest\ConsoleOutput\WriterAwareTrait";}}s:8:"*fqsen";s:31:"\VuFindHarvest\OaiPmh\SetLoader";s:7:"*name";s:9:"SetLoader";s:12:"*namespace";s:21:"\VuFindHarvest\OaiPmh";s:10:"*package";s:13:"Harvest_Tools";s:10:"*summary";s:20:"OAI-PMH Harvest Tool";s:14:"*description";s:0:"";s:17:"*fileDescriptor";r:1;s:7:"*line";i:41;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:6:{s:8:"category";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:8:"category";s:14:"*description";s:6:"VuFind";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:7:"package";s:14:"*description";s:13:"Harvest_Tools";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"author";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\AuthorDescriptor":3:{s:7:"*name";s:6:"author";s:14:"*description";s:39:"Demian Katz ";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:7:"license";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:7:"license";s:14:"*description";s:69:"http://opensource.org/licenses/gpl-2.0.php GNU General Public License";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:4:"link";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:43:"phpDocumentor\Descriptor\Tag\LinkDescriptor":4:{s:7:"*link";s:40:"https://vufind.org/wiki/indexing:oai-pmh";s:7:"*name";s:4:"link";s:14:"*description";s:4:"Wiki";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}}}s:13:"*interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:9:"*traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:10:"*markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:8:"*fqsen";s:0:"";s:7:"*name";s:13:"SetLoader.php";s:12:"*namespace";N;s:10:"*package";s:13:"Harvest_Tools";s:10:"*summary";s:20:"OAI-PMH Harvest Tool";s:14:"*description";s:667:"PHP version 7 Copyright (c) Demian Katz 2010. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA";s:17:"*fileDescriptor";N;s:7:"*line";i:0;s:7:"*tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:6:{s:8:"category";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:8:"category";s:14:"*description";s:6:"VuFind";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:7:"package";s:14:"*description";s:13:"Harvest_Tools";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:6:"author";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\AuthorDescriptor":3:{s:7:"*name";s:6:"author";s:14:"*description";s:39:"Demian Katz ";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:7:"license";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:"*name";s:7:"license";s:14:"*description";s:69:"http://opensource.org/licenses/gpl-2.0.php GNU General Public License";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:4:"link";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:1:{i:0;O:43:"phpDocumentor\Descriptor\Tag\LinkDescriptor":4:{s:7:"*link";s:40:"https://vufind.org/wiki/indexing:oai-pmh";s:7:"*name";s:4:"link";s:14:"*description";s:4:"Wiki";s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}}}s:9:"*errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:"*items";a:0:{}}s:19:"*inheritedElement";N;}