Change class names to meet naming convention
+ removed namespaces
This commit is contained in:
parent
fc545b7f1c
commit
a53b61775a
14 changed files with 35 additions and 257 deletions
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_Utils_ExtensionCache as Cache;
|
||||
use CRM_TwingleCampaign_BAO_CampaignType as CampaignType;
|
||||
use CRM_TwingleCampaign_BAO_TwingleProject as TwingleProject;
|
||||
use CRM_TwingleCampaign_BAO_TwingleEvent as TwingleEvent;
|
||||
use CRM_TwingleCampaign_BAO_TwingleCampaign as TwingleCampaign;
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
use CRM\TwingleCampaign\Utils\ExtensionCache as Cache;
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use CiviCRM_API3_Exception;
|
||||
|
||||
|
||||
abstract class Campaign {
|
||||
abstract class CRM_TwingleCampaign_BAO_Campaign {
|
||||
|
||||
// IN means: heading into CiviCRM database
|
||||
public const IN = 'IN';
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_Civirules_Utils_LoggerFactory as Civi;
|
||||
|
||||
class CampaignType {
|
||||
class CRM_TwingleCampaign_BAO_CampaignType {
|
||||
|
||||
private static $campaignTypes = [];
|
||||
private $id;
|
||||
|
@ -62,7 +60,7 @@ class CampaignType {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$campaignType = CampaignType::fetch($this->name);
|
||||
$campaignType = self::fetch($this->name);
|
||||
foreach ($this as $var => $value) {
|
||||
if (array_key_exists($var, $campaignType->getSetAttributes())) {
|
||||
$this->$var = $campaignType->getSetAttributes()[$var];
|
||||
|
@ -106,7 +104,7 @@ class CampaignType {
|
|||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return \CRM\TwingleCampaign\BAO\CampaignType|null
|
||||
* @return CRM_TwingleCampaign_BAO_CampaignType|null
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public static function fetch(string $name) {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use Civi;
|
||||
|
||||
class Configuration {
|
||||
class CRM_TwingleCampaign_BAO_Configuration {
|
||||
|
||||
private static $settingsKeys = [
|
||||
'twingle_api_key',
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
|
||||
class CustomField {
|
||||
class CRM_TwingleCampaign_BAO_CustomField {
|
||||
|
||||
private $id;
|
||||
|
||||
|
@ -159,7 +156,7 @@ class CustomField {
|
|||
* @param string|null $name
|
||||
* The name of the field you wish to instantiate.
|
||||
*
|
||||
* @return array|\CRM\TwingleCampaign\BAO\CustomField
|
||||
* @return array|CRM_TwingleCampaign_BAO_CustomField
|
||||
* The required CustomField or an array with all custom fields.
|
||||
*
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
|
@ -184,7 +181,7 @@ class CustomField {
|
|||
|
||||
// Recursive method call with all custom field names from the json file
|
||||
foreach ($campaign_info['custom_fields'] as $custom_field) {
|
||||
$result = CustomField::fetch($custom_field['name']);
|
||||
$result = self::fetch($custom_field['name']);
|
||||
array_push($customFields, $result);
|
||||
}
|
||||
return $customFields;
|
||||
|
@ -258,7 +255,7 @@ class CustomField {
|
|||
public static function getMapping() {
|
||||
|
||||
// Get an array with all custom fields
|
||||
$customFields = CustomField::fetch();
|
||||
$customFields = self::fetch();
|
||||
|
||||
$customFieldMapping = [];
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use CRM_Civirules_Utils_LoggerFactory as Civi;
|
||||
|
||||
class CustomGroup {
|
||||
class CRM_TwingleCampaign_BAO_CustomGroup {
|
||||
|
||||
private $id;
|
||||
private $title;
|
||||
|
@ -106,7 +101,7 @@ class CustomGroup {
|
|||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return CustomGroup
|
||||
* @return self
|
||||
* @throws \CiviCRM_API3_Exception
|
||||
*/
|
||||
public static function fetch($name) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
|
||||
class OptionValue {
|
||||
class CRM_TwingleCampaign_BAO_OptionValue {
|
||||
|
||||
}
|
|
@ -1,15 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
use CRM_TwingleCampaign_BAO_TwingleProject as TwingleProject;
|
||||
|
||||
use API_Exception;
|
||||
use Civi;
|
||||
use CRM_Core_BAO_Setting;
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
use Exception;
|
||||
|
||||
|
||||
class TwingleApiCall {
|
||||
class CRM_TwingleCampaign_BAO_TwingleApiCall {
|
||||
|
||||
private $apiKey;
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_BAO_Campaign as Campaign;
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
|
||||
class TwingleCampaign extends Campaign {
|
||||
class CRM_TwingleCampaign_BAO_TwingleCampaign extends Campaign {
|
||||
|
||||
}
|
|
@ -1,19 +1,11 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_Utils_ExtensionCache as Cache;
|
||||
use CRM_TwingleCampaign_BAO_Campaign as Campaign;
|
||||
use CRM_TwingleCampaign_BAO_TwingleApiCall as TwingleApiCall;
|
||||
use CRM_TwingleCampaign_BAO_Configuration as Configuration;
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use Civi;
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
use CRM\TwingleCampaign\Utils\ExtensionCache as Cache;
|
||||
use Exception;
|
||||
use CiviCRM_API3_Exception;
|
||||
|
||||
include_once E::path() . '/CRM/TwingleCampaign/BAO/Campaign.php';
|
||||
include_once E::path() . '/CRM/TwingleCampaign/BAO/Configuration.php';
|
||||
include_once E::path() . '/CRM/TwingleCampaign/Utils/ExtensionCache.php';
|
||||
|
||||
class TwingleEvent extends Campaign {
|
||||
class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||
|
||||
/**
|
||||
* TwingleEvent constructor.
|
||||
|
@ -68,7 +60,7 @@ class TwingleEvent extends Campaign {
|
|||
|
||||
// Instantiate TwingleEvent
|
||||
try {
|
||||
$event = new TwingleEvent(
|
||||
$event = new self(
|
||||
$values,
|
||||
self::TWINGLE
|
||||
);
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
<?php
|
||||
|
||||
use CRM_TwingleCampaign_Utils_ExtensionCache as Cache;
|
||||
use CRM_TwingleCampaign_BAO_Campaign as Campaign;
|
||||
use CRM_TwingleCampaign_BAO_TwingleApiCall as TwingleApiCall;
|
||||
|
||||
namespace CRM\TwingleCampaign\BAO;
|
||||
|
||||
use Civi;
|
||||
use CRM_TwingleCampaign_ExtensionUtil as E;
|
||||
use CRM\TwingleCampaign\Utils\ExtensionCache as Cache;
|
||||
use CRM\TwingleCampaign\BAO\Campaign;
|
||||
use Exception;
|
||||
use CiviCRM_API3_Exception;
|
||||
|
||||
include_once E::path() . '/CRM/TwingleCampaign/BAO/Campaign.php';
|
||||
include_once E::path() . '/CRM/TwingleCampaign/Utils/ExtensionCache.php';
|
||||
|
||||
class TwingleProject extends Campaign {
|
||||
class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign {
|
||||
|
||||
/**
|
||||
* TwingleProject constructor.
|
||||
|
@ -66,7 +57,7 @@ class TwingleProject extends Campaign {
|
|||
|
||||
// Instantiate TwingleProject
|
||||
try {
|
||||
$project = new TwingleProject(
|
||||
$project = new self(
|
||||
$values,
|
||||
self::TWINGLE
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue