<commit_before><?php

/**
 * 
 * Description : create api
 * Author : louche
 * Date : 2015427
 */
use Openapi\Lib\Model\ApiCat;
use Openapi\Lib\Model\Api;
use Openapi\Lib\Model\MethodArg;
use Openapi\Lib\Model\ApiParam;
use Openapi\Lib\Model\Acl;
use Openapi\Lib\Model\Openapi\Lib\Model;

class InitApp extends PHPUnit_Framework_TestCase {
	/**
	 * this method use for create api with one string param
	 * create
	 */
	public function doInit() {
		// init app category
		$api_cat_id = 0;
		$apicat = new ApiCat ();
		$apicat->setName ( "MisMeet" );
		
		if ($apicat->create ()) {
			$api_cat_id = $apicat->getId ();
		} else {
			return;
		}
		
		$api_id = 0;
		// init app (set usage name and class)
		$theapi = new Api ();
		$theapi->setApiCatId ( $api_cat_id );
		$theapi->setName ( "mismeet.operate" );		// 
		$theapi->setVersion ( "1.0" );	//
		$theapi->setDeprecated ( 0 );
		$theapi->setSignatureTtl ( 3600 );
		$theapi->setSaveErrorDetail ( 0 );
		$theapi->setServiceProtocol ( "local" );
		$theapi->setServiceClass ( "MisMeet\\Lib\\Service\\MisMeetService" );	//
		$theapi->setServiceMethod ( "operate" );	//
		$theapi->setSessionOption ( "ignore" );
		
		if ($theapi->create ()) {
			$api_id = $theapi->getId();
		} else {
			return;
		}

		$param_id = 0;
		// param for the method
		$apiparam = new ApiParam();
		$apiparam->setApiId($api_id);
		$apiparam->setName("inparam");		//
		$apiparam->setDataType("string");
		$apiparam->setFormElement("Phalcon\\Forms\\Element\\Text");
		$apiparam->setNullable(1);
		$apiparam->setDefaultValue(NULL);
		$apiparam->setSampleValue(NULL);
		
		if ($apiparam->create()){
			$param_id = $apiparam->getId();
		}else{
			return ;
		}
		
		// init method args
		$methodarg = new MethodArg();
		$methodarg->setApiId($api_id);
		$methodarg->setArgIndex(0);
		$methodarg->setIsHashmap(0);
		$methodarg->setArgSrc("api_param");
		$methodarg->setParamId($param_id);
		
		$this->assertFalse($methodarg->create());
	}
}<commit_msg>add more table op<commit_after><?php

/**
 * 
 * Description : create api
 * Author : louche
 * Date : 2015427
 */
use Openapi\Lib\Model\ApiCat;
use Openapi\Lib\Model\Api;
use Openapi\Lib\Model\MethodArg;
use Openapi\Lib\Model\ApiParam;
use Openapi\Lib\Model\Acl;
use Openapi\Lib\Model\Openapi\Lib\Model;

class InitApp extends PHPUnit_Framework_TestCase {
	/**
	 * this method use for create api with one string param
	 * create
	 */
	public function doInit() {
		// init app category
		$api_cat_id = 0;
		$apicat = new ApiCat ();
		$apicat->setName ( "MisMeet" );
		
		if ($apicat->create ()) {
			$api_cat_id = $apicat->getId ();
		} else {
			return;
		}
		
		$api_id = 0;
		// init app (set usage name and class)
		$theapi = new Api ();
		$theapi->setApiCatId ( $api_cat_id );
		$theapi->setName ( "mismeet.operate" );		// 
		$theapi->setVersion ( "1.0" );	//
		$theapi->setDeprecated ( 0 );
		$theapi->setSignatureTtl ( 3600 );
		$theapi->setSaveErrorDetail ( 0 );
		$theapi->setServiceProtocol ( "local" );
		$theapi->setServiceClass ( "MisMeet\\Lib\\Service\\MisMeetService" );	//
		$theapi->setServiceMethod ( "operate" );	//
		$theapi->setSessionOption ( "ignore" );
		
		if ($theapi->create ()) {
			$api_id = $theapi->getId();
		} else {
			return;
		}

		$param_id = 0;
		// param for the method
		$apiparam = new ApiParam();
		$apiparam->setApiId($api_id);
		$apiparam->setName("inparam");		//
		$apiparam->setDataType("string");
		$apiparam->setFormElement("Phalcon\\Forms\\Element\\Text");
		$apiparam->setNullable(1);
		$apiparam->setDefaultValue(NULL);
		$apiparam->setSampleValue(NULL);
		
		if ($apiparam->create()){
			$param_id = $apiparam->getId();
		}else{
			return ;
		}
		
		// init method args
		$methodarg = new MethodArg();
		$methodarg->setApiId($api_id);
		$methodarg->setArgIndex(0);
		$methodarg->setIsHashmap(0);
		$methodarg->setArgSrc("api_param");
		$methodarg->setParamId($param_id);
		
		$this->assertFalse($methodarg->create());
		
		// init acl
		$acl = new Acl();
		$acl->setAppkey(1077586);	// 
		$acl->setApiId($api_id);
		$acl->setIpStart(16843009);
		$acl->setIpEnd(4278124286);
		$acl->setAllow(1);
		
		$this->assertFalse($acl->create());
	}
}
{'fraction_non_alphanumeric': 0.18236424795771264, 'fraction_numerical': 0.016338298894762134, 'mean_word_length': 3.5646929824561404, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 72, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4694001', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1579, 'n_words': 266}