Pantheon\Terminus\Models\Organization::getFeature PHP Method

getFeature() public method

Returns a specific organization feature value
public getFeature ( string $feature ) : mixed | null
$feature string Feature to check
return mixed | null Feature value, or null if not found
    public function getFeature($feature)
    {
        if (!isset($this->features)) {
            $response = $this->request->request(sprintf('organizations/%s/features', $this->id));
            $this->features = (array) $response['data'];
        }
        if (isset($this->features[$feature])) {
            return $this->features[$feature];
        }
        return null;
    }

Usage Example

 public function testGetFeature()
 {
     $data = ["change_management" => true, "multidev" => false];
     $this->request->expects($this->once())->method('request')->with('organizations/123/features', [])->willReturn(['data' => $data]);
     $organization = new Organization((object) ['id' => '123']);
     $organization->setRequest($this->request);
     $this->assertTrue($organization->getFeature('change_management'));
     $this->assertFalse($organization->getFeature('multidev'));
     $this->assertNull($organization->getFeature('invalid'));
 }