Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,26 +11,30 @@
|
||||
namespace IPS\core\ProfileFields\Api;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Member;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* API output for custom fields groups
|
||||
*/
|
||||
class _FieldGroup
|
||||
class FieldGroup
|
||||
{
|
||||
/**
|
||||
* @brief Name
|
||||
*/
|
||||
protected $name;
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* @brief Values
|
||||
*/
|
||||
protected $values;
|
||||
protected array $values = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -38,7 +42,7 @@ class _FieldGroup
|
||||
* @param string $name Group name
|
||||
* @param array $values Values
|
||||
*/
|
||||
public function __construct( $name, $values )
|
||||
public function __construct( string $name, array $values )
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->values = $values;
|
||||
@@ -47,12 +51,12 @@ class _FieldGroup
|
||||
/**
|
||||
* Get output for API
|
||||
*
|
||||
* @param \IPS\Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
|
||||
* @param Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
|
||||
* @return array
|
||||
* @apiresponse string name Group name
|
||||
* @apiresponse [\IPS\core\ProfileFields\Api\Field] fields Fields
|
||||
*/
|
||||
public function apiOutput( \IPS\Member $authorizedMember = NULL )
|
||||
public function apiOutput( Member $authorizedMember = NULL ): array
|
||||
{
|
||||
return array( 'name' => $this->name, 'fields' => array_map( function( $val ) use ( $authorizedMember ) {
|
||||
return $val->apiOutput( $authorizedMember );
|
||||
|
||||
Reference in new issue
Block a user