Code Duplication    Length = 13-16 lines in 2 locations

core/Container/Container.php 1 location

@@ 268-283 (lines=16) @@
265
	 * @param string $id Unique id of the container
266
	 * @param string $title Title of the container
267
	 **/
268
	public function __construct( $id, $title = '' ) {
269
		if ( empty( $id ) ) {
270
			Incorrect_Syntax_Exception::raise( 'Empty container id is not supported' );
271
		}
272
273
		if ( empty( $title ) ) {
274
			$title = $id;
275
		}
276
277
		$this->title = $title;
278
		$this->id = preg_replace( '~\W~u', '', remove_accents( $id ) );
279
280
		self::verify_unique_panel_id( $this->id );
281
282
		$this->load_scripts_styles();
283
	}
284
285
	/**
286
	 * Load the admin scripts and styles.

core/Field/Field.php 1 location

@@ 388-400 (lines=13) @@
385
	 *
386
	 * @param string $name Field name, either sanitized or not
387
	 **/
388
	public function set_name( $name ) {
389
		$name = preg_replace( '~\s+~', '_', mb_strtolower( $name ) );
390
391
		if ( empty( $name ) ) {
392
			Incorrect_Syntax_Exception::raise( 'Field name can\'t be empty' );
393
		}
394
395
		if ( $this->name_prefix && strpos( $name, $this->name_prefix ) !== 0 ) {
396
			$name = $this->name_prefix . $name;
397
		}
398
399
		$this->name = $name;
400
	}
401
402
	/**
403
	 * Return the field name