Skip to content

Instantly share code, notes, and snippets.

@angerman
Created September 21, 2011 15:11
Show Gist options
  • Save angerman/1232308 to your computer and use it in GitHub Desktop.
Save angerman/1232308 to your computer and use it in GitHub Desktop.
<?php
/**
* Action Login
*
* Used to check if login is successful.
* Returns 200 OK upon success.
* Returns 401 Unauthorized upon fail. (May contain reason in
* X-Login-Error header)
*
* @link http://getfrapi.com
* @author Frapi <frapi@getfrapi.com>
* @link /login
*/
class Action_Login extends Frapi_Action implements Frapi_Action_Interface
{
/**
* class constructor
*
* @return null
*/
public function __construct()
{
// require basic auth module
require_once CUSTOM_MODEL . DIRECTORY_SEPARATOR . 'Basic_Auth.php';
// set auth
$auth = new Frapi_Authorization_HTTP_Basic();
}
/**
* Required parameters
*
* @var An array of required parameters.
*/
protected $requiredParams = array();
/**
* The data container to use in toArray()
*
* @var A container of data to fill and return in toArray()
*/
private $data = array();
/**
* To Array
*
* This method returns the value found in the database
* into an associative array.
*
* @return array
*/
public function toArray()
{
return $this->data;
}
/**
* Default Call Method
*
* This method is called when no specific request handler has been found
*
* @return array
*/
public function executeAction()
{
return $this->toArray();
}
/**
* Get Request Handler
*
* This method is called when a request is a GET
*
* @return array
*/
public function executeGet()
{
return $this->toArray();
}
/**
* Post Request Handler
*
* This method is called when a request is a POST
*
* @return array
*/
public function executePost()
{
return $this->toArray();
}
/**
* Put Request Handler
*
* This method is called when a request is a PUT
*
* @return array
*/
public function executePut()
{
return $this->toArray();
}
/**
* Delete Request Handler
*
* This method is called when a request is a DELETE
*
* @return array
*/
public function executeDelete()
{
return $this->toArray();
}
/**
* Head Request Handler
*
* This method is called when a request is a HEAD
*
* @return array
*/
public function executeHead()
{
return $this->toArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment