Skip to content

Instantly share code, notes, and snippets.

@shawnsandy
Last active February 8, 2017 22:21
Show Gist options
  • Save shawnsandy/2e76ecd5f14f8d78986b034e1e50fdd8 to your computer and use it in GitHub Desktop.
Save shawnsandy/2e76ecd5f14f8d78986b034e1e50fdd8 to your computer and use it in GitHub Desktop.
Refactor gist create method (before)
<?php
/**
* @param array $data
* @return bool
*/
function create($data = [])
{
if (empty($data)) return FALSE;
$content = [
'files' => [
$data['filename'] => [
'content' => $data['content']
]
],
'public' => $data['public'],
'description' => $data['description']
];
return $this->api()->create($content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment