Skip to content
Snippets Groups Projects
Commit d82278bf authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Checkstyles.

parent f347c167
No related merge requests found
......@@ -65,7 +65,6 @@ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface
* Constructor
*
* @param \Zend\Config\Config $config config
* @param \VuFind\Search\BackendManager $backend backend manager
*/
public function __construct($config)
{
......@@ -123,6 +122,8 @@ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface
/**
* Format details properly into the correct keys
*
* @param array $record
*
* @return string
*/
protected function formatDetails($record)
......@@ -154,7 +155,9 @@ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface
// Rearrange combined fields
foreach ($combinedFields as $fields) {
$main = $fields[0];
if (!isset($details[$main]['value']) || !is_array($details[$main]['value'])) {
if (!isset($details[$main]['value'])
|| !is_array($details[$main]['value'])
) {
if (isset($details[$main]['value'])) {
$details[$main]['value'] = array($details[$main]['value']);
} else {
......
......@@ -135,7 +135,8 @@ class Fedora extends AbstractBase
/**
* Get details for the sidebar on a record.
*
* @param string $id ID to retrieve
* @param string $id ID to retrieve
* @param boolean $format Send result through formatDetails?
*
* @return string
*/
......@@ -226,7 +227,9 @@ class Fedora extends AbstractBase
public function getModDate($id)
{
$query = 'select $lastModDate from <#ri> '
. 'where $member <info:fedora/fedora-system:def/view#lastModifiedDate> $lastModDate '
. 'where $member '
. '<info:fedora/fedora-system:def/view#lastModifiedDate> '
. '$lastModDate '
. 'and $member <dc:identifier> \''. $id .'\'';
$response = $this->query($query);
$list = explode("\n", $response->getBody());
......@@ -236,9 +239,9 @@ class Fedora extends AbstractBase
/**
* Returns file contents of the structmap, our most common call
*
* @param string $id record id
* @param string $root record id
*
* @return string $id
* @return array of ids
*/
public function getOrderedMembers($root)
{
......@@ -270,7 +273,7 @@ class Fedora extends AbstractBase
if ($sequenced) {
usort(
$items,
function($a, $b) {
function ($a, $b) {
return intval($a['seq'])-intval($b['seq']);
}
);
......
......@@ -40,12 +40,24 @@ use VuFindHttp\HttpServiceInterface,
*/
class Manager
{
/**
* Array of classes to try in order
*/
protected $priority;
/**
* Cache of class objects
*/
protected $connections;
/**
* Used to load class objects
*/
protected $serviceLocator;
/**
* Constructor
*/
public function __construct($priority, $sm)
{
$this->priority = $priority;
......@@ -53,7 +65,15 @@ class Manager
$this->serviceLocator = $sm;
}
protected function get($className) {
/**
* Get a class object from a classname, save in cache
*
* @param string $className Class we want to load
*
* @return object
*/
protected function get($className)
{
if (!isset($this->connections[$className])) {
$this->connections[$className] = $this->serviceLocator
->get("VuDL\\Connection\\$className");
......@@ -61,6 +81,15 @@ class Manager
return $this->connections[$className];
}
/**
* Try to call a function in each successive class
* according to priority
*
* @param string $methodName The function we want to call
* @param mixed array $params The params to pass to the func
*
* @return mixed
*/
public function __call($methodName, $params)
{
$index = 0;
......@@ -75,6 +104,8 @@ class Manager
}
$index ++;
}
throw new \Exception('VuDL Connection Failed to resolved method "'.$methodName.'"');
throw new \Exception(
'VuDL Connection Failed to resolved method "'.$methodName.'"'
);
}
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ class Solr extends AbstractBase
/**
* Constructor
*
* @param \Zend\Config\Config $config config
* @param \Zend\Config\Config $config config
* @param \VuFind\Search\BackendManager $backend backend manager
*/
public function __construct($config, $backend)
......@@ -63,7 +63,8 @@ class Solr extends AbstractBase
/**
* Get details from Solr
*
* @param string $id ID to look up
* @param string $id ID to look up
* @param boolean $format Send result through formatDetails?
*
* @return array
* @throws \Exception
......@@ -75,7 +76,7 @@ class Solr extends AbstractBase
$params = $map->getParameters('select', 'appends');
$map->setParameters('select', 'appends', array());
$details = null;
if($response = $this->solr->search(
if ($response = $this->solr->search(
new ParamBag(
array(
'q' => 'id:"'.$id.'"',
......@@ -92,7 +93,7 @@ class Solr extends AbstractBase
// Reapply the global filters
$map->setParameters('select', 'appends', $params->getArrayCopy());
return null;
}
}
/**
* Get the last modified date from Solr
......@@ -105,7 +106,7 @@ class Solr extends AbstractBase
public function getModDate($id)
{
$modfield = 'fgs.lastModifiedDate';
if($response = $this->solr->search(
if ($response = $this->solr->search(
new ParamBag(
array(
'q' => 'id:"'.$id.'"',
......@@ -245,7 +246,8 @@ class Solr extends AbstractBase
$origin->response->docs[0]->hierarchy_all_parents_str_mv
);
$ret = array();
foreach ($origin->response->docs[0]->hierarchy_parent_id as $i=>$parent) {
$hierarchyParents = $origin->response->docs[0]->hierarchy_parent_id;
foreach ($hierarchyParents as $i=>$parent) {
$ret[] = array(
$origin->response->docs[0]->hierarchy_parent_id[$i]
=> $origin->response->docs[0]->hierarchy_parent_title[$i]
......@@ -260,7 +262,9 @@ class Solr extends AbstractBase
new ParamBag(
array(
'q' => 'id:"'.$last.'"',
'fl' => 'hierarchy_top_id,hierarchy_parent_id,hierarchy_parent_title',
'fl' => 'hierarchy_top_id,'
. 'hierarchy_parent_id,'
. 'hierarchy_parent_title',
'wt' => 'json',
'group' => 'false',
)
......@@ -329,10 +333,11 @@ class Solr extends AbstractBase
$record = json_decode($response);
if ($record->response->numFound > 0) {
return array_map(
function($op) {
function ($op) {
return substr($op, 12);
},
$record->response->docs[0]->modeltype_str_mv);
$record->response->docs[0]->modeltype_str_mv
);
}
return null;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment