for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Distilleries\Contentful\Commands\Generators\Definitions;
use Exception;
class LinkDefinition extends BaseDefinition
{
/**
* {@inheritdoc}
*/
public function modelGetter()
switch ($this->field['linkType']) {
case 'Entry':
$stubPath = __DIR__ . '/stubs/entry.stub';
break;
case 'Asset':
$stubPath = __DIR__ . '/stubs/asset.stub';
default:
throw new Exception('Unknown Link items type "' . $this->field['linkType'] . '"');
}
return self::getStub($stubPath, [
'field' => $this->id(),
'field_studly' => $this->studlyId(),
]);
public function modelProperty()
$property = ' * @property ';
$property .= '\Distilleries\Contentful\Models\Base\ContentfulModel';
$property .= '\Distilleries\Contentful\Models\Asset';
throw new Exception('Unknown Link items type "' . $this->field['items']['type'] . '"');
return $property . ' $' . $this->snakeId();