Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Config Class Reference
Inheritance diagram for Config:
ConfigInterface

Public Member Functions

 __construct (ConfigData $configData)
 
 getTopic ($topicName)
 
 getTopicHandlers ($topicName)
 
 getTopics ()
 

Protected Attributes

 $data
 

Additional Inherited Members

- Data Fields inherited from ConfigInterface
const TOPICS = 'topics'
 
const TOPIC_NAME = 'name'
 
const TOPIC_HANDLERS = 'handlers'
 
const TOPIC_REQUEST = 'request'
 
const TOPIC_RESPONSE = 'response'
 
const TOPIC_IS_SYNCHRONOUS = 'is_synchronous'
 
const TOPIC_REQUEST_TYPE = 'request_type'
 
const TOPIC_REQUEST_TYPE_CLASS = 'object_interface'
 
const TOPIC_REQUEST_TYPE_METHOD = 'service_method_interface'
 
const SCHEMA_METHOD_PARAMS = 'method_params'
 
const SCHEMA_METHOD_RETURN_TYPE = 'method_return_type'
 
const SCHEMA_METHOD_HANDLER = 'method_callback'
 
const SCHEMA_METHOD_PARAM_NAME = 'param_name'
 
const SCHEMA_METHOD_PARAM_POSITION = 'param_position'
 
const SCHEMA_METHOD_PARAM_TYPE = 'param_type'
 
const SCHEMA_METHOD_PARAM_IS_REQUIRED = 'is_required'
 
const HANDLER_TYPE = 'type'
 
const HANDLER_METHOD = 'method'
 
const HANDLER_DISABLED = 'disabled'
 

Detailed Description

Class for accessing to communication configuration.

Definition at line 15 of file Config.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ConfigData  $configData)

Initialize dependencies.

Parameters
ConfigData$configData

Definition at line 27 of file Config.php.

28  {
29  $this->data = $configData;
30  }

Member Function Documentation

◆ getTopic()

getTopic (   $topicName)

{Get configuration of the specified topic.

Parameters
string$topicName
Returns
array
Exceptions
LocalizedException
Since
100.1.0
}

Implements ConfigInterface.

Definition at line 35 of file Config.php.

36  {
37  $data = $this->data->get(self::TOPICS . '/' . $topicName);
38  if ($data === null) {
39  throw new LocalizedException(
40  new Phrase('Topic "%topic" is not configured.', ['topic' => $topicName])
41  );
42  }
43  return $data;
44  }

◆ getTopicHandlers()

getTopicHandlers (   $topicName)

{Get topic handlers.

Parameters
string$topicName
Returns
array
Since
100.1.0
}

Implements ConfigInterface.

Definition at line 49 of file Config.php.

50  {
51  $topicData = $this->getTopic($topicName);
52  return $topicData[self::TOPIC_HANDLERS];
53  }

◆ getTopics()

getTopics ( )

{Get list of all declared topics and their configuration.

Returns
array
Since
100.1.0
}

Implements ConfigInterface.

Definition at line 58 of file Config.php.

59  {
60  return $this->data->get(self::TOPICS) ?: [];
61  }

Field Documentation

◆ $data

$data
protected

Definition at line 20 of file Config.php.


The documentation for this class was generated from the following file: