2014-12-14 17:54:31 -05:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-02-21 08:06:51 -05:00
|
|
|
declare(strict_types=1);
|
2014-12-14 17:54:31 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-12-14 17:54:31 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCP\AppFramework\Utility;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interface ControllerMethodReflector
|
|
|
|
|
*
|
|
|
|
|
* Reads and parses annotations from doc comments
|
|
|
|
|
*
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2021-06-17 12:21:19 -04:00
|
|
|
* @deprecated 22.0.0 will be obsolete with native attributes in PHP8
|
|
|
|
|
* @see https://help.nextcloud.com/t/how-should-we-use-php8-attributes/104278
|
2014-12-14 17:54:31 -05:00
|
|
|
*/
|
|
|
|
|
interface IControllerMethodReflector {
|
|
|
|
|
/**
|
|
|
|
|
* @param object $object an object or classname
|
|
|
|
|
* @param string $method the method which we want to inspect
|
2016-02-17 08:21:07 -05:00
|
|
|
* @return void
|
2016-02-18 04:50:00 -05:00
|
|
|
* @since 8.0.0
|
2019-08-30 03:36:51 -04:00
|
|
|
* @deprecated 17.0.0 Reflect should not be called multiple times and only be used internally. This will be removed in Nextcloud 18
|
2014-12-14 17:54:31 -05:00
|
|
|
*/
|
2018-02-21 08:06:51 -05:00
|
|
|
public function reflect($object, string $method);
|
2014-12-14 17:54:31 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Inspects the PHPDoc parameters for types
|
|
|
|
|
*
|
|
|
|
|
* @param string $parameter the parameter whose type comments should be
|
|
|
|
|
* parsed
|
|
|
|
|
* @return string|null type in the type parameters (@param int $something)
|
|
|
|
|
* would return int or null if not existing
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2021-06-17 12:21:19 -04:00
|
|
|
* @deprecated 22.0.0 this method is only used internally
|
2014-12-14 17:54:31 -05:00
|
|
|
*/
|
2018-02-21 08:06:51 -05:00
|
|
|
public function getType(string $parameter);
|
2014-12-14 17:54:31 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array the arguments of the method with key => default value
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2021-06-17 12:21:19 -04:00
|
|
|
* @deprecated 22.0.0 this method is only used internally
|
2014-12-14 17:54:31 -05:00
|
|
|
*/
|
2018-02-21 08:06:51 -05:00
|
|
|
public function getParameters(): array;
|
2014-12-14 17:54:31 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a method contains an annotation
|
|
|
|
|
*
|
|
|
|
|
* @param string $name the name of the annotation
|
|
|
|
|
* @return bool true if the annotation is found
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2021-06-17 12:21:19 -04:00
|
|
|
* @deprecated 22.0.0 will be obsolete with native attributes in PHP8
|
|
|
|
|
* @see https://help.nextcloud.com/t/how-should-we-use-php8-attributes/104278
|
2014-12-14 17:54:31 -05:00
|
|
|
*/
|
2018-02-21 08:06:51 -05:00
|
|
|
public function hasAnnotation(string $name): bool;
|
2015-04-16 11:00:08 -04:00
|
|
|
}
|