diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-08-28 20:54:21 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-08-31 16:24:33 +0200 |
commit | a392235e23c3b8af1d0eba4dbac18b18de826a1c (patch) | |
tree | c983c213d99937bb53463e759d703d85861fb631 /core/Controller/ReferenceApiController.php | |
parent | bee8fd2408b053756e052a2b96899935c1adf872 (diff) | |
download | nextcloud-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.php | 19 |
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([ |