<commit_before><?php

namespace Api\V1\Http\Controllers;

use Api\V1\Http\Requests\CreateUploadedPhoto;
use Api\V1\Http\Requests\UpdateUploadedPhoto;
use Core\Models\Photo;
use Core\DataServices\Photo\Contracts\PhotoDataService;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;

/**
 * Class PhotosController.
 *
 * @property PhotoDataService photoDataService
 * @package Api\V1\Http\Controllers
 */
class PhotosController extends ResourceController
{
    /**
     * PhotosController constructor.
     *
     * @param Request $request
     * @param Guard $guard
     * @param string $presenterClass
     * @param PhotoDataService $photoDataService
     */
    public function __construct(
        Request $request,
        Guard $guard,
        string $presenterClass,
        PhotoDataService $photoDataService
    )
    {
        parent::__construct($request, $guard, $presenterClass);

        $this->photoDataService = $photoDataService;
    }

    /**
     * @apiVersion 1.0.0
     * @api {post} /v1/photos Create
     * @apiName Create
     * @apiGroup Photos
     * @apiHeader {String} Accept application/json
     * @apiHeader {String} Content-type multipart/form-data
     * @apiParam {File{1KB..20MB}=JPEG,PNG} file Photo file.
     * @apiSuccessExample {json} Success-Response:
     * HTTP/1.1 201 Created
     * {
     *     "id": 1,
     *     "created_by_user_id" 1,
     *     "absolute_url": "http://path/to/photo/file",
     *     "avg_color": "#000000",
     *     "created_at": "2016-10-24 12:24:33",
     *     "updated_at": "2016-10-24 14:38:05",
     *     "exif": {
     *         "manufacturer": "Manufacturer Name",
     *         "model": "Model Number",
     *         "exposure_time": "1/160",
     *         "aperture": "f/11.0",
     *         "iso": 200,
     *         "taken_at": "2016-10-24 12:24:33"
     *     },
     *     "thumbnails": [
     *         "medium": {
     *             "absolute_url": "http://path/to/photo/thumbnail/medium_file"
     *             "width": 500,
     *             "height": 500
     *         },
     *         "large": {
     *              "absolute_url": "http://path/to/photo/thumbnail/large_file"
     *              "width": 1000,
     *              "height": 1000
     *         }
     *     ]
     * }
     */

    /**
     * Create a photo.
     *
     * @param CreateUploadedPhoto $request
     * @return Photo
     */
    public function create(CreateUploadedPhoto $request) : Photo
    {
        $photo = new Photo;

        $photo
            ->setCreatedByUserIdAttribute($this->guard->user()->id)<commit_msg>[FE]. Fixed code style<commit_after><?php

namespace Api\V1\Http\Controllers;

use Api\V1\Http\Requests\CreateUploadedPhoto;
use Api\V1\Http\Requests\UpdateUploadedPhoto;
use Core\Models\Photo;
use Core\DataServices\Photo\Contracts\PhotoDataService;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;

/**
 * Class PhotosController.
 *
 * @property PhotoDataService photoDataService
 * @package Api\V1\Http\Controllers
 */
class PhotosController extends ResourceController
{
    /**
     * PhotosController constructor.
     *
     * @param Request $request
     * @param Guard $guard
     * @param string $presenterClass
     * @param PhotoDataService $photoDataService
     */
    public function __construct(
        Request $request,
        Guard $guard,
        string $presenterClass,
        PhotoDataService $photoDataService
    )
    {
        parent::__construct($request, $guard, $presenterClass);

        $this->photoDataService = $photoDataService;
    }

    /**
     * @apiVersion 1.0.0
     * @api {post} /v1/photos Create
     * @apiName Create
     * @apiGroup Photos
     * @apiHeader {String} Accept application/json
     * @apiHeader {String} Content-type multipart/form-data
     * @apiParam {File{1KB..20MB}=JPEG,PNG} file Photo file.
     * @apiSuccessExample {json} Success-Response:
     * HTTP/1.1 201 Created
     * {
     *     "id": 1,
     *     "created_by_user_id" 1,
     *     "absolute_url": "http://path/to/photo/file",
     *     "avg_color": "#000000",
     *     "created_at": "2016-10-24 12:24:33",
     *     "updated_at": "2016-10-24 14:38:05",
     *     "exif": {
     *         "manufacturer": "Manufacturer Name",
     *         "model": "Model Number",
     *         "exposure_time": "1/160",
     *         "aperture": "f/11.0",
     *         "iso": 200,
     *         "taken_at": "2016-10-24 12:24:33"
     *     },
     *     "thumbnails": [
     *         "medium": {
     *             "absolute_url": "http://path/to/photo/thumbnail/medium_file"
     *             "width": 500,
     *             "height": 500
     *         },
     *         "large": {
     *              "absolute_url": "http://path/to/photo/thumbnail/large_file"
     *              "width": 1000,
     *              "height": 1000
     *         }
     *     ]
     * }
     */

    /**
     * Create a photo.
     *
     * @param CreateUploadedPhoto $request
     * @return Photo
     */
    public function create(CreateUploadedPhoto $request) : Photo
    {
        $photo = new Photo;

        $photo->setCreatedByUserIdAttribute($this->guard->user()->id)
{'fraction_non_alphanumeric': 0.13812260536398469, 'fraction_numerical': 0.034482758620689655, 'mean_word_length': 2.000574712643678, 'pattern_counts': {'":': 42, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1886036', 'n_tokens_mistral': 1767, 'n_tokens_neox': 1645, 'n_words': 297}