JiraRestApi\Field\FieldService::getAllFields PHP Method

getAllFields() public method

get all field list.
public getAllFields ( $fieldType = Field::BOTH ) : array
return array of Filed class
    public function getAllFields($fieldType = Field::BOTH)
    {
        $ret = $this->exec($this->uri, null);
        $fields = $this->json_mapper->mapArray(json_decode($ret, false), new \ArrayObject(), '\\JiraRestApi\\Field\\Field');
        // temp array
        $ar = [];
        if ($fieldType === Field::CUSTOM) {
            foreach ($fields as $f) {
                if ($f->custom === true) {
                    array_push($ar, $f);
                }
            }
            $fields =& $ar;
        } elseif ($fieldType === Field::SYSTEM) {
            foreach ($fields as $f) {
                if ($f->custom === false) {
                    array_push($ar, $f);
                }
            }
            $fields =& $ar;
        }
        return $fields;
    }

Usage Example

 public function testGetFields()
 {
     try {
         $fieldService = new FieldService();
         $ret = $fieldService->getAllFields(Field::CUSTOM);
         Dumper::dump($ret);
     } catch (JiraException $e) {
         $this->assertTrue(false, 'testSearch Failed : ' . $e->getMessage());
     }
 }