mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
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:
@@ -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 ) {
|
||||
|
||||
@@ -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'] );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user