Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Phoenix Hospitality Management System
- * Phoenix REST API - API Security Service file
- * Written in PHP using the Slim microframework
- *
- * @author Troy L. Marker
- * @version 0.5.0
- * @since 0.5.0
- * @copyright Copyright (c) 2020 By Troy Marker Enterprises
- *
- * Declare namespace and Import needed functions/classes
- */
- namespace App\Domain\Service;
- use App\Domain\Data\LoggingUser as LoggingUser;
- use App\Domain\Data\CurrentUser as CurrentUser;
- use App\Domain\Repository\Security as SecurityRepository;
- use UnexpectedValueException;
- /**
- * This class provides the service calls for the Security Service file
- */
- final class Security {
- private $repository;
- /**
- * This method constructs the service and injects the Security Repository
- *
- * @param SecurityRepository $repository - The repository being injected
- */
- public function __construct(SecurityRepository $repository) {
- $this->repository = $repository;
- }
- /**
- * This method logs a user onto the system.
- */
- public function login(LoggingUser $loggingUser) {
- var_dump($loggingUser);
- $return_value['success'] = false;
- $return_value['message'] = '';
- if(!$logginguser->username){
- $return_value['message'] = 'username field required in Security::login';
- } else {
- if (!$loggeduser->password) {
- $return_value['message'] = 'password field required in Security::login';
- } else {
- $return_value['success'] = true;
- $return_value['message'] = 'User successfully retreived';
- $return_value['data'] = $this->repository->login($loggingUser);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement