/** * Creates a human readable string * @param PodioItem $item * @return string */ public static function toHumanReadableString($item) { $itemFile = '--- ' . $item->title . ' ---' . "\n"; $itemFile .= 'Item ID: ' . $item->item_id . "\n"; if ($item instanceof PodioItem) { foreach ($item->fields as $field) { if ($field instanceof PodioItemField) { $itemFile .= $field->label . ': ' . HumanFormat::getFieldValue($field) . "\n"; } else { echo "WARN non PodioItemField:"; var_dump($item); } } } else { echo "WARN non PodioItem:"; var_dump($item); foreach ($item->fields as $field) { $itemFile .= $field->label . ': ' . HumanFormat::getFieldValue($field) . "\n"; } } $itemFile .= "\n"; return $itemFile; }