<commit_before><?php
/**
 * PHP.Gt (http://php.gt)
 * @copyright Copyright Ⓒ 2014 Bright Flair Ltd. (http://brightflair.com)
 * @license Apache Version 2.0, January 2004. http://www.apache.org/licenses
 */
namespace Gt\Request;
use \Gt\Core\Obj;

class Request_Test extends \PHPUnit_Framework_TestCase {

private $uriTypeArray = [
	"/",
	"/index",
	"/index/",
	"/index.html",
	"/index.html/",
	"page",
	"page/",
	"page.html",
	"page.html/",
	"/dir/nested",
	"/dir/nested/",
	"/dir/nested.html",
	"/dir/nested.html/",
];

public function data_uriType() {
	$return = [];

	foreach ($this->uriTypeArray as $uriType) {
		$return [] = [$uriType];
		$return [] = ["/api"		. $uriType];
		$return [] = ["/myapi"		. $uriType];
		$return [] = ["/service"	. $uriType];
	}

	return $return;
}

/**
 * @dataProvider data_uriType
 */
public function testGetType($uri) {
	$ext = pathinfo($uri, PATHINFO_EXTENSION);

	$objArray = [
		new Obj(["api_prefix" => "api"]),
		new Obj(["api_prefix" => "myapi"]),
		new Obj(["api_prefix" => "service"]),
	];

	foreach ($objArray as $obj) {
		$request = new Request($uri, $obj);
		$type = $request->getType();

		if(strpos($uri, "/" . $obj->api_prefix) === 0) {
			$this->assertEquals(Request::TYPE_API, $type);
		}	
		else {
			$this->assertEquals(Request::TYPE_PAGE, $type);
		}
	}
}
<commit_msg>Use ConfigObj instead of Obj<commit_after><?php
/**
 * PHP.Gt (http://php.gt)
 * @copyright Copyright Ⓒ 2014 Bright Flair Ltd. (http://brightflair.com)
 * @license Apache Version 2.0, January 2004. http://www.apache.org/licenses
 */
namespace Gt\Request;
use \Gt\Core\ConfigObj;

class Request_Test extends \PHPUnit_Framework_TestCase {

private $uriTypeArray = [
	"/",
	"/index",
	"/index/",
	"/index.html",
	"/index.html/",
	"page",
	"page/",
	"page.html",
	"page.html/",
	"/dir/nested",
	"/dir/nested/",
	"/dir/nested.html",
	"/dir/nested.html/",
];

public function data_uriType() {
	$return = [];

	foreach ($this->uriTypeArray as $uriType) {
		$return [] = [$uriType];
		$return [] = ["/api"		. $uriType];
		$return [] = ["/myapi"		. $uriType];
		$return [] = ["/service"	. $uriType];
	}

	return $return;
}

/**
 * @dataProvider data_uriType
 */
public function testGetType($uri) {
	$ext = pathinfo($uri, PATHINFO_EXTENSION);

	$objArray = [
		new ConfigObj(["api_prefix" => "api"]),
		new ConfigObj(["api_prefix" => "myapi"]),
		new ConfigObj(["api_prefix" => "service"]),
	];

	foreach ($objArray as $obj) {
		$request = new Request($uri, $obj);
		$type = $request->getType();

		if(strpos($uri, "/" . $obj->api_prefix) === 0) {
			$this->assertEquals(Request::TYPE_API, $type);
		}	
		else {
			$this->assertEquals(Request::TYPE_PAGE, $type);
		}
	}
}

{'fraction_non_alphanumeric': 0.22197392923649906, 'fraction_numerical': 0.00819366852886406, 'mean_word_length': 3.7372134038800704, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2957981', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1037, 'n_words': 198}