Extract: rename method extract_entries to extract_from_code

The other extract methods are named `extract_from_<something>`, this was
te only one, which wasn't.

Also, it was returning an instance of `Translations`,
not an array of entries, which the name suggested.


git-svn-id: https://develop.svn.wordpress.org/trunk@25920 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Nikolay Bachiyski
2013-10-26 00:54:27 +00:00
parent 54e6261a34
commit 04dd14f3b5
2 changed files with 3 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ class StringExtractor {
function extract_from_file( $file_name, $prefix ) {
$code = file_get_contents( $file_name );
return $this->extract_entries( $code, $prefix . $file_name );
return $this->extract_from_code( $code, $prefix . $file_name );
}
function does_file_name_match( $path, $excludes, $includes ) {
@@ -126,7 +126,7 @@ class StringExtractor {
return $entry;
}
function extract_entries( $code, $file_name ) {
function extract_from_code( $code, $file_name ) {
$translations = new Translations;
$function_calls = $this->find_function_calls( array_keys( $this->rules ), $code );
foreach( $function_calls as $call ) {

View File

@@ -13,7 +13,7 @@ class ExtractTest extends PHPUnit_Framework_TestCase {
function test_with_just_a_string() {
$expected = new Translation_Entry( array( 'singular' => 'baba', 'references' => array('baba.php:1') ) );
$result = $this->extractor->extract_entries('<?php __("baba"); ?>', 'baba.php' );
$result = $this->extractor->extract_from_code('<?php __("baba"); ?>', 'baba.php' );
$this->assertEquals( $expected, $result->entries['baba'] );
}