Completed
Push — master ( 7c7017...661465 )
by Fabien
53:59
created
Classes/Utility/PermissionUtility.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -20,75 +20,75 @@
 block discarded – undo
20 20
  */
21 21
 class PermissionUtility implements SingletonInterface
22 22
 {
23
-    /**
24
-     * Returns a class instance.
25
-     *
26
-     * @return PermissionUtility
27
-     * @throws \InvalidArgumentException
28
-     */
29
-    public static function getInstance()
30
-    {
31
-        return GeneralUtility::makeInstance(PermissionUtility::class);
32
-    }
23
+	/**
24
+	 * Returns a class instance.
25
+	 *
26
+	 * @return PermissionUtility
27
+	 * @throws \InvalidArgumentException
28
+	 */
29
+	public static function getInstance()
30
+	{
31
+		return GeneralUtility::makeInstance(PermissionUtility::class);
32
+	}
33 33
 
34
-    /**
35
-     * Returns allowed extensions given a possible storage.
36
-     *
37
-     * @param null|int|ResourceStorage $storage
38
-     * @return array
39
-     * @throws \InvalidArgumentException
40
-     */
41
-    public function getAllowedExtensions($storage = null)
42
-    {
43
-        $fieldNames = array(
44
-            'extension_allowed_file_type_1',
45
-            'extension_allowed_file_type_2',
46
-            'extension_allowed_file_type_3',
47
-            'extension_allowed_file_type_4',
48
-            'extension_allowed_file_type_5',
49
-        );
34
+	/**
35
+	 * Returns allowed extensions given a possible storage.
36
+	 *
37
+	 * @param null|int|ResourceStorage $storage
38
+	 * @return array
39
+	 * @throws \InvalidArgumentException
40
+	 */
41
+	public function getAllowedExtensions($storage = null)
42
+	{
43
+		$fieldNames = array(
44
+			'extension_allowed_file_type_1',
45
+			'extension_allowed_file_type_2',
46
+			'extension_allowed_file_type_3',
47
+			'extension_allowed_file_type_4',
48
+			'extension_allowed_file_type_5',
49
+		);
50 50
 
51
-        if (!is_null($storage)) {
52
-            if (!$storage instanceof ResourceStorage) {
53
-                $storage = $this->getResourceFactory()->getStorageObject((int)$storage);
54
-            }
55
-        } else {
56
-            $storage = $this->getMediaModule()->getCurrentStorage();
57
-        }
51
+		if (!is_null($storage)) {
52
+			if (!$storage instanceof ResourceStorage) {
53
+				$storage = $this->getResourceFactory()->getStorageObject((int)$storage);
54
+			}
55
+		} else {
56
+			$storage = $this->getMediaModule()->getCurrentStorage();
57
+		}
58 58
 
59
-        $storageRecord = $storage->getStorageRecord();
60
-        $allowedExtensions = [];
61
-        foreach ($fieldNames as $fieldName) {
62
-            $_allowedExtensions = GeneralUtility::trimExplode(',', $storageRecord[$fieldName], true);
63
-            $allowedExtensions = array_merge($allowedExtensions, $_allowedExtensions);
64
-        }
59
+		$storageRecord = $storage->getStorageRecord();
60
+		$allowedExtensions = [];
61
+		foreach ($fieldNames as $fieldName) {
62
+			$_allowedExtensions = GeneralUtility::trimExplode(',', $storageRecord[$fieldName], true);
63
+			$allowedExtensions = array_merge($allowedExtensions, $_allowedExtensions);
64
+		}
65 65
 
66
-        $uniqueAllowedExtensions = array_unique($allowedExtensions);
67
-        return array_filter($uniqueAllowedExtensions, 'strlen');
68
-    }
66
+		$uniqueAllowedExtensions = array_unique($allowedExtensions);
67
+		return array_filter($uniqueAllowedExtensions, 'strlen');
68
+	}
69 69
 
70
-    /**
71
-     * Returns allowed extensions list.
72
-     *
73
-     * @return string
74
-     * @throws \InvalidArgumentException
75
-     */
76
-    public function getAllowedExtensionList()
77
-    {
78
-        return implode(',', $this->getAllowedExtensions());
79
-    }
70
+	/**
71
+	 * Returns allowed extensions list.
72
+	 *
73
+	 * @return string
74
+	 * @throws \InvalidArgumentException
75
+	 */
76
+	public function getAllowedExtensionList()
77
+	{
78
+		return implode(',', $this->getAllowedExtensions());
79
+	}
80 80
 
81
-    /**
82
-     * @return MediaModule|object
83
-     * @throws \InvalidArgumentException
84
-     */
85
-    protected function getMediaModule()
86
-    {
87
-        return GeneralUtility::makeInstance(MediaModule::class);
88
-    }
81
+	/**
82
+	 * @return MediaModule|object
83
+	 * @throws \InvalidArgumentException
84
+	 */
85
+	protected function getMediaModule()
86
+	{
87
+		return GeneralUtility::makeInstance(MediaModule::class);
88
+	}
89 89
 
90
-    protected function getResourceFactory(): ResourceFactory
91
-    {
92
-        return GeneralUtility::makeInstance(ResourceFactory::class);
93
-    }
90
+	protected function getResourceFactory(): ResourceFactory
91
+	{
92
+		return GeneralUtility::makeInstance(ResourceFactory::class);
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Classes/Utility/SessionUtility.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -17,61 +17,61 @@
 block discarded – undo
17 17
  */
18 18
 class SessionUtility implements SingletonInterface
19 19
 {
20
-    /**
21
-     * @var string
22
-     */
23
-    protected $moduleKey = 'media';
20
+	/**
21
+	 * @var string
22
+	 */
23
+	protected $moduleKey = 'media';
24 24
 
25
-    /**
26
-     * Returns a class instance.
27
-     *
28
-     * @return \Fab\Media\Utility\SessionUtility|object
29
-     */
30
-    public static function getInstance()
31
-    {
32
-        return GeneralUtility::makeInstance(\Fab\Media\Utility\SessionUtility::class);
33
-    }
25
+	/**
26
+	 * Returns a class instance.
27
+	 *
28
+	 * @return \Fab\Media\Utility\SessionUtility|object
29
+	 */
30
+	public static function getInstance()
31
+	{
32
+		return GeneralUtility::makeInstance(\Fab\Media\Utility\SessionUtility::class);
33
+	}
34 34
 
35
-    public function __construct()
36
-    {
37
-        // Initialize storage from the current
38
-        if (!is_array($this->getBackendUser()->uc['moduleData'][$this->moduleKey])) {
39
-            $this->getBackendUser()->uc['moduleData'][$this->moduleKey] = [];
40
-            $this->getBackendUser()->writeUC();
41
-        }
42
-    }
35
+	public function __construct()
36
+	{
37
+		// Initialize storage from the current
38
+		if (!is_array($this->getBackendUser()->uc['moduleData'][$this->moduleKey])) {
39
+			$this->getBackendUser()->uc['moduleData'][$this->moduleKey] = [];
40
+			$this->getBackendUser()->writeUC();
41
+		}
42
+	}
43 43
 
44
-    /**
45
-     * Return a value from the Session according to the key
46
-     *
47
-     * @param string $key
48
-     * @return mixed
49
-     */
50
-    public function get($key)
51
-    {
52
-        return $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key];
53
-    }
44
+	/**
45
+	 * Return a value from the Session according to the key
46
+	 *
47
+	 * @param string $key
48
+	 * @return mixed
49
+	 */
50
+	public function get($key)
51
+	{
52
+		return $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key];
53
+	}
54 54
 
55
-    /**
56
-     * Set a key to the Session.
57
-     *
58
-     * @param string $key
59
-     * @param mixed $value
60
-     * @return void
61
-     */
62
-    public function set($key, $value)
63
-    {
64
-        $this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key] = $value;
65
-        $this->getBackendUser()->writeUC();
66
-    }
55
+	/**
56
+	 * Set a key to the Session.
57
+	 *
58
+	 * @param string $key
59
+	 * @param mixed $value
60
+	 * @return void
61
+	 */
62
+	public function set($key, $value)
63
+	{
64
+		$this->getBackendUser()->uc['moduleData'][$this->moduleKey][$key] = $value;
65
+		$this->getBackendUser()->writeUC();
66
+	}
67 67
 
68
-    /**
69
-     * Returns an instance of the current Backend User.
70
-     *
71
-     * @return BackendUserAuthentication
72
-     */
73
-    protected function getBackendUser()
74
-    {
75
-        return $GLOBALS['BE_USER'];
76
-    }
68
+	/**
69
+	 * Returns an instance of the current Backend User.
70
+	 *
71
+	 * @return BackendUserAuthentication
72
+	 */
73
+	protected function getBackendUser()
74
+	{
75
+		return $GLOBALS['BE_USER'];
76
+	}
77 77
 }
Please login to merge, or discard this patch.
Classes/Utility/ClientValidation.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,28 +16,28 @@
 block discarded – undo
16 16
  */
17 17
 class ClientValidation implements SingletonInterface
18 18
 {
19
-    /**
20
-     * Returns a class instance
21
-     *
22
-     * @return \Fab\Media\Utility\ClientValidation|object
23
-     */
24
-    public static function getInstance()
25
-    {
26
-        return GeneralUtility::makeInstance(\Fab\Media\Utility\ClientValidation::class);
27
-    }
19
+	/**
20
+	 * Returns a class instance
21
+	 *
22
+	 * @return \Fab\Media\Utility\ClientValidation|object
23
+	 */
24
+	public static function getInstance()
25
+	{
26
+		return GeneralUtility::makeInstance(\Fab\Media\Utility\ClientValidation::class);
27
+	}
28 28
 
29
-    /**
30
-     * Get the validation class name given a field.
31
-     *
32
-     * @param string $fieldName
33
-     * @return string
34
-     */
35
-    public function get($fieldName)
36
-    {
37
-        $result = '';
38
-        if (TcaField::getService()->isRequired($fieldName)) {
39
-            $result = ' validate[required]';
40
-        }
41
-        return $result;
42
-    }
29
+	/**
30
+	 * Get the validation class name given a field.
31
+	 *
32
+	 * @param string $fieldName
33
+	 * @return string
34
+	 */
35
+	public function get($fieldName)
36
+	{
37
+		$result = '';
38
+		if (TcaField::getService()->isRequired($fieldName)) {
39
+			$result = ' validate[required]';
40
+		}
41
+		return $result;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
Classes/Utility/ImagePresetUtility.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -18,92 +18,92 @@
 block discarded – undo
18 18
  */
19 19
 class ImagePresetUtility implements SingletonInterface
20 20
 {
21
-    /**
22
-     * @var array
23
-     */
24
-    protected $store = [];
21
+	/**
22
+	 * @var array
23
+	 */
24
+	protected $store = [];
25 25
 
26
-    /**
27
-     * @var string
28
-     */
29
-    protected $currentPreset = '';
26
+	/**
27
+	 * @var string
28
+	 */
29
+	protected $currentPreset = '';
30 30
 
31
-    /**
32
-     * Returns a class instance
33
-     *
34
-     * @return \Fab\Media\Utility\ImagePresetUtility|object
35
-     */
36
-    public static function getInstance()
37
-    {
38
-        return GeneralUtility::makeInstance(\Fab\Media\Utility\ImagePresetUtility::class);
39
-    }
31
+	/**
32
+	 * Returns a class instance
33
+	 *
34
+	 * @return \Fab\Media\Utility\ImagePresetUtility|object
35
+	 */
36
+	public static function getInstance()
37
+	{
38
+		return GeneralUtility::makeInstance(\Fab\Media\Utility\ImagePresetUtility::class);
39
+	}
40 40
 
41
-    /**
42
-     * Set the current preset value. Preset values come from the settings and can be:
43
-     * image_thumbnail, image_mini, image_small, image_medium, image_large
44
-     *
45
-     * @throws EmptyValueException
46
-     * @param string $preset image_thumbnail, image_mini, ...
47
-     * @return \Fab\Media\Utility\ImagePresetUtility
48
-     */
49
-    public function preset($preset)
50
-    {
51
-        $size = ConfigurationUtility::getInstance()->get($preset);
52
-        if (is_null($size)) {
53
-            throw new EmptyValueException('No value for preset: ' . $preset, 1362501066);
54
-        }
41
+	/**
42
+	 * Set the current preset value. Preset values come from the settings and can be:
43
+	 * image_thumbnail, image_mini, image_small, image_medium, image_large
44
+	 *
45
+	 * @throws EmptyValueException
46
+	 * @param string $preset image_thumbnail, image_mini, ...
47
+	 * @return \Fab\Media\Utility\ImagePresetUtility
48
+	 */
49
+	public function preset($preset)
50
+	{
51
+		$size = ConfigurationUtility::getInstance()->get($preset);
52
+		if (is_null($size)) {
53
+			throw new EmptyValueException('No value for preset: ' . $preset, 1362501066);
54
+		}
55 55
 
56
-        $this->currentPreset = $preset;
57
-        if (!isset($this->store[$this->currentPreset])) {
58
-            // @todo use object Dimension instead
59
-            $dimensions = GeneralUtility::trimExplode('x', $size);
60
-            $this->store[$this->currentPreset]['width'] = empty($dimensions[0]) ? 0 : $dimensions[0];
61
-            $this->store[$this->currentPreset]['height'] = empty($dimensions[1]) ? 0 : $dimensions[1];
62
-        }
63
-        return $this;
64
-    }
56
+		$this->currentPreset = $preset;
57
+		if (!isset($this->store[$this->currentPreset])) {
58
+			// @todo use object Dimension instead
59
+			$dimensions = GeneralUtility::trimExplode('x', $size);
60
+			$this->store[$this->currentPreset]['width'] = empty($dimensions[0]) ? 0 : $dimensions[0];
61
+			$this->store[$this->currentPreset]['height'] = empty($dimensions[1]) ? 0 : $dimensions[1];
62
+		}
63
+		return $this;
64
+	}
65 65
 
66
-    /**
67
-     * @return array
68
-     */
69
-    public function getStore()
70
-    {
71
-        return $this->store;
72
-    }
66
+	/**
67
+	 * @return array
68
+	 */
69
+	public function getStore()
70
+	{
71
+		return $this->store;
72
+	}
73 73
 
74
-    /**
75
-     * @param array $store
76
-     */
77
-    public function setStore($store)
78
-    {
79
-        $this->store = $store;
80
-    }
74
+	/**
75
+	 * @param array $store
76
+	 */
77
+	public function setStore($store)
78
+	{
79
+		$this->store = $store;
80
+	}
81 81
 
82
-    /**
83
-     * Returns width of the current preset.
84
-     *
85
-     * @throws InvalidKeyInArrayException
86
-     * @return int
87
-     */
88
-    public function getWidth()
89
-    {
90
-        if (empty($this->store[$this->currentPreset])) {
91
-            throw new InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853);
92
-        }
93
-        return (int)$this->store[$this->currentPreset]['width'];
94
-    }
82
+	/**
83
+	 * Returns width of the current preset.
84
+	 *
85
+	 * @throws InvalidKeyInArrayException
86
+	 * @return int
87
+	 */
88
+	public function getWidth()
89
+	{
90
+		if (empty($this->store[$this->currentPreset])) {
91
+			throw new InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853);
92
+		}
93
+		return (int)$this->store[$this->currentPreset]['width'];
94
+	}
95 95
 
96
-    /**
97
-     * Returns height of the current preset.
98
-     *
99
-     * @throws InvalidKeyInArrayException
100
-     * @return int
101
-     */
102
-    public function getHeight()
103
-    {
104
-        if (empty($this->store[$this->currentPreset])) {
105
-            throw new InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853);
106
-        }
107
-        return (int)$this->store[$this->currentPreset]['height'];
108
-    }
96
+	/**
97
+	 * Returns height of the current preset.
98
+	 *
99
+	 * @throws InvalidKeyInArrayException
100
+	 * @return int
101
+	 */
102
+	public function getHeight()
103
+	{
104
+		if (empty($this->store[$this->currentPreset])) {
105
+			throw new InvalidKeyInArrayException('No existing values for current preset. Have you set a preset?', 1362501853);
106
+		}
107
+		return (int)$this->store[$this->currentPreset]['height'];
108
+	}
109 109
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     {
51 51
         $size = ConfigurationUtility::getInstance()->get($preset);
52 52
         if (is_null($size)) {
53
-            throw new EmptyValueException('No value for preset: ' . $preset, 1362501066);
53
+            throw new EmptyValueException('No value for preset: '.$preset, 1362501066);
54 54
         }
55 55
 
56 56
         $this->currentPreset = $preset;
Please login to merge, or discard this patch.
Classes/Utility/ConfigurationUtility.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -17,67 +17,67 @@
 block discarded – undo
17 17
  */
18 18
 class ConfigurationUtility implements SingletonInterface
19 19
 {
20
-    /**
21
-     * @var string
22
-     */
23
-    protected $extensionKey = 'media';
20
+	/**
21
+	 * @var string
22
+	 */
23
+	protected $extensionKey = 'media';
24 24
 
25
-    /**
26
-     * @var array
27
-     */
28
-    protected $configuration = [];
25
+	/**
26
+	 * @var array
27
+	 */
28
+	protected $configuration = [];
29 29
 
30
-    /**
31
-     * Returns a class instance.
32
-     *
33
-     * @return \Fab\Media\Utility\ConfigurationUtility|object
34
-     */
35
-    public static function getInstance()
36
-    {
37
-        return GeneralUtility::makeInstance(\Fab\Media\Utility\ConfigurationUtility::class);
38
-    }
30
+	/**
31
+	 * Returns a class instance.
32
+	 *
33
+	 * @return \Fab\Media\Utility\ConfigurationUtility|object
34
+	 */
35
+	public static function getInstance()
36
+	{
37
+		return GeneralUtility::makeInstance(\Fab\Media\Utility\ConfigurationUtility::class);
38
+	}
39 39
 
40
-    /**
41
-     * Constructor
42
-     */
43
-    public function __construct()
44
-    {
45
-        $configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('media');
40
+	/**
41
+	 * Constructor
42
+	 */
43
+	public function __construct()
44
+	{
45
+		$configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('media');
46 46
 
47
-        // Fill up configuration array with relevant values.
48
-        foreach ($configuration as $key => $value) {
49
-            $this->configuration[$key] = $value;
50
-        }
51
-    }
47
+		// Fill up configuration array with relevant values.
48
+		foreach ($configuration as $key => $value) {
49
+			$this->configuration[$key] = $value;
50
+		}
51
+	}
52 52
 
53
-    /**
54
-     * Returns a setting key.
55
-     *
56
-     * @param string $key
57
-     * @return array
58
-     */
59
-    public function get($key)
60
-    {
61
-        return isset($this->configuration[$key]) ? trim($this->configuration[$key]) : null;
62
-    }
53
+	/**
54
+	 * Returns a setting key.
55
+	 *
56
+	 * @param string $key
57
+	 * @return array
58
+	 */
59
+	public function get($key)
60
+	{
61
+		return isset($this->configuration[$key]) ? trim($this->configuration[$key]) : null;
62
+	}
63 63
 
64
-    /**
65
-     * Set a setting key.
66
-     *
67
-     * @param string $key
68
-     * @param mixed $value
69
-     * @return void
70
-     */
71
-    public function set($key, $value)
72
-    {
73
-        $this->configuration[$key] = $value;
74
-    }
64
+	/**
65
+	 * Set a setting key.
66
+	 *
67
+	 * @param string $key
68
+	 * @param mixed $value
69
+	 * @return void
70
+	 */
71
+	public function set($key, $value)
72
+	{
73
+		$this->configuration[$key] = $value;
74
+	}
75 75
 
76
-    /**
77
-     * @return array
78
-     */
79
-    public function getConfiguration()
80
-    {
81
-        return $this->configuration;
82
-    }
76
+	/**
77
+	 * @return array
78
+	 */
79
+	public function getConfiguration()
80
+	{
81
+		return $this->configuration;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
Classes/Utility/Logger.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@
 block discarded – undo
17 17
  */
18 18
 class Logger implements SingletonInterface
19 19
 {
20
-    /**
21
-     * Returns a logger class instance.
22
-     *
23
-     * @param mixed $instance
24
-     * @return \TYPO3\CMS\Core\Log\Logger
25
-     */
26
-    public static function getInstance($instance)
27
-    {
28
-        /** @var $loggerManager \TYPO3\CMS\Core\Log\LogManager */
29
-        $loggerManager = GeneralUtility::makeInstance(LogManager::class);
20
+	/**
21
+	 * Returns a logger class instance.
22
+	 *
23
+	 * @param mixed $instance
24
+	 * @return \TYPO3\CMS\Core\Log\Logger
25
+	 */
26
+	public static function getInstance($instance)
27
+	{
28
+		/** @var $loggerManager \TYPO3\CMS\Core\Log\LogManager */
29
+		$loggerManager = GeneralUtility::makeInstance(LogManager::class);
30 30
 
31
-        /** @var $logger \TYPO3\CMS\Core\Log\Logger */
32
-        return $loggerManager->getLogger(get_class($instance));
33
-    }
31
+		/** @var $logger \TYPO3\CMS\Core\Log\Logger */
32
+		return $loggerManager->getLogger(get_class($instance));
33
+	}
34 34
 }
Please login to merge, or discard this patch.
Classes/Utility/Path.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -18,77 +18,77 @@
 block discarded – undo
18 18
  */
19 19
 class Path
20 20
 {
21
-    /**
22
-     * @var string
23
-     */
24
-    protected static $extensionName = 'media';
21
+	/**
22
+	 * @var string
23
+	 */
24
+	protected static $extensionName = 'media';
25 25
 
26
-    /**
27
-     * Return a public path pointing to a resource.
28
-     *
29
-     * @param string $resource
30
-     * @return string
31
-     */
32
-    public static function getRelativePath($resource)
33
-    {
34
-        // If file is not found, resolve the path
35
-        if (!is_file(Environment::getPublicPath() . '/' . $resource)) {
36
-            $resource = substr(self::resolvePath($resource), strlen(Environment::getPublicPath() . '/'));
37
-        }
26
+	/**
27
+	 * Return a public path pointing to a resource.
28
+	 *
29
+	 * @param string $resource
30
+	 * @return string
31
+	 */
32
+	public static function getRelativePath($resource)
33
+	{
34
+		// If file is not found, resolve the path
35
+		if (!is_file(Environment::getPublicPath() . '/' . $resource)) {
36
+			$resource = substr(self::resolvePath($resource), strlen(Environment::getPublicPath() . '/'));
37
+		}
38 38
 
39
-        return PathUtility::getRelativePathTo(PathUtility::dirname(Environment::getPublicPath() . '/' . $resource)) . PathUtility::basename($resource);
40
-    }
39
+		return PathUtility::getRelativePathTo(PathUtility::dirname(Environment::getPublicPath() . '/' . $resource)) . PathUtility::basename($resource);
40
+	}
41 41
 
42
-    /**
43
-     * Resolves path e.g. EXT:media/Resources/Public/foo.png or ../../foo and returns an absolute path to the given resource.
44
-     *
45
-     * @param string $resource
46
-     * @return string
47
-     */
48
-    public static function resolvePath($resource)
49
-    {
50
-        $resource = self::canonicalPath($resource);
51
-        if (!is_file(Environment::getPublicPath() . '/' . $resource)) {
52
-            $resource = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored(self::$extensionName) . '/Resources/Public/' . $resource;
53
-        }
54
-        return GeneralUtility::getFileAbsFileName($resource);
55
-    }
42
+	/**
43
+	 * Resolves path e.g. EXT:media/Resources/Public/foo.png or ../../foo and returns an absolute path to the given resource.
44
+	 *
45
+	 * @param string $resource
46
+	 * @return string
47
+	 */
48
+	public static function resolvePath($resource)
49
+	{
50
+		$resource = self::canonicalPath($resource);
51
+		if (!is_file(Environment::getPublicPath() . '/' . $resource)) {
52
+			$resource = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored(self::$extensionName) . '/Resources/Public/' . $resource;
53
+		}
54
+		return GeneralUtility::getFileAbsFileName($resource);
55
+	}
56 56
 
57
-    /**
58
-     * Tell whether a resource exist.
59
-     *
60
-     * @param string $resource
61
-     * @return string
62
-     */
63
-    public static function exists($resource)
64
-    {
65
-        return is_file(self::resolvePath($resource));
66
-    }
57
+	/**
58
+	 * Tell whether a resource exist.
59
+	 *
60
+	 * @param string $resource
61
+	 * @return string
62
+	 */
63
+	public static function exists($resource)
64
+	{
65
+		return is_file(self::resolvePath($resource));
66
+	}
67 67
 
68
-    /**
69
-     * Tell whether a resource does not exist.
70
-     *
71
-     * @param string $resource
72
-     * @return string
73
-     */
74
-    public static function notExists($resource)
75
-    {
76
-        return !self::exists($resource);
77
-    }
68
+	/**
69
+	 * Tell whether a resource does not exist.
70
+	 *
71
+	 * @param string $resource
72
+	 * @return string
73
+	 */
74
+	public static function notExists($resource)
75
+	{
76
+		return !self::exists($resource);
77
+	}
78 78
 
79
-    /**
80
-     * Returns a canonical path by stripping relative segment ../foo/../bar will become foo/bar
81
-     *
82
-     * @param $resource
83
-     * @return string
84
-     */
85
-    public static function canonicalPath($resource)
86
-    {
87
-        $segments = explode('/', $resource);
88
-        $keys = array_keys($segments, '..');
89
-        foreach ($keys as $key) {
90
-            unset($segments[$key]);
91
-        }
92
-        return implode('/', $segments);
93
-    }
79
+	/**
80
+	 * Returns a canonical path by stripping relative segment ../foo/../bar will become foo/bar
81
+	 *
82
+	 * @param $resource
83
+	 * @return string
84
+	 */
85
+	public static function canonicalPath($resource)
86
+	{
87
+		$segments = explode('/', $resource);
88
+		$keys = array_keys($segments, '..');
89
+		foreach ($keys as $key) {
90
+			unset($segments[$key]);
91
+		}
92
+		return implode('/', $segments);
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
     public static function getRelativePath($resource)
33 33
     {
34 34
         // If file is not found, resolve the path
35
-        if (!is_file(Environment::getPublicPath() . '/' . $resource)) {
36
-            $resource = substr(self::resolvePath($resource), strlen(Environment::getPublicPath() . '/'));
35
+        if (!is_file(Environment::getPublicPath().'/'.$resource)) {
36
+            $resource = substr(self::resolvePath($resource), strlen(Environment::getPublicPath().'/'));
37 37
         }
38 38
 
39
-        return PathUtility::getRelativePathTo(PathUtility::dirname(Environment::getPublicPath() . '/' . $resource)) . PathUtility::basename($resource);
39
+        return PathUtility::getRelativePathTo(PathUtility::dirname(Environment::getPublicPath().'/'.$resource)).PathUtility::basename($resource);
40 40
     }
41 41
 
42 42
     /**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
     public static function resolvePath($resource)
49 49
     {
50 50
         $resource = self::canonicalPath($resource);
51
-        if (!is_file(Environment::getPublicPath() . '/' . $resource)) {
52
-            $resource = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored(self::$extensionName) . '/Resources/Public/' . $resource;
51
+        if (!is_file(Environment::getPublicPath().'/'.$resource)) {
52
+            $resource = 'EXT:'.GeneralUtility::camelCaseToLowerCaseUnderscored(self::$extensionName).'/Resources/Public/'.$resource;
53 53
         }
54 54
         return GeneralUtility::getFileAbsFileName($resource);
55 55
     }
Please login to merge, or discard this patch.
Classes/Utility/DomElement.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -16,54 +16,54 @@
 block discarded – undo
16 16
  */
17 17
 class DomElement implements SingletonInterface
18 18
 {
19
-    /**
20
-     * Returns a class instance
21
-     *
22
-     * @return \Fab\Media\Utility\DomElement|object
23
-     */
24
-    public static function getInstance()
25
-    {
26
-        return GeneralUtility::makeInstance(\Fab\Media\Utility\DomElement::class);
27
-    }
19
+	/**
20
+	 * Returns a class instance
21
+	 *
22
+	 * @return \Fab\Media\Utility\DomElement|object
23
+	 */
24
+	public static function getInstance()
25
+	{
26
+		return GeneralUtility::makeInstance(\Fab\Media\Utility\DomElement::class);
27
+	}
28 28
 
29
-    /**
30
-     * Format an id given an input string
31
-     *
32
-     * @param string $input
33
-     * @return string
34
-     */
35
-    public function formatId($input)
36
-    {
37
-        // remove the capital letter from the id
38
-        $segments = preg_split('/(?=[A-Z])/', $input);
39
-        $segments = array_map('strtolower', $segments);
40
-        if ($segments[0] == '') {
41
-            array_shift($segments);
42
-        }
43
-        $result = implode('-', $segments);
29
+	/**
30
+	 * Format an id given an input string
31
+	 *
32
+	 * @param string $input
33
+	 * @return string
34
+	 */
35
+	public function formatId($input)
36
+	{
37
+		// remove the capital letter from the id
38
+		$segments = preg_split('/(?=[A-Z])/', $input);
39
+		$segments = array_map('strtolower', $segments);
40
+		if ($segments[0] == '') {
41
+			array_shift($segments);
42
+		}
43
+		$result = implode('-', $segments);
44 44
 
45
-        return $this->sanitizeId($result);
46
-    }
45
+		return $this->sanitizeId($result);
46
+	}
47 47
 
48
-    /**
49
-     * Sanitize an id
50
-     *
51
-     * @param string $input
52
-     * @return mixed
53
-     */
54
-    protected function sanitizeId($input)
55
-    {
56
-        // remove the track of possible namespace
57
-        $searches[] = ' ';
58
-        $searches[] = '_';
59
-        $searches[] = '--';
60
-        $searches[] = '[';
61
-        $searches[] = ']';
62
-        $replaces[] = '-';
63
-        $replaces[] = '-';
64
-        $replaces[] = '-';
65
-        $replaces[] = '-';
66
-        $replaces[] = '';
67
-        return str_replace($searches, $replaces, strtolower($input));
68
-    }
48
+	/**
49
+	 * Sanitize an id
50
+	 *
51
+	 * @param string $input
52
+	 * @return mixed
53
+	 */
54
+	protected function sanitizeId($input)
55
+	{
56
+		// remove the track of possible namespace
57
+		$searches[] = ' ';
58
+		$searches[] = '_';
59
+		$searches[] = '--';
60
+		$searches[] = '[';
61
+		$searches[] = ']';
62
+		$replaces[] = '-';
63
+		$replaces[] = '-';
64
+		$replaces[] = '-';
65
+		$replaces[] = '-';
66
+		$replaces[] = '';
67
+		return str_replace($searches, $replaces, strtolower($input));
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Classes/View/Button/DeleteButton.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -20,72 +20,72 @@
 block discarded – undo
20 20
  */
21 21
 class DeleteButton extends AbstractComponentView
22 22
 {
23
-    /**
24
-     * Renders a "delete" button to be placed in the grid.
25
-     *
26
-     * @param Content $object
27
-     * @return string
28
-     * @throws \RuntimeException
29
-     * @throws \InvalidArgumentException
30
-     */
31
-    public function render(Content $object = null)
32
-    {
33
-        $button = '';
34
-        $file = $this->getFileConverter()->convert($object);
23
+	/**
24
+	 * Renders a "delete" button to be placed in the grid.
25
+	 *
26
+	 * @param Content $object
27
+	 * @return string
28
+	 * @throws \RuntimeException
29
+	 * @throws \InvalidArgumentException
30
+	 */
31
+	public function render(Content $object = null)
32
+	{
33
+		$button = '';
34
+		$file = $this->getFileConverter()->convert($object);
35 35
 
36
-        // Only display the delete icon if the file has no reference.
37
-        if ($this->getFileReferenceService()->countTotalReferences($object->getUid()) === 0 && $file->checkActionPermission('write')) {
38
-            $button = $this->makeLinkButton()
39
-                ->setHref($this->getDeleteUri($object))
40
-                ->setDataAttributes([
41
-                    'uid' => $object->getUid(),
42
-                    'toggle' => 'tooltip',
43
-                    'label' => $file->getProperty('title'),
44
-                ])
45
-                ->setClasses('btn-delete')
46
-                ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:delete'))
47
-                ->setIcon($this->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL))
48
-                ->render();
49
-        }
36
+		// Only display the delete icon if the file has no reference.
37
+		if ($this->getFileReferenceService()->countTotalReferences($object->getUid()) === 0 && $file->checkActionPermission('write')) {
38
+			$button = $this->makeLinkButton()
39
+				->setHref($this->getDeleteUri($object))
40
+				->setDataAttributes([
41
+					'uid' => $object->getUid(),
42
+					'toggle' => 'tooltip',
43
+					'label' => $file->getProperty('title'),
44
+				])
45
+				->setClasses('btn-delete')
46
+				->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:delete'))
47
+				->setIcon($this->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL))
48
+				->render();
49
+		}
50 50
 
51
-        return $button;
52
-    }
51
+		return $button;
52
+	}
53 53
 
54
-    /**
55
-     * @param Content $object
56
-     * @return string
57
-     * @throws \InvalidArgumentException
58
-     */
59
-    protected function getDeleteUri(Content $object)
60
-    {
61
-        $additionalParameters = array(
62
-            $this->getModuleLoader()->getParameterPrefix() => array(
63
-                'controller' => 'Content',
64
-                'action' => 'delete',
65
-                'format' => 'json',
66
-                'matches' => array(
67
-                    'uid' => $object->getUid(),
68
-                ),
69
-            ),
70
-        );
71
-        return $this->getModuleLoader()->getModuleUrl($additionalParameters);
72
-    }
54
+	/**
55
+	 * @param Content $object
56
+	 * @return string
57
+	 * @throws \InvalidArgumentException
58
+	 */
59
+	protected function getDeleteUri(Content $object)
60
+	{
61
+		$additionalParameters = array(
62
+			$this->getModuleLoader()->getParameterPrefix() => array(
63
+				'controller' => 'Content',
64
+				'action' => 'delete',
65
+				'format' => 'json',
66
+				'matches' => array(
67
+					'uid' => $object->getUid(),
68
+				),
69
+			),
70
+		);
71
+		return $this->getModuleLoader()->getModuleUrl($additionalParameters);
72
+	}
73 73
 
74
-    /**
75
-     * @return FileReferenceService|object
76
-     * @throws \InvalidArgumentException
77
-     */
78
-    protected function getFileReferenceService()
79
-    {
80
-        return GeneralUtility::makeInstance(FileReferenceService::class);
81
-    }
74
+	/**
75
+	 * @return FileReferenceService|object
76
+	 * @throws \InvalidArgumentException
77
+	 */
78
+	protected function getFileReferenceService()
79
+	{
80
+		return GeneralUtility::makeInstance(FileReferenceService::class);
81
+	}
82 82
 
83
-    /**
84
-     * @return ContentToFileConverter|object
85
-     * @throws \InvalidArgumentException
86
-     */
87
-    protected function getFileConverter()
88
-    {
89
-        return GeneralUtility::makeInstance(ContentToFileConverter::class);
90
-    }
83
+	/**
84
+	 * @return ContentToFileConverter|object
85
+	 * @throws \InvalidArgumentException
86
+	 */
87
+	protected function getFileConverter()
88
+	{
89
+		return GeneralUtility::makeInstance(ContentToFileConverter::class);
90
+	}
91 91
 }
Please login to merge, or discard this patch.