aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/ReferenceApiController.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-08-28 20:54:21 +0200
committerJulius Härtl <jus@bitgrid.net>2022-08-31 16:24:33 +0200
commita392235e23c3b8af1d0eba4dbac18b18de826a1c (patch)
treec983c213d99937bb53463e759d703d85861fb631 /core/Controller/ReferenceApiController.php
parentbee8fd2408b053756e052a2b96899935c1adf872 (diff)
downloadnextcloud-server-a392235e23c3b8af1d0eba4dbac18b18de826a1c.tar.gz
nextcloud-server-a392235e23c3b8af1d0eba4dbac18b18de826a1c.zip
Cleanup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/Controller/ReferenceApiController.php')
-rw-r--r--core/Controller/ReferenceApiController.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php
index d9af5520cfc..3e94bf34c25 100644
--- a/core/Controller/ReferenceApiController.php
+++ b/core/Controller/ReferenceApiController.php
@@ -25,23 +25,19 @@ declare(strict_types=1);
namespace OC\Core\Controller;
use OCP\AppFramework\Http\DataResponse;
-use OC\Collaboration\Reference\ReferenceManager;
+use OCP\Collaboration\Reference\IReferenceManager;
use OCP\IRequest;
class ReferenceApiController extends \OCP\AppFramework\OCSController {
- private ReferenceManager $referenceManager;
+ private IReferenceManager $referenceManager;
- public function __construct($appName, IRequest $request, ReferenceManager $referenceManager) {
+ public function __construct(string $appName, IRequest $request, IReferenceManager $referenceManager) {
parent::__construct($appName, $request);
$this->referenceManager = $referenceManager;
}
/**
* @NoAdminRequired
- *
- * @param string $text
- * @param bool $resolve
- * @return DataResponse
*/
public function extract(string $text, bool $resolve = false, int $limit = 1): DataResponse {
$references = $this->referenceManager->extractReferences($text);
@@ -63,16 +59,17 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
/**
* @NoAdminRequired
*
- * @param array $references
- * @return DataResponse
+ * @param string[] $references
*/
public function resolve(array $references, int $limit = 1): DataResponse {
$result = [];
$index = 0;
foreach ($references as $reference) {
- if ($index++ < $limit) {
- $result[$reference] = $this->referenceManager->resolveReference($reference);
+ if ($index++ >= $limit) {
+ break;
}
+
+ $result[$reference] = $this->referenceManager->resolveReference($reference);
}
return new DataResponse([