Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
weboAp committed Jul 25, 2014
1 parent bf59b45 commit 686f641
Showing 1 changed file with 68 additions and 31 deletions.
99 changes: 68 additions & 31 deletions src/Package/Visitor/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
use Countable;


/**
* Class Visitor
* @package Weboap\Visitor
*/
class Visitor implements Countable{


Expand Down Expand Up @@ -36,18 +40,26 @@ class Visitor implements Countable{
*/
protected $config;


protected $ip;

/**
* @var Ip
*/
protected $ip;

/**
* The Geo Interface
*/
protected $geo;




public function __construct( VisitorInterface $storage,


/**
* @param VisitorInterface $storage
* @param GeoInterface $geo
* @param Ip $ip
* @param Config $config
* @param CacheClass $cache
*/
public function __construct( VisitorInterface $storage,
GeoInterface $geo,
Ip $ip,
Config $config,
Expand All @@ -64,11 +76,13 @@ public function __construct( VisitorInterface $storage,
$this->tableName = $this->config->get('visitor::table');

}




public function get( $ip = null )


/**
* @param null $ip
* @return null
*/
public function get( $ip = null )
{
if( ! isset( $ip ) )
{
Expand All @@ -82,11 +96,12 @@ public function get( $ip = null )

return null;
}




public function log()


/**
*
*/
public function log()
{

$ip = $this->ip->get();
Expand Down Expand Up @@ -125,9 +140,12 @@ public function log()


}


public function forget( $ip )


/**
* @param $ip
*/
public function forget( $ip )
{
if( ! $this->ip->isValid( $ip ) ) return;

Expand All @@ -138,34 +156,53 @@ public function forget( $ip )
$this->cache->destroy( $this->tableName );


}


public function has( $ip )
}


/**
* @param $ip
* @return bool
*/
public function has( $ip )
{
if( ! $this->ip->isValid( $ip ) ) return false;

return $this->count( $ip ) > 0 ;

}

public function count( $ip = null)

/**
* @param null $ip
* @return mixed
*/
public function count( $ip = null)
{
//if ip null then return count of all visits
return $this->storage->count( $ip );
}

public function all()

/**
* @return mixed
*/
public function all()
{
return $this->storage->all();
}

public function clicks()

/**
* @return mixed
*/
public function clicks()
{
return $this->storage->clicksSum();
}

public function range($start, $end)
/**
* @param $start
* @param $end
* @return mixed
*/
public function range($start, $end)
{
$start = date( 'Y-m-d H:i:s', strtotime( $start ));
$end = date( 'Y-m-d 23:59:59', strtotime( $end ));
Expand Down

0 comments on commit 686f641

Please sign in to comment.