@@ -122,7 +122,7 @@ |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
125 | - $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | + $this->dispatcher->dispatch(self::class.'::'.$eventName, new GenericEvent(null, [ |
|
126 | 126 | 'userId' => $user->getUID(), |
127 | 127 | 'fileId' => $fileId, |
128 | 128 | 'path' => $path, |
@@ -38,110 +38,110 @@ |
||
38 | 38 | */ |
39 | 39 | class TagService { |
40 | 40 | |
41 | - /** @var IUserSession */ |
|
42 | - private $userSession; |
|
43 | - /** @var IManager */ |
|
44 | - private $activityManager; |
|
45 | - /** @var ITags */ |
|
46 | - private $tagger; |
|
47 | - /** @var Folder */ |
|
48 | - private $homeFolder; |
|
49 | - /** @var EventDispatcherInterface */ |
|
50 | - private $dispatcher; |
|
41 | + /** @var IUserSession */ |
|
42 | + private $userSession; |
|
43 | + /** @var IManager */ |
|
44 | + private $activityManager; |
|
45 | + /** @var ITags */ |
|
46 | + private $tagger; |
|
47 | + /** @var Folder */ |
|
48 | + private $homeFolder; |
|
49 | + /** @var EventDispatcherInterface */ |
|
50 | + private $dispatcher; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param IUserSession $userSession |
|
54 | - * @param IManager $activityManager |
|
55 | - * @param ITags $tagger |
|
56 | - * @param Folder $homeFolder |
|
57 | - * @param EventDispatcherInterface $dispatcher |
|
58 | - */ |
|
59 | - public function __construct( |
|
60 | - IUserSession $userSession, |
|
61 | - IManager $activityManager, |
|
62 | - ITags $tagger, |
|
63 | - Folder $homeFolder, |
|
64 | - EventDispatcherInterface $dispatcher |
|
65 | - ) { |
|
66 | - $this->userSession = $userSession; |
|
67 | - $this->activityManager = $activityManager; |
|
68 | - $this->tagger = $tagger; |
|
69 | - $this->homeFolder = $homeFolder; |
|
70 | - $this->dispatcher = $dispatcher; |
|
71 | - } |
|
52 | + /** |
|
53 | + * @param IUserSession $userSession |
|
54 | + * @param IManager $activityManager |
|
55 | + * @param ITags $tagger |
|
56 | + * @param Folder $homeFolder |
|
57 | + * @param EventDispatcherInterface $dispatcher |
|
58 | + */ |
|
59 | + public function __construct( |
|
60 | + IUserSession $userSession, |
|
61 | + IManager $activityManager, |
|
62 | + ITags $tagger, |
|
63 | + Folder $homeFolder, |
|
64 | + EventDispatcherInterface $dispatcher |
|
65 | + ) { |
|
66 | + $this->userSession = $userSession; |
|
67 | + $this->activityManager = $activityManager; |
|
68 | + $this->tagger = $tagger; |
|
69 | + $this->homeFolder = $homeFolder; |
|
70 | + $this->dispatcher = $dispatcher; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Updates the tags of the specified file path. |
|
75 | - * The passed tags are absolute, which means they will |
|
76 | - * replace the actual tag selection. |
|
77 | - * |
|
78 | - * @param string $path path |
|
79 | - * @param array $tags array of tags |
|
80 | - * @return array list of tags |
|
81 | - * @throws \OCP\Files\NotFoundException if the file does not exist |
|
82 | - */ |
|
83 | - public function updateFileTags($path, $tags) { |
|
84 | - $fileId = $this->homeFolder->get($path)->getId(); |
|
73 | + /** |
|
74 | + * Updates the tags of the specified file path. |
|
75 | + * The passed tags are absolute, which means they will |
|
76 | + * replace the actual tag selection. |
|
77 | + * |
|
78 | + * @param string $path path |
|
79 | + * @param array $tags array of tags |
|
80 | + * @return array list of tags |
|
81 | + * @throws \OCP\Files\NotFoundException if the file does not exist |
|
82 | + */ |
|
83 | + public function updateFileTags($path, $tags) { |
|
84 | + $fileId = $this->homeFolder->get($path)->getId(); |
|
85 | 85 | |
86 | - $currentTags = $this->tagger->getTagsForObjects([$fileId]); |
|
86 | + $currentTags = $this->tagger->getTagsForObjects([$fileId]); |
|
87 | 87 | |
88 | - if (!empty($currentTags)) { |
|
89 | - $currentTags = current($currentTags); |
|
90 | - } |
|
88 | + if (!empty($currentTags)) { |
|
89 | + $currentTags = current($currentTags); |
|
90 | + } |
|
91 | 91 | |
92 | - $newTags = array_diff($tags, $currentTags); |
|
93 | - foreach ($newTags as $tag) { |
|
94 | - if ($tag === ITags::TAG_FAVORITE) { |
|
95 | - $this->addActivity(true, $fileId, $path); |
|
96 | - } |
|
97 | - $this->tagger->tagAs($fileId, $tag); |
|
98 | - } |
|
99 | - $deletedTags = array_diff($currentTags, $tags); |
|
100 | - foreach ($deletedTags as $tag) { |
|
101 | - if ($tag === ITags::TAG_FAVORITE) { |
|
102 | - $this->addActivity(false, $fileId, $path); |
|
103 | - } |
|
104 | - $this->tagger->unTag($fileId, $tag); |
|
105 | - } |
|
92 | + $newTags = array_diff($tags, $currentTags); |
|
93 | + foreach ($newTags as $tag) { |
|
94 | + if ($tag === ITags::TAG_FAVORITE) { |
|
95 | + $this->addActivity(true, $fileId, $path); |
|
96 | + } |
|
97 | + $this->tagger->tagAs($fileId, $tag); |
|
98 | + } |
|
99 | + $deletedTags = array_diff($currentTags, $tags); |
|
100 | + foreach ($deletedTags as $tag) { |
|
101 | + if ($tag === ITags::TAG_FAVORITE) { |
|
102 | + $this->addActivity(false, $fileId, $path); |
|
103 | + } |
|
104 | + $this->tagger->unTag($fileId, $tag); |
|
105 | + } |
|
106 | 106 | |
107 | - // TODO: re-read from tagger to make sure the |
|
108 | - // list is up to date, in case of concurrent changes ? |
|
109 | - return $tags; |
|
110 | - } |
|
107 | + // TODO: re-read from tagger to make sure the |
|
108 | + // list is up to date, in case of concurrent changes ? |
|
109 | + return $tags; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * @param bool $addToFavorite |
|
114 | - * @param int $fileId |
|
115 | - * @param string $path |
|
116 | - */ |
|
117 | - protected function addActivity($addToFavorite, $fileId, $path) { |
|
118 | - $user = $this->userSession->getUser(); |
|
119 | - if (!$user instanceof IUser) { |
|
120 | - return; |
|
121 | - } |
|
112 | + /** |
|
113 | + * @param bool $addToFavorite |
|
114 | + * @param int $fileId |
|
115 | + * @param string $path |
|
116 | + */ |
|
117 | + protected function addActivity($addToFavorite, $fileId, $path) { |
|
118 | + $user = $this->userSession->getUser(); |
|
119 | + if (!$user instanceof IUser) { |
|
120 | + return; |
|
121 | + } |
|
122 | 122 | |
123 | - $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
|
124 | - $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | - 'userId' => $user->getUID(), |
|
126 | - 'fileId' => $fileId, |
|
127 | - 'path' => $path, |
|
128 | - ])); |
|
123 | + $eventName = $addToFavorite ? 'addFavorite' : 'removeFavorite'; |
|
124 | + $this->dispatcher->dispatch(self::class . '::' . $eventName, new GenericEvent(null, [ |
|
125 | + 'userId' => $user->getUID(), |
|
126 | + 'fileId' => $fileId, |
|
127 | + 'path' => $path, |
|
128 | + ])); |
|
129 | 129 | |
130 | - $event = $this->activityManager->generateEvent(); |
|
131 | - try { |
|
132 | - $event->setApp('files') |
|
133 | - ->setObject('files', $fileId, $path) |
|
134 | - ->setType('favorite') |
|
135 | - ->setAuthor($user->getUID()) |
|
136 | - ->setAffectedUser($user->getUID()) |
|
137 | - ->setTimestamp(time()) |
|
138 | - ->setSubject( |
|
139 | - $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
140 | - ['id' => $fileId, 'path' => $path] |
|
141 | - ); |
|
142 | - $this->activityManager->publish($event); |
|
143 | - } catch (\InvalidArgumentException $e) { |
|
144 | - } catch (\BadMethodCallException $e) { |
|
145 | - } |
|
146 | - } |
|
130 | + $event = $this->activityManager->generateEvent(); |
|
131 | + try { |
|
132 | + $event->setApp('files') |
|
133 | + ->setObject('files', $fileId, $path) |
|
134 | + ->setType('favorite') |
|
135 | + ->setAuthor($user->getUID()) |
|
136 | + ->setAffectedUser($user->getUID()) |
|
137 | + ->setTimestamp(time()) |
|
138 | + ->setSubject( |
|
139 | + $addToFavorite ? FavoriteProvider::SUBJECT_ADDED : FavoriteProvider::SUBJECT_REMOVED, |
|
140 | + ['id' => $fileId, 'path' => $path] |
|
141 | + ); |
|
142 | + $this->activityManager->publish($event); |
|
143 | + } catch (\InvalidArgumentException $e) { |
|
144 | + } catch (\BadMethodCallException $e) { |
|
145 | + } |
|
146 | + } |
|
147 | 147 | } |
@@ -29,53 +29,53 @@ |
||
29 | 29 | |
30 | 30 | class Mount extends MountPoint implements MoveableMount { |
31 | 31 | |
32 | - /** |
|
33 | - * @var \OCA\Files_Sharing\External\Manager |
|
34 | - */ |
|
35 | - protected $manager; |
|
32 | + /** |
|
33 | + * @var \OCA\Files_Sharing\External\Manager |
|
34 | + */ |
|
35 | + protected $manager; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param string|\OC\Files\Storage\Storage $storage |
|
39 | - * @param string $mountpoint |
|
40 | - * @param array $options |
|
41 | - * @param \OCA\Files_Sharing\External\Manager $manager |
|
42 | - * @param \OC\Files\Storage\StorageFactory $loader |
|
43 | - */ |
|
44 | - public function __construct($storage, $mountpoint, $options, $manager, $loader = null) { |
|
45 | - parent::__construct($storage, $mountpoint, $options, $loader); |
|
46 | - $this->manager = $manager; |
|
47 | - } |
|
37 | + /** |
|
38 | + * @param string|\OC\Files\Storage\Storage $storage |
|
39 | + * @param string $mountpoint |
|
40 | + * @param array $options |
|
41 | + * @param \OCA\Files_Sharing\External\Manager $manager |
|
42 | + * @param \OC\Files\Storage\StorageFactory $loader |
|
43 | + */ |
|
44 | + public function __construct($storage, $mountpoint, $options, $manager, $loader = null) { |
|
45 | + parent::__construct($storage, $mountpoint, $options, $loader); |
|
46 | + $this->manager = $manager; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Move the mount point to $target |
|
51 | - * |
|
52 | - * @param string $target the target mount point |
|
53 | - * @return bool |
|
54 | - */ |
|
55 | - public function moveMount($target) { |
|
56 | - $result = $this->manager->setMountPoint($this->mountPoint, $target); |
|
57 | - $this->setMountPoint($target); |
|
49 | + /** |
|
50 | + * Move the mount point to $target |
|
51 | + * |
|
52 | + * @param string $target the target mount point |
|
53 | + * @return bool |
|
54 | + */ |
|
55 | + public function moveMount($target) { |
|
56 | + $result = $this->manager->setMountPoint($this->mountPoint, $target); |
|
57 | + $this->setMountPoint($target); |
|
58 | 58 | |
59 | - return $result; |
|
60 | - } |
|
59 | + return $result; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Remove the mount points |
|
64 | - * |
|
65 | - * @return mixed |
|
66 | - * @return bool |
|
67 | - */ |
|
68 | - public function removeMount() { |
|
69 | - return $this->manager->removeShare($this->mountPoint); |
|
70 | - } |
|
62 | + /** |
|
63 | + * Remove the mount points |
|
64 | + * |
|
65 | + * @return mixed |
|
66 | + * @return bool |
|
67 | + */ |
|
68 | + public function removeMount() { |
|
69 | + return $this->manager->removeShare($this->mountPoint); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Get the type of mount point, used to distinguish things like shares and external storages |
|
74 | - * in the web interface |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getMountType() { |
|
79 | - return 'shared'; |
|
80 | - } |
|
72 | + /** |
|
73 | + * Get the type of mount point, used to distinguish things like shares and external storages |
|
74 | + * in the web interface |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getMountType() { |
|
79 | + return 'shared'; |
|
80 | + } |
|
81 | 81 | } |
@@ -25,81 +25,81 @@ |
||
25 | 25 | |
26 | 26 | class DatabaseSchemaChecker { |
27 | 27 | |
28 | - /** |
|
29 | - * @param string $appId |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - public function analyse($appId) { |
|
33 | - $appPath = \OC_App::getAppPath($appId); |
|
34 | - if ($appPath === false) { |
|
35 | - throw new \RuntimeException("No app with given id <$appId> known."); |
|
36 | - } |
|
37 | - |
|
38 | - if (!file_exists($appPath . '/appinfo/database.xml')) { |
|
39 | - return ['errors' => [], 'warnings' => []]; |
|
40 | - } |
|
41 | - |
|
42 | - libxml_use_internal_errors(true); |
|
43 | - $loadEntities = libxml_disable_entity_loader(false); |
|
44 | - $xml = simplexml_load_file($appPath . '/appinfo/database.xml'); |
|
45 | - libxml_disable_entity_loader($loadEntities); |
|
46 | - |
|
47 | - |
|
48 | - $errors = $warnings = []; |
|
49 | - |
|
50 | - foreach ($xml->table as $table) { |
|
51 | - // Table names |
|
52 | - if (strpos((string)$table->name, '*dbprefix*') !== 0) { |
|
53 | - $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*'; |
|
54 | - } |
|
55 | - $tableName = substr((string)$table->name, strlen('*dbprefix*')); |
|
56 | - if (strpos($tableName, '*dbprefix*') !== false) { |
|
57 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name; |
|
58 | - } |
|
59 | - |
|
60 | - if (strlen($tableName) > 27) { |
|
61 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
62 | - } |
|
63 | - |
|
64 | - $hasAutoIncrement = false; |
|
65 | - |
|
66 | - // Column names |
|
67 | - foreach ($table->declaration->field as $column) { |
|
68 | - if (strpos((string)$column->name, '*dbprefix*') !== false) { |
|
69 | - $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name; |
|
70 | - } |
|
71 | - |
|
72 | - if (strlen((string)$column->name) > 30) { |
|
73 | - $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed'; |
|
74 | - } |
|
75 | - |
|
76 | - if ($column->autoincrement) { |
|
77 | - if ($hasAutoIncrement) { |
|
78 | - $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns'; |
|
79 | - } |
|
80 | - |
|
81 | - if (strlen($tableName) > 21) { |
|
82 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
83 | - } |
|
84 | - |
|
85 | - $hasAutoIncrement = true; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - // Index names |
|
90 | - foreach ($table->declaration->index as $index) { |
|
91 | - $hasPrefix = strpos((string)$index->name, '*dbprefix*'); |
|
92 | - if ($hasPrefix !== false && $hasPrefix !== 0) { |
|
93 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name; |
|
94 | - } |
|
95 | - |
|
96 | - $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name; |
|
97 | - if (strlen($indexName) > 27) { |
|
98 | - $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed'; |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - return ['errors' => $errors, 'warnings' => $warnings]; |
|
104 | - } |
|
28 | + /** |
|
29 | + * @param string $appId |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + public function analyse($appId) { |
|
33 | + $appPath = \OC_App::getAppPath($appId); |
|
34 | + if ($appPath === false) { |
|
35 | + throw new \RuntimeException("No app with given id <$appId> known."); |
|
36 | + } |
|
37 | + |
|
38 | + if (!file_exists($appPath . '/appinfo/database.xml')) { |
|
39 | + return ['errors' => [], 'warnings' => []]; |
|
40 | + } |
|
41 | + |
|
42 | + libxml_use_internal_errors(true); |
|
43 | + $loadEntities = libxml_disable_entity_loader(false); |
|
44 | + $xml = simplexml_load_file($appPath . '/appinfo/database.xml'); |
|
45 | + libxml_disable_entity_loader($loadEntities); |
|
46 | + |
|
47 | + |
|
48 | + $errors = $warnings = []; |
|
49 | + |
|
50 | + foreach ($xml->table as $table) { |
|
51 | + // Table names |
|
52 | + if (strpos((string)$table->name, '*dbprefix*') !== 0) { |
|
53 | + $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*'; |
|
54 | + } |
|
55 | + $tableName = substr((string)$table->name, strlen('*dbprefix*')); |
|
56 | + if (strpos($tableName, '*dbprefix*') !== false) { |
|
57 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name; |
|
58 | + } |
|
59 | + |
|
60 | + if (strlen($tableName) > 27) { |
|
61 | + $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
62 | + } |
|
63 | + |
|
64 | + $hasAutoIncrement = false; |
|
65 | + |
|
66 | + // Column names |
|
67 | + foreach ($table->declaration->field as $column) { |
|
68 | + if (strpos((string)$column->name, '*dbprefix*') !== false) { |
|
69 | + $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name; |
|
70 | + } |
|
71 | + |
|
72 | + if (strlen((string)$column->name) > 30) { |
|
73 | + $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed'; |
|
74 | + } |
|
75 | + |
|
76 | + if ($column->autoincrement) { |
|
77 | + if ($hasAutoIncrement) { |
|
78 | + $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns'; |
|
79 | + } |
|
80 | + |
|
81 | + if (strlen($tableName) > 21) { |
|
82 | + $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
83 | + } |
|
84 | + |
|
85 | + $hasAutoIncrement = true; |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + // Index names |
|
90 | + foreach ($table->declaration->index as $index) { |
|
91 | + $hasPrefix = strpos((string)$index->name, '*dbprefix*'); |
|
92 | + if ($hasPrefix !== false && $hasPrefix !== 0) { |
|
93 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name; |
|
94 | + } |
|
95 | + |
|
96 | + $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name; |
|
97 | + if (strlen($indexName) > 27) { |
|
98 | + $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed'; |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + return ['errors' => $errors, 'warnings' => $warnings]; |
|
104 | + } |
|
105 | 105 | } |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | throw new \RuntimeException("No app with given id <$appId> known."); |
36 | 36 | } |
37 | 37 | |
38 | - if (!file_exists($appPath . '/appinfo/database.xml')) { |
|
38 | + if (!file_exists($appPath.'/appinfo/database.xml')) { |
|
39 | 39 | return ['errors' => [], 'warnings' => []]; |
40 | 40 | } |
41 | 41 | |
42 | 42 | libxml_use_internal_errors(true); |
43 | 43 | $loadEntities = libxml_disable_entity_loader(false); |
44 | - $xml = simplexml_load_file($appPath . '/appinfo/database.xml'); |
|
44 | + $xml = simplexml_load_file($appPath.'/appinfo/database.xml'); |
|
45 | 45 | libxml_disable_entity_loader($loadEntities); |
46 | 46 | |
47 | 47 | |
@@ -49,37 +49,37 @@ discard block |
||
49 | 49 | |
50 | 50 | foreach ($xml->table as $table) { |
51 | 51 | // Table names |
52 | - if (strpos((string)$table->name, '*dbprefix*') !== 0) { |
|
53 | - $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*'; |
|
52 | + if (strpos((string) $table->name, '*dbprefix*') !== 0) { |
|
53 | + $errors[] = 'Database schema error: name of table '.(string) $table->name.' does not start with *dbprefix*'; |
|
54 | 54 | } |
55 | - $tableName = substr((string)$table->name, strlen('*dbprefix*')); |
|
55 | + $tableName = substr((string) $table->name, strlen('*dbprefix*')); |
|
56 | 56 | if (strpos($tableName, '*dbprefix*') !== false) { |
57 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name; |
|
57 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table '.(string) $table->name; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (strlen($tableName) > 27) { |
61 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
61 | + $errors[] = 'Database schema error: Name of table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $hasAutoIncrement = false; |
65 | 65 | |
66 | 66 | // Column names |
67 | 67 | foreach ($table->declaration->field as $column) { |
68 | - if (strpos((string)$column->name, '*dbprefix*') !== false) { |
|
69 | - $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name; |
|
68 | + if (strpos((string) $column->name, '*dbprefix*') !== false) { |
|
69 | + $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column '.(string) $column->name.' on table '.(string) $table->name; |
|
70 | 70 | } |
71 | 71 | |
72 | - if (strlen((string)$column->name) > 30) { |
|
73 | - $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed'; |
|
72 | + if (strlen((string) $column->name) > 30) { |
|
73 | + $errors[] = 'Database schema error: Name of column '.(string) $column->name.' on table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 30 characters allowed'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if ($column->autoincrement) { |
77 | 77 | if ($hasAutoIncrement) { |
78 | - $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns'; |
|
78 | + $errors[] = 'Database schema error: Table '.(string) $table->name.' has multiple autoincrement columns'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if (strlen($tableName) > 21) { |
82 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
82 | + $errors[] = 'Database schema error: Name of table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $hasAutoIncrement = true; |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | |
89 | 89 | // Index names |
90 | 90 | foreach ($table->declaration->index as $index) { |
91 | - $hasPrefix = strpos((string)$index->name, '*dbprefix*'); |
|
91 | + $hasPrefix = strpos((string) $index->name, '*dbprefix*'); |
|
92 | 92 | if ($hasPrefix !== false && $hasPrefix !== 0) { |
93 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name; |
|
93 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index '.(string) $index->name.' on table '.(string) $table->name; |
|
94 | 94 | } |
95 | 95 | |
96 | - $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name; |
|
96 | + $indexName = $hasPrefix === 0 ? substr((string) $index->name, strlen('*dbprefix*')) : (string) $index->name; |
|
97 | 97 | if (strlen($indexName) > 27) { |
98 | - $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed'; |
|
98 | + $errors[] = 'Database schema error: Name of index '.(string) $index->name.' on table '.(string) $table->name.' is too long ('.strlen($tableName).'), max. 27 characters + *dbprefix* allowed'; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -33,26 +33,26 @@ |
||
33 | 33 | * @package OC\Security\RateLimiting\Backend |
34 | 34 | */ |
35 | 35 | interface IBackend { |
36 | - /** |
|
37 | - * Gets the amount of attempts within the last specified seconds |
|
38 | - * |
|
39 | - * @param string $methodIdentifier Identifier for the method |
|
40 | - * @param string $userIdentifier Identifier for the user |
|
41 | - * @param int $seconds Seconds to look back at |
|
42 | - * @return int |
|
43 | - */ |
|
44 | - public function getAttempts(string $methodIdentifier, |
|
45 | - string $userIdentifier, |
|
46 | - int $seconds): int; |
|
36 | + /** |
|
37 | + * Gets the amount of attempts within the last specified seconds |
|
38 | + * |
|
39 | + * @param string $methodIdentifier Identifier for the method |
|
40 | + * @param string $userIdentifier Identifier for the user |
|
41 | + * @param int $seconds Seconds to look back at |
|
42 | + * @return int |
|
43 | + */ |
|
44 | + public function getAttempts(string $methodIdentifier, |
|
45 | + string $userIdentifier, |
|
46 | + int $seconds): int; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Registers an attempt |
|
50 | - * |
|
51 | - * @param string $methodIdentifier Identifier for the method |
|
52 | - * @param string $userIdentifier Identifier for the user |
|
53 | - * @param int $period Period in seconds how long this attempt should be stored |
|
54 | - */ |
|
55 | - public function registerAttempt(string $methodIdentifier, |
|
56 | - string $userIdentifier, |
|
57 | - int $period); |
|
48 | + /** |
|
49 | + * Registers an attempt |
|
50 | + * |
|
51 | + * @param string $methodIdentifier Identifier for the method |
|
52 | + * @param string $userIdentifier Identifier for the user |
|
53 | + * @param int $period Period in seconds how long this attempt should be stored |
|
54 | + */ |
|
55 | + public function registerAttempt(string $methodIdentifier, |
|
56 | + string $userIdentifier, |
|
57 | + int $period); |
|
58 | 58 | } |
@@ -23,19 +23,19 @@ |
||
23 | 23 | // WARNING: this should be moved to proper AppFramework handling |
24 | 24 | // Check if we are a user |
25 | 25 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
26 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
27 | - 'core.login.showLoginForm', |
|
28 | - [ |
|
29 | - 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
|
30 | - ] |
|
31 | - ) |
|
32 | - ); |
|
33 | - exit(); |
|
26 | + header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
27 | + 'core.login.showLoginForm', |
|
28 | + [ |
|
29 | + 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
|
30 | + ] |
|
31 | + ) |
|
32 | + ); |
|
33 | + exit(); |
|
34 | 34 | } |
35 | 35 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
36 | 36 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
37 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
38 | - exit(); |
|
37 | + header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
38 | + exit(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $tmpl = new OCP\Template('systemtags', 'list', ''); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // WARNING: this should be moved to proper AppFramework handling |
24 | 24 | // Check if we are a user |
25 | 25 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
26 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
26 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
27 | 27 | 'core.login.showLoginForm', |
28 | 28 | [ |
29 | 29 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
36 | 36 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
37 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
37 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
38 | 38 | exit(); |
39 | 39 | } |
40 | 40 |
@@ -30,35 +30,35 @@ |
||
30 | 30 | * @since 12.0.0 |
31 | 31 | */ |
32 | 32 | interface ICloudId { |
33 | - /** |
|
34 | - * The remote cloud id |
|
35 | - * |
|
36 | - * @return string |
|
37 | - * @since 12.0.0 |
|
38 | - */ |
|
39 | - public function getId(): string; |
|
33 | + /** |
|
34 | + * The remote cloud id |
|
35 | + * |
|
36 | + * @return string |
|
37 | + * @since 12.0.0 |
|
38 | + */ |
|
39 | + public function getId(): string; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Get a clean representation of the cloud id for display |
|
43 | - * |
|
44 | - * @return string |
|
45 | - * @since 12.0.0 |
|
46 | - */ |
|
47 | - public function getDisplayId(): string; |
|
41 | + /** |
|
42 | + * Get a clean representation of the cloud id for display |
|
43 | + * |
|
44 | + * @return string |
|
45 | + * @since 12.0.0 |
|
46 | + */ |
|
47 | + public function getDisplayId(): string; |
|
48 | 48 | |
49 | - /** |
|
50 | - * The username on the remote server |
|
51 | - * |
|
52 | - * @return string |
|
53 | - * @since 12.0.0 |
|
54 | - */ |
|
55 | - public function getUser(): string; |
|
49 | + /** |
|
50 | + * The username on the remote server |
|
51 | + * |
|
52 | + * @return string |
|
53 | + * @since 12.0.0 |
|
54 | + */ |
|
55 | + public function getUser(): string; |
|
56 | 56 | |
57 | - /** |
|
58 | - * The base address of the remote server |
|
59 | - * |
|
60 | - * @return string |
|
61 | - * @since 12.0.0 |
|
62 | - */ |
|
63 | - public function getRemote(): string; |
|
57 | + /** |
|
58 | + * The base address of the remote server |
|
59 | + * |
|
60 | + * @return string |
|
61 | + * @since 12.0.0 |
|
62 | + */ |
|
63 | + public function getRemote(): string; |
|
64 | 64 | } |
@@ -31,33 +31,33 @@ |
||
31 | 31 | * @since 12.0.0 |
32 | 32 | */ |
33 | 33 | interface ICloudIdManager { |
34 | - /** |
|
35 | - * @param string $cloudId |
|
36 | - * @return ICloudId |
|
37 | - * @throws \InvalidArgumentException |
|
38 | - * |
|
39 | - * @since 12.0.0 |
|
40 | - */ |
|
41 | - public function resolveCloudId(string $cloudId): ICloudId; |
|
34 | + /** |
|
35 | + * @param string $cloudId |
|
36 | + * @return ICloudId |
|
37 | + * @throws \InvalidArgumentException |
|
38 | + * |
|
39 | + * @since 12.0.0 |
|
40 | + */ |
|
41 | + public function resolveCloudId(string $cloudId): ICloudId; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the cloud id for a remote user |
|
45 | - * |
|
46 | - * @param string $user |
|
47 | - * @param string $remote |
|
48 | - * @return ICloudId |
|
49 | - * |
|
50 | - * @since 12.0.0 |
|
51 | - */ |
|
52 | - public function getCloudId(string $user, string $remote): ICloudId; |
|
43 | + /** |
|
44 | + * Get the cloud id for a remote user |
|
45 | + * |
|
46 | + * @param string $user |
|
47 | + * @param string $remote |
|
48 | + * @return ICloudId |
|
49 | + * |
|
50 | + * @since 12.0.0 |
|
51 | + */ |
|
52 | + public function getCloudId(string $user, string $remote): ICloudId; |
|
53 | 53 | |
54 | - /** |
|
55 | - * Check if the input is a correctly formatted cloud id |
|
56 | - * |
|
57 | - * @param string $cloudId |
|
58 | - * @return bool |
|
59 | - * |
|
60 | - * @since 12.0.0 |
|
61 | - */ |
|
62 | - public function isValidCloudId(string $cloudId): bool; |
|
54 | + /** |
|
55 | + * Check if the input is a correctly formatted cloud id |
|
56 | + * |
|
57 | + * @param string $cloudId |
|
58 | + * @return bool |
|
59 | + * |
|
60 | + * @since 12.0.0 |
|
61 | + */ |
|
62 | + public function isValidCloudId(string $cloudId): bool; |
|
63 | 63 | } |
@@ -32,178 +32,178 @@ |
||
32 | 32 | */ |
33 | 33 | interface IClient { |
34 | 34 | |
35 | - /** |
|
36 | - * Sends a GET request |
|
37 | - * @param string $uri |
|
38 | - * @param array $options Array such as |
|
39 | - * 'query' => [ |
|
40 | - * 'field' => 'abc', |
|
41 | - * 'other_field' => '123', |
|
42 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
43 | - * ], |
|
44 | - * 'headers' => [ |
|
45 | - * 'foo' => 'bar', |
|
46 | - * ], |
|
47 | - * 'cookies' => [' |
|
48 | - * 'foo' => 'bar', |
|
49 | - * ], |
|
50 | - * 'allow_redirects' => [ |
|
51 | - * 'max' => 10, // allow at most 10 redirects. |
|
52 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
53 | - * 'referer' => true, // add a Referer header |
|
54 | - * 'protocols' => ['https'] // only allow https URLs |
|
55 | - * ], |
|
56 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
57 | - * 'verify' => true, // bool or string to CA file |
|
58 | - * 'debug' => true, |
|
59 | - * @return IResponse |
|
60 | - * @throws \Exception If the request could not get completed |
|
61 | - * @since 8.1.0 |
|
62 | - */ |
|
63 | - public function get(string $uri, array $options = []): IResponse; |
|
35 | + /** |
|
36 | + * Sends a GET request |
|
37 | + * @param string $uri |
|
38 | + * @param array $options Array such as |
|
39 | + * 'query' => [ |
|
40 | + * 'field' => 'abc', |
|
41 | + * 'other_field' => '123', |
|
42 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
43 | + * ], |
|
44 | + * 'headers' => [ |
|
45 | + * 'foo' => 'bar', |
|
46 | + * ], |
|
47 | + * 'cookies' => [' |
|
48 | + * 'foo' => 'bar', |
|
49 | + * ], |
|
50 | + * 'allow_redirects' => [ |
|
51 | + * 'max' => 10, // allow at most 10 redirects. |
|
52 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
53 | + * 'referer' => true, // add a Referer header |
|
54 | + * 'protocols' => ['https'] // only allow https URLs |
|
55 | + * ], |
|
56 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
57 | + * 'verify' => true, // bool or string to CA file |
|
58 | + * 'debug' => true, |
|
59 | + * @return IResponse |
|
60 | + * @throws \Exception If the request could not get completed |
|
61 | + * @since 8.1.0 |
|
62 | + */ |
|
63 | + public function get(string $uri, array $options = []): IResponse; |
|
64 | 64 | |
65 | - /** |
|
66 | - * Sends a HEAD request |
|
67 | - * @param string $uri |
|
68 | - * @param array $options Array such as |
|
69 | - * 'headers' => [ |
|
70 | - * 'foo' => 'bar', |
|
71 | - * ], |
|
72 | - * 'cookies' => [' |
|
73 | - * 'foo' => 'bar', |
|
74 | - * ], |
|
75 | - * 'allow_redirects' => [ |
|
76 | - * 'max' => 10, // allow at most 10 redirects. |
|
77 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
78 | - * 'referer' => true, // add a Referer header |
|
79 | - * 'protocols' => ['https'] // only allow https URLs |
|
80 | - * ], |
|
81 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
82 | - * 'verify' => true, // bool or string to CA file |
|
83 | - * 'debug' => true, |
|
84 | - * @return IResponse |
|
85 | - * @throws \Exception If the request could not get completed |
|
86 | - * @since 8.1.0 |
|
87 | - */ |
|
88 | - public function head(string $uri, array $options = []): IResponse; |
|
65 | + /** |
|
66 | + * Sends a HEAD request |
|
67 | + * @param string $uri |
|
68 | + * @param array $options Array such as |
|
69 | + * 'headers' => [ |
|
70 | + * 'foo' => 'bar', |
|
71 | + * ], |
|
72 | + * 'cookies' => [' |
|
73 | + * 'foo' => 'bar', |
|
74 | + * ], |
|
75 | + * 'allow_redirects' => [ |
|
76 | + * 'max' => 10, // allow at most 10 redirects. |
|
77 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
78 | + * 'referer' => true, // add a Referer header |
|
79 | + * 'protocols' => ['https'] // only allow https URLs |
|
80 | + * ], |
|
81 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
82 | + * 'verify' => true, // bool or string to CA file |
|
83 | + * 'debug' => true, |
|
84 | + * @return IResponse |
|
85 | + * @throws \Exception If the request could not get completed |
|
86 | + * @since 8.1.0 |
|
87 | + */ |
|
88 | + public function head(string $uri, array $options = []): IResponse; |
|
89 | 89 | |
90 | - /** |
|
91 | - * Sends a POST request |
|
92 | - * @param string $uri |
|
93 | - * @param array $options Array such as |
|
94 | - * 'body' => [ |
|
95 | - * 'field' => 'abc', |
|
96 | - * 'other_field' => '123', |
|
97 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
98 | - * ], |
|
99 | - * 'headers' => [ |
|
100 | - * 'foo' => 'bar', |
|
101 | - * ], |
|
102 | - * 'cookies' => [' |
|
103 | - * 'foo' => 'bar', |
|
104 | - * ], |
|
105 | - * 'allow_redirects' => [ |
|
106 | - * 'max' => 10, // allow at most 10 redirects. |
|
107 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
108 | - * 'referer' => true, // add a Referer header |
|
109 | - * 'protocols' => ['https'] // only allow https URLs |
|
110 | - * ], |
|
111 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
112 | - * 'verify' => true, // bool or string to CA file |
|
113 | - * 'debug' => true, |
|
114 | - * @return IResponse |
|
115 | - * @throws \Exception If the request could not get completed |
|
116 | - * @since 8.1.0 |
|
117 | - */ |
|
118 | - public function post(string $uri, array $options = []): IResponse; |
|
90 | + /** |
|
91 | + * Sends a POST request |
|
92 | + * @param string $uri |
|
93 | + * @param array $options Array such as |
|
94 | + * 'body' => [ |
|
95 | + * 'field' => 'abc', |
|
96 | + * 'other_field' => '123', |
|
97 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
98 | + * ], |
|
99 | + * 'headers' => [ |
|
100 | + * 'foo' => 'bar', |
|
101 | + * ], |
|
102 | + * 'cookies' => [' |
|
103 | + * 'foo' => 'bar', |
|
104 | + * ], |
|
105 | + * 'allow_redirects' => [ |
|
106 | + * 'max' => 10, // allow at most 10 redirects. |
|
107 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
108 | + * 'referer' => true, // add a Referer header |
|
109 | + * 'protocols' => ['https'] // only allow https URLs |
|
110 | + * ], |
|
111 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
112 | + * 'verify' => true, // bool or string to CA file |
|
113 | + * 'debug' => true, |
|
114 | + * @return IResponse |
|
115 | + * @throws \Exception If the request could not get completed |
|
116 | + * @since 8.1.0 |
|
117 | + */ |
|
118 | + public function post(string $uri, array $options = []): IResponse; |
|
119 | 119 | |
120 | - /** |
|
121 | - * Sends a PUT request |
|
122 | - * @param string $uri |
|
123 | - * @param array $options Array such as |
|
124 | - * 'body' => [ |
|
125 | - * 'field' => 'abc', |
|
126 | - * 'other_field' => '123', |
|
127 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
128 | - * ], |
|
129 | - * 'headers' => [ |
|
130 | - * 'foo' => 'bar', |
|
131 | - * ], |
|
132 | - * 'cookies' => [' |
|
133 | - * 'foo' => 'bar', |
|
134 | - * ], |
|
135 | - * 'allow_redirects' => [ |
|
136 | - * 'max' => 10, // allow at most 10 redirects. |
|
137 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
138 | - * 'referer' => true, // add a Referer header |
|
139 | - * 'protocols' => ['https'] // only allow https URLs |
|
140 | - * ], |
|
141 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
142 | - * 'verify' => true, // bool or string to CA file |
|
143 | - * 'debug' => true, |
|
144 | - * @return IResponse |
|
145 | - * @throws \Exception If the request could not get completed |
|
146 | - * @since 8.1.0 |
|
147 | - */ |
|
148 | - public function put(string $uri, array $options = []): IResponse; |
|
120 | + /** |
|
121 | + * Sends a PUT request |
|
122 | + * @param string $uri |
|
123 | + * @param array $options Array such as |
|
124 | + * 'body' => [ |
|
125 | + * 'field' => 'abc', |
|
126 | + * 'other_field' => '123', |
|
127 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
128 | + * ], |
|
129 | + * 'headers' => [ |
|
130 | + * 'foo' => 'bar', |
|
131 | + * ], |
|
132 | + * 'cookies' => [' |
|
133 | + * 'foo' => 'bar', |
|
134 | + * ], |
|
135 | + * 'allow_redirects' => [ |
|
136 | + * 'max' => 10, // allow at most 10 redirects. |
|
137 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
138 | + * 'referer' => true, // add a Referer header |
|
139 | + * 'protocols' => ['https'] // only allow https URLs |
|
140 | + * ], |
|
141 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
142 | + * 'verify' => true, // bool or string to CA file |
|
143 | + * 'debug' => true, |
|
144 | + * @return IResponse |
|
145 | + * @throws \Exception If the request could not get completed |
|
146 | + * @since 8.1.0 |
|
147 | + */ |
|
148 | + public function put(string $uri, array $options = []): IResponse; |
|
149 | 149 | |
150 | - /** |
|
151 | - * Sends a DELETE request |
|
152 | - * @param string $uri |
|
153 | - * @param array $options Array such as |
|
154 | - * 'body' => [ |
|
155 | - * 'field' => 'abc', |
|
156 | - * 'other_field' => '123', |
|
157 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
158 | - * ], |
|
159 | - * 'headers' => [ |
|
160 | - * 'foo' => 'bar', |
|
161 | - * ], |
|
162 | - * 'cookies' => [' |
|
163 | - * 'foo' => 'bar', |
|
164 | - * ], |
|
165 | - * 'allow_redirects' => [ |
|
166 | - * 'max' => 10, // allow at most 10 redirects. |
|
167 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
168 | - * 'referer' => true, // add a Referer header |
|
169 | - * 'protocols' => ['https'] // only allow https URLs |
|
170 | - * ], |
|
171 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
172 | - * 'verify' => true, // bool or string to CA file |
|
173 | - * 'debug' => true, |
|
174 | - * @return IResponse |
|
175 | - * @throws \Exception If the request could not get completed |
|
176 | - * @since 8.1.0 |
|
177 | - */ |
|
178 | - public function delete(string $uri, array $options = []): IResponse; |
|
150 | + /** |
|
151 | + * Sends a DELETE request |
|
152 | + * @param string $uri |
|
153 | + * @param array $options Array such as |
|
154 | + * 'body' => [ |
|
155 | + * 'field' => 'abc', |
|
156 | + * 'other_field' => '123', |
|
157 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
158 | + * ], |
|
159 | + * 'headers' => [ |
|
160 | + * 'foo' => 'bar', |
|
161 | + * ], |
|
162 | + * 'cookies' => [' |
|
163 | + * 'foo' => 'bar', |
|
164 | + * ], |
|
165 | + * 'allow_redirects' => [ |
|
166 | + * 'max' => 10, // allow at most 10 redirects. |
|
167 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
168 | + * 'referer' => true, // add a Referer header |
|
169 | + * 'protocols' => ['https'] // only allow https URLs |
|
170 | + * ], |
|
171 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
172 | + * 'verify' => true, // bool or string to CA file |
|
173 | + * 'debug' => true, |
|
174 | + * @return IResponse |
|
175 | + * @throws \Exception If the request could not get completed |
|
176 | + * @since 8.1.0 |
|
177 | + */ |
|
178 | + public function delete(string $uri, array $options = []): IResponse; |
|
179 | 179 | |
180 | - /** |
|
181 | - * Sends a options request |
|
182 | - * @param string $uri |
|
183 | - * @param array $options Array such as |
|
184 | - * 'body' => [ |
|
185 | - * 'field' => 'abc', |
|
186 | - * 'other_field' => '123', |
|
187 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
188 | - * ], |
|
189 | - * 'headers' => [ |
|
190 | - * 'foo' => 'bar', |
|
191 | - * ], |
|
192 | - * 'cookies' => [' |
|
193 | - * 'foo' => 'bar', |
|
194 | - * ], |
|
195 | - * 'allow_redirects' => [ |
|
196 | - * 'max' => 10, // allow at most 10 redirects. |
|
197 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
198 | - * 'referer' => true, // add a Referer header |
|
199 | - * 'protocols' => ['https'] // only allow https URLs |
|
200 | - * ], |
|
201 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
202 | - * 'verify' => true, // bool or string to CA file |
|
203 | - * 'debug' => true, |
|
204 | - * @return IResponse |
|
205 | - * @throws \Exception If the request could not get completed |
|
206 | - * @since 8.1.0 |
|
207 | - */ |
|
208 | - public function options(string $uri, array $options = []): IResponse; |
|
180 | + /** |
|
181 | + * Sends a options request |
|
182 | + * @param string $uri |
|
183 | + * @param array $options Array such as |
|
184 | + * 'body' => [ |
|
185 | + * 'field' => 'abc', |
|
186 | + * 'other_field' => '123', |
|
187 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
188 | + * ], |
|
189 | + * 'headers' => [ |
|
190 | + * 'foo' => 'bar', |
|
191 | + * ], |
|
192 | + * 'cookies' => [' |
|
193 | + * 'foo' => 'bar', |
|
194 | + * ], |
|
195 | + * 'allow_redirects' => [ |
|
196 | + * 'max' => 10, // allow at most 10 redirects. |
|
197 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
198 | + * 'referer' => true, // add a Referer header |
|
199 | + * 'protocols' => ['https'] // only allow https URLs |
|
200 | + * ], |
|
201 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
202 | + * 'verify' => true, // bool or string to CA file |
|
203 | + * 'debug' => true, |
|
204 | + * @return IResponse |
|
205 | + * @throws \Exception If the request could not get completed |
|
206 | + * @since 8.1.0 |
|
207 | + */ |
|
208 | + public function options(string $uri, array $options = []): IResponse; |
|
209 | 209 | } |
@@ -31,9 +31,9 @@ |
||
31 | 31 | * @since 8.1.0 |
32 | 32 | */ |
33 | 33 | interface IClientService { |
34 | - /** |
|
35 | - * @return IClient |
|
36 | - * @since 8.1.0 |
|
37 | - */ |
|
38 | - public function newClient(): IClient; |
|
34 | + /** |
|
35 | + * @return IClient |
|
36 | + * @since 8.1.0 |
|
37 | + */ |
|
38 | + public function newClient(): IClient; |
|
39 | 39 | } |