| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * citeproc-php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @link        http://github.com/seboettg/citeproc-php for the source repository | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @copyright   Copyright (c) 2017 Sebastian Böttger. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license     https://opensource.org/licenses/MIT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | namespace Seboettg\CiteProc\Style\Options; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * Class GlobalOptionsTrait | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @package Seboettg\CiteProc\Style | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @author Sebastian Böttger <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | class GlobalOptions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     private $initializeWithHyphen = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * @var PageRangeFormats | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     private $pageRangeFormat; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @var DemoteNonDroppingParticle | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     private $demoteNonDroppingParticles; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * GlobalOptions constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     public function __construct(\SimpleXMLElement $node) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         /** @var \SimpleXMLElement $attribute */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         foreach ($node->attributes() as $attribute) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             switch ($attribute->getName()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |                 case 'initialize-with-hyphen': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |                     $this->initializeWithHyphen = "false" === (string) $attribute ? false : true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |                 case 'page-range-format': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                     $this->pageRangeFormat = new PageRangeFormats((string) $attribute); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |                 case 'demote-non-dropping-particle': | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |                     $this->demoteNonDroppingParticles = new DemoteNonDroppingParticle((string) $attribute); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * Specifies whether compound given names (e.g. “Jean-Luc”) should be initialized with a hyphen (“J.-L.”, value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * “true”, default) or without (“J.L.”, value “false”). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * @return bool | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 60 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |     public function isInitializeWithHyphen() | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |         return $this->initializeWithHyphen; | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * Activates expansion or collapsing of page ranges: “chicago” (“321–28”), “expanded” (e.g. “321–328”), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * “minimal” (“321–8”), or “minimal-two” (“321–28”). Delimits page ranges | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * with the “page-range-delimiter” term (introduced with CSL 1.0.1, and defaults to an en-dash). If the attribute is | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * not set, page ranges are rendered without reformatting. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @return PageRangeFormats | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     public function getPageRangeFormat() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         return $this->pageRangeFormat; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      * Sets the display and sorting behavior of the non-dropping-particle in inverted names (e.g. “Koning, W. de”). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * @return DemoteNonDroppingParticle | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     public function getDemoteNonDroppingParticles() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         return $this->demoteNonDroppingParticles; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 86 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 87 |  |  | } |