Inheritance: extends Gpf_Object, implements Gpf_Rpc_Serializable
	/**
	 * @service campaign read
	 * @return Gpf_Data_Table
	 */
	public function getRows(Gpf_Rpc_Params $params) {		
		$select = $this->createCommissionTypeSelect($params->get('campaignid'));
		$commTypes = $select->getAllRows();
		$this->addSpecialTypes($commTypes);
		$this->translateCommTypes($commTypes);				
		return $this->createResponse($params, $commTypes);
	}
 /**
  * Load role privileges
  *
  * @service
  * @anonym
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Data_RecordSet
  */
 public function loadRolePrivileges(Gpf_Rpc_Params $params)
 {
     if (!Gpf_Session::getAuthUser()->hasPrivilege(Gpf_Privileges::ROLE, Gpf_Privileges::P_READ) && !Gpf_Session::getAuthUser()->hasPrivilege(Gpf_Privileges::ROLE, Pap_Privileges::P_READ_OWN)) {
         throw new Gpf_Rpc_PermissionDeniedException('Gpf_Role_RolePrivilegesForm', 'loadRolePrivileges');
     }
     $role = new Gpf_Db_Role();
     $role->setId($params->get('roleid'));
     $role->load();
     $defaultPrivileges = Gpf_Application::getInstance()->getDefaultPrivilegesByRoleType($role->getRoleType());
     $result = new Gpf_Data_RecordSet();
     $result->addColumn('object');
     $result->addColumn('objectName');
     $result->addColumn('possiblePrivileges');
     $result->addColumn('activePrivileges');
     $rolePrivileges = Gpf_Privileges::loadPrivileges($role->getId());
     foreach ($defaultPrivileges->getDefaultPrivileges() as $object => $privileges) {
         $record = new Gpf_Data_Record($result->getHeader());
         $record->add('object', $object);
         $record->add('objectName', ucfirst(str_replace('_', ' ', strtolower($object))));
         $allTypes = $defaultPrivileges->getObjectToTypeRelation();
         $record->add('possiblePrivileges', implode(',', $allTypes[$object]));
         if (array_key_exists($object, $rolePrivileges)) {
             $record->add('activePrivileges', implode(',', array_keys($rolePrivileges[$object])));
         } else {
             $record->add('activePrivileges', '');
         }
         $result->addRecord($record);
     }
     $result->sort('objectName');
     return $result;
 }
    /**
     * @param $params
     * @param $row
     * @param $primaryKeyName
     * @param $baseAttributes
     */
    private function getResponse(Gpf_Rpc_Params $params, Gpf_DbEngine_RowBase $row, $primaryKeyName, array $baseAttributes = null) {
    	$this->visitorId = $params->get('visitorId');

        $response = new Gpf_Rpc_Data();
        if ($this->visitorId == '') {
            return $response;
        }
        $this->setAccountId($params->get('accountId'));
        
        $this->processAllVisitorVisits();
        if (($visitorAffiliate = $this->getCurrentVisitorAffiliate()) == null) {
            return $response;
        }  
              
    	if (is_null($baseAttributes)) {
    		$baseAttributes = array($primaryKeyName);
    	}
    	$row->set($primaryKeyName, $visitorAffiliate->get($primaryKeyName));
        try {
            $row->load();
        } catch (Gpf_Exception $e) {
            return $response;
        }
        if (Gpf_Session::getAuthUser()->hasPrivilege('click', 'write')) {
            foreach ($row->getAttributes() as $name => $value) {
                $response->setValue($name, $value);
            }
        } else {
        	foreach ($baseAttributes as $attribute) {
            	$response->setValue($attribute, $row->get($attribute));
        	}
        }
        return $response;
    }
 /**
  * @service banner read
  * @param $bannerId
  * @return Gpf_Rpc_Action
  */
 public function check(Gpf_Rpc_Params $params) {
     $response = new Gpf_Rpc_Action($params);
     $bannerFactory = new Pap_Common_Banner_Factory();
     $site = $bannerFactory->getBanner($params->get('id'));
     $site->setDestinationUrl(rtrim($params->get('url'), "/\\").'/');
     
     $response->setInfoMessage('Site replication .htaccess is working at this location');
     $response->setErrorMessage('Site replication .htaccess is not set up at this location or it is not working correctly. Please make sure that you have mod_rewrite and mod_proxy enabled in your Apache configuration');
     
     $testUser = new Pap_Common_User();
     $testUser->setRefId(Pap_Features_SiteReplication_Replicator::TEST_STRING);
     $request = new Gpf_Net_Http_Request();
     $request->setUrl($site->getUrl($testUser).Pap_Features_SiteReplication_Replicator::TEST_STRING);
     $httpClient = new Gpf_Net_Http_Client();
     try {
         $testResponse = $httpClient->execute($request);
         if ($testResponse->getBody() == Pap_Features_SiteReplication_Replicator::TEST_RESPONSE) {
             $response->addOk();
         } else {
             $response->addError();                
         }
     } catch (Gpf_Exception $e) {
         $response->addError();
     }
     
     return $response;
 }
    /**
     * @service pay_affiliate read
     * @param $data
     */
    public function load(Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);

        $select = new Gpf_SqlBuilder_SelectBuilder();
        $select->select->add("au.username","userName");
        $select->select->add("au.firstname","firstName");
        $select->select->add("au.lastname","lastname");
        $select->select->add("SUM(t.".Pap_Db_Table_Transactions::COMMISSION.")", "payout");
        $select->select->add("pu.".Pap_Db_Table_Users::MINIMUM_PAYOUT, "minimumPayout");
        $select->select->add("IFNULL(po.".Gpf_Db_Table_FieldGroups::NAME.", 'undefined')", "payoutMethod");
        $select->from->add(Pap_Db_Table_Transactions::getName(), "t");
        $select->from->addInnerJoin(Pap_Db_Table_Users::getName(), "pu", "t.userid = pu.userid");
        $select->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "pu.accountuserid = gu.accountuserid");
        $select->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");
        $select->groupBy->add("t.".Pap_Db_Table_Transactions::USER_ID);
        $select->from->addLeftJoin(Gpf_Db_Table_FieldGroups::getName(), "po", "pu.payoutoptionid = po.fieldgroupid");
        $select->where->add("t.".Pap_Db_Table_Transactions::USER_ID, "=", $params->get("id"));
        $row = $select->getOneRow();

        $data->setValue("userName", $row->get("userName"));
        $data->setValue("firstName", $row->get("firstName"));
        $data->setValue("lastname", $row->get("lastname"));
        $data->setValue("payout", $row->get("payout"));
        $data->setValue("minimumPayout", $row->get("minimumPayout"));
        $data->setValue("payoutMethod", $row->get("payoutMethod"));

        return $data;
    }
 /**
  * returns available plugins
  *
  * @service plugin read
  * @param $fields
  */
 public function load(Gpf_Rpc_Params $params)
 {
     $availablePlugins = Gpf_Plugins_Engine::getInstance()->getAvailablePlugins();
     if ($params->exists("type")) {
         $type = $params->get("type");
     } else {
         $type = Gpf_Plugins_Definition::PLUGIN_TYPE_NORMAL;
     }
     $response = new Gpf_Data_RecordSet();
     $response->addColumn(Gpf_Plugins_Definition::CODE);
     $response->addColumn(Gpf_Plugins_Definition::NAME);
     $response->addColumn(Gpf_Plugins_Definition::URL);
     $response->addColumn(Gpf_Plugins_Definition::DESCRIPTION);
     $response->addColumn(Gpf_Plugins_Definition::VERSION);
     $response->addColumn(Gpf_Plugins_Definition::AUTHOR);
     $response->addColumn(Gpf_Plugins_Definition::AUTHOR_URL);
     $response->addColumn(Gpf_Plugins_Definition::ACTIVE);
     $response->addColumn(Gpf_Plugins_Definition::HELP);
     $response->addColumn(Gpf_Plugins_Definition::CONFIG_CLASS_NAME);
     foreach ($availablePlugins as $plugin) {
         if ($plugin->getPluginType() == $type) {
             $response->addRecord($plugin->toRecord($response));
         }
     }
     $response = $this->setActivePlugins($response);
     return $response;
 }
 /**
  * @param $itemId
  * @return Gpf_Data_RecordSet
  */
 public function loadTree(Gpf_Rpc_Params $params)
 {
     if (!$params->exists("itemId")) {
         throw new Gpf_Exception($this->_('Param itemId is mising'));
     }
     return $this->loadItems($params->get('itemId'));
 }
 /**
  * @service theme read
  *
  * @return Gpf_Data_RecordSet
  */
 public function getThemes(Gpf_Rpc_Params $params)
 {
     if ($params->exists('panelName')) {
         return $this->getThemesNoRpc($params->get('panelName'));
     } else {
         return $this->getThemesNoRpc(Gpf_Session::getModule()->getPanelName(), $params->get('filterDisabled'));
     }
 }
 /**
  *  Returns parent affiliates plus current affiliate
  *
  * @service affiliate_tree read
  * @param $itemId
  * @return Gpf_Data_RecordSet
  */
 public function loadParents(Gpf_Rpc_Params $params) {
     $result = new Gpf_Data_RecordSet();
     $user = new Pap_Affiliates_User();
     $result->setHeader(array_keys($user->toArray()));
     $result->addColumn("subaffiliates", 1);
     $this->addUserToRecordSet($result, $params->get('itemId'));
     return $result;
 }
Beispiel #10
0
 /**
  *
  * @param unknown_type $className
  * @param unknown_type $methodName
  * @param unknown_type $formRequest
  * @param unknown_type $formResponse
  * @return Gpf_Rpc_Params
  */
 public static function create($className, $methodName = 'execute', $formRequest = false, $formResponse = false)
 {
     $params = new Gpf_Rpc_Params();
     $obj = new stdClass();
     foreach (self::createGetRequest($className, $methodName, $formRequest, $formResponse) as $name => $value) {
         $params->add($name, $value);
     }
     return $params;
 }
	/**
	 * @return Gpf_Rpc_Params
	 */
	private function getParams() {
		$params = new Gpf_Rpc_Params();
		$params->add('sort_col', 'name');
		$params->add('sort_asc', true);
		$params->add('offset', 0);
		$params->add('limit', 9999);
		$params->add('columns', array(array("id"),array("id"),array("userid"),array("username"),array("firstname"),array("lastname"),array("username"),array("commission"),array("pendingAmount"),array("declinedAmount"),array("minimumpayout"),array("payoutMethod"),array("payoutData")));

		return $params;
	}
 private function init(Gpf_Rpc_Params $params)
 {
     $filtersArray = $params->get("filters");
     if (!is_array($filtersArray)) {
         return;
     }
     foreach ($filtersArray as $filterArray) {
         $this->add($filterArray);
     }
 }
    protected function addFilters(Gpf_Rpc_Params $params) {       
        $recordset = $this->getFiltersRecordset();
        $fields = null;
    	foreach ($recordset as $record) {
            $fields[] = array($record->get(Gpf_Db_Table_FilterConditions::CODE), $record->get(Gpf_Db_Table_FilterConditions::OPERATOR), $record->get(Gpf_Db_Table_FilterConditions::VALUE));
        }
        $params->add('filters', $fields);

        return $params;
    }
 /**
  * @service
  * @anonym
  * @return Gpf_Data_RecordSet
  */
 public function getRow(Gpf_Rpc_Params $params)
 {
     $select = $this->createCountriesSelect();
     $select->where->add(Gpf_Db_Table_Countries::COUNTRY_CODE, '=', $params->get(self::SEARCH));
     $select->limit->set(0, 1);
     $recordset = $select->getAllRows();
     foreach ($recordset as $record) {
         $record->set('name', $this->_localize($record->get('name')));
     }
     return $recordset;
 }
Beispiel #15
0
 protected function getRequestIdsIterator()
 {
     $json = new Gpf_Rpc_Json();
     $requestParams = new Gpf_Rpc_Params($json->decode($this->params->get(self::IDS_REQUEST)));
     $c = $requestParams->getClass();
     $gridService = new $c();
     if (!$gridService instanceof Gpf_View_GridService) {
         throw new Gpf_Exception(sprintf('%s is not Gpf_View_GridService class.', $requestParams->getClass()));
     }
     return $gridService->getIdsIterator($requestParams);
 }
 /**
  * @service language read
  * @return Gpf_Rpc_Serializable
  */
 public function getRows(Gpf_Rpc_Params $params)
 {
     $language = new Gpf_Db_Language();
     $language->setId($params->get(Gpf_Db_Table_Languages::ID));
     $language->load();
     $filters = $params->get('filters');
     $filters[0][2] = htmlspecialchars($filters[0][2]);
     $params->set('filters', $filters);
     $this->setCsvReader(new Gpf_Io_Csv_Reader(Gpf_Lang_CsvLanguage::getAccountCsvFileName($language->getCode())));
     return parent::getRows($params);
 }
    /**
     * @service theme read
     */
    public function loadTree(Gpf_Rpc_Params $params) {
        $themeBase = $this->getThemeFile($params->get('panelName'));
        $themeDirName = $params->get('themeId');
        $itemPath = $params->get('itemId');
        $filter = $params->get('filter');

        $files = array();
        $dirs = array();
        $this->loadFiles($files, $dirs, $themeBase.'/'.Gpf_Paths::DEFAULT_THEME.$itemPath, $filter);
        $this->loadFiles($files, $dirs, $themeBase.'/'.$themeDirName.'/'.$itemPath, $filter);
        return $this->createLoadTreeResult($files, $dirs, $itemPath);
    }
 /**
  * Load list of template variables for template specified in input parameter templateId
  *
  * @service mail_template read
  * @param Gpf_Rpc_Params $params
  */
 public function getTemplateVariables(Gpf_Rpc_Params $params)
 {
     $dbRow = $this->loadMailTemplate($params->get("templateId"));
     $recordSet = new Gpf_Data_RecordSet();
     $recordSet->setHeader(array('code', 'name'));
     $className = $dbRow->get(Gpf_Db_Table_MailTemplates::CLASS_NAME);
     $objTemplate = new $className();
     foreach ($objTemplate->getTemplateVariables() as $code => $name) {
         $recordSet->add(array($code, $name));
     }
     return $recordSet;
 }
 /**
  * Gets template names for template name suggestion oracle
  *
  * @service template read
  * @param $search
  */
 public function getTemplateNames(Gpf_Rpc_Params $params)
 {
     $searchString = $params->get('search');
     $this->loadTemplates();
     $result = new Gpf_Data_RecordSet();
     $result->setHeader(array('id', 'name'));
     foreach ($this->templates as $templateName) {
         if ($searchString == "" || strstr($templateName, $searchString) !== false) {
             $result->add(array($templateName, $templateName . '.tpl'));
         }
     }
     return $result;
 }
Beispiel #20
0
 public function __construct(Gpf_Rpc_Params $params = null)
 {
     $this->fields = new Gpf_Data_IndexedRecordSet(self::FIELD_NAME);
     $header = new Gpf_Data_RecordHeader();
     $header->add(self::FIELD_NAME);
     $header->add(self::FIELD_VALUE);
     $header->add(self::FIELD_VALUES);
     $header->add(self::FIELD_ERROR);
     $this->fields->setHeader($header);
     $this->validator = new Gpf_Rpc_Form_Validator_FormValidatorCollection($this);
     if ($params) {
         $this->loadFieldsFromArray($params->get("fields"));
     }
 }
    /**
     *
     * @param $message
     * @param $simulation
     * @return Gpf_Rpc_Form
     */
    private function action(Gpf_Rpc_Params $params, $message = '', $simulation = false) {
        $data = new Gpf_Rpc_Data($params);

        $filters = new Gpf_Rpc_FilterCollection($params);
        if ($filters->getFilterValue('reachedCondition') == Gpf::YES) {
            $data->setValue('message', $message);
            return $data;
        }

        $compressedCommissionProcesor = new Pap_Features_CompressedCommissionPlacementModel_Processor();
        $output = $compressedCommissionProcesor->recalculate($params->get('filters'), $simulation);

        $data->setValue('message', $output);
        return $data;
    }
	/**
	 * returns all commission types for a campaign
	 *
	 * @service commission read
	 * @param $fields
	 */
	public function loadAllCommissionSettings(Gpf_Rpc_Params $params) {
		$commissionGroupId = $params->get("commissiongroupid");
		$campaignId = $params->get("campaignid");
		$rtype = $params->get("rtype");
		if($campaignId != '') {
			if($commissionGroupId == '') {
				$commissionGroupId = $this->getDefaultCommissionGroupId($campaignId);
			}
			return Pap_Db_Table_Commissions::getInstance()->getAllCommissions('', $commissionGroupId);
		}
		if($rtype != '') {
			return Pap_Db_Table_Commissions::getInstance()->getAllCommissions('', $commissionGroupId);
		}
		throw new Exception($this->_("Campaign ID cannot be empty!"));
	}
	protected function buildData(Gpf_Data_RecordSet $fields, Gpf_Rpc_Params $params) {
		$selectBuilder = Pap_Db_Table_Commissions::getInstance()->getAllCommissionsInCampaignSelectBuilder($params->get('campaignid'), '');
		$selectBuilder->orderBy->add('c.' . Pap_Db_Table_Commissions::ID);
		$selectBuilder->orderBy->add('tier');
		$selectBuilder->orderBy->add('ct.' . Pap_Db_Table_CommissionTypes::PARENT_COMMISSIONTYPE_ID);
		$commissionGroupID = $this->getCommissionGroupId($params->get('campaignid'));

		foreach ($selectBuilder->getAllRowsIterator() as $commission) {
			if ($commission->get('commissiongroupid') != $commissionGroupID) {
				continue;
			}
			$fields->add($this->createRecordArray($commission));
			$this->addCommission($commission);
		}
	}
Beispiel #24
0
 /**
  * Create instance to handle DataRequest
  *
  * @param Gpf_Rpc_Params $params
  */
 public function __construct(Gpf_Rpc_Params $params = null)
 {
     if ($params === null) {
         $params = new Gpf_Rpc_Params();
     }
     $this->filters = new Gpf_Rpc_FilterCollection($params);
     $this->params = new Gpf_Data_IndexedRecordSet(self::NAME);
     $this->params->setHeader(array(self::NAME, self::VALUE));
     if ($params->exists(self::DATA) !== null) {
         $this->loadParamsFromArray($params->get(self::DATA));
     }
     $this->id = $params->get(self::ID);
     $this->response = new Gpf_Data_IndexedRecordSet(self::NAME);
     $this->response->setHeader(array(self::NAME, self::VALUE));
 }
 private function getAffiliateIds($searchValue) {
     $affiliatesGrid = new Pap_Merchants_User_AffiliatesGrid();
     $params = new Gpf_Rpc_Params();
     $params->add('filters', array(array("search", "L", $searchValue)));
     $params->add('columns', array(array("id")));
     $affiliateRows = $affiliatesGrid->getRows($params);
     $affiliateIds = array();
     foreach ($affiliateRows->rows as $row) {
         if ($row[0] == 'id') {
             continue;
         }
         $affiliateIds[] = $row[0];
     }
     return $affiliateIds;
 }
Beispiel #26
0
    /**
     * Load Location of last 20 IP addresses of logins of selected affiliate
     *
     * @service online_user read
     * @return Gpf_Data_RecordSet
     */
    public function getAffiliateLogins(Gpf_Rpc_Params $params) {
        $sql = new Gpf_SqlBuilder_SelectBuilder();

        $sql->select->add('l.'.Gpf_Db_Table_LoginsHistory::IP);
        $sql->select->add('MAX(l.'.Gpf_Db_Table_LoginsHistory::LOGIN . ')', 'login');

        $sql->from->add(Gpf_Db_Table_LoginsHistory::getName(), 'l');
        $sql->from->addInnerJoin(Gpf_Db_Table_Users::getName(), 'u', 'l.accountuserid=u.accountuserid');
        $sql->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), 'au', 'u.authid=au.authid');

        $sql->where->add(Gpf_Db_Table_AuthUsers::USERNAME, '=', $params->get('username'));
        $sql->where->add('l.'.Gpf_Db_Table_LoginsHistory::IP, '<>', '127.0.0.1');

        $sql->orderBy->add(Gpf_Db_Table_LoginsHistory::LOGIN, false);

        $sql->groupBy->add('l.'.Gpf_Db_Table_LoginsHistory::IP);

        $sql->limit->set(0, 20);

        $recordset = $sql->getAllRows();

        $recordset->addColumn('countryCode', '');
        $recordset->addColumn('countryName', '');
        $recordset->addColumn('city', '');
        $recordset->addColumn('latitude', '');
        $recordset->addColumn('longitude', '');
        $recordset->addColumn('postalCode', '');
        $recordset->addColumn('region', '');

        foreach ($recordset as $record) {
            $location = new GeoIp_Location();
            $location->setIpString($record->get('ip'));
            $location->load();

            $record->set('countryCode', $location->getCountryCode());
            $record->set('countryName', $location->getCountryName());
            $record->set('city', $location->getCity());
            $record->set('latitude', $location->getLatitude());
            $record->set('longitude', $location->getLongitude());
            $record->set('postalCode', $location->getPostalCode());
            $record->set('region', $location->getRegion());

            $record->set('login', Gpf_Common_DateUtils::getHumanRelativeTime(Gpf_Common_DateUtils::getClientTime(
            Gpf_Common_DateUtils::mysqlDateTime2Timestamp($record->get('login')))));
        }

        return $recordset;
    }
    /**
     *
     * @service recurring_transaction write
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function changeStatus(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Status of selected recurring transaction(s) was changed"));
        $action->setErrorMessage($this->_("Failed to change status of selected recurring transaction(s)"));

        $ids = array();
        foreach ($action->getIds() as $id) {
            $ids[] = $id;
        }
        
        $status = $params->get("status");

        $this->massUpdateStatus($status, $ids, $action);

        return $action;
    }
    /**
     * Get pdf banner for affiliate
     * 
     * @service banner read
     * @param Gpf_Rpc_Params $params
     */
    public function generateAffiliatePdf(Gpf_Rpc_Params $params) {
    	$form = new Gpf_Rpc_Form($params);
        $fileName = $this->correctFilename($form->getFieldValue('fileName'));
        
        try {
            $this->initAffiliate(Gpf_Session::getAuthUser()->getPapUserId());
        } catch (Gpf_DbEngine_NoRowException $e) {
            return $this->getFormResponse($this->_('Affiliate is not defined'));
        }
        
        $bannerFactory = new Pap_Common_Banner_Factory();
        try {
			$banner = $bannerFactory->getBanner($form->getFieldValue('bannerId'));
			
			$channel = $this->findChannel($form->getFieldValue('channel'));
			if($channel != null) {
				$banner->setChannel($channel);
			}
			
        	$html = $banner->get(Pap_Db_Table_Banners::DATA2);
        } catch (Pap_Common_Banner_NotFound $e) {
        	return $this->getFormResponse($this->_("Banner with id '".$params->get('bannerId')."' doesn't exist"));
        }
        
        $html = $this->decodeBanner($html, $banner, 0);
        $this->generatePDF($html);
        
        return new Pap_Common_Banner_PdfGeneratorResponse($fileName, $this->pdf);
    }
 function __construct(Gpf_Rpc_Params $params)
 {
     $this->methodName = $params->getMethod();
     $this->className = $params->getClass();
     $reflectionClass = new ReflectionClass($this->className);
     $reflectionMethod = $reflectionClass->getMethod($this->methodName);
     if (!$reflectionMethod->isPublic()) {
         throw new Gpf_Exception($this->className . '->' . $this->methodName . '() is not a service method (not public)');
     }
     $this->annotations = new Gpf_Rpc_Annotation($reflectionMethod);
     if (!$this->annotations->hasServiceAnnotation()) {
         throw new Gpf_Exception($this->className . '->' . $this->methodName . '() is not a service method (annotation)');
     }
     $this->initSession($params->getSessionId());
     $this->createInstance();
 }
    /**
     * @anonym
     * @service direct_link read
     */
    public function getAffiliateId(Pap_Contexts_Click $context, Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);

        $context = new Pap_Contexts_Click();
        $context->getRequestObject()->setRequestParameter(
        Pap_Tracking_Request::PARAM_REFERRERURL_NAME,
        $params->get('url'));
        $match = $this->getMatch($context);

        if ($match != null) {
            foreach ($match as $key => $value) {
                $data->setValue($key, $value);
            }
        }
        return $data;
    }