Passed
Push — master ( 24ec4a...f04f93 )
by Roeland
13:26 queued 11s
created
lib/public/AppFramework/Bootstrap/IRegistrationContext.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -37,106 +37,106 @@
 block discarded – undo
37 37
  */
38 38
 interface IRegistrationContext {
39 39
 
40
-	/**
41
-	 * @param string $capability
42
-	 * @see IAppContainer::registerCapability
43
-	 *
44
-	 * @since 20.0.0
45
-	 */
46
-	public function registerCapability(string $capability): void;
40
+    /**
41
+     * @param string $capability
42
+     * @see IAppContainer::registerCapability
43
+     *
44
+     * @since 20.0.0
45
+     */
46
+    public function registerCapability(string $capability): void;
47 47
 
48
-	/**
49
-	 * Register an implementation of \OCP\Support\CrashReport\IReporter that
50
-	 * will receive unhandled exceptions and throwables
51
-	 *
52
-	 * @param string $reporterClass
53
-	 * @return void
54
-	 * @since 20.0.0
55
-	 */
56
-	public function registerCrashReporter(string $reporterClass): void;
48
+    /**
49
+     * Register an implementation of \OCP\Support\CrashReport\IReporter that
50
+     * will receive unhandled exceptions and throwables
51
+     *
52
+     * @param string $reporterClass
53
+     * @return void
54
+     * @since 20.0.0
55
+     */
56
+    public function registerCrashReporter(string $reporterClass): void;
57 57
 
58
-	/**
59
-	 * Register an implementation of \OCP\Dashboard\IPanel that
60
-	 * will handle the implementation of a dashboard panel
61
-	 *
62
-	 * @param string $panelClass
63
-	 * @return void
64
-	 * @since 20.0.0
65
-	 */
66
-	public function registerDashboardPanel(string $panelClass): void;
67
-	/**
68
-	 * Register a service
69
-	 *
70
-	 * @param string $name
71
-	 * @param callable $factory
72
-	 * @param bool $shared
73
-	 *
74
-	 * @return void
75
-	 * @see IContainer::registerService()
76
-	 *
77
-	 * @since 20.0.0
78
-	 */
79
-	public function registerService(string $name, callable $factory, bool $shared = true): void;
58
+    /**
59
+     * Register an implementation of \OCP\Dashboard\IPanel that
60
+     * will handle the implementation of a dashboard panel
61
+     *
62
+     * @param string $panelClass
63
+     * @return void
64
+     * @since 20.0.0
65
+     */
66
+    public function registerDashboardPanel(string $panelClass): void;
67
+    /**
68
+     * Register a service
69
+     *
70
+     * @param string $name
71
+     * @param callable $factory
72
+     * @param bool $shared
73
+     *
74
+     * @return void
75
+     * @see IContainer::registerService()
76
+     *
77
+     * @since 20.0.0
78
+     */
79
+    public function registerService(string $name, callable $factory, bool $shared = true): void;
80 80
 
81
-	/**
82
-	 * @param string $alias
83
-	 * @param string $target
84
-	 *
85
-	 * @return void
86
-	 * @see IContainer::registerAlias()
87
-	 *
88
-	 * @since 20.0.0
89
-	 */
90
-	public function registerServiceAlias(string $alias, string $target): void;
81
+    /**
82
+     * @param string $alias
83
+     * @param string $target
84
+     *
85
+     * @return void
86
+     * @see IContainer::registerAlias()
87
+     *
88
+     * @since 20.0.0
89
+     */
90
+    public function registerServiceAlias(string $alias, string $target): void;
91 91
 
92
-	/**
93
-	 * @param string $name
94
-	 * @param mixed $value
95
-	 *
96
-	 * @return void
97
-	 * @see IContainer::registerParameter()
98
-	 *
99
-	 * @since 20.0.0
100
-	 */
101
-	public function registerParameter(string $name, $value): void;
92
+    /**
93
+     * @param string $name
94
+     * @param mixed $value
95
+     *
96
+     * @return void
97
+     * @see IContainer::registerParameter()
98
+     *
99
+     * @since 20.0.0
100
+     */
101
+    public function registerParameter(string $name, $value): void;
102 102
 
103
-	/**
104
-	 * Register a service listener
105
-	 *
106
-	 * This is equivalent to calling IEventDispatcher::addServiceListener
107
-	 *
108
-	 * @param string $event preferably the fully-qualified class name of the Event sub class to listen for
109
-	 * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
110
-	 * @param int $priority
111
-	 *
112
-	 * @see IEventDispatcher::addServiceListener()
113
-	 *
114
-	 * @since 20.0.0
115
-	 */
116
-	public function registerEventListener(string $event, string $listener, int $priority = 0): void;
103
+    /**
104
+     * Register a service listener
105
+     *
106
+     * This is equivalent to calling IEventDispatcher::addServiceListener
107
+     *
108
+     * @param string $event preferably the fully-qualified class name of the Event sub class to listen for
109
+     * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
110
+     * @param int $priority
111
+     *
112
+     * @see IEventDispatcher::addServiceListener()
113
+     *
114
+     * @since 20.0.0
115
+     */
116
+    public function registerEventListener(string $event, string $listener, int $priority = 0): void;
117 117
 
118
-	/**
119
-	 * @param string $class
120
-	 *
121
-	 * @return void
122
-	 * @see IAppContainer::registerMiddleWare()
123
-	 *
124
-	 * @since 20.0.0
125
-	 */
126
-	public function registerMiddleware(string $class): void;
118
+    /**
119
+     * @param string $class
120
+     *
121
+     * @return void
122
+     * @see IAppContainer::registerMiddleWare()
123
+     *
124
+     * @since 20.0.0
125
+     */
126
+    public function registerMiddleware(string $class): void;
127 127
 
128
-	/**
129
-	 * Register a search provider for the unified search
130
-	 *
131
-	 * It is allowed to register more than one provider per app as the search
132
-	 * results can go into distinct sections, e.g. "Files" and "Files shared
133
-	 * with you" in the Files app.
134
-	 *
135
-	 * @param string $class
136
-	 *
137
-	 * @return void
138
-	 *
139
-	 * @since 20.0.0
140
-	 */
141
-	public function registerSearchProvider(string $class): void;
128
+    /**
129
+     * Register a search provider for the unified search
130
+     *
131
+     * It is allowed to register more than one provider per app as the search
132
+     * results can go into distinct sections, e.g. "Files" and "Files shared
133
+     * with you" in the Files app.
134
+     *
135
+     * @param string $class
136
+     *
137
+     * @return void
138
+     *
139
+     * @since 20.0.0
140
+     */
141
+    public function registerSearchProvider(string $class): void;
142 142
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/IDashboardWidget.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -51,99 +51,99 @@
 block discarded – undo
51 51
  */
52 52
 interface IDashboardWidget {
53 53
 
54
-	/**
55
-	 * Should returns the (unique) Id of the widget.
56
-	 *
57
-	 * @since 15.0.0
58
-	 * @deprecated 20.0.0
59
-	 *
60
-	 * @return string
61
-	 */
62
-	public function getId(): string;
63
-
64
-
65
-	/**
66
-	 * Should returns the [display] name of the widget.
67
-	 *
68
-	 * @since 15.0.0
69
-	 * @deprecated 20.0.0
70
-	 *
71
-	 * @return string
72
-	 */
73
-	public function getName(): string;
74
-
75
-
76
-	/**
77
-	 * Should returns some text describing the widget.
78
-	 * This description is displayed in the listing of the available widgets.
79
-	 *
80
-	 * @since 15.0.0
81
-	 * @deprecated 20.0.0
82
-	 *
83
-	 * @return string
84
-	 */
85
-	public function getDescription(): string;
86
-
87
-
88
-	/**
89
-	 * Must generate and return a WidgetTemplate that define important stuff
90
-	 * about the Widget: icon, content, css or javascript.
91
-	 *
92
-	 * @see WidgetTemplate
93
-	 *
94
-	 * @since 15.0.0
95
-	 * @deprecated 20.0.0
96
-	 *
97
-	 * @return WidgetTemplate
98
-	 */
99
-	public function getWidgetTemplate(): WidgetTemplate;
100
-
101
-
102
-	/**
103
-	 * Must create and return a WidgetSetup containing the general setup of
104
-	 * the widget
105
-	 *
106
-	 * @see WidgetSetup
107
-	 *
108
-	 * @since 15.0.0
109
-	 * @deprecated 20.0.0
110
-	 *
111
-	 * @return WidgetSetup
112
-	 */
113
-	public function getWidgetSetup(): WidgetSetup;
114
-
115
-
116
-	/**
117
-	 * This method is called when a widget is loaded on the dashboard.
118
-	 * A widget is 'loaded on the dashboard' when one of these conditions
119
-	 * occurs:
120
-	 *
121
-	 * - the user is adding the widget on his dashboard,
122
-	 * - the user already added the widget on his dashboard and he is opening
123
-	 *   the dashboard app.
124
-	 *
125
-	 * @see IWidgetConfig
126
-	 *
127
-	 * @since 15.0.0
128
-	 * @deprecated 20.0.0
129
-	 *
130
-	 * @param IWidgetConfig $settings
131
-	 */
132
-	public function loadWidget(IWidgetConfig $settings);
133
-
134
-
135
-	/**
136
-	 * This method s executed when the widget call the net.requestWidget()
137
-	 * from the Javascript API.
138
-	 *
139
-	 * This is used by the frontend to communicate with the backend.
140
-	 *
141
-	 * @see IWidgetRequest
142
-	 *
143
-	 * @since 15.0.0
144
-	 * @deprecated 20.0.0
145
-	 *
146
-	 * @param IWidgetRequest $request
147
-	 */
148
-	public function requestWidget(IWidgetRequest $request);
54
+    /**
55
+     * Should returns the (unique) Id of the widget.
56
+     *
57
+     * @since 15.0.0
58
+     * @deprecated 20.0.0
59
+     *
60
+     * @return string
61
+     */
62
+    public function getId(): string;
63
+
64
+
65
+    /**
66
+     * Should returns the [display] name of the widget.
67
+     *
68
+     * @since 15.0.0
69
+     * @deprecated 20.0.0
70
+     *
71
+     * @return string
72
+     */
73
+    public function getName(): string;
74
+
75
+
76
+    /**
77
+     * Should returns some text describing the widget.
78
+     * This description is displayed in the listing of the available widgets.
79
+     *
80
+     * @since 15.0.0
81
+     * @deprecated 20.0.0
82
+     *
83
+     * @return string
84
+     */
85
+    public function getDescription(): string;
86
+
87
+
88
+    /**
89
+     * Must generate and return a WidgetTemplate that define important stuff
90
+     * about the Widget: icon, content, css or javascript.
91
+     *
92
+     * @see WidgetTemplate
93
+     *
94
+     * @since 15.0.0
95
+     * @deprecated 20.0.0
96
+     *
97
+     * @return WidgetTemplate
98
+     */
99
+    public function getWidgetTemplate(): WidgetTemplate;
100
+
101
+
102
+    /**
103
+     * Must create and return a WidgetSetup containing the general setup of
104
+     * the widget
105
+     *
106
+     * @see WidgetSetup
107
+     *
108
+     * @since 15.0.0
109
+     * @deprecated 20.0.0
110
+     *
111
+     * @return WidgetSetup
112
+     */
113
+    public function getWidgetSetup(): WidgetSetup;
114
+
115
+
116
+    /**
117
+     * This method is called when a widget is loaded on the dashboard.
118
+     * A widget is 'loaded on the dashboard' when one of these conditions
119
+     * occurs:
120
+     *
121
+     * - the user is adding the widget on his dashboard,
122
+     * - the user already added the widget on his dashboard and he is opening
123
+     *   the dashboard app.
124
+     *
125
+     * @see IWidgetConfig
126
+     *
127
+     * @since 15.0.0
128
+     * @deprecated 20.0.0
129
+     *
130
+     * @param IWidgetConfig $settings
131
+     */
132
+    public function loadWidget(IWidgetConfig $settings);
133
+
134
+
135
+    /**
136
+     * This method s executed when the widget call the net.requestWidget()
137
+     * from the Javascript API.
138
+     *
139
+     * This is used by the frontend to communicate with the backend.
140
+     *
141
+     * @see IWidgetRequest
142
+     *
143
+     * @since 15.0.0
144
+     * @deprecated 20.0.0
145
+     *
146
+     * @param IWidgetRequest $request
147
+     */
148
+    public function requestWidget(IWidgetRequest $request);
149 149
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/IManager.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,16 +34,16 @@
 block discarded – undo
34 34
  */
35 35
 interface IManager {
36 36
 
37
-	/**
38
-	 * @param string $panelClass
39
-	 * @since 20.0.0
40
-	 */
41
-	public function lazyRegisterPanel(string $panelClass): void;
37
+    /**
38
+     * @param string $panelClass
39
+     * @since 20.0.0
40
+     */
41
+    public function lazyRegisterPanel(string $panelClass): void;
42 42
 
43
-	/**
44
-	 * @since 20.0.0
45
-	 *
46
-	 * @return IPanel[]
47
-	 */
48
-	public function getPanels(): array;
43
+    /**
44
+     * @since 20.0.0
45
+     *
46
+     * @return IPanel[]
47
+     */
48
+    public function getPanels(): array;
49 49
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/IPanel.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -34,39 +34,39 @@
 block discarded – undo
34 34
  */
35 35
 interface IPanel {
36 36
 
37
-	/**
38
-	 * @return string Unique id that identifies the panel, e.g. the app id
39
-	 * @since 20.0.0
40
-	 */
41
-	public function getId(): string;
37
+    /**
38
+     * @return string Unique id that identifies the panel, e.g. the app id
39
+     * @since 20.0.0
40
+     */
41
+    public function getId(): string;
42 42
 
43
-	/**
44
-	 * @return string User facing title of the panel
45
-	 * @since 20.0.0
46
-	 */
47
-	public function getTitle(): string;
43
+    /**
44
+     * @return string User facing title of the panel
45
+     * @since 20.0.0
46
+     */
47
+    public function getTitle(): string;
48 48
 
49
-	/**
50
-	 * @return int Initial order for panel sorting
51
-	 * @since 20.0.0
52
-	 */
53
-	public function getOrder(): int;
49
+    /**
50
+     * @return int Initial order for panel sorting
51
+     * @since 20.0.0
52
+     */
53
+    public function getOrder(): int;
54 54
 
55
-	/**
56
-	 * @return string css class that displays an icon next to the panel title
57
-	 * @since 20.0.0
58
-	 */
59
-	public function getIconClass(): string;
55
+    /**
56
+     * @return string css class that displays an icon next to the panel title
57
+     * @since 20.0.0
58
+     */
59
+    public function getIconClass(): string;
60 60
 
61
-	/**
62
-	 * @return string|null The absolute url to the apps own view
63
-	 * @since 20.0.0
64
-	 */
65
-	public function getUrl(): ?string;
61
+    /**
62
+     * @return string|null The absolute url to the apps own view
63
+     * @since 20.0.0
64
+     */
65
+    public function getUrl(): ?string;
66 66
 
67
-	/**
68
-	 * Execute panel bootstrap code like loading scripts and providing initial state
69
-	 * @since 20.0.0
70
-	 */
71
-	public function load(): void;
67
+    /**
68
+     * Execute panel bootstrap code like loading scripts and providing initial state
69
+     * @since 20.0.0
70
+     */
71
+    public function load(): void;
72 72
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/Model/IWidgetConfig.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -43,86 +43,86 @@
 block discarded – undo
43 43
 interface IWidgetConfig {
44 44
 
45 45
 
46
-	/**
47
-	 * Returns the userId
48
-	 *
49
-	 * @since 15.0.0
50
-	 * @deprecated 20.0.0
51
-	 *
52
-	 * @return string
53
-	 */
54
-	public function getUserId(): string;
46
+    /**
47
+     * Returns the userId
48
+     *
49
+     * @since 15.0.0
50
+     * @deprecated 20.0.0
51
+     *
52
+     * @return string
53
+     */
54
+    public function getUserId(): string;
55 55
 
56 56
 
57
-	/**
58
-	 * Returns the widgetId
59
-	 *
60
-	 * @since 15.0.0
61
-	 * @deprecated 20.0.0
62
-	 *
63
-	 * @return string
64
-	 */
65
-	public function getWidgetId(): string;
57
+    /**
58
+     * Returns the widgetId
59
+     *
60
+     * @since 15.0.0
61
+     * @deprecated 20.0.0
62
+     *
63
+     * @return string
64
+     */
65
+    public function getWidgetId(): string;
66 66
 
67 67
 
68
-	/**
69
-	 * Returns the current position and the current size of the widget as
70
-	 * displayed on the user's dashboard
71
-	 *
72
-	 * The returned value is an array:
73
-	 * [
74
-	 *   'x'      => (int) position on the X axis,
75
-	 *   'y'      => (int) position on the Y axis,
76
-	 *   'width'  => (int) width of the widget,
77
-	 *   'height' => (int) height of the widget
78
-	 * ]
79
-	 *
80
-	 * @since 15.0.0
81
-	 * @deprecated 20.0.0
82
-	 *
83
-	 * @return array
84
-	 */
85
-	public function getPosition(): array;
68
+    /**
69
+     * Returns the current position and the current size of the widget as
70
+     * displayed on the user's dashboard
71
+     *
72
+     * The returned value is an array:
73
+     * [
74
+     *   'x'      => (int) position on the X axis,
75
+     *   'y'      => (int) position on the Y axis,
76
+     *   'width'  => (int) width of the widget,
77
+     *   'height' => (int) height of the widget
78
+     * ]
79
+     *
80
+     * @since 15.0.0
81
+     * @deprecated 20.0.0
82
+     *
83
+     * @return array
84
+     */
85
+    public function getPosition(): array;
86 86
 
87 87
 
88
-	/**
89
-	 * Returns an array with the settings defined by the user for the widget.
90
-	 * The returned value is an array, with setting used as keys:
91
-	 *
92
-	 * [
93
-	 *   'setting1'  => 'any value',
94
-	 *   'setting2'  => 'other value'
95
-	 * ]
96
-	 *
97
-	 * Each setting that can be edited by a user should be defined in a
98
-	 * WidgetSetting.
99
-	 *
100
-	 * @see WidgetSetting
101
-	 *
102
-	 * Those WidgetSetting are in the WidgetTemplate defined during the setup
103
-	 * of the widget in the IDashboardWidget.
104
-	 *
105
-	 * @see IDashboardWidget::getWidgetTemplate
106
-	 * @see WidgetTemplate
107
-	 *
108
-	 * When using this framework, the settings interface is generated by the
109
-	 * Dashboard app.
110
-	 *
111
-	 * @since 15.0.0
112
-	 * @deprecated 20.0.0
113
-	 *
114
-	 * @return array
115
-	 */
116
-	public function getSettings(): array;
88
+    /**
89
+     * Returns an array with the settings defined by the user for the widget.
90
+     * The returned value is an array, with setting used as keys:
91
+     *
92
+     * [
93
+     *   'setting1'  => 'any value',
94
+     *   'setting2'  => 'other value'
95
+     * ]
96
+     *
97
+     * Each setting that can be edited by a user should be defined in a
98
+     * WidgetSetting.
99
+     *
100
+     * @see WidgetSetting
101
+     *
102
+     * Those WidgetSetting are in the WidgetTemplate defined during the setup
103
+     * of the widget in the IDashboardWidget.
104
+     *
105
+     * @see IDashboardWidget::getWidgetTemplate
106
+     * @see WidgetTemplate
107
+     *
108
+     * When using this framework, the settings interface is generated by the
109
+     * Dashboard app.
110
+     *
111
+     * @since 15.0.0
112
+     * @deprecated 20.0.0
113
+     *
114
+     * @return array
115
+     */
116
+    public function getSettings(): array;
117 117
 
118 118
 
119
-	/**
120
-	 * Returns if the widget is enabled/displayed in this user's dashboard.
121
-	 *
122
-	 * @since 15.0.0
123
-	 * @deprecated 20.0.0
124
-	 *
125
-	 * @return bool
126
-	 */
127
-	public function isEnabled(): bool;
119
+    /**
120
+     * Returns if the widget is enabled/displayed in this user's dashboard.
121
+     *
122
+     * @since 15.0.0
123
+     * @deprecated 20.0.0
124
+     *
125
+     * @return bool
126
+     */
127
+    public function isEnabled(): bool;
128 128
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/Model/WidgetSetup.php 1 patch
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -43,235 +43,235 @@
 block discarded – undo
43 43
  * @package OCP\Dashboard\Model
44 44
  */
45 45
 final class WidgetSetup implements JsonSerializable {
46
-	public const SIZE_TYPE_MIN = 'min';
47
-	public const SIZE_TYPE_MAX = 'max';
48
-	public const SIZE_TYPE_DEFAULT = 'default';
49
-
50
-
51
-	/** @var array */
52
-	private $sizes = [];
53
-
54
-	/** @var array */
55
-	private $menus = [];
56
-
57
-	/** @var array */
58
-	private $jobs = [];
59
-
60
-	/** @var string */
61
-	private $push = '';
62
-
63
-	/** @var array */
64
-	private $settings = [];
65
-
66
-
67
-	/**
68
-	 * Get the defined size for a specific type (min, max, default)
69
-	 * Returns an array:
70
-	 * [
71
-	 *   'width' => width,
72
-	 *   'height' => height
73
-	 * ]
74
-	 *
75
-	 *
76
-	 * @since 15.0.0
77
-	 * @deprecated 20.0.0
78
-	 *
79
-	 * @param string $type
80
-	 *
81
-	 * @return array
82
-	 */
83
-	public function getSize(string $type): array {
84
-		if (array_key_exists($type, $this->sizes)) {
85
-			return $this->sizes[$type];
86
-		}
87
-
88
-		return [];
89
-	}
90
-
91
-	/**
92
-	 * Returns all sizes defined for the widget.
93
-	 *
94
-	 * @since 15.0.0
95
-	 * @deprecated 20.0.0
96
-	 *
97
-	 * @return array
98
-	 */
99
-	public function getSizes(): array {
100
-		return $this->sizes;
101
-	}
102
-
103
-	/**
104
-	 * Add a new size to the setup.
105
-	 *
106
-	 * @since 15.0.0
107
-	 * @deprecated 20.0.0
108
-	 *
109
-	 * @param string $type
110
-	 * @param int $width
111
-	 * @param int $height
112
-	 *
113
-	 * @return WidgetSetup
114
-	 */
115
-	public function addSize(string $type, int $width, int $height): WidgetSetup {
116
-		$this->sizes[$type] = [
117
-			'width' => $width,
118
-			'height' => $height
119
-		];
120
-
121
-		return $this;
122
-	}
123
-
124
-	/**
125
-	 * Returns menu entries.
126
-	 *
127
-	 * @since 15.0.0
128
-	 * @deprecated 20.0.0
129
-	 *
130
-	 * @return array
131
-	 */
132
-	public function getMenuEntries(): array {
133
-		return $this->menus;
134
-	}
135
-
136
-	/**
137
-	 * Add a menu entry to the widget.
138
-	 * $function is the Javascript function to be called when clicking the
139
-	 *           menu entry.
140
-	 * $icon is the css class of the icon.
141
-	 * $text is the display name of the menu entry.
142
-	 *
143
-	 * @since 15.0.0
144
-	 * @deprecated 20.0.0
145
-	 *
146
-	 * @param string $function
147
-	 * @param string $icon
148
-	 * @param string $text
149
-	 *
150
-	 * @return WidgetSetup
151
-	 */
152
-	public function addMenuEntry(string $function, string $icon, string $text): WidgetSetup {
153
-		$this->menus[] = [
154
-			'function' => $function,
155
-			'icon' => $icon,
156
-			'text' => $text
157
-		];
158
-
159
-		return $this;
160
-	}
161
-
162
-
163
-	/**
164
-	 * Add a delayed job to the widget.
165
-	 *
166
-	 * $function is the Javascript function to be called.
167
-	 * $delay is the time in seconds between each call.
168
-	 *
169
-	 * @since 15.0.0
170
-	 * @deprecated 20.0.0
171
-	 *
172
-	 * @param string $function
173
-	 * @param int $delay
174
-	 *
175
-	 * @return WidgetSetup
176
-	 */
177
-	public function addDelayedJob(string $function, int $delay): WidgetSetup {
178
-		$this->jobs[] = [
179
-			'function' => $function,
180
-			'delay' => $delay
181
-		];
182
-
183
-		return $this;
184
-	}
185
-
186
-	/**
187
-	 * Get delayed jobs.
188
-	 *
189
-	 * @since 15.0.0
190
-	 * @deprecated 20.0.0
191
-	 *
192
-	 * @return array
193
-	 */
194
-	public function getDelayedJobs(): array {
195
-		return $this->jobs;
196
-	}
197
-
198
-
199
-	/**
200
-	 * Get the push function, called when an event is send to the front-end
201
-	 *
202
-	 * @since 15.0.0
203
-	 * @deprecated 20.0.0
204
-	 *
205
-	 * @return string
206
-	 */
207
-	public function getPush(): string {
208
-		return $this->push;
209
-	}
210
-
211
-	/**
212
-	 * Set the Javascript function to be called when an event is pushed to the
213
-	 * frontend.
214
-	 *
215
-	 * @since 15.0.0
216
-	 * @deprecated 20.0.0
217
-	 *
218
-	 * @param string $function
219
-	 *
220
-	 * @return WidgetSetup
221
-	 */
222
-	public function setPush(string $function): WidgetSetup {
223
-		$this->push = $function;
224
-
225
-		return $this;
226
-	}
227
-
228
-
229
-	/**
230
-	 * Returns the default settings for a widget.
231
-	 *
232
-	 * @since 15.0.0
233
-	 * @deprecated 20.0.0
234
-	 *
235
-	 * @return array
236
-	 */
237
-	public function getDefaultSettings(): array {
238
-		return $this->settings;
239
-	}
240
-
241
-	/**
242
-	 * Set the default settings for a widget.
243
-	 * This method is used by the Dashboard app, using the settings created
244
-	 * using WidgetSetting
245
-	 *
246
-	 * @see WidgetSetting
247
-	 *
248
-	 * @since 15.0.0
249
-	 * @deprecated 20.0.0
250
-	 *
251
-	 * @param array $settings
252
-	 *
253
-	 * @return WidgetSetup
254
-	 */
255
-	public function setDefaultSettings(array $settings): WidgetSetup {
256
-		$this->settings = $settings;
257
-
258
-		return $this;
259
-	}
260
-
261
-
262
-	/**
263
-	 * @since 15.0.0
264
-	 * @deprecated 20.0.0
265
-	 *
266
-	 * @return array
267
-	 */
268
-	public function jsonSerialize() {
269
-		return [
270
-			'size' => $this->getSizes(),
271
-			'menu' => $this->getMenuEntries(),
272
-			'jobs' => $this->getDelayedJobs(),
273
-			'push' => $this->getPush(),
274
-			'settings' => $this->getDefaultSettings()
275
-		];
276
-	}
46
+    public const SIZE_TYPE_MIN = 'min';
47
+    public const SIZE_TYPE_MAX = 'max';
48
+    public const SIZE_TYPE_DEFAULT = 'default';
49
+
50
+
51
+    /** @var array */
52
+    private $sizes = [];
53
+
54
+    /** @var array */
55
+    private $menus = [];
56
+
57
+    /** @var array */
58
+    private $jobs = [];
59
+
60
+    /** @var string */
61
+    private $push = '';
62
+
63
+    /** @var array */
64
+    private $settings = [];
65
+
66
+
67
+    /**
68
+     * Get the defined size for a specific type (min, max, default)
69
+     * Returns an array:
70
+     * [
71
+     *   'width' => width,
72
+     *   'height' => height
73
+     * ]
74
+     *
75
+     *
76
+     * @since 15.0.0
77
+     * @deprecated 20.0.0
78
+     *
79
+     * @param string $type
80
+     *
81
+     * @return array
82
+     */
83
+    public function getSize(string $type): array {
84
+        if (array_key_exists($type, $this->sizes)) {
85
+            return $this->sizes[$type];
86
+        }
87
+
88
+        return [];
89
+    }
90
+
91
+    /**
92
+     * Returns all sizes defined for the widget.
93
+     *
94
+     * @since 15.0.0
95
+     * @deprecated 20.0.0
96
+     *
97
+     * @return array
98
+     */
99
+    public function getSizes(): array {
100
+        return $this->sizes;
101
+    }
102
+
103
+    /**
104
+     * Add a new size to the setup.
105
+     *
106
+     * @since 15.0.0
107
+     * @deprecated 20.0.0
108
+     *
109
+     * @param string $type
110
+     * @param int $width
111
+     * @param int $height
112
+     *
113
+     * @return WidgetSetup
114
+     */
115
+    public function addSize(string $type, int $width, int $height): WidgetSetup {
116
+        $this->sizes[$type] = [
117
+            'width' => $width,
118
+            'height' => $height
119
+        ];
120
+
121
+        return $this;
122
+    }
123
+
124
+    /**
125
+     * Returns menu entries.
126
+     *
127
+     * @since 15.0.0
128
+     * @deprecated 20.0.0
129
+     *
130
+     * @return array
131
+     */
132
+    public function getMenuEntries(): array {
133
+        return $this->menus;
134
+    }
135
+
136
+    /**
137
+     * Add a menu entry to the widget.
138
+     * $function is the Javascript function to be called when clicking the
139
+     *           menu entry.
140
+     * $icon is the css class of the icon.
141
+     * $text is the display name of the menu entry.
142
+     *
143
+     * @since 15.0.0
144
+     * @deprecated 20.0.0
145
+     *
146
+     * @param string $function
147
+     * @param string $icon
148
+     * @param string $text
149
+     *
150
+     * @return WidgetSetup
151
+     */
152
+    public function addMenuEntry(string $function, string $icon, string $text): WidgetSetup {
153
+        $this->menus[] = [
154
+            'function' => $function,
155
+            'icon' => $icon,
156
+            'text' => $text
157
+        ];
158
+
159
+        return $this;
160
+    }
161
+
162
+
163
+    /**
164
+     * Add a delayed job to the widget.
165
+     *
166
+     * $function is the Javascript function to be called.
167
+     * $delay is the time in seconds between each call.
168
+     *
169
+     * @since 15.0.0
170
+     * @deprecated 20.0.0
171
+     *
172
+     * @param string $function
173
+     * @param int $delay
174
+     *
175
+     * @return WidgetSetup
176
+     */
177
+    public function addDelayedJob(string $function, int $delay): WidgetSetup {
178
+        $this->jobs[] = [
179
+            'function' => $function,
180
+            'delay' => $delay
181
+        ];
182
+
183
+        return $this;
184
+    }
185
+
186
+    /**
187
+     * Get delayed jobs.
188
+     *
189
+     * @since 15.0.0
190
+     * @deprecated 20.0.0
191
+     *
192
+     * @return array
193
+     */
194
+    public function getDelayedJobs(): array {
195
+        return $this->jobs;
196
+    }
197
+
198
+
199
+    /**
200
+     * Get the push function, called when an event is send to the front-end
201
+     *
202
+     * @since 15.0.0
203
+     * @deprecated 20.0.0
204
+     *
205
+     * @return string
206
+     */
207
+    public function getPush(): string {
208
+        return $this->push;
209
+    }
210
+
211
+    /**
212
+     * Set the Javascript function to be called when an event is pushed to the
213
+     * frontend.
214
+     *
215
+     * @since 15.0.0
216
+     * @deprecated 20.0.0
217
+     *
218
+     * @param string $function
219
+     *
220
+     * @return WidgetSetup
221
+     */
222
+    public function setPush(string $function): WidgetSetup {
223
+        $this->push = $function;
224
+
225
+        return $this;
226
+    }
227
+
228
+
229
+    /**
230
+     * Returns the default settings for a widget.
231
+     *
232
+     * @since 15.0.0
233
+     * @deprecated 20.0.0
234
+     *
235
+     * @return array
236
+     */
237
+    public function getDefaultSettings(): array {
238
+        return $this->settings;
239
+    }
240
+
241
+    /**
242
+     * Set the default settings for a widget.
243
+     * This method is used by the Dashboard app, using the settings created
244
+     * using WidgetSetting
245
+     *
246
+     * @see WidgetSetting
247
+     *
248
+     * @since 15.0.0
249
+     * @deprecated 20.0.0
250
+     *
251
+     * @param array $settings
252
+     *
253
+     * @return WidgetSetup
254
+     */
255
+    public function setDefaultSettings(array $settings): WidgetSetup {
256
+        $this->settings = $settings;
257
+
258
+        return $this;
259
+    }
260
+
261
+
262
+    /**
263
+     * @since 15.0.0
264
+     * @deprecated 20.0.0
265
+     *
266
+     * @return array
267
+     */
268
+    public function jsonSerialize() {
269
+        return [
270
+            'size' => $this->getSizes(),
271
+            'menu' => $this->getMenuEntries(),
272
+            'jobs' => $this->getDelayedJobs(),
273
+            'push' => $this->getPush(),
274
+            'settings' => $this->getDefaultSettings()
275
+        ];
276
+    }
277 277
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/Model/WidgetSetting.php 1 patch
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -50,197 +50,197 @@
 block discarded – undo
50 50
  * @package OCP\Dashboard\Model
51 51
  */
52 52
 final class WidgetSetting implements JsonSerializable {
53
-	public const TYPE_INPUT = 'input';
54
-	public const TYPE_CHECKBOX = 'checkbox';
55
-
56
-
57
-	/** @var string */
58
-	private $name = '';
59
-
60
-	/** @var string */
61
-	private $title = '';
62
-
63
-	/** @var string */
64
-	private $type = '';
65
-
66
-	/** @var string */
67
-	private $placeholder = '';
68
-
69
-	/** @var string */
70
-	private $default = '';
71
-
72
-
73
-	/**
74
-	 * WidgetSetting constructor.
75
-	 *
76
-	 * @since 15.0.0
77
-	 * @deprecated 20.0.0
78
-	 *
79
-	 * @param string $type
80
-	 */
81
-	public function __construct(string $type = '') {
82
-		$this->type = $type;
83
-	}
84
-
85
-
86
-	/**
87
-	 * Set the name of the setting (full string, no space)
88
-	 *
89
-	 * @since 15.0.0
90
-	 * @deprecated 20.0.0
91
-	 *
92
-	 * @param string $name
93
-	 *
94
-	 * @return WidgetSetting
95
-	 */
96
-	public function setName(string $name): WidgetSetting {
97
-		$this->name = $name;
98
-
99
-		return $this;
100
-	}
101
-
102
-	/**
103
-	 * Get the name of the setting
104
-	 *
105
-	 * @since 15.0.0
106
-	 * @deprecated 20.0.0
107
-	 *
108
-	 * @return string
109
-	 */
110
-	public function getName(): string {
111
-		return $this->name;
112
-	}
113
-
114
-
115
-	/**
116
-	 * Set the title/display name of the setting.
117
-	 *
118
-	 * @since 15.0.0
119
-	 * @deprecated 20.0.0
120
-	 *
121
-	 * @param string $title
122
-	 *
123
-	 * @return WidgetSetting
124
-	 */
125
-	public function setTitle(string $title): WidgetSetting {
126
-		$this->title = $title;
127
-
128
-		return $this;
129
-	}
130
-
131
-	/**
132
-	 * Get the title of the setting
133
-	 *
134
-	 * @since 15.0.0
135
-	 * @deprecated 20.0.0
136
-	 *
137
-	 * @return string
138
-	 */
139
-	public function getTitle(): string {
140
-		return $this->title;
141
-	}
142
-
143
-
144
-	/**
145
-	 * Set the type of the setting (input, checkbox, ...)
146
-	 *
147
-	 * @since 15.0.0
148
-	 * @deprecated 20.0.0
149
-	 *
150
-	 * @param string $type
151
-	 *
152
-	 * @return WidgetSetting
153
-	 */
154
-	public function setType(string $type): WidgetSetting {
155
-		$this->type = $type;
156
-
157
-		return $this;
158
-	}
159
-
160
-	/**
161
-	 * Get the type of the setting.
162
-	 *
163
-	 * @since 15.0.0
164
-	 * @deprecated 20.0.0
165
-	 *
166
-	 * @return string
167
-	 */
168
-	public function getType(): string {
169
-		return $this->type;
170
-	}
171
-
172
-
173
-	/**
174
-	 * Set the placeholder (in case of type=input)
175
-	 *
176
-	 * @since 15.0.0
177
-	 * @deprecated 20.0.0
178
-	 *
179
-	 * @param string $text
180
-	 *
181
-	 * @return WidgetSetting
182
-	 */
183
-	public function setPlaceholder(string $text): WidgetSetting {
184
-		$this->placeholder = $text;
185
-
186
-		return $this;
187
-	}
188
-
189
-	/**
190
-	 * Get the placeholder.
191
-	 *
192
-	 * @since 15.0.0
193
-	 * @deprecated 20.0.0
194
-	 *
195
-	 * @return string
196
-	 */
197
-	public function getPlaceholder(): string {
198
-		return $this->placeholder;
199
-	}
200
-
201
-
202
-	/**
203
-	 * Set the default value of the setting.
204
-	 *
205
-	 * @since 15.0.0
206
-	 * @deprecated 20.0.0
207
-	 *
208
-	 * @param string $value
209
-	 *
210
-	 * @return WidgetSetting
211
-	 */
212
-	public function setDefault(string $value): WidgetSetting {
213
-		$this->default = $value;
214
-
215
-		return $this;
216
-	}
217
-
218
-	/**
219
-	 * Get the default value.
220
-	 *
221
-	 * @since 15.0.0
222
-	 * @deprecated 20.0.0
223
-	 *
224
-	 * @return string
225
-	 */
226
-	public function getDefault(): string {
227
-		return $this->default;
228
-	}
229
-
230
-
231
-	/**
232
-	 * @since 15.0.0
233
-	 * @deprecated 20.0.0
234
-	 *
235
-	 * @return array
236
-	 */
237
-	public function jsonSerialize() {
238
-		return [
239
-			'name' => $this->getName(),
240
-			'title' => $this->getTitle(),
241
-			'type' => $this->getTitle(),
242
-			'default' => $this->getDefault(),
243
-			'placeholder' => $this->getPlaceholder()
244
-		];
245
-	}
53
+    public const TYPE_INPUT = 'input';
54
+    public const TYPE_CHECKBOX = 'checkbox';
55
+
56
+
57
+    /** @var string */
58
+    private $name = '';
59
+
60
+    /** @var string */
61
+    private $title = '';
62
+
63
+    /** @var string */
64
+    private $type = '';
65
+
66
+    /** @var string */
67
+    private $placeholder = '';
68
+
69
+    /** @var string */
70
+    private $default = '';
71
+
72
+
73
+    /**
74
+     * WidgetSetting constructor.
75
+     *
76
+     * @since 15.0.0
77
+     * @deprecated 20.0.0
78
+     *
79
+     * @param string $type
80
+     */
81
+    public function __construct(string $type = '') {
82
+        $this->type = $type;
83
+    }
84
+
85
+
86
+    /**
87
+     * Set the name of the setting (full string, no space)
88
+     *
89
+     * @since 15.0.0
90
+     * @deprecated 20.0.0
91
+     *
92
+     * @param string $name
93
+     *
94
+     * @return WidgetSetting
95
+     */
96
+    public function setName(string $name): WidgetSetting {
97
+        $this->name = $name;
98
+
99
+        return $this;
100
+    }
101
+
102
+    /**
103
+     * Get the name of the setting
104
+     *
105
+     * @since 15.0.0
106
+     * @deprecated 20.0.0
107
+     *
108
+     * @return string
109
+     */
110
+    public function getName(): string {
111
+        return $this->name;
112
+    }
113
+
114
+
115
+    /**
116
+     * Set the title/display name of the setting.
117
+     *
118
+     * @since 15.0.0
119
+     * @deprecated 20.0.0
120
+     *
121
+     * @param string $title
122
+     *
123
+     * @return WidgetSetting
124
+     */
125
+    public function setTitle(string $title): WidgetSetting {
126
+        $this->title = $title;
127
+
128
+        return $this;
129
+    }
130
+
131
+    /**
132
+     * Get the title of the setting
133
+     *
134
+     * @since 15.0.0
135
+     * @deprecated 20.0.0
136
+     *
137
+     * @return string
138
+     */
139
+    public function getTitle(): string {
140
+        return $this->title;
141
+    }
142
+
143
+
144
+    /**
145
+     * Set the type of the setting (input, checkbox, ...)
146
+     *
147
+     * @since 15.0.0
148
+     * @deprecated 20.0.0
149
+     *
150
+     * @param string $type
151
+     *
152
+     * @return WidgetSetting
153
+     */
154
+    public function setType(string $type): WidgetSetting {
155
+        $this->type = $type;
156
+
157
+        return $this;
158
+    }
159
+
160
+    /**
161
+     * Get the type of the setting.
162
+     *
163
+     * @since 15.0.0
164
+     * @deprecated 20.0.0
165
+     *
166
+     * @return string
167
+     */
168
+    public function getType(): string {
169
+        return $this->type;
170
+    }
171
+
172
+
173
+    /**
174
+     * Set the placeholder (in case of type=input)
175
+     *
176
+     * @since 15.0.0
177
+     * @deprecated 20.0.0
178
+     *
179
+     * @param string $text
180
+     *
181
+     * @return WidgetSetting
182
+     */
183
+    public function setPlaceholder(string $text): WidgetSetting {
184
+        $this->placeholder = $text;
185
+
186
+        return $this;
187
+    }
188
+
189
+    /**
190
+     * Get the placeholder.
191
+     *
192
+     * @since 15.0.0
193
+     * @deprecated 20.0.0
194
+     *
195
+     * @return string
196
+     */
197
+    public function getPlaceholder(): string {
198
+        return $this->placeholder;
199
+    }
200
+
201
+
202
+    /**
203
+     * Set the default value of the setting.
204
+     *
205
+     * @since 15.0.0
206
+     * @deprecated 20.0.0
207
+     *
208
+     * @param string $value
209
+     *
210
+     * @return WidgetSetting
211
+     */
212
+    public function setDefault(string $value): WidgetSetting {
213
+        $this->default = $value;
214
+
215
+        return $this;
216
+    }
217
+
218
+    /**
219
+     * Get the default value.
220
+     *
221
+     * @since 15.0.0
222
+     * @deprecated 20.0.0
223
+     *
224
+     * @return string
225
+     */
226
+    public function getDefault(): string {
227
+        return $this->default;
228
+    }
229
+
230
+
231
+    /**
232
+     * @since 15.0.0
233
+     * @deprecated 20.0.0
234
+     *
235
+     * @return array
236
+     */
237
+    public function jsonSerialize() {
238
+        return [
239
+            'name' => $this->getName(),
240
+            'title' => $this->getTitle(),
241
+            'type' => $this->getTitle(),
242
+            'default' => $this->getDefault(),
243
+            'placeholder' => $this->getPlaceholder()
244
+        ];
245
+    }
246 246
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/Model/IWidgetRequest.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -44,95 +44,95 @@
 block discarded – undo
44 44
  */
45 45
 interface IWidgetRequest {
46 46
 
47
-	/**
48
-	 * Get the widgetId.
49
-	 *
50
-	 * @since 15.0.0
51
-	 * @deprecated 20.0.0
52
-	 *
53
-	 * @return string
54
-	 */
55
-	public function getWidgetId(): string;
56
-
57
-
58
-	/**
59
-	 * Get the WidgetClass.
60
-	 *
61
-	 * @since 15.0.0
62
-	 * @deprecated 20.0.0
63
-	 *
64
-	 * @return IDashboardWidget
65
-	 */
66
-	public function getWidget(): IDashboardWidget;
67
-
68
-
69
-	/**
70
-	 * Get the 'request' string sent by the request from the front-end with
71
-	 * the format:
72
-	 *
73
-	 *  net.requestWidget(
74
-	 *    {
75
-	 *     widget: widgetId,
76
-	 *     request: request,
77
-	 *     value: value
78
-	 *    },
79
-	 *    callback);
80
-	 *
81
-	 * @since 15.0.0
82
-	 * @deprecated 20.0.0
83
-	 *
84
-	 * @return string
85
-	 */
86
-	public function getRequest(): string;
87
-
88
-
89
-	/**
90
-	 * Get the 'value' string sent by the request from the front-end.
91
-	 *
92
-	 * @see getRequest
93
-	 *
94
-	 * @since 15.0.0
95
-	 * @deprecated 20.0.0
96
-	 *
97
-	 * @return string
98
-	 */
99
-	public function getValue(): string;
100
-
101
-
102
-	/**
103
-	 * Returns the result.
104
-	 *
105
-	 * @since 15.0.0
106
-	 * @deprecated 20.0.0
107
-	 *
108
-	 * @return array
109
-	 */
110
-	public function getResult(): array;
111
-
112
-
113
-	/**
114
-	 * add a result (as string)
115
-	 *
116
-	 * @since 15.0.0
117
-	 * @deprecated 20.0.0
118
-	 *
119
-	 * @param string $key
120
-	 * @param string $result
121
-	 *
122
-	 * @return $this
123
-	 */
124
-	public function addResult(string $key, string $result): IWidgetRequest;
125
-
126
-	/**
127
-	 * add a result (as array)
128
-	 *
129
-	 * @since 15.0.0
130
-	 * @deprecated 20.0.0
131
-	 *
132
-	 * @param string $key
133
-	 * @param array $result
134
-	 *
135
-	 * @return $this
136
-	 */
137
-	public function addResultArray(string $key, array $result): IWidgetRequest;
47
+    /**
48
+     * Get the widgetId.
49
+     *
50
+     * @since 15.0.0
51
+     * @deprecated 20.0.0
52
+     *
53
+     * @return string
54
+     */
55
+    public function getWidgetId(): string;
56
+
57
+
58
+    /**
59
+     * Get the WidgetClass.
60
+     *
61
+     * @since 15.0.0
62
+     * @deprecated 20.0.0
63
+     *
64
+     * @return IDashboardWidget
65
+     */
66
+    public function getWidget(): IDashboardWidget;
67
+
68
+
69
+    /**
70
+     * Get the 'request' string sent by the request from the front-end with
71
+     * the format:
72
+     *
73
+     *  net.requestWidget(
74
+     *    {
75
+     *     widget: widgetId,
76
+     *     request: request,
77
+     *     value: value
78
+     *    },
79
+     *    callback);
80
+     *
81
+     * @since 15.0.0
82
+     * @deprecated 20.0.0
83
+     *
84
+     * @return string
85
+     */
86
+    public function getRequest(): string;
87
+
88
+
89
+    /**
90
+     * Get the 'value' string sent by the request from the front-end.
91
+     *
92
+     * @see getRequest
93
+     *
94
+     * @since 15.0.0
95
+     * @deprecated 20.0.0
96
+     *
97
+     * @return string
98
+     */
99
+    public function getValue(): string;
100
+
101
+
102
+    /**
103
+     * Returns the result.
104
+     *
105
+     * @since 15.0.0
106
+     * @deprecated 20.0.0
107
+     *
108
+     * @return array
109
+     */
110
+    public function getResult(): array;
111
+
112
+
113
+    /**
114
+     * add a result (as string)
115
+     *
116
+     * @since 15.0.0
117
+     * @deprecated 20.0.0
118
+     *
119
+     * @param string $key
120
+     * @param string $result
121
+     *
122
+     * @return $this
123
+     */
124
+    public function addResult(string $key, string $result): IWidgetRequest;
125
+
126
+    /**
127
+     * add a result (as array)
128
+     *
129
+     * @since 15.0.0
130
+     * @deprecated 20.0.0
131
+     *
132
+     * @param string $key
133
+     * @param array $result
134
+     *
135
+     * @return $this
136
+     */
137
+    public function addResultArray(string $key, array $result): IWidgetRequest;
138 138
 }
Please login to merge, or discard this patch.
lib/public/Dashboard/Model/WidgetTemplate.php 1 patch
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -44,286 +44,286 @@
 block discarded – undo
44 44
 final class WidgetTemplate implements JsonSerializable {
45 45
 
46 46
 
47
-	/** @var string */
48
-	private $icon = '';
49
-
50
-	/** @var array */
51
-	private $css = [];
52
-
53
-	/** @var array */
54
-	private $js = [];
55
-
56
-	/** @var string */
57
-	private $content = '';
58
-
59
-	/** @var string */
60
-	private $function = '';
61
-
62
-	/** @var WidgetSetting[] */
63
-	private $settings = [];
64
-
65
-
66
-	/**
67
-	 * Get the icon class of the widget.
68
-	 *
69
-	 * @since 15.0.0
70
-	 * @deprecated 20.0.0
71
-	 *
72
-	 * @return string
73
-	 */
74
-	public function getIcon(): string {
75
-		return $this->icon;
76
-	}
77
-
78
-	/**
79
-	 * Set the icon class of the widget.
80
-	 * This class must be defined in one of the CSS file used by the widget.
81
-	 *
82
-	 * @see addCss
83
-	 *
84
-	 * @since 15.0.0
85
-	 * @deprecated 20.0.0
86
-	 *
87
-	 * @param string $icon
88
-	 *
89
-	 * @return WidgetTemplate
90
-	 */
91
-	public function setIcon(string $icon): WidgetTemplate {
92
-		$this->icon = $icon;
93
-
94
-		return $this;
95
-	}
96
-
97
-	/**
98
-	 * Get CSS files to be included when displaying a widget
99
-	 *
100
-	 * @since 15.0.0
101
-	 * @deprecated 20.0.0
102
-	 *
103
-	 * @return array
104
-	 */
105
-	public function getCss(): array {
106
-		return $this->css;
107
-	}
108
-
109
-	/**
110
-	 * path and name of CSS files
111
-	 *
112
-	 * @since 15.0.0
113
-	 * @deprecated 20.0.0
114
-	 *
115
-	 * @param array $css
116
-	 *
117
-	 * @return WidgetTemplate
118
-	 */
119
-	public function setCss(array $css): WidgetTemplate {
120
-		$this->css = $css;
121
-
122
-		return $this;
123
-	}
124
-
125
-	/**
126
-	 * Add a CSS file to be included when displaying a widget.
127
-	 *
128
-	 * @since 15.0.0
129
-	 * @deprecated 20.0.0
130
-	 *
131
-	 * @param string $css
132
-	 *
133
-	 * @return WidgetTemplate
134
-	 */
135
-	public function addCss(string $css): WidgetTemplate {
136
-		$this->css[] = $css;
137
-
138
-		return $this;
139
-	}
140
-
141
-	/**
142
-	 * Get JS files to be included when loading a widget
143
-	 *
144
-	 * @since 15.0.0
145
-	 * @deprecated 20.0.0
146
-	 *
147
-	 * @return array
148
-	 */
149
-	public function getJs(): array {
150
-		return $this->js;
151
-	}
152
-
153
-	/**
154
-	 * Set an array of JS files to be included when loading a widget.
155
-	 *
156
-	 * @since 15.0.0
157
-	 * @deprecated 20.0.0
158
-	 *
159
-	 * @param array $js
160
-	 *
161
-	 * @return WidgetTemplate
162
-	 */
163
-	public function setJs(array $js): WidgetTemplate {
164
-		$this->js = $js;
165
-
166
-		return $this;
167
-	}
168
-
169
-	/**
170
-	 * Add a JS file to be included when loading a widget.
171
-	 *
172
-	 * @since 15.0.0
173
-	 * @deprecated 20.0.0
174
-	 *
175
-	 * @param string $js
176
-	 *
177
-	 * @return WidgetTemplate
178
-	 */
179
-	public function addJs(string $js): WidgetTemplate {
180
-		$this->js[] = $js;
181
-
182
-		return $this;
183
-	}
184
-
185
-	/**
186
-	 * Get the HTML file that contains the content of the widget.
187
-	 *
188
-	 * @since 15.0.0
189
-	 * @deprecated 20.0.0
190
-	 *
191
-	 * @return string
192
-	 */
193
-	public function getContent(): string {
194
-		return $this->content;
195
-	}
196
-
197
-	/**
198
-	 * Set the HTML file that contains the content of the widget.
199
-	 *
200
-	 * @since 15.0.0
201
-	 * @deprecated 20.0.0
202
-	 *
203
-	 * @param string $content
204
-	 *
205
-	 * @return WidgetTemplate
206
-	 */
207
-	public function setContent(string $content): WidgetTemplate {
208
-		$this->content = $content;
209
-
210
-		return $this;
211
-	}
212
-
213
-	/**
214
-	 * Get the JS function to be called when loading the widget.
215
-	 *
216
-	 * @since 15.0.0
217
-	 * @deprecated 20.0.0
218
-	 *
219
-	 * @return string
220
-	 */
221
-	public function getInitFunction(): string {
222
-		return $this->function;
223
-	}
224
-
225
-	/**
226
-	 * JavaScript function to be called when loading the widget on the
227
-	 * dashboard
228
-	 *
229
-	 * @since 15.0.0
230
-	 * @deprecated 20.0.0
231
-	 *
232
-	 * @param string $function
233
-	 *
234
-	 * @return WidgetTemplate
235
-	 */
236
-	public function setInitFunction(string $function): WidgetTemplate {
237
-		$this->function = $function;
238
-
239
-		return $this;
240
-	}
241
-
242
-	/**
243
-	 * Get all WidgetSetting defined for the widget.
244
-	 *
245
-	 * @see WidgetSetting
246
-	 *
247
-	 * @since 15.0.0
248
-	 * @deprecated 20.0.0
249
-	 *
250
-	 * @return WidgetSetting[]
251
-	 */
252
-	public function getSettings(): array {
253
-		return $this->settings;
254
-	}
255
-
256
-	/**
257
-	 * Define all WidgetSetting for the widget.
258
-	 *
259
-	 * @since 15.0.0
260
-	 * @deprecated 20.0.0
261
-	 *
262
-	 * @see WidgetSetting
263
-	 *
264
-	 * @param WidgetSetting[] $settings
265
-	 *
266
-	 * @return WidgetTemplate
267
-	 */
268
-	public function setSettings(array $settings): WidgetTemplate {
269
-		$this->settings = $settings;
270
-
271
-		return $this;
272
-	}
273
-
274
-	/**
275
-	 * Add a WidgetSetting.
276
-	 *
277
-	 * @see WidgetSetting
278
-	 *
279
-	 * @since 15.0.0
280
-	 * @deprecated 20.0.0
281
-	 *
282
-	 * @param WidgetSetting $setting
283
-	 *
284
-	 * @return WidgetTemplate
285
-	 */
286
-	public function addSetting(WidgetSetting $setting): WidgetTemplate {
287
-		$this->settings[] = $setting;
288
-
289
-		return $this;
290
-	}
291
-
292
-	/**
293
-	 * Get a WidgetSetting by its name
294
-	 *
295
-	 * @see WidgetSetting::setName
296
-	 *
297
-	 * @since 15.0.0
298
-	 * @deprecated 20.0.0
299
-	 *
300
-	 * @param string $key
301
-	 *
302
-	 * @return WidgetSetting
303
-	 */
304
-	public function getSetting(string $key): WidgetSetting {
305
-		if (!array_key_exists($key, $this->settings)) {
306
-			return null;
307
-		}
308
-
309
-		return $this->settings[$key];
310
-	}
311
-
312
-
313
-	/**
314
-	 * @since 15.0.0
315
-	 * @deprecated 20.0.0
316
-	 *
317
-	 * @return array
318
-	 */
319
-	public function jsonSerialize() {
320
-		return [
321
-			'icon' => $this->getIcon(),
322
-			'css' => $this->getCss(),
323
-			'js' => $this->getJs(),
324
-			'content' => $this->getContent(),
325
-			'function' => $this->getInitFunction(),
326
-			'settings' => $this->getSettings()
327
-		];
328
-	}
47
+    /** @var string */
48
+    private $icon = '';
49
+
50
+    /** @var array */
51
+    private $css = [];
52
+
53
+    /** @var array */
54
+    private $js = [];
55
+
56
+    /** @var string */
57
+    private $content = '';
58
+
59
+    /** @var string */
60
+    private $function = '';
61
+
62
+    /** @var WidgetSetting[] */
63
+    private $settings = [];
64
+
65
+
66
+    /**
67
+     * Get the icon class of the widget.
68
+     *
69
+     * @since 15.0.0
70
+     * @deprecated 20.0.0
71
+     *
72
+     * @return string
73
+     */
74
+    public function getIcon(): string {
75
+        return $this->icon;
76
+    }
77
+
78
+    /**
79
+     * Set the icon class of the widget.
80
+     * This class must be defined in one of the CSS file used by the widget.
81
+     *
82
+     * @see addCss
83
+     *
84
+     * @since 15.0.0
85
+     * @deprecated 20.0.0
86
+     *
87
+     * @param string $icon
88
+     *
89
+     * @return WidgetTemplate
90
+     */
91
+    public function setIcon(string $icon): WidgetTemplate {
92
+        $this->icon = $icon;
93
+
94
+        return $this;
95
+    }
96
+
97
+    /**
98
+     * Get CSS files to be included when displaying a widget
99
+     *
100
+     * @since 15.0.0
101
+     * @deprecated 20.0.0
102
+     *
103
+     * @return array
104
+     */
105
+    public function getCss(): array {
106
+        return $this->css;
107
+    }
108
+
109
+    /**
110
+     * path and name of CSS files
111
+     *
112
+     * @since 15.0.0
113
+     * @deprecated 20.0.0
114
+     *
115
+     * @param array $css
116
+     *
117
+     * @return WidgetTemplate
118
+     */
119
+    public function setCss(array $css): WidgetTemplate {
120
+        $this->css = $css;
121
+
122
+        return $this;
123
+    }
124
+
125
+    /**
126
+     * Add a CSS file to be included when displaying a widget.
127
+     *
128
+     * @since 15.0.0
129
+     * @deprecated 20.0.0
130
+     *
131
+     * @param string $css
132
+     *
133
+     * @return WidgetTemplate
134
+     */
135
+    public function addCss(string $css): WidgetTemplate {
136
+        $this->css[] = $css;
137
+
138
+        return $this;
139
+    }
140
+
141
+    /**
142
+     * Get JS files to be included when loading a widget
143
+     *
144
+     * @since 15.0.0
145
+     * @deprecated 20.0.0
146
+     *
147
+     * @return array
148
+     */
149
+    public function getJs(): array {
150
+        return $this->js;
151
+    }
152
+
153
+    /**
154
+     * Set an array of JS files to be included when loading a widget.
155
+     *
156
+     * @since 15.0.0
157
+     * @deprecated 20.0.0
158
+     *
159
+     * @param array $js
160
+     *
161
+     * @return WidgetTemplate
162
+     */
163
+    public function setJs(array $js): WidgetTemplate {
164
+        $this->js = $js;
165
+
166
+        return $this;
167
+    }
168
+
169
+    /**
170
+     * Add a JS file to be included when loading a widget.
171
+     *
172
+     * @since 15.0.0
173
+     * @deprecated 20.0.0
174
+     *
175
+     * @param string $js
176
+     *
177
+     * @return WidgetTemplate
178
+     */
179
+    public function addJs(string $js): WidgetTemplate {
180
+        $this->js[] = $js;
181
+
182
+        return $this;
183
+    }
184
+
185
+    /**
186
+     * Get the HTML file that contains the content of the widget.
187
+     *
188
+     * @since 15.0.0
189
+     * @deprecated 20.0.0
190
+     *
191
+     * @return string
192
+     */
193
+    public function getContent(): string {
194
+        return $this->content;
195
+    }
196
+
197
+    /**
198
+     * Set the HTML file that contains the content of the widget.
199
+     *
200
+     * @since 15.0.0
201
+     * @deprecated 20.0.0
202
+     *
203
+     * @param string $content
204
+     *
205
+     * @return WidgetTemplate
206
+     */
207
+    public function setContent(string $content): WidgetTemplate {
208
+        $this->content = $content;
209
+
210
+        return $this;
211
+    }
212
+
213
+    /**
214
+     * Get the JS function to be called when loading the widget.
215
+     *
216
+     * @since 15.0.0
217
+     * @deprecated 20.0.0
218
+     *
219
+     * @return string
220
+     */
221
+    public function getInitFunction(): string {
222
+        return $this->function;
223
+    }
224
+
225
+    /**
226
+     * JavaScript function to be called when loading the widget on the
227
+     * dashboard
228
+     *
229
+     * @since 15.0.0
230
+     * @deprecated 20.0.0
231
+     *
232
+     * @param string $function
233
+     *
234
+     * @return WidgetTemplate
235
+     */
236
+    public function setInitFunction(string $function): WidgetTemplate {
237
+        $this->function = $function;
238
+
239
+        return $this;
240
+    }
241
+
242
+    /**
243
+     * Get all WidgetSetting defined for the widget.
244
+     *
245
+     * @see WidgetSetting
246
+     *
247
+     * @since 15.0.0
248
+     * @deprecated 20.0.0
249
+     *
250
+     * @return WidgetSetting[]
251
+     */
252
+    public function getSettings(): array {
253
+        return $this->settings;
254
+    }
255
+
256
+    /**
257
+     * Define all WidgetSetting for the widget.
258
+     *
259
+     * @since 15.0.0
260
+     * @deprecated 20.0.0
261
+     *
262
+     * @see WidgetSetting
263
+     *
264
+     * @param WidgetSetting[] $settings
265
+     *
266
+     * @return WidgetTemplate
267
+     */
268
+    public function setSettings(array $settings): WidgetTemplate {
269
+        $this->settings = $settings;
270
+
271
+        return $this;
272
+    }
273
+
274
+    /**
275
+     * Add a WidgetSetting.
276
+     *
277
+     * @see WidgetSetting
278
+     *
279
+     * @since 15.0.0
280
+     * @deprecated 20.0.0
281
+     *
282
+     * @param WidgetSetting $setting
283
+     *
284
+     * @return WidgetTemplate
285
+     */
286
+    public function addSetting(WidgetSetting $setting): WidgetTemplate {
287
+        $this->settings[] = $setting;
288
+
289
+        return $this;
290
+    }
291
+
292
+    /**
293
+     * Get a WidgetSetting by its name
294
+     *
295
+     * @see WidgetSetting::setName
296
+     *
297
+     * @since 15.0.0
298
+     * @deprecated 20.0.0
299
+     *
300
+     * @param string $key
301
+     *
302
+     * @return WidgetSetting
303
+     */
304
+    public function getSetting(string $key): WidgetSetting {
305
+        if (!array_key_exists($key, $this->settings)) {
306
+            return null;
307
+        }
308
+
309
+        return $this->settings[$key];
310
+    }
311
+
312
+
313
+    /**
314
+     * @since 15.0.0
315
+     * @deprecated 20.0.0
316
+     *
317
+     * @return array
318
+     */
319
+    public function jsonSerialize() {
320
+        return [
321
+            'icon' => $this->getIcon(),
322
+            'css' => $this->getCss(),
323
+            'js' => $this->getJs(),
324
+            'content' => $this->getContent(),
325
+            'function' => $this->getInitFunction(),
326
+            'settings' => $this->getSettings()
327
+        ];
328
+    }
329 329
 }
Please login to merge, or discard this patch.