@@ -112,6 +112,10 @@ |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | + /** |
|
| 116 | + * @param string $csl |
|
| 117 | + * @param string $lang |
|
| 118 | + */ |
|
| 115 | 119 | private function init($csl, $lang) { |
| 116 | 120 | // define field values appropriate to your data in the csl_mapper class and un-comment the next line. |
| 117 | 121 | $this->mapper = new Mapper(); |
@@ -92,13 +92,13 @@ |
||
| 92 | 92 | * @throws \Exception |
| 93 | 93 | */ |
| 94 | 94 | public static function loadStyleSheet($name) { |
| 95 | - include_once __DIR__.'/../vendorPath.php'; |
|
| 95 | + include_once __DIR__ . '/../vendorPath.php'; |
|
| 96 | 96 | |
| 97 | 97 | if (!($vendorPath = vendorPath())) { |
| 98 | 98 | throw new \Exception('Error: vendor path not found. Use composer to initialize your project'); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - return file_get_contents($vendorPath.'/academicpuma/styles/'.$name.'.csl'); |
|
| 101 | + return file_get_contents($vendorPath . '/academicpuma/styles/' . $name . '.csl'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -35,6 +35,9 @@ |
||
| 35 | 35 | parent::initFormatting(); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $mode |
|
| 40 | + */ |
|
| 38 | 41 | public function render($data, $mode = null) |
| 39 | 42 | { |
| 40 | 43 | //$text = ''; |
@@ -91,6 +91,9 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | protected $styleLocale; |
| 93 | 93 | |
| 94 | + /** |
|
| 95 | + * @param string $lang |
|
| 96 | + */ |
|
| 94 | 97 | private static function getLocalesFileName($lang) { |
| 95 | 98 | |
| 96 | 99 | include_once __DIR__.'/../vendorPath.php'; |
@@ -136,6 +139,10 @@ discard block |
||
| 136 | 139 | } |
| 137 | 140 | } |
| 138 | 141 | |
| 142 | + /** |
|
| 143 | + * @param string $type |
|
| 144 | + * @param string $arg3 |
|
| 145 | + */ |
|
| 139 | 146 | public function locale($type, $arg1, $arg2 = NULL, $arg3 = NULL) { |
| 140 | 147 | |
| 141 | 148 | switch ($type) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | private static function getLocalesFileName($lang) { |
| 95 | 95 | |
| 96 | - include_once __DIR__.'/../vendorPath.php'; |
|
| 96 | + include_once __DIR__ . '/../vendorPath.php'; |
|
| 97 | 97 | |
| 98 | 98 | if (!($vendorPath = vendorPath())) { |
| 99 | 99 | throw new \Exception('Error: vendor path not found. Use composer to initialize your project'); |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $localeFile = null; |
| 103 | 103 | |
| 104 | - if(isset(self::$langBase[$lang])) { |
|
| 105 | - $localeFile = file_get_contents($vendorPath.'/academicpuma/locales/locales-' . self::$langBase[$lang] . '.xml'); |
|
| 104 | + if (isset(self::$langBase[$lang])) { |
|
| 105 | + $localeFile = file_get_contents($vendorPath . '/academicpuma/locales/locales-' . self::$langBase[$lang] . '.xml'); |
|
| 106 | 106 | } else { |
| 107 | - $localeFile = file_get_contents($vendorPath.'/academicpuma/locales/locales-en-US.xml'); |
|
| 107 | + $localeFile = file_get_contents($vendorPath . '/academicpuma/locales/locales-en-US.xml'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $localeFile; |
@@ -306,6 +306,9 @@ |
||
| 306 | 306 | $print, $punct, $space, $upper, $word, $patternModifiers); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | + /** |
|
| 310 | + * @return string |
|
| 311 | + */ |
|
| 309 | 312 | protected function format($text, $part = 'base') |
| 310 | 313 | { |
| 311 | 314 | |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | |
| 170 | 170 | if ($this->form == 'count') { |
| 171 | 171 | if (!$et_al_triggered) { |
| 172 | - return (int)count($authors); |
|
| 172 | + return (int) count($authors); |
|
| 173 | 173 | } else { |
| 174 | - return (int)(count($authors) - 1); |
|
| 174 | + return (int) (count($authors) - 1); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | // strip out the last delimiter if not required |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | if (empty(HierAttributes::$arr)) { |
| 57 | 57 | $refClass = new \ReflectionClass('\AcademicPuma\CiteProc\HierAttributes'); |
| 58 | 58 | $constants = $refClass->getConstants(); |
| 59 | - array_walk($constants, function ($value) { |
|
| 59 | + array_walk($constants, function($value) { |
|
| 60 | 60 | HierAttributes::$arr[$value] = $value; |
| 61 | 61 | }); |
| 62 | 62 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $element_count++; |
| 37 | 37 | if (($element instanceof Text) && |
| 38 | 38 | ($element->source == 'term' || |
| 39 | - $element->source == 'value' )) { |
|
| 39 | + $element->source == 'value')) { |
|
| 40 | 40 | $terms++; |
| 41 | 41 | } |
| 42 | 42 | if (($element instanceof Label)) { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | //give the text parts a name |
| 65 | - if($element instanceof Text) { |
|
| 65 | + if ($element instanceof Text) { |
|
| 66 | 66 | $text_parts[$element->getVar()] = $text; |
| 67 | 67 | } else { |
| 68 | 68 | $text_parts[$element_count] = $text; |
@@ -26,27 +26,27 @@ |
||
| 26 | 26 | //$class_name = 'csl_' . str_replace('-', '_', $dom_node->nodeName); |
| 27 | 27 | $className = ucfirst($dom_node->nodeName); |
| 28 | 28 | |
| 29 | - while(true) { |
|
| 29 | + while (true) { |
|
| 30 | 30 | //find '-' |
| 31 | 31 | $pos = strpos($className, '-'); |
| 32 | - if($pos === false) { |
|
| 32 | + if ($pos === false) { |
|
| 33 | 33 | break; |
| 34 | 34 | } |
| 35 | 35 | //replace '-' and transform to camel case |
| 36 | - $className = substr($className, 0, $pos) . ucfirst(substr($className, $pos+1)); |
|
| 36 | + $className = substr($className, 0, $pos) . ucfirst(substr($className, $pos + 1)); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // |
| 40 | - switch($className) { |
|
| 40 | + switch ($className) { |
|
| 41 | 41 | case 'If': |
| 42 | 42 | case 'Else': |
| 43 | 43 | case 'ElseIf': |
| 44 | - $className = 'P'.$className; |
|
| 44 | + $className = 'P' . $className; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $className = 'AcademicPuma\\CiteProc\\'.$className; |
|
| 47 | + $className = 'AcademicPuma\\CiteProc\\' . $className; |
|
| 48 | 48 | |
| 49 | - if(!class_exists($className)) { |
|
| 49 | + if (!class_exists($className)) { |
|
| 50 | 50 | new \Exception("Class \"$className\" does not exist."); |
| 51 | 51 | } |
| 52 | 52 | return new $className($dom_node, $citeproc); |