Xpressengine\Plugin\PluginEntity::getSupport PHP Method

getSupport() public method

Support 정보를 조회한다. 만약 필드명이 주어질 경우 해당 필드명의 정보를 조회한다.
public getSupport ( string $field = null ) : array | string
$field string 조회할 필드명
return array | string
    public function getSupport($field = null)
    {
        $metaData = $this->getMetaData();
        $support = array_get($metaData, 'support');
        if ($support === null) {
            if ($field === null) {
                return [];
            } else {
                return null;
            }
        }
        if ($field === null) {
            return $support;
        } else {
            return array_get($support, $field, null);
        }
    }

Usage Example

 /**
  * @depends testConstruct
  *
  * @param \Xpressengine\Plugin\PluginEntity $entity
  */
 public function testGetters($entity)
 {
     $this->assertEquals('title', $entity->getTitle());
     $this->assertEquals(__DIR__ . '/plugins/plugin_sample', $entity->getPath());
     $this->assertEquals('khongchi plugin.', $entity->getDescription());
     $this->assertCount(6, $entity->getSupport());
     $this->assertEquals('khongchi/plugin_sample', $entity->getName());
     $this->assertEquals(['xpressengine', 'board'], $entity->getKeywords());
     $this->assertEquals('khongchi', $entity->getAuthors()[0]['name']);
     $this->assertEquals('LGPL-2.0', $entity->getLicense());
 }