Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/Controllers/Admin/ManagePostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public function create_post()
/**
* Save a new post.
*
* @throws Exception
*
* @return RedirectResponse|Redirector
*
* @throws Exception
*/
public function store(CreateBlogEtcPostRequest $request)
{
Expand All @@ -96,7 +96,6 @@ public function store_post(CreateBlogEtcPostRequest $request)
* Show form to edit post.
*
* @param $blogPostId
*
* @return mixed
*/
public function edit($blogPostId)
Expand All @@ -120,10 +119,9 @@ public function edit_post($blogPostId)
* This uses some legacy code. This will get refactored soon into something nicer.
*
* @param $blogPostId
* @return RedirectResponse|Redirector
*
* @throws Exception
*
* @return RedirectResponse|Redirector
*/
public function update(UpdateBlogEtcPostRequest $request, $blogPostId)
{
Expand All @@ -144,7 +142,6 @@ public function update_post(UpdateBlogEtcPostRequest $request, $blogPostId)
* Delete a post.
*
* @param $blogPostId
*
* @return mixed
*/
public function destroy(DeleteBlogEtcPostRequest $request, $blogPostId)
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* For backwards compatibility only.
*
* @deprecated - use ManagePostsController
*/
class BlogEtcAdminController extends ManagePostsController
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcCategoryAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* For backwards compatibility only.
*
* @deprecated - use ManageCategoriesController
*/
class BlogEtcCategoryAdminController extends ManageCategoriesController
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcCommentWriterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* For backwards compatibility only.
*
* @deprecated - use CommentsController instead
*/
class BlogEtcCommentWriterController extends CommentsController
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcCommentsAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* For backwards compatibility only.
*
* @deprecated - use ManageCommentsController
*/
class BlogEtcCommentsAdminController extends ManageCommentsController
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcImageUploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* For backwards compatibility only.
*
* @deprecated - use ManageUploadsController
*/
class BlogEtcImageUploadController extends ManageUploadsController
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcReaderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* For backwards compatibility only.
*
* @deprecated - use PostsController instead
*/
class BlogEtcReaderController extends PostsController
Expand Down
1 change: 1 addition & 0 deletions src/Controllers/BlogEtcRssFeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* Legacy class for backwards compatibility.
*
* @deprecated - use FeedController instead
*/
class BlogEtcRssFeedController extends FeedController
Expand Down
1 change: 0 additions & 1 deletion src/Controllers/FeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ protected function makeFreshFeed(Feed $feed)

/**
* @param $posts
*
* @return mixed
*/
protected function setupFeed(Feed $feed, $posts)
Expand Down
6 changes: 3 additions & 3 deletions src/Controllers/PostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function search(SearchRequest $request): \Illuminate\Contracts\View\View

// Map it so the post is actually accessible with ->indexable, for backwards compatibility in old view files.
$searchResultsMappedWithIndexable = $searchResults->map(function (Post $post) {
return new class($post) {
return new class($post)
{
public $indexable;

public function __construct(Post $post)
Expand Down Expand Up @@ -89,8 +90,7 @@ public function showCategory($categorySlug): \Illuminate\Contracts\View\View
* Show blog posts
* If $categorySlug is set, then only show from that category.
*
* @param string $categorySlug
*
* @param string $categorySlug
* @return mixed
*/
public function index(string $categorySlug = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Events/UploadedImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class UploadedImage
* UploadedImage constructor.
*
* @param $image_filename - the new filename
* @param Post $blogEtcPost
* @param Post $blogEtcPost
* @param $image
* @param $source string|null the __METHOD__ firing this event (or other string)
*/
Expand Down
1 change: 1 addition & 0 deletions src/Interfaces/LegacyGetImageFileInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface LegacyGetImageFileInterface
{
/**
* legacy.
*
* @param $size
* @return mixed
*/
Expand Down
1 change: 1 addition & 0 deletions src/Models/BlogEtcCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* Legacy class for backwards compatibility.
*
* @deprecated
*/
class BlogEtcCategory extends Category
Expand Down
1 change: 1 addition & 0 deletions src/Models/BlogEtcComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* Legacy class for backwards compatibility.
*
* @deprecated
*/
class BlogEtcComment extends Comment
Expand Down
1 change: 1 addition & 0 deletions src/Models/BlogEtcPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* Legacy class name for backwards compatibility.
*
* @deprecated
*/
class BlogEtcPost extends Post
Expand Down
1 change: 1 addition & 0 deletions src/Models/BlogEtcUploadedPhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/**
* legacy class for backwards compatibility.
*
* @deprecated
*/
class BlogEtcUploadedPhoto extends UploadedPhoto
Expand Down
14 changes: 7 additions & 7 deletions src/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function genSeoTitle(): ?string
}

/**
* @param mixed ...$args
* @param mixed ...$args
*
* @deprecated - use imageTag() instead
*/
Expand All @@ -177,10 +177,10 @@ public function image_tag($size = 'medium',
*
* TODO - return HtmlString
*
* @param string $size - large, medium, thumbnail
* @param bool $addAHref - if true then it will add <a href=''>...</a> around the <img> tag
* @param string|null $imgTagClass - if you want any additional CSS classes for this tag for the <IMG>
* @param string|null $anchorTagClass - is you want any additional CSS classes in the <a> anchor tag
* @param string $size - large, medium, thumbnail
* @param bool $addAHref - if true then it will add <a href=''>...</a> around the <img> tag
* @param string|null $imgTagClass - if you want any additional CSS classes for this tag for the <IMG>
* @param string|null $anchorTagClass - is you want any additional CSS classes in the <a> anchor tag
*/
public function imageTag(
$size = 'medium',
Expand All @@ -205,7 +205,7 @@ public function imageTag(
* Returns true if the database record indicates that this blog post
* has a featured image of size $size.
*
* @param string $size
* @param string $size
*/
public function hasImage($size = 'medium'): bool
{
Expand Down Expand Up @@ -233,7 +233,7 @@ protected function checkValidImageSize(string $size = 'medium'): bool
* Get the full URL for an image
* You should use ::has_image($size) to check if the size is valid.
*
* @param string $size - should be 'medium' , 'large' or 'thumbnail'
* @param string $size - should be 'medium' , 'large' or 'thumbnail'
*/
public function imageUrl($size = 'medium'): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Repositories/PostsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(Post $model)
/**
* Return blog posts ordered by posted_at, paginated.
*
* @param int $categoryID
* @param int $categoryID
*/
public function indexPaginated(int $perPage = 10, int $categoryID = null): LengthAwarePaginator
{
Expand Down Expand Up @@ -147,7 +147,7 @@ public function find(int $blogEtcPostID): Post
*
* TODO - currently untested.
*
* @param array $uploadedImages
* @param array $uploadedImages
*/
public function updateImageSizes(Post $post, ?array $uploadedImages): Post
{
Expand Down
1 change: 0 additions & 1 deletion src/Requests/Traits/HasImageUploadTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ trait HasImageUploadTrait
{
/**
* @param $size
*
* @return UploadedFile|null
*/
public function get_image_file($size)
Expand Down
6 changes: 3 additions & 3 deletions src/Services/PostsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function repository(): PostsRepository
/**
* Return all results, paginated.
*
* @param int $perPage
* @param int $perPage
*/
public function indexPaginated($perPage = 10, int $categoryID = null): LengthAwarePaginator
{
Expand Down Expand Up @@ -133,9 +133,9 @@ public function update(/** @scrutinizer ignore-unused */ int $blogPostID, /*Post
* Delete a blog etc post, return the deleted post and an array of featured images which were associated
* to the blog post (but which were not deleted form the filesystem).
*
* @throws Exception
*
* @return array - [Post (deleted post), array (remaining featured photos)
*
* @throws Exception
*/
public function delete(int $postID): array
{
Expand Down
25 changes: 11 additions & 14 deletions src/Services/UploadsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public function legacyUpdatePost(UpdateBlogEtcPostRequest $request, $blogPostId)
*
* Process any uploaded images (for featured image).
*
* @throws Exception
*
* @return array returns an array of details about each file resized
*
* @throws Exception
*
* @todo - This class was added after the other main features, so this duplicates some code from the main blog post admin controller (BlogEtcAdminController). For next full release this should be tided up.
*/
public function legacyProcessUploadedImagesSingle(UploadImageRequest $request)
Expand Down Expand Up @@ -177,14 +177,13 @@ public function legacyProcessUploadedImages(LegacyGetImageFileInterface $request
}

/**
* @param Post $new_blog_post
* @param Post $new_blog_post
* @param $suggested_title string - used to help generate the filename
* @param $image_size_details mixed - either an array (with 'w' and 'h') or a string (and it'll be uploaded at full size, no size reduction, but will use this string to generate the filename)
* @param $photo
* @return array
*
* @throws Exception
*
* @return array
*/
protected function legacyUploadAndResize(Post $new_blog_post = null, $suggested_title, $image_size_details, $photo)
{
Expand Down Expand Up @@ -223,9 +222,9 @@ protected function legacyUploadAndResize(Post $new_blog_post = null, $suggested_
}

/**
* @throws RuntimeException
*
* @return string
*
* @throws RuntimeException
*/
public function image_destination_path()
{
Expand Down Expand Up @@ -258,10 +257,9 @@ protected function check_image_destination_path_is_writable($path)
* Todo: support multiple filesystem locations.
*
* @param $image_size_details - either an array (with w/h attributes) or a string
* @return string
*
* @throws RuntimeException
*
* @return string
*/
public function legacyGetImageFilename(string $suggested_title, $image_size_details, UploadedFile $photo)
{
Expand Down Expand Up @@ -381,10 +379,10 @@ public function increaseMemoryLimit(): void
/**
* Resize and store an image.
*
* @param Post $new_blog_post
* @param Post $new_blog_post
* @param $suggested_title - used to help generate the filename
* @param array|string $imageSizeDetails - either an array (with 'w' and 'h') or a string (and it'll be uploaded at full size,
* no size reduction, but will use this string to generate the filename)
* @param array|string $imageSizeDetails - either an array (with 'w' and 'h') or a string (and it'll be uploaded at full size,
* no size reduction, but will use this string to generate the filename)
* @param $photo
*
* @throws Exception
Expand Down Expand Up @@ -491,7 +489,7 @@ protected function baseFilename(string $suggestedTitle): string
* If a string is given:
* getWhForFilename("some string") it will return -some-string". (max len: 30)
*
* @param array|string $imageSize
* @param array|string $imageSize
*
* @throws RuntimeException
*/
Expand Down Expand Up @@ -606,7 +604,6 @@ protected function storeInDatabase(
* Legacy function, will be refactored soon.
*
* @param $blogPostId
*
* @return mixed
*/
public function legacyDestroyPost(/* @scrutinizer ignore-unused */ DeleteBlogEtcPostRequest $request, $blogPostId)
Expand Down
6 changes: 2 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ protected function mockView(string $expectedView, array $viewArgumentTypes): voi
/**
* Used for Orchestra\Testbench package.
*
* @param Application $app
*
* @param Application $app
* @return array
*/
protected function getPackageProviders($app)
Expand Down Expand Up @@ -181,8 +180,7 @@ protected function loadMigrations(): void
/**
* Define environment setup.
*
* @param Application $app
*
* @param Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
Expand Down