public function set_file_attr( $file, $attr, $value, $recursive = false ) {

		$file_atts = $this->get_file( $file );

		if ( false === $file_atts ) {
			return false;
		}

		if ( 'contents' === $attr ) {
			if ( 'file' === $file_atts->type ) {
				$file_atts->size = mb_strlen( $value, '8bit' );
			} else {
				return false;
			}
		}

		if ( true === $recursive ) {
			$this->set_file_attr_recursive( $file_atts, $attr, $value );
		}

		$file_atts->$attr = $value;

		return true;
	}
public function set_file_attr( $file, $attr, $value, $recursive = false ) {

		$file_atts = $this->get_file( $file );

		if ( false === $file_atts ) {
			return false;
		}

		if ( 'contents' === $attr ) {
			if ( 'file' === $file_atts->type ) {
				$file_atts->size = mb_strlen( $value, '8bit' );
			} else {
				return false;
			}
		}

		if ( true === $recursive ) {
			$this->set_file_attr_recursive( $file_atts, $attr, $value );
		}

		$file_atts->$attr = $value;

		return true;
	}
public function set_file_attr ( $ file , $ attr , $ value , $ recursive = false ) { $ file_atts = $ this -> get_file ( $ file ) ; if ( false === $ file_atts ) { return false ; } if ( 'contents' === $ attr ) { if ( 'file' === $ file_atts -> type ) { $ file_atts -> size = mb_strlen ( $ value , '8bit' ) ; } else { return false ; } } if ( true === $ recursive ) { $ this -> set_file_attr_recursive ( $ file_atts , $ attr , $ value ) ; } $ file_atts -> $ attr = $ value ; return true ; }
Set the value of file attribute.

@since 0.1.0

@param string $file      The path of the file/directory.
@param string $attr      The attribute to set.
@param mixed  $value     The new value for this attribute.
@param bool   $recursive Whether to set the value recursively.

@return bool True if the attribute value was set, false otherwise.
Set the value of file attribute .