chobie\Jira\Api::getFields PHP Method

getFields() public method

Get fields definitions.
public getFields ( ) : array
return array
    public function getFields()
    {
        // Fetch fields when the method is called for the first time.
        if ($this->fields === null) {
            $fields = array();
            $result = $this->api(self::REQUEST_GET, '/rest/api/2/field', array(), true);
            /* set hash key as custom field id */
            foreach ($result as $field) {
                $fields[$field['id']] = $field;
            }
            $this->fields = $fields;
        }
        return $this->fields;
    }

Usage Example

Example #1
0
 /**
  * Get fields definitions.
  *
  * @param integer $cache_duration Cache duration.
  *
  * @return array
  */
 public function getFields($cache_duration = 0)
 {
     $cache_key = __METHOD__ . '()';
     $cached_value = $this->cache->fetch($cache_key);
     if ($cached_value === false) {
         $cached_value = parent::getFields();
         $this->cache->save($cache_key, $cached_value, $cache_duration);
     }
     return $cached_value;
 }
All Usage Examples Of chobie\Jira\Api::getFields