Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Analyst\Contracts;
|
||||
|
||||
interface AnalystContract
|
||||
{
|
||||
/**
|
||||
* Must return version of analyst
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function version();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Analyst\Contracts;
|
||||
|
||||
/**
|
||||
* Interface CacheContract
|
||||
*
|
||||
* @since 1.1.5
|
||||
*/
|
||||
interface CacheContract
|
||||
{
|
||||
/**
|
||||
* Save value with given key
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function put($key, $value);
|
||||
|
||||
/**
|
||||
* Get value by given key
|
||||
*
|
||||
* @param $key
|
||||
*
|
||||
* @param null $default
|
||||
* @return string
|
||||
*/
|
||||
public function get($key, $default = null);
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function delete($key);
|
||||
|
||||
/**
|
||||
* Should get value and remove it from cache
|
||||
*
|
||||
* @param $key
|
||||
* @param null $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop($key, $default = null);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Analyst\Contracts;
|
||||
|
||||
use Analyst\ApiResponse;
|
||||
|
||||
interface HttpClientContract
|
||||
{
|
||||
/**
|
||||
* Make an http request
|
||||
*
|
||||
* @param $method
|
||||
* @param $url
|
||||
* @param $body
|
||||
* @param $headers
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function request($method, $url, $body, $headers);
|
||||
|
||||
/**
|
||||
* Must return `true` if client is supported
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasSupport();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Analyst\Contracts;
|
||||
|
||||
use Analyst\ApiResponse;
|
||||
|
||||
interface RequestContract
|
||||
{
|
||||
/**
|
||||
* Cast request data to array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray();
|
||||
|
||||
/**
|
||||
* Execute the request
|
||||
* @param RequestorContract $requestor
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function execute(RequestorContract $requestor);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Analyst\Contracts;
|
||||
|
||||
interface RequestorContract
|
||||
{
|
||||
/**
|
||||
* Get request
|
||||
*
|
||||
* @param $url
|
||||
* @param array $headers
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($url, $headers = []);
|
||||
|
||||
/**
|
||||
* Post request
|
||||
*
|
||||
* @param $url
|
||||
* @param $body
|
||||
* @param array $headers
|
||||
* @return mixed
|
||||
*/
|
||||
public function post($url, $body = [], $headers = []);
|
||||
|
||||
/**
|
||||
* Put request
|
||||
*
|
||||
* @param $url
|
||||
* @param $body
|
||||
* @param array $headers
|
||||
* @return mixed
|
||||
*/
|
||||
public function put($url, $body = [], $headers = []);
|
||||
|
||||
/**
|
||||
* Delete request
|
||||
*
|
||||
* @param $url
|
||||
* @param array $headers
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete($url, $headers = []);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Analyst\Contracts;
|
||||
|
||||
interface TrackerContract
|
||||
{
|
||||
/**
|
||||
* Should register activation and deactivation
|
||||
* event hooks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerHooks();
|
||||
|
||||
/**
|
||||
* Will fire when admin activates plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onActivePluginListener();
|
||||
|
||||
/**
|
||||
* Will fire when admin deactivates plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onDeactivatePluginListener();
|
||||
|
||||
/**
|
||||
* Will fire when user opted in
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onOptInListener();
|
||||
|
||||
/**
|
||||
* Will fire when user opted out
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onOptOutListener();
|
||||
|
||||
/**
|
||||
* Will fire when user accept opt/in at first time
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onInstallListener();
|
||||
|
||||
/**
|
||||
* Will fire when user skipped installation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function onSkipInstallListener();
|
||||
|
||||
/**
|
||||
* Will fire when user delete plugin through admin panel.
|
||||
* This action will happen if admin at least once
|
||||
* activated the plugin.
|
||||
*
|
||||
* The register_uninstall_hook function accepts only static
|
||||
* function or global function to be executed, so this is
|
||||
* why this method is static
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function onUninstallPluginListener();
|
||||
}
|
||||
Reference in New Issue
Block a user