Passed
Pull Request — master (#123)
by Sebastian
03:52
created
Classes/Api/Viaf/Client.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function __construct($viaf, RequestFactory $requestFactory)
67 67
     {
68 68
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69
-        $this->viafUrl = 'http://viaf.org/viaf/' . $viaf;
69
+        $this->viafUrl = 'http://viaf.org/viaf/'.$viaf;
70 70
         $this->requestFactory = $requestFactory;
71 71
     }
72 72
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         try {
93 93
             $response = $this->requestFactory->request($url);
94 94
         } catch (\Exception $e) {
95
-            $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
95
+            $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.');
96 96
             return false;
97 97
         }
98 98
         return $response->getBody()->getContents();
@@ -105,6 +105,6 @@  discard block
 block discarded – undo
105 105
      **/
106 106
     protected function getApiEndpoint()
107 107
     {
108
-        return $this->viafUrl . '/' . $this->endpoint;
108
+        return $this->viafUrl.'/'.$this->endpoint;
109 109
     }
110 110
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Client
29
-{
28
+class Client {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      * @param RequestFactory $requestFactory a request object to inject
64 63
      * @return void
65 64
      **/
66
-    public function __construct($viaf, RequestFactory $requestFactory)
67
-    {
65
+    public function __construct($viaf, RequestFactory $requestFactory) {
68 66
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69 67
         $this->viafUrl = 'http://viaf.org/viaf/' . $viaf;
70 68
         $this->requestFactory = $requestFactory;
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      *
87 85
      * @return object|bool
88 86
      **/
89
-    public function getData()
90
-    {
87
+    public function getData() {
91 88
         $url = $this->getApiEndpoint();
92 89
         try {
93 90
             $response = $this->requestFactory->request($url);
@@ -103,8 +100,7 @@  discard block
 block discarded – undo
103 100
      *
104 101
      * @return string
105 102
      **/
106
-    protected function getApiEndpoint()
107
-    {
103
+    protected function getApiEndpoint() {
108 104
         return $this->viafUrl . '/' . $this->endpoint;
109 105
     }
110 106
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @var string
49 49
      **/
50
-    private $viafUrl = null;
50
+    private $viafUrl = NULL;
51 51
 
52 52
     /**
53 53
      * The request object
54 54
      *
55 55
      * @var RequestFactoryInterface
56 56
      **/
57
-    private $requestFactory = null;
57
+    private $requestFactory = NULL;
58 58
 
59 59
     /**
60 60
      * Constructs a new instance
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $response = $this->requestFactory->request($url);
94 94
         } catch (\Exception $e) {
95 95
             $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
96
-            return false;
96
+            return FALSE;
97 97
         }
98 98
         return $response->getBody()->getContents();
99 99
     }
Please login to merge, or discard this patch.
Classes/Api/Viaf/Profile.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Profile
29
-{
28
+class Profile {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return void
59 58
      **/
60
-    public function __construct($viaf)
61
-    {
59
+    public function __construct($viaf) {
62 60
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
63 61
         $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class));
64 62
     }
@@ -68,8 +66,7 @@  discard block
 block discarded – undo
68 66
      *
69 67
      * @return array|false
70 68
      **/
71
-    public function getData()
72
-    {
69
+    public function getData() {
73 70
         $this->getRaw();
74 71
         if (!empty($this->raw)) {
75 72
             $data = [];
@@ -87,8 +84,7 @@  discard block
 block discarded – undo
87 84
      *
88 85
      * @return string|false
89 86
      **/
90
-    public function getAddress()
91
-    {
87
+    public function getAddress() {
92 88
         $this->getRaw();
93 89
         if (!empty($this->raw->asXML())) {
94 90
             return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0];
@@ -103,8 +99,7 @@  discard block
 block discarded – undo
103 99
      *
104 100
      * @return string|false
105 101
      **/
106
-    public function getFullName()
107
-    {
102
+    public function getFullName() {
108 103
         $this->getRaw();
109 104
         if (!empty($this->raw->asXML())) {
110 105
             $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text');
@@ -122,8 +117,7 @@  discard block
 block discarded – undo
122 117
      *
123 118
      * @return void
124 119
      **/
125
-    protected function getRaw()
126
-    {
120
+    protected function getRaw() {
127 121
         $data = $this->client->getData();
128 122
         if (!isset($this->raw) && $data != false) {
129 123
             $this->raw = Helper::getXmlFileAsString($data);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var \SimpleXmlElement|false
50 50
      **/
51
-    private $raw = null;
51
+    private $raw = NULL;
52 52
 
53 53
     /**
54 54
      * Constructs client instance
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             return $data;
79 79
         } else {
80 80
             $this->logger->warning('No data found for given VIAF URL');
81
-            return false;
81
+            return FALSE;
82 82
         }
83 83
     }
84 84
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0];
95 95
         } else {
96 96
             $this->logger->warning('No address found for given VIAF URL');
97
-            return false;
97
+            return FALSE;
98 98
         }
99 99
     }
100 100
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             return $name;
114 114
         } else {
115 115
             $this->logger->warning('No name found for given VIAF URL');
116
-            return false;
116
+            return FALSE;
117 117
         }
118 118
     }
119 119
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     protected function getRaw()
126 126
     {
127 127
         $data = $this->client->getData();
128
-        if (!isset($this->raw) && $data != false) {
128
+        if (!isset($this->raw) && $data != FALSE) {
129 129
             $this->raw = Helper::getXmlFileAsString($data);
130 130
             $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#');
131 131
         }
Please login to merge, or discard this patch.