This method is called a lot (~1000 times each time). It calls
the callback function ~10 times per table, resulting in ~10000
calls of strlen. Which is just not necesarry. The string length does
not change.
Change-Id: I19194f1166da465a1c9ef4b2fb9cdaef4105a6f7
* @return array
*/
public function unprefixFieldNames( array $fieldNames ) {
- return array_map( array( $this, 'unprefixFieldName' ), $fieldNames );
+ $start = strlen( $this->fieldPrefix );
+
+ return array_map( function( $fieldName ) use ( $start ) {
+ return substr( $fieldName, $start );
+ }, $fieldNames );
}
/**