Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
286
Merge Requests
38
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
65285097
Commit
65285097
authored
2 hours ago
by
Guy Thouret
Browse files
Options
Download
Add phpdocs and move referral cookie instantiation to constructor -
#1077
parent
6cefab06
extract-view-api-1077
1 merge request
!413
Extract record view details from analytics/views api call
Pipeline
#101844703
passed with stages
in 7 minutes and 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
5 deletions
+34
-5
Core/Analytics/Views/Record.php
View file @
65285097
...
...
@@ -7,10 +7,16 @@ use Minds\Core\Di\Di;
use
Minds\Entities
;
use
Minds\Helpers\Counters
;
/**
* Class Record
* @package Minds\Core\Analytics\Views
*/
class
Record
{
/** @var Manager */
protected
$manager
;
/** @var Core\Referrals\ReferralCookie $referralCookie */
protected
$referralCookie
;
/** @var string $lastError */
protected
$lastError
=
''
;
/** @var array $boostData */
...
...
@@ -20,33 +26,55 @@ class Record
/** @var array $clientMeta */
protected
$clientMeta
;
public
function
__construct
(
Manager
$manager
=
null
)
public
function
__construct
(
Manager
$manager
=
null
,
Core\Referrals\ReferralCookie
$referralCookie
=
null
)
{
$this
->
manager
=
$manager
?:
new
Manager
();
$this
->
referralCookie
=
$referralCookie
?:
Di
::
_
()
->
get
(
'Referrals\Cookie'
);
}
/**
* Set the client meta
* @param array $clientMeta
* @return $this
*/
public
function
setClientMeta
(
array
$clientMeta
)
:
self
{
$this
->
clientMeta
=
$clientMeta
;
return
$this
;
}
/**
* Set the identifier
* @param string $identifier
* @return $this
*/
public
function
setIdentifier
(
string
$identifier
)
:
self
{
$this
->
identifier
=
$identifier
;
return
$this
;
}
/**
* Get boost impressions data
* @return array
*/
public
function
getBoostImpressionsData
()
:
array
{
return
$this
->
boostData
;
}
/**
* @return string
*/
public
function
getLastError
()
:
string
{
return
$this
->
lastError
;
}
/**
* Record a boost
* @return bool
*/
public
function
recordBoost
()
:
bool
{
/** @var Core\Boost\Network\Expire $expire */
...
...
@@ -93,6 +121,10 @@ class Record
return
true
;
}
/**
* Record an entity
* @return bool
*/
public
function
recordEntity
()
:
bool
{
$entity
=
Entities\Factory
::
build
(
$this
->
identifier
);
...
...
@@ -141,10 +173,7 @@ class Record
error_log
(
$e
);
}
Di
::
_
()
->
get
(
'Referrals\Cookie'
)
->
setEntity
(
$entity
)
->
create
();
$this
->
referralCookie
->
setEntity
(
$entity
)
->
create
();
return
true
;
}
}
This diff is collapsed.
Please
register
or
sign in
to comment