Test Setup Failed
Push — master ( 3c5964...ba530c )
by Simon
15:31
created
ext_emconf.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -22,33 +22,33 @@
 block discarded – undo
22 22
  */
23 23
 
24 24
 $EM_CONF[$_EXTKEY] = [
25
-    'title' => 'GS Library',
26
-    'description' => 'GS Library is a collection of utility functions, base classes and other templates for the usage in other extensions.',
27
-    'version' => '0.0.9',
28
-    'category' => 'misc',
29
-    'constraints' => [
30
-        'depends' => [
31
-            'php' => '7.0.0-7.2.99',
32
-            'typo3' => '8.7.0-9.5.99',
33
-        ],
34
-        'conflicts' => [],
35
-        'suggests' => [],
36
-    ],
37
-    'state' => 'beta',
38
-    'uploadfolder' => 0,
39
-    'createDirs' => '',
40
-    'clearCacheOnLoad' => 0,
41
-    'author' => 'Simon Gilli',
42
-    'author_email' => '[email protected]',
43
-    'author_company' => 'Gilbertsoft',
44
-    'autoload' => [
45
-        'psr-4' => [
46
-            'Gilbertsoft\\Lib\\' => 'Classes',
47
-        ],
48
-    ],
49
-    'autoload-dev' => [
50
-        'psr-4' => [
51
-            'Gilbertsoft\\Lib\\Tests\\' => 'Tests',
52
-        ],
53
-    ],
25
+	'title' => 'GS Library',
26
+	'description' => 'GS Library is a collection of utility functions, base classes and other templates for the usage in other extensions.',
27
+	'version' => '0.0.9',
28
+	'category' => 'misc',
29
+	'constraints' => [
30
+		'depends' => [
31
+			'php' => '7.0.0-7.2.99',
32
+			'typo3' => '8.7.0-9.5.99',
33
+		],
34
+		'conflicts' => [],
35
+		'suggests' => [],
36
+	],
37
+	'state' => 'beta',
38
+	'uploadfolder' => 0,
39
+	'createDirs' => '',
40
+	'clearCacheOnLoad' => 0,
41
+	'author' => 'Simon Gilli',
42
+	'author_email' => '[email protected]',
43
+	'author_company' => 'Gilbertsoft',
44
+	'autoload' => [
45
+		'psr-4' => [
46
+			'Gilbertsoft\\Lib\\' => 'Classes',
47
+		],
48
+	],
49
+	'autoload-dev' => [
50
+		'psr-4' => [
51
+			'Gilbertsoft\\Lib\\Tests\\' => 'Tests',
52
+		],
53
+	],
54 54
 ];
Please login to merge, or discard this patch.
Classes/Utility/StorageRepositoryUtility.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -34,135 +34,135 @@
 block discarded – undo
34 34
  */
35 35
 class StorageRepositoryUtility
36 36
 {
37
-    /**
38
-     * @const string Suffix added to storage name
39
-     */
40
-    const STORAGE_SUFFIX = '/ (auto-created)';
41
-
42
-    /**
43
-     * Get the storage repository
44
-     *
45
-     * @return \TYPO3\CMS\Core\Resource\StorageRepository
46
-     */
47
-    public static function getStorageRepository()
48
-    {
49
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
50
-    }
51
-
52
-    /**
53
-     * Searches for a local storage.
54
-     *
55
-     * @param string $name Local storage name
56
-     * @return NULL|\TYPO3\CMS\Core\Resource\ResourceStorage
57
-     */
58
-    public static function findLocalStorage($name)
59
-    {
60
-        /** @var $storageObjects \TYPO3\CMS\Core\Resource\ResourceStorage[] */
61
-        $storageObjects = self::getStorageRepository()->findByStorageType('Local');
62
-
63
-        foreach ($storageObjects as $storage) {
64
-            if (isset($storage->getConfiguration()['basePath']) && ($storage->getConfiguration()['basePath'] == rtrim($name, '/') . '/')) {
65
-                return $storage;
66
-            }
67
-        }
68
-
69
-        return null;
70
-    }
71
-
72
-    /**
73
-     * Creates a directory in the web root if it is not existing.
74
-     *
75
-     * @param string $name Relative path to folder from web root, see PHP mkdir() function. Removes trailing slash internally.
76
-     * @return bool TRUE if mkdir went well!
77
-     */
78
-    public static function createDirectoryAtWebRoot($name)
79
-    {
80
-        if (!@is_dir(Environment::getPublicPath() . '/' . $name)) {
81
-            return GeneralUtility::mkdir(Environment::getPublicPath() . '/' . $name);
82
-        }
83
-
84
-        return true;
85
-    }
86
-
87
-    /**
88
-     * Creates a local storage if not exists.
89
-     *
90
-     * @param string $extensionKey
91
-     * @param string $name Local storage name
92
-     * @param string $message Optional message
93
-     * @return NULL|int Uid of the inserted or found record
94
-     * @throws \InvalidArgumentException
95
-     */
96
-    public static function createLocalStorage($extensionKey, $name, $message = '')
97
-    {
98
-        if (!is_string($name) || empty($name)) {
99
-            throw new \InvalidArgumentException('$name must be a non empty string.', 1491681665);
100
-        }
101
-
102
-        if (self::createDirectoryAtWebRoot($name) !== true) {
103
-            FlashMessageUtility::showFlashMessage(
104
-                $extensionKey,
105
-                'Local storage ' . $name . ' could not be created!',
106
-                'Local storage not created',
107
-                FlashMessage::WARNING
108
-            );
109
-
110
-            return null;
111
-        }
112
-
113
-        $addMessage = (is_string($message) && !empty($message) ? ' ' . $message : '');
114
-        /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
115
-        $storage = self::findLocalStorage($name);
116
-
117
-        if ($storage !== null) {
118
-            FlashMessageUtility::showFlashMessage(
119
-                $extensionKey,
120
-                'Local storage ' . $name . ' was found.' . $addMessage,
121
-                'Local storage found',
122
-                FlashMessage::NOTICE
123
-            );
124
-
125
-            return $storage->getUid();
126
-        }
127
-
128
-        $uid = self::getStorageRepository()->createLocalStorage(
129
-            $name . self::STORAGE_SUFFIX,
130
-            $name,
131
-            'relative',
132
-            'This is the local ' . $name . '/ directory. This storage mount has been created automatically by ' . $extensionKey . '.' . $addMessage,
133
-            false
134
-        );
135
-
136
-        FlashMessageUtility::showFlashMessage(
137
-            $extensionKey,
138
-            'Local storage ' . $name . ' successfully created.' . $addMessage,
139
-            'Local storage created'
140
-        );
141
-
142
-        return $uid;
143
-    }
144
-
145
-    /**
146
-     * Removes a local storage.
147
-     *
148
-     * @param string $extensionKey
149
-     * @param string $name Local storage name
150
-     * @return void
151
-     * @throws \InvalidArgumentException
152
-     */
153
-    public static function removeLocalStorage($extensionKey, $name)
154
-    {
155
-        if (!is_string($name) || empty($name)) {
156
-            throw new \InvalidArgumentException('$name must be a non empty string.', 1491682406);
157
-        }
158
-
159
-        if (self::findLocalStorage($name) !== null) {
160
-            FlashMessageUtility::showFlashMessage(
161
-                $extensionKey,
162
-                'Local storage ' . $name . ' must be removed by an admin from the root line in the backend and web root directory.',
163
-                'Remove local storage',
164
-                FlashMessage::NOTICE
165
-            );
166
-        }
167
-    }
37
+	/**
38
+	 * @const string Suffix added to storage name
39
+	 */
40
+	const STORAGE_SUFFIX = '/ (auto-created)';
41
+
42
+	/**
43
+	 * Get the storage repository
44
+	 *
45
+	 * @return \TYPO3\CMS\Core\Resource\StorageRepository
46
+	 */
47
+	public static function getStorageRepository()
48
+	{
49
+		return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
50
+	}
51
+
52
+	/**
53
+	 * Searches for a local storage.
54
+	 *
55
+	 * @param string $name Local storage name
56
+	 * @return NULL|\TYPO3\CMS\Core\Resource\ResourceStorage
57
+	 */
58
+	public static function findLocalStorage($name)
59
+	{
60
+		/** @var $storageObjects \TYPO3\CMS\Core\Resource\ResourceStorage[] */
61
+		$storageObjects = self::getStorageRepository()->findByStorageType('Local');
62
+
63
+		foreach ($storageObjects as $storage) {
64
+			if (isset($storage->getConfiguration()['basePath']) && ($storage->getConfiguration()['basePath'] == rtrim($name, '/') . '/')) {
65
+				return $storage;
66
+			}
67
+		}
68
+
69
+		return null;
70
+	}
71
+
72
+	/**
73
+	 * Creates a directory in the web root if it is not existing.
74
+	 *
75
+	 * @param string $name Relative path to folder from web root, see PHP mkdir() function. Removes trailing slash internally.
76
+	 * @return bool TRUE if mkdir went well!
77
+	 */
78
+	public static function createDirectoryAtWebRoot($name)
79
+	{
80
+		if (!@is_dir(Environment::getPublicPath() . '/' . $name)) {
81
+			return GeneralUtility::mkdir(Environment::getPublicPath() . '/' . $name);
82
+		}
83
+
84
+		return true;
85
+	}
86
+
87
+	/**
88
+	 * Creates a local storage if not exists.
89
+	 *
90
+	 * @param string $extensionKey
91
+	 * @param string $name Local storage name
92
+	 * @param string $message Optional message
93
+	 * @return NULL|int Uid of the inserted or found record
94
+	 * @throws \InvalidArgumentException
95
+	 */
96
+	public static function createLocalStorage($extensionKey, $name, $message = '')
97
+	{
98
+		if (!is_string($name) || empty($name)) {
99
+			throw new \InvalidArgumentException('$name must be a non empty string.', 1491681665);
100
+		}
101
+
102
+		if (self::createDirectoryAtWebRoot($name) !== true) {
103
+			FlashMessageUtility::showFlashMessage(
104
+				$extensionKey,
105
+				'Local storage ' . $name . ' could not be created!',
106
+				'Local storage not created',
107
+				FlashMessage::WARNING
108
+			);
109
+
110
+			return null;
111
+		}
112
+
113
+		$addMessage = (is_string($message) && !empty($message) ? ' ' . $message : '');
114
+		/** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
115
+		$storage = self::findLocalStorage($name);
116
+
117
+		if ($storage !== null) {
118
+			FlashMessageUtility::showFlashMessage(
119
+				$extensionKey,
120
+				'Local storage ' . $name . ' was found.' . $addMessage,
121
+				'Local storage found',
122
+				FlashMessage::NOTICE
123
+			);
124
+
125
+			return $storage->getUid();
126
+		}
127
+
128
+		$uid = self::getStorageRepository()->createLocalStorage(
129
+			$name . self::STORAGE_SUFFIX,
130
+			$name,
131
+			'relative',
132
+			'This is the local ' . $name . '/ directory. This storage mount has been created automatically by ' . $extensionKey . '.' . $addMessage,
133
+			false
134
+		);
135
+
136
+		FlashMessageUtility::showFlashMessage(
137
+			$extensionKey,
138
+			'Local storage ' . $name . ' successfully created.' . $addMessage,
139
+			'Local storage created'
140
+		);
141
+
142
+		return $uid;
143
+	}
144
+
145
+	/**
146
+	 * Removes a local storage.
147
+	 *
148
+	 * @param string $extensionKey
149
+	 * @param string $name Local storage name
150
+	 * @return void
151
+	 * @throws \InvalidArgumentException
152
+	 */
153
+	public static function removeLocalStorage($extensionKey, $name)
154
+	{
155
+		if (!is_string($name) || empty($name)) {
156
+			throw new \InvalidArgumentException('$name must be a non empty string.', 1491682406);
157
+		}
158
+
159
+		if (self::findLocalStorage($name) !== null) {
160
+			FlashMessageUtility::showFlashMessage(
161
+				$extensionKey,
162
+				'Local storage ' . $name . ' must be removed by an admin from the root line in the backend and web root directory.',
163
+				'Remove local storage',
164
+				FlashMessage::NOTICE
165
+			);
166
+		}
167
+	}
168 168
 }
Please login to merge, or discard this patch.
Classes/Utility/FlashMessageUtility.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -34,76 +34,76 @@
 block discarded – undo
34 34
  */
35 35
 class FlashMessageUtility
36 36
 {
37
-    /**
38
-     * @var \TYPO3\CMS\Core\Messaging\FlashMessageService
39
-     */
40
-    protected static $flashMessageService = null;
41
-    /**
42
-     * Returns the Flash Message Service
43
-     *
44
-     * @return \TYPO3\CMS\Core\Messaging\FlashMessageService
45
-     */
46
-    public static function getFlashMessageService()
47
-    {
48
-        if (self::$flashMessageService === null) {
49
-            // cache the object for performance-reasons
50
-            self::$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
51
-        }
52
-        return self::$flashMessageService;
53
-    }
37
+	/**
38
+	 * @var \TYPO3\CMS\Core\Messaging\FlashMessageService
39
+	 */
40
+	protected static $flashMessageService = null;
41
+	/**
42
+	 * Returns the Flash Message Service
43
+	 *
44
+	 * @return \TYPO3\CMS\Core\Messaging\FlashMessageService
45
+	 */
46
+	public static function getFlashMessageService()
47
+	{
48
+		if (self::$flashMessageService === null) {
49
+			// cache the object for performance-reasons
50
+			self::$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
51
+		}
52
+		return self::$flashMessageService;
53
+	}
54 54
 
55
-    /**
56
-     * Returns the Flash Message Queue
57
-     *
58
-     * @param string $extensionKey
59
-     * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue
60
-     * @throws \InvalidArgumentException
61
-     */
62
-    public static function getFlashMessageQueue($extensionKey)
63
-    {
64
-        if (!is_string($extensionKey) || empty($extensionKey)) {
65
-            throw new \InvalidArgumentException('$extensionKey must be a non empty string.', 1491502264);
66
-        }
67
-        return self::getFlashMessageService()->getMessageQueueByIdentifier('gslib.flashmessages.' . $extensionKey);
68
-    }
55
+	/**
56
+	 * Returns the Flash Message Queue
57
+	 *
58
+	 * @param string $extensionKey
59
+	 * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue
60
+	 * @throws \InvalidArgumentException
61
+	 */
62
+	public static function getFlashMessageQueue($extensionKey)
63
+	{
64
+		if (!is_string($extensionKey) || empty($extensionKey)) {
65
+			throw new \InvalidArgumentException('$extensionKey must be a non empty string.', 1491502264);
66
+		}
67
+		return self::getFlashMessageService()->getMessageQueueByIdentifier('gslib.flashmessages.' . $extensionKey);
68
+	}
69 69
 
70
-    /**
71
-     * Adds a Flash Message to the Flash Message Queue
72
-     *
73
-     * @param \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage
74
-     * @param string $extensionKey
75
-     * @return void
76
-     */
77
-    public static function addFlashMessageToQueue(FlashMessage $flashMessage, $extensionKey)
78
-    {
79
-        if ($flashMessage) {
80
-            self::getFlashMessageQueue($extensionKey)->enqueue($flashMessage);
81
-        }
82
-    }
70
+	/**
71
+	 * Adds a Flash Message to the Flash Message Queue
72
+	 *
73
+	 * @param \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage
74
+	 * @param string $extensionKey
75
+	 * @return void
76
+	 */
77
+	public static function addFlashMessageToQueue(FlashMessage $flashMessage, $extensionKey)
78
+	{
79
+		if ($flashMessage) {
80
+			self::getFlashMessageQueue($extensionKey)->enqueue($flashMessage);
81
+		}
82
+	}
83 83
 
84
-    /**
85
-     * Create a Flash Message and add it to the Queue
86
-     *
87
-     * @param string $extensionKey
88
-     * @param string $message The message.
89
-     * @param string $title Optional message title.
90
-     * @param int $severity Optional severity, must be either of one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
91
-     * @param bool $storeInSession Optional, defines whether the message should be stored in the session or only for one request (default)
92
-     * @return void
93
-     */
94
-    public static function showFlashMessage($extensionKey, $message, $title = '', $severity = FlashMessage::OK, $storeInSession = true)
95
-    {
96
-        if (is_string($message) || !empty($message)) {
97
-            self::addFlashMessageToQueue(
98
-                GeneralUtility::makeInstance(
99
-                    FlashMessage::class,
100
-                    $message,
101
-                    $title,
102
-                    $severity,
103
-                    $storeInSession
104
-                ), 
105
-                $extensionKey
106
-            );
107
-        }
108
-    }
84
+	/**
85
+	 * Create a Flash Message and add it to the Queue
86
+	 *
87
+	 * @param string $extensionKey
88
+	 * @param string $message The message.
89
+	 * @param string $title Optional message title.
90
+	 * @param int $severity Optional severity, must be either of one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
91
+	 * @param bool $storeInSession Optional, defines whether the message should be stored in the session or only for one request (default)
92
+	 * @return void
93
+	 */
94
+	public static function showFlashMessage($extensionKey, $message, $title = '', $severity = FlashMessage::OK, $storeInSession = true)
95
+	{
96
+		if (is_string($message) || !empty($message)) {
97
+			self::addFlashMessageToQueue(
98
+				GeneralUtility::makeInstance(
99
+					FlashMessage::class,
100
+					$message,
101
+					$title,
102
+					$severity,
103
+					$storeInSession
104
+				), 
105
+				$extensionKey
106
+			);
107
+		}
108
+	}
109 109
 }
Please login to merge, or discard this patch.
Classes/Utility/ExtensionUtility.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -36,53 +36,53 @@
 block discarded – undo
36 36
  */
37 37
 class ObjectUtility
38 38
 {
39
-    /**
40
-     * Get Object Manager instance.
41
-     *
42
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
43
-     */
44
-    public static function getObjectManager()
45
-    {
46
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
47
-    }
39
+	/**
40
+	 * Get Object Manager instance.
41
+	 *
42
+	 * @return \TYPO3\CMS\Extbase\Object\ObjectManager
43
+	 */
44
+	public static function getObjectManager()
45
+	{
46
+		return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
47
+	}
48 48
 
49
-    /**
50
-     * Get Configuration Manager instance.
51
-     *
52
-     * @return \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
53
-     */
54
-    public static function getConfigurationManager()
55
-    {
56
-        return self::getObjectManager()->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
57
-    }
49
+	/**
50
+	 * Get Configuration Manager instance.
51
+	 *
52
+	 * @return \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
53
+	 */
54
+	public static function getConfigurationManager()
55
+	{
56
+		return self::getObjectManager()->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
57
+	}
58 58
 
59
-    /**
60
-     * Get Typoscript Service instance.
61
-     *
62
-     * @return \TYPO3\CMS\Extbase\Service\TyposcriptService
63
-     */
64
-    public static function getTyposcriptService()
65
-    {
66
-        return self::getObjectManager()->get(\TYPO3\CMS\Extbase\Service\TyposcriptService::class);
67
-    }
59
+	/**
60
+	 * Get Typoscript Service instance.
61
+	 *
62
+	 * @return \TYPO3\CMS\Extbase\Service\TyposcriptService
63
+	 */
64
+	public static function getTyposcriptService()
65
+	{
66
+		return self::getObjectManager()->get(\TYPO3\CMS\Extbase\Service\TyposcriptService::class);
67
+	}
68 68
 
69
-    /**
70
-     * Get Flex Form Service instance.
71
-     *
72
-     * @return \TYPO3\CMS\Core\Service\FlexFormService
73
-     */
74
-    public static function getFlexFormService()
75
-    {
76
-        return self::getObjectManager()->get(\TYPO3\CMS\Core\Service\FlexFormService::class);
77
-    }
69
+	/**
70
+	 * Get Flex Form Service instance.
71
+	 *
72
+	 * @return \TYPO3\CMS\Core\Service\FlexFormService
73
+	 */
74
+	public static function getFlexFormService()
75
+	{
76
+		return self::getObjectManager()->get(\TYPO3\CMS\Core\Service\FlexFormService::class);
77
+	}
78 78
 
79
-    /**
80
-     * Get Configuration Utility instance.
81
-     *
82
-     * @return \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility
83
-     */
84
-    public static function getConfigurationUtility()
85
-    {
86
-        return self::getObjectManager()->get(\TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility::class);
87
-    }
79
+	/**
80
+	 * Get Configuration Utility instance.
81
+	 *
82
+	 * @return \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility
83
+	 */
84
+	public static function getConfigurationUtility()
85
+	{
86
+		return self::getObjectManager()->get(\TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility::class);
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Classes/Service/InstallService.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,29 +33,29 @@
 block discarded – undo
33 33
  */
34 34
 class InstallService extends AbstractInstallService
35 35
 {
36
-    /**
37
-     * Executes the setup tasks if extension is installed.
38
-     *
39
-     * @param string $extensionKey Installed extension key
40
-     */
41
-    public function afterInstall($extensionKey)
42
-    {
43
-        if ($extensionKey == $this->extensionKey)
44
-        {
45
-            // insert custom code here
46
-        }
47
-    }
36
+	/**
37
+	 * Executes the setup tasks if extension is installed.
38
+	 *
39
+	 * @param string $extensionKey Installed extension key
40
+	 */
41
+	public function afterInstall($extensionKey)
42
+	{
43
+		if ($extensionKey == $this->extensionKey)
44
+		{
45
+			// insert custom code here
46
+		}
47
+	}
48 48
 
49
-    /**
50
-     * Executes the setup tasks if extension is uninstalled.
51
-     *
52
-     * @param string $extensionKey Uninstalled extension key
53
-     */
54
-    public function afterUninstall($extensionKey)
55
-    {
56
-        if ($extensionKey == $this->extensionKey)
57
-        {
58
-            // insert custom code here
59
-        }
60
-    }
49
+	/**
50
+	 * Executes the setup tasks if extension is uninstalled.
51
+	 *
52
+	 * @param string $extensionKey Uninstalled extension key
53
+	 */
54
+	public function afterUninstall($extensionKey)
55
+	{
56
+		if ($extensionKey == $this->extensionKey)
57
+		{
58
+			// insert custom code here
59
+		}
60
+	}
61 61
 }
Please login to merge, or discard this patch.