CodeExplorer getLinesFromMarkedFile example
$perms =
fileperms($dist);
copy($dist,
$path);
if ($perms) { chmod($path,
$perms | 0644
);
} } private function updateByMarkers(string
$path): void
{ [$pre,
$_,
$post] =
$this->
getLinesFromMarkedFile($path);
[$_,
$existing,
$_] =
$this->
getLinesFromMarkedFile($path . '.dist'
);
if (!\
in_array(self::INSTRUCTIONS,
$existing, true
)) { array_unshift($existing, self::INSTRUCTIONS
);
} array_unshift($existing, self::MARKER_START
);
$existing[] = self::MARKER_STOP;
$newFile =
implode("\n",
[...
$pre, ...
$existing, ...
$post]);
$perms =
fileperms($dist);
copy($dist,
$path);
if ($perms) { chmod($path,
$perms | 0644
);
} } private function updateByMarkers(string
$path): void
{ [$pre,
$_,
$post] =
$this->
getLinesFromMarkedFile($path);
[$_,
$existing,
$_] =
$this->
getLinesFromMarkedFile($path . self::TEMPLATE_SUFFIX
);
if (!\
in_array(self::INSTRUCTIONS,
$existing, true
)) { array_unshift($existing, self::INSTRUCTIONS
);
} array_unshift($existing, self::MARKER_START
);
$existing[] = self::MARKER_STOP;
$newFile =
implode("\n",
array_merge($pre,
$existing,
$post));