Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisdom Ebong committed Oct 17, 2023
1 parent 8998d66 commit 88f2d1c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Ushahidi/Core/Tool/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function hasPermission(Entity $user, $permission)
protected function customRoleHasPermission(Entity $user, $permission)
{
$role = $this->role_repo->getByName($user->role);
if (isset($role->permissions) && is_null($role->permissions) === false ) {
if (isset($role->permissions) && is_null($role->permissions) === false) {
$permissions = array_map('strtolower', $role->permissions);

// Does the user have the permission?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class FetchCollectionQueryHandler extends AbstractQueryHandler
public function __construct(
CollectionRepository $collection_repository,
SetAuthorizer $setAuthorizer
)
{
) {
$this->collection_repository = $collection_repository;
$this->setAuthorizer = $setAuthorizer;
}
Expand Down
1 change: 0 additions & 1 deletion src/Ushahidi/Modules/V5/Policies/SetPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ public function update(User $user, Set $set)
$set_entity = new OhanzeeSet($set->toArray());
return $this->authorizer->isAllowed($set_entity, 'update');
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setSearchParams(SearchData $searchData)

private function setSearchCondition(Builder $builder, ?SearchData $search_fields)
{
if($search_fields === null) {
if ($search_fields === null) {
return $builder;
}

Expand All @@ -56,7 +56,7 @@ private function setSearchCondition(Builder $builder, ?SearchData $search_fields

if (isset($parent_id)) {
$builder->where('parent_id', '=', $parent_id);
} else if ($is_parent === false) {
} elseif ($is_parent === false) {
$builder->whereNull('parent_id');
}

Expand All @@ -82,12 +82,11 @@ private function setSearchCondition(Builder $builder, ?SearchData $search_fields
});
}

if (isset($role) && !is_null($role)){
if (isset($role) && !is_null($role)) {
$builder->orWhere(function (Builder $query) use ($role) {
$query->where('role', 'LIKE', "%" . $role . "%");
});
}

});
}

Expand Down Expand Up @@ -117,7 +116,7 @@ public function fetchAll(Paging $paging)
Category::take($paging->getLimit())
->skip($paging->getSkip())
->orderBy($paging->getOrderBy(), $paging->getOrder()),
$this->searchData
$this->searchData
)->paginate($paging->getLimit());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class EloquentSetRepository implements SetRepository
*
* @return Set[]|LengthAwarePaginator
*/
public function fetch() {
public function fetch()
{
$data = $this->searchData;

$query = $this->setSearchCondition(Set::query(), $data);
Expand All @@ -41,7 +42,7 @@ public function fetch() {
$query->orderBy($sort, $order);
}

if($data->getFilter('with_post_count')) {
if ($data->getFilter('with_post_count')) {
$query->withCount('posts');
}

Expand All @@ -58,13 +59,13 @@ private function setSearchCondition(Builder $builder, SearchData $search_fields)
$builder->where('search', '=', $is_saved_search);

$keyword = $search_fields->getFilter('keyword');
if (isset($keyword) && !empty($keyword) ) {
if (isset($keyword) && !empty($keyword)) {
$builder->where('name', 'LIKE', "%" . $keyword . "%");
}

$is_admin = $search_fields->getFilter('is_admin');
if ($is_admin == false) {
$builder->where(function ($query) use ($search_fields){
$builder->where(function ($query) use ($search_fields) {
// Default search for everyone and guest user
$query->where('role', 'LIKE', "%everyone%");

Expand Down

0 comments on commit 88f2d1c

Please sign in to comment.