composer.phar 2.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917121918121919121920121921121922121923121924121925121926121927121928121929121930121931121932121933121934121935121936121937121938121939121940121941121942121943121944121945121946121947121948121949121950121951121952121953121954121955121956121957121958121959121960121961121962121963121964121965121966121967121968121969121970121971121972121973121974121975121976121977121978121979121980121981121982121983121984121985121986121987121988121989121990121991121992121993121994121995121996121997121998121999122000122001122002122003122004122005122006122007122008122009122010122011122012122013122014122015122016122017122018122019122020122021122022122023122024122025122026122027122028122029122030122031122032122033122034122035122036122037122038122039122040122041122042122043122044122045122046122047122048122049122050122051122052122053122054122055122056122057122058122059122060122061122062122063122064122065122066122067122068122069122070122071122072122073122074122075122076122077122078122079122080122081122082122083122084122085122086122087122088122089122090122091122092122093122094122095122096122097122098122099122100122101122102122103122104122105122106122107122108122109122110122111122112122113122114122115122116122117122118122119122120122121122122122123122124122125122126122127122128122129122130122131122132122133122134122135122136122137122138122139122140122141122142122143122144122145122146122147122148122149122150122151122152122153122154122155122156122157122158122159122160122161122162122163122164122165122166122167122168122169122170122171122172122173122174122175122176122177122178122179122180122181122182122183122184122185122186122187122188122189122190122191122192122193122194122195122196122197122198122199122200122201122202122203122204122205122206122207122208122209122210122211122212122213122214122215122216122217122218122219122220122221122222122223122224122225122226122227122228122229122230122231122232122233122234122235122236122237122238122239122240122241122242122243122244122245122246122247122248122249122250122251122252122253122254122255122256122257122258122259122260122261122262122263122264122265122266122267122268122269122270122271122272122273122274122275122276122277122278122279122280122281122282122283122284122285122286122287122288122289122290122291122292122293122294122295122296122297122298122299122300122301122302122303122304122305122306122307122308122309122310122311122312122313122314122315122316122317122318122319122320122321122322122323122324122325122326122327122328122329122330122331122332122333122334122335122336122337122338122339122340122341122342122343122344122345122346122347122348122349122350122351122352122353122354122355122356122357122358122359122360122361122362122363122364122365122366122367122368122369122370122371122372122373122374122375122376122377122378122379122380122381122382122383122384122385122386122387122388122389122390122391122392122393122394122395122396122397122398122399122400122401122402122403122404122405122406122407122408122409122410122411122412122413122414122415122416122417122418122419122420122421122422122423122424122425122426122427122428122429122430122431122432122433122434122435122436122437122438122439122440122441122442122443122444122445122446122447122448122449122450122451122452122453122454122455122456122457122458122459122460122461122462122463122464122465122466122467122468122469122470122471122472122473122474122475122476122477122478122479122480122481122482122483122484122485122486122487122488122489122490122491122492122493122494122495122496122497122498122499122500122501122502122503122504122505122506122507122508122509122510122511122512122513122514122515122516122517122518122519122520122521122522122523122524122525122526122527122528122529122530122531122532122533122534122535122536122537122538122539122540122541122542122543122544122545122546122547122548122549122550122551122552122553122554122555122556122557122558122559122560122561122562122563122564122565122566122567122568122569122570122571122572122573122574122575122576122577122578122579122580122581122582122583122584122585122586122587122588122589122590122591122592122593122594122595122596122597122598122599122600122601122602122603122604122605122606122607122608122609122610122611122612122613122614122615122616122617122618122619122620122621122622122623122624122625122626122627122628122629122630122631122632122633122634122635122636122637122638122639122640122641122642122643122644122645122646122647122648122649122650122651122652122653122654122655122656122657122658122659122660122661122662122663122664122665122666122667122668122669122670122671122672122673122674122675122676122677122678122679122680122681122682122683122684122685122686122687122688122689122690122691122692122693122694122695122696122697122698122699122700122701122702122703122704122705122706122707122708122709122710122711122712122713122714122715122716122717122718122719122720122721122722122723122724122725122726122727122728122729122730122731122732122733122734122735122736122737122738122739122740122741122742122743122744122745122746122747122748122749122750122751122752122753122754122755122756122757122758122759122760122761122762122763122764122765122766122767122768122769122770122771122772122773122774122775122776122777122778122779122780122781122782122783122784122785122786122787122788122789122790122791122792122793122794122795122796122797122798122799122800122801122802122803122804122805122806122807122808122809122810122811122812122813122814122815122816122817122818122819122820122821122822122823122824122825122826122827122828122829122830122831122832122833122834122835122836122837122838122839122840122841122842122843122844122845122846122847122848122849122850122851122852122853122854122855122856122857122858122859122860122861122862122863122864122865122866122867122868122869122870122871122872122873122874122875122876122877122878122879122880122881122882122883122884122885122886122887122888122889122890122891122892122893122894122895122896122897122898122899122900122901122902122903122904122905122906122907122908122909122910122911122912122913122914122915122916122917122918122919122920122921122922122923122924122925122926122927122928122929122930122931122932122933122934122935122936122937122938122939122940122941122942122943122944122945122946122947122948122949122950122951122952122953122954122955122956122957122958122959122960122961122962122963122964122965122966122967122968122969122970122971122972122973122974122975122976122977122978122979122980122981122982122983122984122985122986122987122988122989122990122991122992122993122994122995122996122997122998122999123000123001123002123003123004123005123006123007123008123009123010123011123012123013123014123015123016123017123018123019123020123021123022123023123024123025123026123027123028123029123030123031123032123033123034123035123036123037123038123039123040123041123042123043123044123045123046123047123048123049123050123051123052123053123054123055123056123057123058123059123060123061123062123063123064123065123066123067123068123069123070123071123072123073123074123075123076123077123078123079123080123081123082123083123084123085123086123087123088123089123090123091123092123093123094123095123096123097123098123099123100123101123102123103123104123105123106123107123108123109123110123111123112123113123114123115123116123117123118123119123120123121123122123123123124123125123126123127123128123129123130123131123132123133123134123135123136123137123138123139123140123141123142123143123144123145123146123147123148123149123150123151123152123153123154123155123156123157123158123159123160123161123162123163123164123165123166123167123168123169123170123171123172123173123174123175123176123177123178123179123180123181123182123183123184123185123186123187123188123189123190123191123192123193123194123195123196123197123198123199123200123201123202123203123204123205123206123207123208123209123210123211123212123213123214123215123216123217123218123219123220123221123222123223123224123225123226123227123228123229123230123231123232123233123234123235123236123237123238123239123240123241123242123243123244123245123246123247123248123249123250123251123252123253123254123255123256123257123258123259123260123261123262123263123264123265123266123267123268123269123270123271123272123273123274123275123276123277123278123279123280123281123282123283123284123285123286123287123288123289123290123291123292123293123294123295123296123297123298123299123300123301123302123303123304123305123306123307123308123309123310123311123312123313123314123315123316123317123318123319123320123321123322123323123324123325123326123327123328123329123330123331123332123333123334123335123336123337123338123339123340123341123342123343123344123345123346123347123348123349123350123351123352123353123354123355123356123357123358123359123360123361123362123363123364123365123366123367123368123369123370123371123372123373123374123375123376123377123378123379123380123381123382123383123384123385123386123387123388123389123390123391123392123393123394123395123396123397123398123399123400123401123402123403123404123405123406123407123408123409123410123411123412123413123414123415123416123417123418123419123420123421123422123423123424123425123426123427123428123429123430123431123432123433123434123435123436123437123438123439123440123441123442123443123444123445123446123447123448123449123450123451123452123453123454123455123456123457123458123459123460123461123462123463123464123465123466123467123468123469123470123471123472123473123474123475123476123477123478123479123480123481123482123483123484123485123486123487123488123489123490123491123492123493123494123495123496123497123498123499123500123501123502123503123504123505123506123507123508123509123510123511123512123513123514123515123516123517123518123519123520123521123522123523123524123525123526123527123528123529123530123531123532123533123534123535123536123537123538123539123540123541123542123543123544123545123546123547123548123549123550123551123552123553123554123555123556123557123558123559123560123561123562123563123564123565123566123567123568123569123570123571123572123573123574123575123576123577123578123579123580123581123582123583123584123585123586123587123588123589123590123591123592123593123594123595123596123597123598123599123600123601123602123603123604123605123606123607123608123609123610123611123612123613123614123615123616123617123618123619123620123621123622123623123624123625123626123627123628123629123630123631123632123633123634123635123636123637123638123639123640123641123642123643123644123645123646123647123648123649123650123651123652123653123654123655123656123657123658123659123660123661123662123663123664123665123666123667123668123669123670123671123672123673123674123675123676123677123678123679123680123681123682123683123684123685123686123687123688123689123690123691123692123693123694123695123696123697123698123699123700123701123702123703123704123705123706123707123708123709123710123711123712123713123714123715123716123717123718123719123720123721123722123723123724123725123726123727123728123729123730123731123732123733123734123735123736123737123738123739123740123741123742123743123744123745123746123747123748123749123750123751123752123753123754123755123756123757123758123759123760123761123762123763123764123765123766123767123768123769123770123771123772123773123774123775123776123777123778123779123780123781123782123783123784123785123786123787123788123789123790123791123792123793123794123795123796123797123798123799123800123801123802123803123804123805123806123807123808123809123810123811123812123813123814123815123816123817123818123819123820123821123822123823123824123825123826123827123828123829123830123831123832123833123834123835123836123837123838123839123840123841123842123843123844123845123846123847123848123849123850123851123852123853123854123855123856123857123858123859123860123861123862123863123864123865123866123867123868123869123870123871123872123873123874123875123876123877123878123879123880123881123882123883123884123885123886123887123888123889123890123891123892123893123894123895123896123897123898123899123900123901123902123903123904123905123906123907123908123909123910123911123912123913123914123915123916123917123918123919123920123921123922123923123924123925123926123927123928123929123930123931123932123933123934123935123936123937123938123939123940123941123942123943123944123945123946123947123948123949123950123951123952123953123954123955123956123957123958123959123960123961123962123963123964123965123966123967123968123969123970123971123972123973123974123975123976123977123978123979123980123981123982123983123984123985123986123987123988123989123990123991123992123993123994123995123996123997123998123999124000124001124002124003124004124005124006124007124008124009124010124011124012124013124014124015124016124017124018124019124020124021124022124023124024124025124026124027124028124029124030124031124032124033124034124035124036124037124038124039124040124041124042124043124044124045124046124047124048124049124050124051124052124053124054124055124056124057124058124059124060124061124062124063124064124065124066124067124068124069124070124071124072124073124074124075124076124077124078124079124080124081124082124083124084124085124086124087124088124089124090124091124092124093124094124095124096124097124098124099124100124101124102124103124104124105124106124107124108124109124110124111124112124113124114124115124116124117124118124119124120124121124122124123124124124125124126124127124128124129124130124131124132124133124134124135124136124137124138124139124140124141124142124143124144124145124146124147124148124149124150124151124152124153124154124155124156124157124158124159124160124161124162124163124164124165124166124167124168124169124170124171124172124173124174124175124176124177124178124179124180124181124182124183124184124185124186124187124188124189124190124191124192124193124194124195124196124197124198124199124200124201124202124203124204124205124206124207124208124209124210124211124212124213124214124215124216124217124218124219124220124221124222124223124224124225124226124227124228124229124230124231124232124233124234124235124236124237124238124239124240124241124242124243124244124245124246124247124248124249124250124251124252124253124254124255124256124257124258124259124260124261124262124263124264124265124266124267124268124269124270124271124272124273124274124275124276124277124278124279124280124281124282124283124284124285124286124287124288124289124290124291124292124293124294124295124296124297124298124299124300124301124302124303124304124305124306124307124308124309124310124311124312124313124314124315124316124317124318124319124320124321124322124323124324124325124326124327124328124329124330124331124332124333124334124335124336124337124338124339124340124341124342124343124344124345124346124347124348124349124350124351124352124353124354124355124356124357124358124359124360124361124362124363124364124365124366124367124368124369124370124371124372124373124374124375124376124377124378124379124380124381124382124383124384124385124386124387124388124389124390124391124392124393124394124395124396124397124398124399124400124401124402124403124404124405124406124407124408124409124410124411124412124413124414124415124416124417124418124419124420124421124422124423124424124425124426124427124428124429124430124431124432124433124434124435124436124437124438124439124440124441124442124443124444124445124446124447124448124449124450124451124452124453124454124455124456124457124458124459124460124461124462124463124464124465124466124467124468124469124470124471124472124473124474124475124476124477124478124479124480124481124482124483124484124485124486124487124488124489124490124491124492124493124494124495124496124497124498124499124500124501124502124503124504124505124506124507124508124509124510124511124512124513124514124515124516124517124518124519124520124521124522124523124524124525124526124527124528124529124530124531124532124533124534124535124536124537124538124539124540124541124542124543124544124545124546124547124548124549124550124551124552124553124554124555124556124557124558124559124560124561124562124563124564124565124566124567124568124569124570124571124572124573124574124575124576124577124578124579124580124581124582124583124584124585124586124587124588124589124590124591124592124593124594124595124596124597124598124599124600124601124602124603124604124605124606124607124608124609124610124611124612124613124614124615124616124617124618124619124620124621124622124623124624124625124626124627124628124629124630124631124632124633124634124635124636124637124638124639124640124641124642124643124644124645124646124647124648124649124650124651124652124653124654124655124656124657124658124659124660124661124662124663124664124665124666124667124668124669124670124671124672124673124674124675124676124677124678124679124680124681124682124683124684124685124686124687124688124689124690124691124692124693124694124695124696124697124698124699124700124701124702124703124704124705124706124707124708124709124710124711124712124713124714124715124716124717124718124719124720124721124722124723124724124725124726124727124728124729124730124731124732124733124734124735124736124737124738124739124740124741124742124743124744124745124746124747124748124749124750124751124752124753124754124755124756124757124758124759124760124761124762124763124764124765124766124767124768124769124770124771124772124773124774124775124776124777124778124779124780124781124782124783124784124785124786124787124788124789124790124791124792124793124794124795124796124797124798124799124800124801124802124803124804124805124806124807124808124809124810124811124812124813124814124815124816124817124818124819124820124821124822124823124824124825124826124827124828124829124830124831124832124833124834124835124836124837124838124839124840124841124842124843124844124845124846124847124848124849124850124851124852124853124854124855124856124857124858124859124860124861124862124863124864124865124866124867124868124869124870124871124872124873124874124875124876124877124878124879124880124881124882124883124884124885124886124887124888124889124890124891124892124893124894124895124896124897124898124899124900124901124902124903124904124905124906124907124908124909124910124911124912124913124914124915124916124917124918124919124920124921124922124923124924124925124926124927124928124929124930124931124932124933124934124935124936124937124938124939124940124941124942124943124944124945124946124947124948124949124950124951124952124953124954124955124956124957124958124959124960124961124962124963124964124965124966124967124968124969124970124971124972124973124974124975124976124977124978124979124980124981124982124983124984124985124986124987124988124989124990124991124992124993124994124995124996124997124998124999125000125001125002125003125004125005125006125007125008125009125010125011125012125013125014125015125016125017125018125019125020125021125022125023125024125025125026125027125028125029125030125031125032125033125034125035125036125037125038125039125040125041125042125043125044125045125046125047125048125049125050125051125052125053125054125055125056125057125058125059125060125061125062125063125064125065125066125067125068125069125070125071125072125073125074125075125076125077125078125079125080125081125082125083125084125085125086125087125088125089125090125091125092125093125094125095125096125097125098125099125100125101125102125103125104125105125106125107125108125109125110125111125112125113125114125115125116125117125118125119125120125121125122125123125124125125125126125127125128125129125130125131125132125133125134125135125136125137125138125139125140125141125142125143125144125145125146125147125148125149125150125151125152125153125154125155125156125157125158125159125160125161125162125163125164125165125166125167125168125169125170125171125172125173125174125175125176125177125178125179125180125181125182125183125184125185125186125187125188125189125190125191125192125193125194125195125196125197125198125199125200125201125202125203125204125205125206125207125208125209125210125211125212125213125214125215125216125217125218125219125220125221125222125223125224125225125226125227125228125229125230125231125232125233125234125235125236125237125238125239125240125241125242125243125244125245125246125247125248125249125250125251125252125253125254125255125256125257125258125259125260125261125262125263125264125265125266125267125268125269125270125271125272125273125274125275125276125277125278125279125280125281125282125283125284125285125286125287125288125289125290125291125292125293125294125295125296125297125298125299125300125301125302125303125304125305125306125307125308125309125310125311125312125313125314125315125316125317125318125319125320125321125322125323125324125325125326125327125328125329125330125331125332125333125334125335125336125337125338125339125340125341125342125343125344125345125346125347125348125349125350125351125352125353125354125355125356125357125358125359125360125361125362125363125364125365125366125367125368125369125370125371125372125373125374125375125376125377125378125379125380125381125382125383125384125385125386125387125388125389125390125391125392125393125394125395125396125397125398125399125400125401125402125403125404125405125406125407125408125409125410125411125412125413125414125415125416125417125418125419125420125421125422125423125424125425125426125427125428125429125430125431125432125433125434125435125436125437125438125439125440125441125442125443125444125445125446125447125448125449125450125451125452125453125454125455125456125457125458125459125460125461125462125463125464125465125466125467125468125469125470125471125472125473125474125475125476125477125478125479125480125481125482125483125484125485125486125487125488125489125490125491125492125493125494125495125496125497125498125499125500125501125502125503125504125505125506125507125508125509125510125511125512125513125514125515125516125517125518125519125520125521125522125523125524125525125526125527125528125529125530125531125532125533125534125535125536125537125538125539125540125541125542125543125544125545125546125547125548125549125550125551125552125553125554125555125556125557125558125559125560125561125562125563125564125565125566125567125568125569125570125571125572125573125574125575125576125577125578125579125580125581125582125583125584125585125586125587125588125589125590125591125592125593125594125595125596125597125598125599125600125601125602125603125604125605125606125607125608125609125610125611125612125613125614125615125616125617125618125619125620125621125622125623125624125625125626125627125628125629125630125631125632125633125634125635125636125637125638125639125640125641125642125643125644125645125646125647125648125649125650125651125652125653125654125655125656125657125658125659125660125661125662125663125664125665125666125667125668125669125670125671125672125673125674125675125676125677125678125679125680125681125682125683125684125685125686125687125688125689125690125691125692125693125694125695125696125697125698125699125700125701125702125703125704125705125706125707125708125709125710125711125712125713125714125715125716125717125718125719125720125721125722125723125724125725125726125727125728125729125730125731125732125733125734125735125736125737125738125739125740125741125742125743125744125745125746125747125748125749125750125751125752125753125754125755125756125757125758125759125760125761125762125763125764125765125766125767125768125769125770125771125772125773125774125775125776125777125778125779125780125781125782125783125784125785125786125787125788125789125790125791125792125793125794125795125796125797125798125799125800125801125802125803125804125805125806125807125808125809125810125811125812125813125814125815125816125817125818125819125820125821125822125823125824125825125826125827125828125829125830125831125832125833125834125835125836125837125838125839125840125841125842125843125844125845125846125847125848125849125850125851125852125853125854125855125856125857125858125859125860125861125862125863125864125865125866125867125868125869125870125871125872125873125874125875125876125877125878125879125880125881125882125883125884125885125886125887125888125889125890125891125892125893125894125895125896125897125898125899125900125901125902125903125904125905125906125907125908125909125910125911125912125913125914125915125916125917125918125919125920125921125922125923125924125925125926125927125928125929125930125931125932125933125934125935125936125937125938125939125940125941125942125943125944125945125946125947125948125949125950125951125952125953125954125955125956125957125958125959125960125961125962125963125964125965125966125967125968125969125970125971125972125973125974125975125976125977125978125979125980125981125982125983125984125985125986125987125988125989125990125991125992125993125994125995125996125997125998125999126000126001126002126003126004126005126006126007126008126009126010126011126012126013126014126015126016126017126018126019126020126021126022126023126024126025126026126027126028126029126030126031126032126033126034126035126036126037126038126039126040126041126042126043126044126045126046126047126048126049126050126051126052126053126054126055126056126057126058126059126060126061126062126063126064126065126066126067126068126069126070126071126072126073126074126075126076126077126078126079126080126081126082126083126084126085126086126087126088126089126090126091126092126093126094126095126096126097126098126099126100126101126102126103126104126105126106126107126108126109126110126111126112126113126114126115126116126117126118126119126120126121126122126123126124126125126126126127126128126129126130126131126132126133126134126135126136126137126138126139126140126141126142126143126144126145126146126147126148126149126150126151126152126153126154126155126156126157126158126159126160126161126162126163126164126165126166126167126168126169126170126171126172126173126174126175126176126177126178126179126180126181126182126183126184126185126186126187126188126189126190126191126192126193126194126195126196126197126198126199126200126201126202126203126204126205126206126207126208126209126210126211126212126213126214126215126216126217126218126219126220126221126222126223126224126225126226126227126228126229126230126231126232126233126234126235126236126237126238126239126240126241126242126243126244126245126246126247126248126249126250126251126252126253126254126255126256126257126258126259126260126261126262126263126264126265126266126267126268126269126270126271126272126273126274126275126276126277126278126279126280126281126282126283126284126285126286126287126288126289126290126291126292126293126294126295126296126297126298126299126300126301126302126303126304126305126306126307126308126309126310126311126312126313126314126315126316126317126318126319126320126321126322126323126324126325126326126327126328126329126330126331126332126333126334126335126336126337126338126339126340126341126342126343126344126345126346126347126348126349126350126351126352126353126354126355126356126357126358126359126360126361126362126363126364126365126366126367126368126369126370126371126372126373126374126375126376126377126378126379126380126381126382126383126384126385126386126387126388126389126390126391126392126393126394126395126396126397126398126399126400126401126402126403126404126405126406126407126408126409126410126411126412126413126414126415126416126417126418126419126420126421126422126423126424126425126426126427126428126429126430126431126432126433126434126435126436126437126438126439126440126441126442126443126444126445126446126447126448126449126450126451126452126453126454126455126456126457126458126459126460126461126462126463126464126465126466126467126468126469126470126471126472126473126474126475126476126477126478126479126480126481126482126483126484126485126486126487126488126489126490126491126492126493126494126495126496126497126498126499126500126501126502126503126504126505126506126507126508126509126510126511126512126513126514126515126516126517126518126519126520126521126522126523126524126525126526126527126528126529126530126531126532126533126534126535126536126537126538126539126540126541126542126543126544126545126546126547126548126549126550126551126552126553126554126555126556126557126558126559126560126561126562126563126564126565126566126567126568126569126570126571126572126573126574126575126576126577126578126579126580126581126582126583126584126585126586126587126588126589126590126591126592126593126594126595126596126597126598126599126600126601126602126603126604126605126606126607126608126609126610126611126612126613126614126615126616126617126618126619126620126621126622126623126624126625126626126627126628126629126630126631126632126633126634126635126636126637126638126639126640126641126642126643126644126645126646126647126648126649126650126651126652126653126654126655126656126657126658126659126660126661126662126663126664126665126666126667126668126669126670126671126672126673126674126675126676126677126678126679126680126681126682126683126684126685126686126687126688126689126690126691126692126693126694126695126696126697126698126699126700126701126702126703126704126705126706126707126708126709126710126711126712126713126714126715126716126717126718126719126720126721126722126723126724126725126726126727126728126729126730126731126732126733126734126735126736126737126738126739126740126741126742126743126744126745126746126747126748126749126750126751126752126753126754126755126756126757126758126759126760126761126762126763126764126765126766126767126768126769126770126771126772126773126774126775126776126777126778126779126780126781126782126783126784126785126786126787126788126789126790126791126792126793126794126795126796126797126798126799126800126801126802126803126804126805126806126807126808126809126810126811126812126813126814126815126816126817126818126819126820126821126822126823126824126825126826126827126828126829126830126831126832126833126834126835126836126837126838126839126840126841126842126843126844126845126846126847126848126849126850126851126852126853126854126855126856126857126858126859126860126861126862126863126864126865126866126867126868126869126870126871126872126873126874126875126876126877126878126879126880126881126882126883126884126885126886126887126888126889126890126891126892126893126894126895126896126897126898126899126900126901126902126903126904126905126906126907126908126909126910126911126912126913126914126915126916126917126918126919126920126921126922126923126924126925126926126927126928126929126930126931126932126933126934126935126936126937126938126939126940126941126942126943126944126945126946126947126948126949126950126951126952126953126954126955126956126957126958126959126960126961126962126963126964126965126966126967126968126969126970126971126972126973126974126975126976126977126978126979126980126981126982126983126984126985126986126987126988126989126990126991126992126993126994126995126996126997126998126999127000127001127002127003127004127005127006127007127008127009127010127011127012127013127014127015127016127017127018127019127020127021127022127023127024127025127026127027127028127029127030127031127032127033127034127035127036127037127038127039127040127041127042127043127044127045127046127047127048127049127050127051127052127053127054127055127056127057127058127059127060127061127062127063127064127065127066127067127068127069127070127071127072127073127074127075127076127077127078127079127080127081127082127083127084127085127086127087127088127089127090127091127092127093127094127095127096127097127098127099127100127101127102127103127104127105127106127107127108127109127110127111127112127113127114127115127116127117127118127119127120127121127122127123127124127125127126127127127128127129127130127131127132127133127134127135127136127137127138127139127140127141127142127143127144127145127146127147127148127149127150127151127152127153127154127155127156127157127158127159127160127161127162127163127164127165127166127167127168127169127170127171127172127173127174127175127176127177127178127179127180127181127182127183127184127185127186127187127188127189127190127191127192127193127194127195127196127197127198127199127200127201127202127203127204127205127206127207127208127209127210127211127212127213127214127215127216127217127218127219127220127221127222127223127224127225127226127227127228127229127230127231127232127233127234127235127236127237127238127239127240127241127242127243127244127245127246127247127248127249127250127251127252127253127254127255127256127257127258127259127260127261127262127263127264127265127266127267127268127269127270127271127272127273127274127275127276127277127278127279127280127281127282127283127284127285127286127287127288127289127290127291127292127293127294127295127296127297127298127299127300127301127302127303127304127305127306127307127308127309127310127311127312127313127314127315127316127317127318127319127320127321127322127323127324127325127326127327127328127329127330127331127332127333127334127335127336127337127338127339127340127341127342127343127344127345127346127347127348127349127350127351127352127353127354127355127356127357127358127359127360127361127362127363127364127365127366127367127368127369127370127371127372127373127374127375127376127377127378127379127380127381127382127383127384127385127386127387127388127389127390127391127392127393127394127395127396127397127398127399127400127401127402127403127404127405127406127407127408127409127410127411127412127413127414127415127416127417127418127419127420127421127422127423127424127425127426127427127428127429127430127431127432127433127434127435127436127437127438127439127440127441127442127443127444127445127446127447127448127449127450127451127452127453127454127455127456127457127458127459127460127461127462127463127464127465127466127467127468127469127470127471127472127473127474127475127476127477127478127479127480127481127482127483127484127485127486127487127488127489127490127491127492127493127494127495127496127497127498127499127500127501127502127503127504127505127506127507127508127509127510127511127512127513127514127515127516127517127518127519127520127521127522127523127524127525127526127527127528127529127530127531127532127533127534127535127536127537127538127539127540127541127542127543127544127545127546127547127548127549127550127551127552127553127554127555127556127557127558127559127560127561127562127563127564127565127566127567127568127569127570127571127572127573127574127575127576127577127578127579127580127581127582127583127584127585127586127587127588127589127590127591127592127593127594127595127596127597127598127599127600127601127602127603127604127605127606127607127608127609127610127611127612127613127614127615127616127617127618127619127620127621127622127623127624127625127626127627127628127629127630127631127632127633127634127635127636127637127638127639127640127641127642127643127644127645127646127647127648127649127650127651127652127653127654127655127656127657127658127659127660127661127662127663127664127665127666127667127668127669127670127671127672127673127674127675127676127677127678127679127680127681127682127683127684127685127686127687127688127689127690127691127692127693127694127695127696127697127698127699127700127701127702127703127704127705127706127707127708127709127710127711127712127713127714127715127716127717127718127719127720127721127722127723127724127725127726127727127728127729127730127731127732127733127734127735127736127737127738127739127740127741127742127743127744127745127746127747127748127749127750127751127752127753127754127755127756127757127758127759127760127761127762127763127764127765127766127767127768127769127770127771127772127773127774127775127776127777127778127779127780127781127782127783127784127785127786127787127788127789127790127791127792127793127794127795127796127797127798127799127800127801127802127803127804127805127806127807127808127809127810127811127812127813127814127815127816127817127818127819127820127821127822127823127824127825127826127827127828127829127830127831127832127833127834127835127836127837127838127839127840127841127842127843127844127845127846127847127848127849127850127851127852127853127854127855127856127857127858127859127860127861127862127863127864127865127866127867127868127869127870127871127872127873127874127875127876127877127878127879127880127881127882127883127884127885127886127887127888127889127890127891127892127893127894127895127896127897127898127899127900127901127902127903127904127905127906127907127908127909127910127911127912127913127914127915127916127917127918127919127920127921127922127923127924127925127926127927127928127929127930127931127932127933127934127935127936127937127938127939127940127941127942127943127944127945127946127947127948127949127950127951127952127953127954127955127956127957127958127959127960127961127962127963127964127965127966127967127968127969127970127971127972127973127974127975127976127977127978127979127980127981127982127983127984127985127986127987127988127989127990127991127992127993127994127995127996127997127998127999128000128001128002128003128004128005128006128007128008128009128010128011128012128013128014128015128016128017128018128019128020128021128022128023128024128025128026128027128028128029128030128031128032128033128034128035128036128037128038128039128040128041128042128043128044128045128046128047128048128049128050128051128052128053128054128055128056128057128058128059128060128061128062128063128064128065128066128067128068128069128070128071128072128073128074128075128076128077128078128079128080128081128082128083128084128085128086128087128088128089128090128091128092128093128094128095128096128097128098128099128100128101128102128103128104128105128106128107128108128109128110128111128112128113128114128115128116128117128118128119128120128121128122128123128124128125128126128127128128128129128130128131128132128133128134128135128136128137128138128139128140128141128142128143128144128145128146128147128148128149128150128151128152128153128154128155128156128157128158128159128160128161128162128163128164128165128166128167128168128169128170128171128172128173128174128175128176128177128178128179128180128181128182128183128184128185128186128187128188128189128190128191128192128193128194128195128196128197128198128199128200128201128202128203128204128205128206128207128208128209128210128211128212128213128214128215128216128217128218128219128220128221128222128223128224128225128226128227128228128229128230128231128232128233128234128235128236128237128238128239128240128241128242128243128244128245128246128247128248128249128250128251128252128253128254128255128256128257128258128259128260128261128262128263128264128265128266128267128268128269128270128271128272128273128274128275128276128277128278128279128280128281128282128283128284128285128286128287128288128289128290128291128292128293128294128295128296128297128298128299128300128301128302128303128304128305128306128307128308128309128310128311128312128313128314128315128316128317128318128319128320128321128322128323128324128325128326128327128328128329128330128331128332128333128334128335128336128337128338128339128340128341128342128343128344128345128346128347128348128349128350128351128352128353128354128355128356128357128358128359128360128361128362128363128364128365128366128367128368128369128370128371128372128373128374128375128376128377128378128379128380128381128382128383128384128385128386128387128388128389128390128391128392128393128394128395128396128397128398128399128400128401128402128403128404128405128406128407128408128409128410128411128412128413128414128415128416128417128418128419128420128421128422128423128424128425128426128427128428128429128430128431128432128433128434128435128436128437128438128439128440128441128442128443128444128445128446128447128448128449128450128451128452128453128454128455128456128457128458128459128460128461128462128463128464128465128466128467128468128469128470128471128472128473128474128475128476128477128478128479128480128481128482128483128484128485128486128487128488128489128490128491128492128493128494128495128496128497128498128499128500128501128502128503128504128505128506128507128508128509128510128511128512128513128514128515128516128517128518128519128520128521128522128523128524128525128526128527128528128529128530128531128532128533128534128535128536128537128538128539128540128541128542128543128544128545128546128547128548128549128550128551128552128553128554128555128556128557128558128559128560128561128562128563128564128565128566128567128568128569128570128571128572128573128574128575128576128577128578128579128580128581128582128583128584128585128586128587128588128589128590128591128592128593128594128595128596128597128598128599128600128601128602128603128604128605128606128607128608128609128610128611128612128613128614128615128616128617128618128619128620128621128622128623128624128625128626128627128628128629128630128631128632128633128634128635128636128637128638128639128640128641128642128643128644128645128646128647128648128649128650128651128652128653128654128655128656128657128658128659128660128661128662128663128664128665128666128667128668128669128670128671128672128673128674128675128676128677128678128679128680128681128682128683128684128685128686128687128688128689128690128691128692128693128694128695128696128697128698128699128700128701128702128703128704128705128706128707128708128709128710128711128712128713128714128715128716128717128718128719128720128721128722128723128724128725128726128727128728128729128730128731128732128733128734128735128736128737128738128739128740128741128742128743128744128745128746128747128748128749128750128751128752128753128754128755128756128757128758128759128760128761128762128763128764128765128766128767128768128769128770128771128772128773128774128775128776128777128778128779128780128781128782128783128784128785128786128787128788128789128790128791128792128793128794128795128796128797128798128799128800128801128802128803128804128805128806128807128808128809128810128811128812128813128814128815128816128817128818128819128820128821128822128823128824128825128826128827128828128829128830128831128832128833128834128835128836128837128838128839128840128841128842128843128844128845128846128847128848128849128850128851128852128853128854128855128856128857128858128859128860128861128862128863128864128865128866128867128868128869128870128871128872128873128874128875128876128877128878128879128880128881128882128883128884128885128886128887128888128889128890128891128892128893128894128895128896128897128898128899128900128901128902128903128904128905128906128907128908128909128910128911128912128913128914128915128916128917128918128919128920128921128922128923128924128925128926128927128928128929128930128931128932128933128934128935128936128937128938128939128940128941128942128943128944128945128946128947128948128949128950128951128952128953128954128955128956128957128958128959128960128961128962128963128964128965128966128967128968128969128970128971128972128973128974128975128976128977128978128979128980128981128982128983128984128985128986128987128988128989128990128991128992128993128994128995128996128997128998128999129000129001129002129003129004129005129006129007129008129009129010129011129012129013129014129015129016129017129018129019129020129021129022129023129024129025129026129027129028129029129030129031129032129033129034129035129036129037129038129039129040129041129042129043129044129045129046129047129048129049129050129051129052129053129054129055129056129057129058129059129060129061129062129063129064129065129066129067129068129069129070129071129072129073129074129075129076129077129078129079129080129081129082129083129084129085129086129087129088129089129090129091129092129093129094129095129096129097129098129099129100129101129102129103129104129105129106129107129108129109129110129111129112129113129114129115129116129117129118129119129120129121129122129123129124129125129126129127129128129129129130129131129132129133129134129135129136129137129138129139129140129141129142129143129144129145129146129147129148129149129150129151129152129153129154129155129156129157129158129159129160129161129162129163129164129165129166129167129168129169129170129171129172129173129174129175129176129177129178129179129180129181129182129183129184129185129186129187129188129189129190129191129192129193129194129195129196129197129198129199129200129201129202129203129204129205129206129207129208129209129210129211129212129213129214129215129216129217129218129219129220129221129222129223129224129225129226129227129228129229129230129231129232129233129234129235129236129237129238129239129240129241129242129243129244129245129246129247129248129249129250129251129252129253129254129255129256129257129258129259129260129261129262129263129264129265129266129267129268129269129270129271129272129273129274129275129276129277129278129279129280129281129282129283129284129285129286129287129288129289129290129291129292129293129294129295129296129297129298129299129300129301129302129303129304129305129306129307129308129309129310129311129312129313129314129315129316129317129318129319129320129321129322129323129324129325129326129327129328129329129330129331129332129333129334129335129336129337129338129339129340129341129342129343129344129345129346129347129348129349129350129351129352129353129354129355129356129357129358129359129360129361129362129363129364129365129366129367129368129369129370129371129372129373129374129375129376129377129378129379129380129381129382129383129384129385129386129387129388129389129390129391129392129393129394129395129396129397129398129399129400129401129402129403129404129405129406129407129408129409129410129411129412129413129414129415129416129417129418129419129420129421129422129423129424129425129426129427129428129429129430129431129432129433129434129435129436129437129438129439129440129441129442129443129444129445129446129447129448129449129450129451129452129453129454129455129456129457129458129459129460129461129462129463129464129465129466129467129468129469129470129471129472129473129474129475129476129477129478129479129480129481129482129483129484129485129486129487129488129489129490129491129492129493129494129495129496129497129498129499129500129501129502129503129504129505129506129507129508129509129510129511129512129513129514129515129516129517129518129519129520129521129522129523129524129525129526129527129528129529129530129531129532129533129534129535129536129537129538129539129540129541129542129543129544129545129546129547129548129549129550129551129552129553129554129555129556129557129558129559129560129561129562129563129564129565129566129567129568129569129570129571129572129573129574129575129576129577129578129579129580129581129582129583129584129585129586129587129588129589129590129591129592129593129594129595129596129597129598129599129600129601129602129603129604129605129606129607129608129609129610129611129612129613129614129615129616129617129618129619129620129621129622129623129624129625129626129627129628129629129630129631129632129633129634129635129636129637129638129639129640129641129642129643129644129645129646129647129648129649129650129651129652129653129654129655129656129657129658129659129660129661129662129663129664129665129666129667129668129669129670129671129672129673129674129675129676129677129678129679129680129681129682129683129684129685129686129687129688129689129690129691129692129693129694129695129696129697129698129699129700129701129702129703129704129705129706129707129708129709129710129711129712129713129714129715129716129717129718129719129720129721129722129723129724129725129726129727129728129729129730129731129732129733129734129735129736129737129738129739129740129741129742129743129744129745129746129747129748129749129750129751129752129753129754129755129756129757129758129759129760129761129762129763129764129765129766129767129768129769129770129771129772129773129774129775129776129777129778129779129780129781129782129783129784129785129786129787129788129789129790129791129792129793129794129795129796129797129798129799129800129801129802129803129804129805129806129807129808129809129810129811129812129813129814129815129816129817129818129819129820129821129822129823129824129825129826129827129828129829129830129831129832129833129834129835129836129837129838129839129840129841129842129843129844129845129846129847129848129849129850129851129852129853129854129855129856129857129858129859129860129861129862129863129864129865129866129867129868129869129870129871129872129873129874129875129876129877129878129879129880129881129882129883129884129885129886129887129888129889129890129891129892129893129894129895129896129897129898129899129900129901129902129903129904129905129906129907129908129909129910129911129912129913129914129915129916129917129918129919129920129921129922129923129924129925129926129927129928129929129930129931129932129933129934129935129936129937129938129939129940129941129942129943129944129945129946129947129948129949129950129951129952129953129954129955129956129957129958129959129960129961129962129963129964129965129966129967129968129969129970129971129972129973129974129975129976129977129978129979129980129981129982129983129984129985129986129987129988129989129990129991129992129993129994129995129996129997129998129999130000130001130002130003130004130005130006130007130008130009130010130011130012130013130014130015130016130017130018130019130020130021130022130023130024130025130026130027130028130029130030130031130032130033130034130035130036130037130038130039130040130041130042130043130044130045130046130047130048130049130050130051130052130053130054130055130056130057130058130059130060130061130062130063130064130065130066130067130068130069130070130071130072130073130074130075130076130077130078130079130080130081130082130083130084130085130086130087130088130089130090130091130092130093130094130095130096130097130098130099130100130101130102130103130104130105130106130107130108130109130110130111130112130113130114130115130116130117130118130119130120130121130122130123130124130125130126130127130128130129130130130131130132130133130134130135130136130137130138130139130140130141130142130143130144130145130146130147130148130149130150130151130152130153130154130155130156130157130158130159130160130161130162130163130164130165130166130167130168130169130170130171130172130173130174130175130176130177130178130179130180130181130182130183130184130185130186130187130188130189130190130191130192130193130194130195130196130197130198130199130200130201130202130203130204130205130206130207130208130209130210130211130212130213130214130215130216130217130218130219130220130221130222130223130224130225130226130227130228130229130230130231130232130233130234130235130236130237130238130239130240130241130242130243130244130245130246130247130248130249130250130251130252130253130254130255130256130257130258130259130260130261130262130263130264130265130266130267130268130269130270130271130272130273130274130275130276130277130278130279130280130281130282130283130284130285130286130287130288130289130290130291130292130293130294130295130296130297130298130299130300130301130302130303130304130305130306130307130308130309130310130311130312130313130314130315130316130317130318130319130320130321130322130323130324130325130326130327130328130329130330130331130332130333130334130335130336130337130338130339130340130341130342130343130344130345130346130347130348130349130350130351130352130353130354130355130356130357130358130359130360130361130362130363130364130365130366130367130368130369130370130371130372130373130374130375130376130377130378130379130380130381130382130383130384130385130386130387130388130389130390130391130392130393130394130395130396130397130398130399130400130401130402130403130404130405130406130407130408130409130410130411130412130413130414130415130416130417130418130419130420130421130422130423130424130425130426130427130428130429130430130431130432130433130434130435130436130437130438130439130440130441130442130443130444130445130446130447130448130449130450130451130452130453130454130455130456130457130458130459130460130461130462130463130464130465130466130467130468130469130470130471130472130473130474130475130476130477130478130479130480130481130482130483130484130485130486130487130488130489130490130491130492130493130494130495130496130497130498130499130500130501130502130503130504130505130506130507130508130509130510130511130512130513130514130515130516130517130518130519130520130521130522130523130524130525130526130527130528130529130530130531130532130533130534130535130536130537130538130539130540130541130542130543130544130545130546130547130548130549130550130551130552130553130554130555130556130557130558130559130560130561130562130563130564130565130566130567130568130569130570130571130572130573130574130575130576130577130578130579130580130581130582130583130584130585130586130587130588130589130590130591130592130593130594130595130596130597130598130599130600130601130602130603130604130605130606130607130608130609130610130611130612130613130614130615130616130617130618130619130620130621130622130623130624130625130626130627130628130629130630130631130632130633130634130635130636130637130638130639130640130641130642130643130644130645130646130647130648130649130650130651130652130653130654130655130656130657130658130659130660130661130662130663130664130665130666130667130668130669130670130671130672130673130674130675130676130677130678130679130680130681130682130683130684130685130686130687130688130689130690130691130692130693130694130695130696130697130698130699130700130701130702130703130704130705130706130707130708130709130710130711130712130713130714130715130716130717130718130719130720130721130722130723130724130725130726130727130728130729130730130731130732130733130734130735130736130737130738130739130740130741130742130743130744130745130746130747130748130749130750130751130752130753130754130755130756130757130758130759130760130761130762130763130764130765130766130767130768130769130770130771130772130773130774130775130776130777130778130779130780130781130782130783130784130785130786130787130788130789130790130791130792130793130794130795130796130797130798130799130800130801130802130803130804130805130806130807130808130809130810130811130812130813130814130815130816130817130818130819130820130821130822130823130824130825130826130827130828130829130830130831130832130833130834130835130836130837130838130839130840130841130842130843130844130845130846130847130848130849130850130851130852130853130854130855130856130857130858130859130860130861130862130863130864130865130866130867130868130869130870130871130872130873130874130875130876130877130878130879130880130881130882130883130884130885130886130887130888130889130890130891130892130893130894130895130896130897130898130899130900130901130902130903130904130905130906130907130908130909130910130911130912130913130914130915130916130917130918130919130920130921130922130923130924130925130926130927130928130929130930130931130932130933130934130935130936130937130938130939130940130941130942130943130944130945130946130947130948130949130950130951130952130953130954130955130956130957130958130959130960130961130962130963130964130965130966130967130968130969130970130971130972130973130974130975130976130977130978130979130980130981130982130983130984130985130986130987130988130989130990130991130992130993130994130995130996130997130998130999131000131001131002131003131004131005131006131007131008131009131010131011131012131013131014131015131016131017131018131019131020131021131022131023131024131025131026131027131028131029131030131031131032131033131034131035131036131037131038131039131040131041131042131043131044131045131046131047131048131049131050131051131052131053131054131055131056131057131058131059131060131061131062131063131064131065131066131067131068131069131070131071131072131073131074131075131076131077131078131079131080131081131082131083131084131085131086131087131088131089131090131091131092131093131094131095131096131097131098131099131100131101131102131103131104131105131106131107131108131109131110131111131112131113131114131115131116131117131118131119131120131121131122131123131124131125131126131127131128131129131130131131131132131133131134131135131136131137131138131139131140131141131142131143131144131145131146131147131148131149131150131151131152131153131154131155131156131157131158131159131160131161131162131163131164131165131166131167131168131169131170131171131172131173131174131175131176131177131178131179131180131181131182131183131184131185131186131187131188131189131190131191131192131193131194131195131196131197131198131199131200131201131202131203131204131205131206131207131208131209131210131211131212131213131214131215131216131217131218131219131220131221131222131223131224131225131226131227131228131229131230131231131232131233131234131235131236131237131238131239131240131241131242131243131244131245131246131247131248131249131250131251131252131253131254131255131256131257131258131259131260131261131262131263131264131265131266131267131268131269131270131271131272131273131274131275131276131277131278131279131280131281131282131283131284131285131286131287131288131289131290131291131292131293131294131295131296131297131298131299131300131301131302131303131304131305131306131307131308131309131310131311131312131313131314131315131316131317131318131319131320131321131322131323131324131325131326131327131328131329131330131331131332131333131334131335131336131337131338131339131340131341131342131343131344131345131346131347131348131349131350131351131352131353131354131355131356131357131358131359131360131361131362131363131364131365131366131367131368131369131370131371131372131373131374131375131376131377131378131379131380131381131382131383131384131385131386131387131388131389131390131391131392131393131394131395131396131397131398131399131400131401131402131403131404131405131406131407131408131409131410131411131412131413131414131415131416131417131418131419131420131421131422131423131424131425131426131427131428131429131430131431131432131433131434131435131436131437131438131439131440131441131442131443131444131445131446131447131448131449131450131451131452131453131454131455131456131457131458131459131460131461131462131463131464131465131466131467131468131469131470131471131472131473131474131475131476131477131478131479131480131481131482131483131484131485131486131487131488131489131490131491131492131493131494131495131496131497131498131499131500131501131502131503131504131505131506131507131508131509131510131511131512131513131514131515131516131517131518131519131520131521131522131523131524131525131526131527131528131529131530131531131532131533131534131535131536131537131538131539131540131541131542131543131544131545131546131547131548131549131550131551131552131553131554131555131556131557131558131559131560131561131562131563131564131565131566131567131568131569131570131571131572131573131574131575131576131577131578131579131580131581131582131583131584131585131586131587131588131589131590131591131592131593131594131595131596131597131598131599131600131601131602131603131604131605131606131607131608131609131610131611131612131613131614131615131616131617131618131619131620131621131622131623131624131625131626131627131628131629131630131631131632131633131634131635131636131637131638131639131640131641131642131643131644131645131646131647131648131649131650131651131652131653131654131655131656131657131658131659131660131661131662131663131664131665131666131667131668131669131670131671131672131673131674131675131676131677131678131679131680131681131682131683131684131685131686131687131688131689131690131691131692131693131694131695131696131697131698131699131700131701131702131703131704131705131706131707131708131709131710131711131712131713131714131715131716131717131718131719131720131721131722131723131724131725131726131727131728131729131730131731131732131733131734131735131736131737131738131739131740131741131742131743131744131745131746131747131748131749131750131751131752131753131754131755131756131757131758131759131760131761131762131763131764131765131766131767131768131769131770131771131772131773131774131775131776131777131778131779131780131781131782131783131784131785131786131787131788131789131790131791131792131793131794131795131796131797131798131799131800131801131802131803131804131805131806131807131808131809131810131811131812131813131814131815131816131817131818131819131820131821131822131823131824131825131826131827131828131829131830131831131832131833131834131835131836131837131838131839131840131841131842131843131844131845131846131847131848131849131850131851131852131853131854131855131856131857131858131859131860131861131862131863131864131865131866131867131868131869131870131871131872131873131874131875131876131877131878131879131880131881131882131883131884131885131886131887131888131889131890131891131892131893131894131895131896131897131898131899131900131901131902131903131904131905131906131907131908131909131910131911131912131913131914131915131916131917131918131919131920131921131922131923131924131925131926131927131928131929131930131931131932131933131934131935131936131937131938131939131940131941131942131943131944131945131946131947131948131949131950131951131952131953131954131955131956131957131958131959131960131961131962131963131964131965131966131967131968131969131970131971131972131973131974131975131976131977131978131979131980131981131982131983131984131985131986131987131988131989131990131991131992131993131994131995131996131997131998131999132000132001132002132003132004132005132006132007132008132009132010132011132012132013132014132015132016132017132018132019132020132021132022132023132024132025132026132027132028132029132030132031132032132033132034132035132036132037132038132039132040132041132042132043132044132045132046132047132048132049132050132051132052132053132054132055132056132057132058132059132060132061132062132063132064132065132066132067132068132069132070132071132072132073132074132075132076132077132078132079132080132081132082132083132084132085132086132087132088132089132090132091132092132093132094132095132096132097132098132099132100132101132102132103132104132105132106132107132108132109132110132111132112132113132114132115132116132117132118132119132120132121132122132123132124132125132126132127132128132129132130132131132132132133132134132135132136132137132138132139132140132141132142132143132144132145132146132147132148132149132150132151132152132153132154132155132156132157132158132159132160132161132162132163132164132165132166132167132168132169132170132171132172132173132174132175132176132177132178132179132180132181132182132183132184132185132186132187132188132189132190132191132192132193132194132195132196132197132198132199132200132201132202132203132204132205132206132207132208132209132210132211132212132213132214132215132216132217132218132219132220132221132222132223132224132225132226132227132228132229132230132231132232132233132234132235132236132237132238132239132240132241132242132243132244132245132246132247132248132249132250132251132252132253132254132255132256132257132258132259132260132261132262132263132264132265132266132267132268132269132270132271132272132273132274132275132276132277132278132279132280132281132282132283132284132285132286132287132288132289132290132291132292132293132294132295132296132297132298132299132300132301132302132303132304132305132306132307132308132309132310132311132312132313132314132315132316132317132318132319132320132321132322132323132324132325132326132327132328132329132330132331132332132333132334132335132336132337132338132339132340132341132342132343132344132345132346132347132348132349132350132351132352132353132354132355132356132357132358132359132360132361132362132363132364132365132366132367132368132369132370132371132372132373132374132375132376132377132378132379132380132381132382132383132384132385132386132387132388132389132390132391132392132393132394132395132396132397132398132399132400132401132402132403132404132405132406132407132408132409132410132411132412132413132414132415132416132417132418132419132420132421132422132423132424132425132426132427132428132429132430132431132432132433132434132435132436132437132438132439132440132441132442132443132444132445132446132447132448132449132450132451132452132453132454132455132456132457132458132459132460132461132462132463132464132465132466132467132468132469132470132471132472132473132474132475132476132477132478132479132480132481132482132483132484132485132486132487132488132489132490132491132492132493132494132495132496132497132498132499132500132501132502132503132504132505132506132507132508132509132510132511132512132513132514132515132516132517132518132519132520132521132522132523132524132525132526132527132528132529132530132531132532132533132534132535132536132537132538132539132540132541132542132543132544132545132546132547132548132549132550132551132552132553132554132555132556132557132558132559132560132561132562132563132564132565132566132567132568132569132570132571132572132573132574132575132576132577132578132579132580132581132582132583132584132585132586132587132588132589132590132591132592132593132594132595132596132597132598132599132600132601132602132603132604132605132606132607132608132609132610132611132612132613132614132615132616132617132618132619132620132621132622132623132624132625132626132627132628132629132630132631132632132633132634132635132636132637132638132639132640132641132642132643132644132645132646132647132648132649132650132651132652132653132654132655132656132657132658132659132660132661132662132663132664132665132666132667132668132669132670132671132672132673132674132675132676132677132678132679132680132681132682132683132684132685132686132687132688132689132690132691132692132693132694132695132696132697132698132699132700132701132702132703132704132705132706132707132708132709132710132711132712132713132714132715132716132717132718132719132720132721132722132723132724132725132726132727132728132729132730132731132732132733132734132735132736132737132738132739132740132741132742132743132744132745132746132747132748132749132750132751132752132753132754132755132756132757132758132759132760132761132762132763132764132765132766132767132768132769132770132771132772132773132774132775132776132777132778132779132780132781132782132783132784132785132786132787132788132789132790132791132792132793132794132795132796132797132798132799132800132801132802132803132804132805132806132807132808132809132810132811132812132813132814132815132816132817132818132819132820132821132822132823132824132825132826132827132828132829132830132831132832132833132834132835132836132837132838132839132840132841132842132843132844132845132846132847132848132849132850132851132852132853132854132855132856132857132858132859132860132861132862132863132864132865132866132867132868132869132870132871132872132873132874132875132876132877132878132879132880132881132882132883132884132885132886132887132888132889132890132891132892132893132894132895132896132897132898132899132900132901132902132903132904132905132906132907132908132909132910132911132912132913132914132915132916132917132918132919132920132921132922132923132924132925132926132927132928132929132930132931132932132933132934132935132936132937132938132939132940132941132942132943132944132945132946132947132948132949132950132951132952132953132954132955132956132957132958132959132960132961132962132963132964132965132966132967132968132969132970132971132972132973132974132975132976132977132978132979132980132981132982132983132984132985132986132987132988132989132990132991132992132993132994132995132996132997132998132999133000133001133002133003133004133005133006133007133008133009133010133011133012133013133014133015133016133017133018133019133020133021133022133023133024133025133026133027133028133029133030133031133032133033133034133035133036133037133038133039133040133041133042133043133044133045133046133047133048133049133050133051133052133053133054133055133056133057133058133059133060133061133062133063133064133065133066133067133068133069133070133071133072133073133074133075133076133077133078133079133080133081133082133083133084133085133086133087133088133089133090133091133092133093133094133095133096133097133098133099133100133101133102133103133104133105133106133107133108133109133110133111133112133113133114133115133116133117133118133119133120133121133122133123133124133125133126133127133128133129133130133131133132133133133134133135133136133137133138133139133140133141133142133143133144133145133146133147133148133149133150133151133152133153133154133155133156133157133158133159133160133161133162133163133164133165133166133167133168133169133170133171133172133173133174133175133176133177133178133179133180133181133182133183133184133185133186133187133188133189133190133191133192133193133194133195133196133197133198133199133200133201133202133203133204133205133206133207133208133209133210133211133212133213133214133215133216133217133218133219133220133221133222133223133224133225133226133227133228133229133230133231133232133233133234133235133236133237133238133239133240133241133242133243133244133245133246133247133248133249133250133251133252133253133254133255133256133257133258133259133260133261133262133263133264133265133266133267133268133269133270133271133272133273133274133275133276133277133278133279133280133281133282133283133284133285133286133287133288133289133290133291133292133293133294133295133296133297133298133299133300133301133302133303133304133305133306133307133308133309133310133311133312133313133314133315133316133317133318133319133320133321133322133323133324133325133326133327133328133329133330133331133332133333133334133335133336133337133338133339133340133341133342133343133344133345133346133347133348133349133350133351133352133353133354133355133356133357133358133359133360133361133362133363133364133365133366133367133368133369133370133371133372133373133374133375133376133377133378133379133380133381133382133383133384133385133386133387133388133389133390133391133392133393133394133395133396133397133398133399133400133401133402133403133404133405133406133407133408133409133410133411133412133413133414133415133416133417133418133419133420133421133422133423133424133425133426133427133428133429133430133431133432133433133434133435133436133437133438133439133440133441133442133443133444133445133446133447133448133449133450133451133452133453133454133455133456133457133458133459133460133461133462133463133464133465133466133467133468133469133470133471133472133473133474133475133476133477133478133479133480133481133482133483133484133485133486133487133488133489133490133491133492133493133494133495133496133497133498133499133500133501133502133503133504133505133506133507133508133509133510133511133512133513133514133515133516133517133518133519133520133521133522133523133524133525133526133527133528133529133530133531133532133533133534133535133536133537133538133539133540133541133542133543133544133545133546133547133548133549133550133551133552133553133554133555133556133557133558133559133560133561133562133563133564133565133566133567133568133569133570133571133572133573133574133575133576133577133578133579133580133581133582133583133584133585133586133587133588133589133590133591133592133593133594133595133596133597133598133599133600133601133602133603133604133605133606133607133608133609133610133611133612133613133614133615133616133617133618133619133620133621133622133623133624133625133626133627133628133629133630133631133632133633133634133635133636133637133638133639133640133641133642133643133644133645133646133647133648133649133650133651133652133653133654133655133656133657133658133659133660133661133662133663133664133665133666133667133668133669133670133671133672133673133674133675133676133677133678133679133680133681133682133683133684133685133686133687133688133689133690133691133692133693133694133695133696133697133698133699133700133701133702133703133704133705133706133707133708133709133710133711133712133713133714133715133716133717133718133719133720133721133722133723133724133725133726133727133728133729133730133731133732133733133734133735133736133737133738133739133740133741133742133743133744133745133746133747133748133749133750133751133752133753133754133755133756133757133758133759133760133761133762133763133764133765133766133767133768133769133770133771133772133773133774133775133776133777133778133779133780133781133782133783133784133785133786133787133788133789133790133791133792133793133794133795133796133797133798133799133800133801133802133803133804133805133806133807133808133809133810133811133812133813133814133815133816133817133818133819133820133821133822133823133824133825133826133827133828133829133830133831133832133833133834133835133836133837133838133839133840133841133842133843133844133845133846133847133848133849133850133851133852133853133854133855133856133857133858133859133860133861133862133863133864133865133866133867133868133869133870133871133872133873133874133875133876133877133878133879133880133881133882133883133884133885133886133887133888133889133890133891133892133893133894133895133896133897133898133899133900133901133902133903133904133905133906133907133908133909133910133911133912133913133914133915133916133917133918133919133920133921133922133923133924133925133926133927133928133929133930133931133932133933133934133935133936133937133938133939133940133941133942133943133944133945133946133947133948133949133950133951133952133953133954133955133956133957133958133959133960133961133962133963133964133965133966133967133968133969133970133971133972133973133974133975133976133977133978133979133980133981133982133983133984133985133986133987133988133989133990133991133992133993133994133995133996133997133998133999134000134001134002134003134004134005134006134007134008134009134010134011134012134013134014134015134016134017134018134019134020134021134022134023134024134025134026134027134028134029134030134031134032134033134034134035134036134037134038134039134040134041134042134043134044134045134046134047134048134049134050134051134052134053134054134055134056134057134058134059134060134061134062134063134064134065134066134067134068134069134070134071134072134073134074134075134076134077134078134079134080134081134082134083134084134085134086134087134088134089134090134091134092134093134094134095134096134097134098134099134100134101134102134103134104134105134106134107134108134109134110134111134112134113134114134115134116134117134118134119134120134121134122134123134124134125134126134127134128134129134130134131134132134133134134134135134136134137134138134139134140134141134142134143134144134145134146134147134148134149134150134151134152134153134154134155134156134157134158134159134160134161134162134163134164134165134166134167134168134169134170134171134172134173134174134175134176134177134178134179134180134181134182134183134184134185134186134187134188134189134190134191134192134193134194134195134196134197134198134199134200134201134202134203134204134205134206134207134208134209134210134211134212134213134214134215134216134217134218134219134220134221134222134223134224134225134226134227134228134229134230134231134232134233134234134235134236134237134238134239134240134241134242134243134244134245134246134247134248134249134250134251134252134253134254134255134256134257134258134259134260134261134262134263134264134265134266134267134268134269134270134271134272134273134274134275134276134277134278134279134280134281134282134283134284134285134286134287134288134289134290134291134292134293134294134295134296134297134298134299134300134301134302134303134304134305134306134307134308134309134310134311134312134313134314134315134316134317134318134319134320134321134322134323134324134325134326134327134328134329134330134331134332134333134334134335134336134337134338134339134340134341134342134343134344134345134346134347134348134349134350134351134352134353134354134355134356134357134358134359134360134361134362134363134364134365134366134367134368134369134370134371134372134373134374134375134376134377134378134379134380134381134382134383134384134385134386134387134388134389134390134391134392134393134394134395134396134397134398134399134400134401134402134403134404134405134406134407134408134409134410134411134412134413134414134415134416134417134418134419134420134421134422134423134424134425134426134427134428134429134430134431134432134433134434134435134436134437134438134439134440134441134442134443134444134445134446134447134448134449134450134451134452134453134454134455134456134457134458134459134460134461134462134463134464134465134466134467134468134469134470134471134472134473134474134475134476134477134478134479134480134481134482134483134484134485134486134487134488134489134490134491134492134493134494134495134496134497134498134499134500134501134502134503134504134505134506134507134508134509134510134511134512134513134514134515134516134517134518134519134520134521134522134523134524134525134526134527134528134529134530134531134532134533134534134535134536134537134538134539134540134541134542134543134544134545134546134547134548134549134550134551134552134553134554134555134556134557134558134559134560134561134562134563134564134565134566134567134568134569134570134571134572134573134574134575134576134577134578134579134580134581134582134583134584134585134586134587134588134589134590134591134592134593134594134595134596134597134598134599134600134601134602134603134604134605134606134607134608134609134610134611134612134613134614134615134616134617134618134619134620134621134622134623134624134625134626134627134628134629134630134631134632134633134634134635134636134637134638134639134640134641134642134643134644134645134646134647134648134649134650134651134652134653134654134655134656134657134658134659134660134661134662134663134664134665134666134667134668134669134670134671134672134673134674134675134676134677134678134679134680134681134682134683134684134685134686134687134688134689134690134691134692134693134694134695134696134697134698134699134700134701134702134703134704134705134706134707134708134709134710134711134712134713134714134715134716134717134718134719134720134721134722134723134724134725134726134727134728134729134730134731134732134733134734134735134736134737134738134739134740134741134742134743134744134745134746134747134748134749134750134751134752134753134754134755134756134757134758134759134760134761134762134763134764134765134766134767134768134769134770134771134772134773134774134775134776134777134778134779134780134781134782134783134784134785134786134787134788134789134790134791134792134793134794134795134796134797134798134799134800134801134802134803134804134805134806134807134808134809134810134811134812134813134814134815134816134817134818134819134820134821134822134823134824134825134826134827134828134829134830134831134832134833134834134835134836134837134838134839134840134841134842134843134844134845134846134847134848134849134850134851134852134853134854134855134856134857134858134859134860134861134862134863134864134865134866134867134868134869134870134871134872134873134874134875134876134877134878134879134880134881134882134883134884134885134886134887134888134889134890134891134892134893134894134895134896134897134898134899134900134901134902134903134904134905134906134907134908134909134910134911134912134913134914134915134916134917134918134919134920134921134922134923134924134925134926134927134928134929134930134931134932134933134934134935134936134937134938134939134940134941134942134943134944134945134946134947134948134949134950134951134952134953134954134955134956134957134958134959134960134961134962134963134964134965134966134967134968134969134970134971134972134973134974134975134976134977134978134979134980134981134982134983134984134985134986134987134988134989134990134991134992134993134994134995134996134997134998134999135000135001135002135003135004135005135006135007135008135009135010135011135012135013135014135015135016135017135018135019135020135021135022135023135024135025135026135027135028135029135030135031135032135033135034135035135036135037135038135039135040135041135042135043135044135045135046135047135048135049135050135051135052135053135054135055135056135057135058135059135060135061135062135063135064135065135066135067135068135069135070135071135072135073135074135075135076135077135078135079135080135081135082135083135084135085135086135087135088135089135090135091135092135093135094135095135096135097135098135099135100135101135102135103135104135105135106135107135108135109135110135111135112135113135114135115135116135117
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. if (!class_exists('Phar')) {
  22. echo 'PHP\'s phar extension is missing. Composer requires it to run. Enable the extension or recompile php without --disable-phar then try again.' . PHP_EOL;
  23. exit(1);
  24. }
  25. Phar::mapPhar('composer.phar');
  26. require 'phar://composer.phar/bin/composer';
  27. __HALT_COMPILER(); ?>
  28. ÁÁ��Š������ ���composer.phar����!���src/Composer/Advisory/Auditor.phpN$��6ÆeN$��uËÒš¤������1���src/Composer/Advisory/IgnoredSecurityAdvisory.phpT��6ÆeT��"¼ï¤������1���src/Composer/Advisory/PartialSecurityAdvisory.php��6Æe��•ôã¤������*���src/Composer/Advisory/SecurityAdvisory.phpü��6Æeü��µ5t0¤������+���src/Composer/Autoload/AutoloadGenerator.phpâ†��6Æeâ†���ˆp¤������+���src/Composer/Autoload/ClassMapGenerator.php’��6Æe’���¨|S¤���������src/Composer/Cache.phpQ��6ÆeQ��Ã;"|¤������%���src/Composer/Command/AboutCommand.phpW��6ÆeW��â:†!¤������'���src/Composer/Command/ArchiveCommand.php$��6Æe$��dSWA¤������%���src/Composer/Command/AuditCommand.phpÁ
  29. ��6ÆeÁ
  30. ��1ñѤ������$���src/Composer/Command/BaseCommand.php((��6Æe((��8î¤������.���src/Composer/Command/BaseDependencyCommand.php7��6Æe7��eï}ø¤������$���src/Composer/Command/BumpCommand.php“��6Æe“��(‘¤������1���src/Composer/Command/CheckPlatformReqsCommand.php`��6Æe`��ù<t¤������*���src/Composer/Command/ClearCacheCommand.php ��6Æe ��Å*¤������(���src/Composer/Command/CompletionTrait.phpW��6ÆeW��@Ίö¤������&���src/Composer/Command/ConfigCommand.php%p��6Æe%p��ëpú¤������-���src/Composer/Command/CreateProjectCommand.php�J��6Æe�J��6Jb‡¤������'���src/Composer/Command/DependsCommand.phpE��6ÆeE���z¤������(���src/Composer/Command/DiagnoseCommand.php¾Z��6Æe¾Z��1%ó¤������,���src/Composer/Command/DumpAutoloadCommand.phpÒ��6ÆeÒ��Û%¾p¤������$���src/Composer/Command/ExecCommand.php ��6Æe ��Oì¡0¤������$���src/Composer/Command/FundCommand.phpÁ��6ÆeÁ��5`ÈG¤������&���src/Composer/Command/GlobalCommand.php���6Æe���!Ûº¤������$���src/Composer/Command/HomeCommand.php^��6Æe^��ë"+C¤������$���src/Composer/Command/InitCommand.php©B��6Æe©B��ƒ¦Oh¤������'���src/Composer/Command/InstallCommand.phpa��6Æea��ÛáÅ£¤������(���src/Composer/Command/LicensesCommand.php½��6Æe½��ƃi]¤������(���src/Composer/Command/OutdatedCommand.phpr��6Æer��Pš’0¤������.���src/Composer/Command/PackageDiscoveryTrait.phpk6��6Æek6��V,!å¤������)���src/Composer/Command/ProhibitsCommand.phpå��6Æeå��ÊDrø¤������)���src/Composer/Command/ReinstallCommand.php„��6Æe„��(!»e¤������&���src/Composer/Command/RemoveCommand.phpF.��6ÆeF.��³š¤������'���src/Composer/Command/RequireCommand.php‘Z��6Æe‘Z��`Ë°¤������)���src/Composer/Command/RunScriptCommand.php��6Æe��f¿¤������+���src/Composer/Command/ScriptAliasCommand.phpò��6Æeò��sä*-¤������&���src/Composer/Command/SearchCommand.phpo��6Æeo��ÇO�¨¤������*���src/Composer/Command/SelfUpdateCommand.php!L��6Æe!L�� mŒ-¤������$���src/Composer/Command/ShowCommand.php=º��6Æe=º��bå5¤������&���src/Composer/Command/StatusCommand.php²��6Æe²��ºoĤ������(���src/Composer/Command/SuggestsCommand.phpÉ ��6ÆeÉ ��ùÏfk¤������&���src/Composer/Command/UpdateCommand.phpá6��6Æeá6��o±€¼¤������(���src/Composer/Command/ValidateCommand.php��6Æe��˘ä¤���������src/Composer/Composer.php���6Æe���&¤]¤���������src/Composer/Config.phpÅ9��6ÆeÅ9��.%;ª¤������-���src/Composer/Config/ConfigSourceInterface.phpº��6Æeº��½Ó¤������(���src/Composer/Config/JsonConfigSource.phpv��6Æev��dã“Ť������$���src/Composer/Console/Application.phpÚR��6ÆeÚR�� $-†¤������*���src/Composer/Console/GithubActionError.php��6Æe��`±‰æ¤������,���src/Composer/Console/HtmlOutputFormatter.php>��6Æe>��Ò ïR¤������,���src/Composer/Console/Input/InputArgument.php¶��6Æe¶��ª¼K¤������*���src/Composer/Console/Input/InputOption.phpg��6Æeg��ˆ7'4¤������-���src/Composer/DependencyResolver/Decisions.php���6Æe���)ƒ²&¤������1���src/Composer/DependencyResolver/DefaultPolicy.php„��6Æe„���Ñ#˜¤������/���src/Composer/DependencyResolver/GenericRule.php–��6Æe–��Z)í¤������8���src/Composer/DependencyResolver/LocalRepoTransaction.php½��6Æe½��ßšHš¤������3���src/Composer/DependencyResolver/LockTransaction.phpå ��6Æeå ��¤N°z¤������5���src/Composer/DependencyResolver/MultiConflictRule.php+��6Æe+��Ãwì¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpÿ��6Æeÿ��=ú§§¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php��6Æe���1NJ¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php��6Æe��tw ¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpø���6Æeø���÷Wý¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.phpH��6ÆeH��§¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpç��6Æeç��|ÁR¤������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phpŸ��6ÆeŸ��Ü7椤������3���src/Composer/DependencyResolver/PolicyInterface.phpž��6Æež��øÎá¤������(���src/Composer/DependencyResolver/Pool.php ��6Æe ��xF!¤������/���src/Composer/DependencyResolver/PoolBuilder.phpRF��6ÆeRF��ìLûì¤������1���src/Composer/DependencyResolver/PoolOptimizer.phpÛ)��6ÆeÛ)��¥!\¤������+���src/Composer/DependencyResolver/Problem.phpøN��6ÆeøN��âÈò1¤������+���src/Composer/DependencyResolver/Request.php���6Æe���À›sܤ������(���src/Composer/DependencyResolver/Rule.php<0��6Æe<0��À³ù¤������1���src/Composer/DependencyResolver/Rule2Literals.php��6Æe��3vþ¤������+���src/Composer/DependencyResolver/RuleSet.php£ ��6Æe£ ��uò©Ä¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php=��6Æe=��kŤ������3���src/Composer/DependencyResolver/RuleSetIterator.phpõ��6Æeõ��œ y¤������2���src/Composer/DependencyResolver/RuleWatchChain.php{��6Æe{��‚hóD¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpœ ��6Æeœ ��Zœ{|¤������1���src/Composer/DependencyResolver/RuleWatchNode.phpv��6Æev��p™·¤������*���src/Composer/DependencyResolver/Solver.php³7��6Æe³7��²{פ������6���src/Composer/DependencyResolver/SolverBugException.php¹��6Æe¹��z­=¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpœ��6Æeœ��¼.½À¤������/���src/Composer/DependencyResolver/Transaction.php-��6Æe-��É铤������-���src/Composer/Downloader/ArchiveDownloader.phpú��6Æeú��Ó�%š¤������1���src/Composer/Downloader/ChangeReportInterface.phpõ���6Æeõ���­ÃÂB¤������+���src/Composer/Downloader/DownloadManager.phpª��6Æeª��²œ?g¤������/���src/Composer/Downloader/DownloaderInterface.phpÓ��6ÆeÓ��bm[Ȥ������3���src/Composer/Downloader/DvcsDownloaderInterface.phpú���6Æeú���à%'¤������*���src/Composer/Downloader/FileDownloader.php2��6Æe2��WcÊD¤������/���src/Composer/Downloader/FilesystemException.php/��6Æe/��!‹å&¤������,���src/Composer/Downloader/FossilDownloader.phpi ��6Æei ��¡‹Z¤������)���src/Composer/Downloader/GitDownloader.php�E��6Æe�E��Aõ›@¤������*���src/Composer/Downloader/GzipDownloader.php±��6Æe±��í‰v÷¤������(���src/Composer/Downloader/HgDownloader.php? ��6Æe? ��€/Œ¤������8���src/Composer/Downloader/MaxFileSizeExceededException.phpŒ���6ÆeŒ���ÚºÔ¤������*���src/Composer/Downloader/PathDownloader.php*��6Æe*��¯?a¤������.���src/Composer/Downloader/PerforceDownloader.php‹ ��6Æe‹ ���<­�¤������*���src/Composer/Downloader/PharDownloader.phpª��6Æeª��XÈȤ������)���src/Composer/Downloader/RarDownloader.php›��6Æe›��GU¤������)���src/Composer/Downloader/SvnDownloader.phpƒ��6Æeƒ��…}%"¤������)���src/Composer/Downloader/TarDownloader.php¨��6Æe¨��×rß‚¤������.���src/Composer/Downloader/TransportException.phps��6Æes��ø ¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpý���6Æeý���ä6¤¤������)���src/Composer/Downloader/VcsDownloader.php6��6Æe6��_w˜ø¤������(���src/Composer/Downloader/XzDownloader.php­��6Æe­��&Ør‚¤������)���src/Composer/Downloader/ZipDownloader.php—#��6Æe—#��žÖÊ›¤������&���src/Composer/EventDispatcher/Event.phpØ��6ÆeØ��…÷¡ð¤������0���src/Composer/EventDispatcher/EventDispatcher.phpAB��6ÆeAB��YP.ì¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.phpÂ���6ÆeÂ���}=é¤������9���src/Composer/EventDispatcher/ScriptExecutionException.php‘���6Æe‘���XvèϤ������9���src/Composer/Exception/IrrecoverableDownloadException.php����6Æe����0Þ4 ¤������)���src/Composer/Exception/NoSslException.php����6Æe����ØU¦Ò¤���������src/Composer/Factory.phpTP��6ÆeTP��0c›´¤������T���src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.php®��6Æe®��Zkª¤������U���src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php.��6Æe.��!;¤������X���src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.phpT��6ÆeT��ÇàÙ¤������R���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.phpw��6Æew��ÑT¿¤������T���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.phpø���6Æeø���‰µÒg¤���������src/Composer/IO/BaseIO.phpØ��6ÆeØ�� „¤���������src/Composer/IO/BufferIO.php{��6Æe{��@M¤���������src/Composer/IO/ConsoleIO.phpë��6Æeë��«ýâ¤���������src/Composer/IO/IOInterface.phpÐ��6ÆeÐ��~ÿh­¤���������src/Composer/IO/NullIO.phpO��6ÆeO��bˆ¨s¤���������src/Composer/Installer.phpåŒ��6ÆeåŒ��I«m;¤������*���src/Composer/Installer/BinaryInstaller.phpp)��6Æep)��|ÛâK¤������2���src/Composer/Installer/BinaryPresenceInterface.phpæ���6Æeæ���®3—Œ¤������.���src/Composer/Installer/InstallationManager.php�5��6Æe�5��Šöó¤������)���src/Composer/Installer/InstallerEvent.php*��6Æe*��FZäÙ¤������*���src/Composer/Installer/InstallerEvents.php¥���6Æe¥���>•íǤ������-���src/Composer/Installer/InstallerInterface.php~��6Æe~���͔դ������+���src/Composer/Installer/LibraryInstaller.php��6Æe��ºc2¤������/���src/Composer/Installer/MetapackageInstaller.phpÖ��6ÆeÖ��û
  31. õ"¤������(���src/Composer/Installer/NoopInstaller.phpa��6Æea��êxQn¤������'���src/Composer/Installer/PackageEvent.phpô��6Æeô��b‘\A¤������(���src/Composer/Installer/PackageEvents.phpû��6Æeû��ò«K¤������*���src/Composer/Installer/PluginInstaller.php� ��6Æe� ��ò”=¤������+���src/Composer/Installer/ProjectInstaller.php9 ��6Æe9 ��Uц¤������4���src/Composer/Installer/SuggestedPackagesReporter.php¥��6Æe¥��ö”Oë¤���������src/Composer/Json/JsonFile.phpY��6ÆeY��8òh¤������#���src/Composer/Json/JsonFormatter.phpÀ��6ÆeÀ��øAqå¤������%���src/Composer/Json/JsonManipulator.phpL6��6ÆeL6��ĵð¤������-���src/Composer/Json/JsonValidationException.php—��6Æe—���^^´¤������2���src/Composer/PHPStan/ConfigReturnTypeExtension.php–��6Æe–��uoü¤������:���src/Composer/PHPStan/RuleReasonDataReturnTypeExtension.php~��6Æe~��¦ç¬H¤������%���src/Composer/Package/AliasPackage.phpk��6Æek��®‰é¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.phpS��6ÆeS��'25f¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpl��6Æel��mu!¤������0���src/Composer/Package/Archiver/ArchiveManager.php!��6Æe!��jè*Þ¤������3���src/Composer/Package/Archiver/ArchiverInterface.phpS��6ÆeS��ÿì?î¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php��6Æe��xÆ6Ȥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php?��6Æe?��?�`^¤������2���src/Composer/Package/Archiver/GitExcludeFilter.php$��6Æe$��t�8N¤������.���src/Composer/Package/Archiver/PharArchiver.phpÆ��6ÆeÆ��-íÙª¤������-���src/Composer/Package/Archiver/ZipArchiver.phpŽ��6ÆeŽ��aEФ������$���src/Composer/Package/BasePackage.phpö��6Æeö��ÿ¡Â̤������*���src/Composer/Package/Comparer/Comparer.php¦ ��6Æe¦ ��7Fâ¤������-���src/Composer/Package/CompleteAliasPackage.phpq
  32. ��6Æeq
  33. ��ú #·¤������(���src/Composer/Package/CompletePackage.php
  34. ��6Æe
  35. ��† J±¤������1���src/Composer/Package/CompletePackageInterface.php���6Æe���‰‘”¤������+���src/Composer/Package/Dumper/ArrayDumper.phpH ��6ÆeH ��(ª ¤���������src/Composer/Package/Link.phpö��6Æeö�� "j¥¤������+���src/Composer/Package/Loader/ArrayLoader.phpÛ-��6ÆeÛ-��uÐäǤ������7���src/Composer/Package/Loader/InvalidPackageException.php„��6Æe„��èMü•¤������*���src/Composer/Package/Loader/JsonLoader.php“��6Æe“��褢4¤������/���src/Composer/Package/Loader/LoaderInterface.phpž��6Æež��FB¤¤������1���src/Composer/Package/Loader/RootPackageLoader.php��6Æe��Ñh›½¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpfO��6ÆefO��ZÚ꾤���������src/Composer/Package/Locker.php›/��6Æe›/��꧉ù¤������ ���src/Composer/Package/Package.php_$��6Æe_$��RóBJ¤������)���src/Composer/Package/PackageInterface.phpÓ ��6ÆeÓ ��]ÀÄá¤������)���src/Composer/Package/RootAliasPackage.phpç ��6Æeç ��A:–D¤������$���src/Composer/Package/RootPackage.php©��6Æe©�� º¤������-���src/Composer/Package/RootPackageInterface.php9��6Æe9��ˆ¨ì¤������0���src/Composer/Package/Version/StabilityFilter.php��6Æe��µêrú¤������.���src/Composer/Package/Version/VersionBumper.phpP ��6ÆeP ��¾B&‘¤������/���src/Composer/Package/Version/VersionGuesser.phpå'��6Æeå'��H¬‘¤������.���src/Composer/Package/Version/VersionParser.phpÔ��6ÆeÔ��Øà’æ¤������0���src/Composer/Package/Version/VersionSelector.php��6Æe��x`e*¤������ ���src/Composer/PartialComposer.phpþ��6Æeþ��¨ù š¤������&���src/Composer/Platform/HhvmDetector.php-��6Æe-���‚À#¤������!���src/Composer/Platform/Runtime.phpï��6Æeï��o^1%¤������!���src/Composer/Platform/Version.php¨��6Æe¨��»¤������-���src/Composer/Plugin/Capability/Capability.phpp���6Æep���š#c;¤������2���src/Composer/Plugin/Capability/CommandProvider.php°���6Æe°���FüÙ¤¤���������src/Composer/Plugin/Capable.php˜���6Æe˜���û°hª¤������$���src/Composer/Plugin/CommandEvent.php?��6Æe?��|U`¤������.���src/Composer/Plugin/PluginBlockedException.php§���6Æe§���öùr¤������$���src/Composer/Plugin/PluginEvents.php¨��6Æe¨��\K“Ö¤������'���src/Composer/Plugin/PluginInterface.php«��6Æe«��õ1i ¤������%���src/Composer/Plugin/PluginManager.phpTN��6ÆeTN��µ-Œï¤������-���src/Composer/Plugin/PostFileDownloadEvent.php¿��6Æe¿��à@>‰¤������*���src/Composer/Plugin/PreCommandRunEvent.php/��6Æe/��3 ±¤������,���src/Composer/Plugin/PreFileDownloadEvent.php ��6Æe ��´qŠl¤������*���src/Composer/Plugin/PrePoolCreateEvent.php±��6Æe±��ó¼Û¤������4���src/Composer/Question/StrictConfirmationQuestion.php•��6Æe•��x”»A¤������5���src/Composer/Repository/AdvisoryProviderInterface.php©��6Æe©��•Ð°¤������+���src/Composer/Repository/ArrayRepository.php4��6Æe4��º�ÒÕ¤������.���src/Composer/Repository/ArtifactRepository.phpt ��6Æet ���Ôã¤������2���src/Composer/Repository/CanonicalPackagesTrait.phpÄ��6ÆeÄ��¦{ë¤������.���src/Composer/Repository/ComposerRepository.phpa·��6Æea·��(ëû¤������/���src/Composer/Repository/CompositeRepository.php… ��6Æe… ��û«ߤ������;���src/Composer/Repository/ConfigurableRepositoryInterface.php¡���6Æe¡���ce*2¤������0���src/Composer/Repository/FilesystemRepository.phpç'��6Æeç'��öÊ�8¤������,���src/Composer/Repository/FilterRepository.phpg��6Æeg��+¯F¾¤������4���src/Composer/Repository/InstalledArrayRepository.phpX��6ÆeX��¼,[¤������9���src/Composer/Repository/InstalledFilesystemRepository.phpJ��6ÆeJ��'kCè¤������/���src/Composer/Repository/InstalledRepository.phpK��6ÆeK��y™á’¤������8���src/Composer/Repository/InstalledRepositoryInterface.phpà���6Æeà���¾²ÿg¤������6���src/Composer/Repository/InvalidRepositoryException.php‡���6Æe‡��� W<_¤������/���src/Composer/Repository/LockArrayRepository.phpâ���6Æeâ����^†ú¤������-���src/Composer/Repository/PackageRepository.php ��6Æe ��\/*þ¤������*���src/Composer/Repository/PathRepository.php���6Æe���ç,j ¤������*���src/Composer/Repository/PearRepository.php��6Æe��QuÏj¤������.���src/Composer/Repository/PlatformRepository.phpVW��6ÆeVW��ÑYQ«¤������-���src/Composer/Repository/RepositoryFactory.phpW��6ÆeW��è(¤������/���src/Composer/Repository/RepositoryInterface.php¤��6Æe¤��, :¤������-���src/Composer/Repository/RepositoryManager.php¢ ��6Æe¢ ��,}~¤������7���src/Composer/Repository/RepositorySecurityException.phpˆ���6Æeˆ���qœ×t¤������)���src/Composer/Repository/RepositorySet.phpl"��6Æel"��áœ]¤������+���src/Composer/Repository/RepositoryUtils.php��6Æe��I³z¤������1���src/Composer/Repository/RootPackageRepository.php\��6Æe\��¾`9ü¤������,���src/Composer/Repository/Vcs/FossilDriver.phpB��6ÆeB��~*�¦¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpÖ&��6ÆeÖ&��ëy!†¤������)���src/Composer/Repository/Vcs/GitDriver.phps��6Æes��¼„%ݤ������,���src/Composer/Repository/Vcs/GitHubDriver.php!9��6Æe!9��º”7¾¤������,���src/Composer/Repository/Vcs/GitLabDriver.php3��6Æe3��±�W¿¤������(���src/Composer/Repository/Vcs/HgDriver.phpå��6Æeå��lëñ9¤������.���src/Composer/Repository/Vcs/PerforceDriver.php ��6Æe ��Î%ÿÚ¤������)���src/Composer/Repository/Vcs/SvnDriver.php+��6Æe+��ßTc¬¤������)���src/Composer/Repository/Vcs/VcsDriver.php ��6Æe ��Î&þ:¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php±��6Æe±��TŠ„ø¤������)���src/Composer/Repository/VcsRepository.php~4��6Æe~4��
  36. 0À¯¤������1���src/Composer/Repository/VersionCacheInterface.php¹���6Æe¹���‚h‡¤������3���src/Composer/Repository/WritableArrayRepository.phpÙ��6ÆeÙ��l&´#¤������7���src/Composer/Repository/WritableRepositoryInterface.phpw��6Æew��Õ~¼0¤���������src/Composer/Script/Event.phpå��6Æeå��Š¼ y¤������$���src/Composer/Script/ScriptEvents.phpI��6ÆeI��¤£D4¤������ ���src/Composer/SelfUpdate/Keys.phpÙ��6ÆeÙ��É ¨s¤������$���src/Composer/SelfUpdate/Versions.php\ ��6Æe\ ��nMè0¤������ ���src/Composer/Util/AuthHelper.phpv#��6Æev#��3̱¤���������src/Composer/Util/Bitbucket.phpF��6ÆeF��´ðè’¤������$���src/Composer/Util/ComposerMirror.php ��6Æe ��·ÍIs¤������%���src/Composer/Util/ConfigValidator.phps��6Æes��ÕH¡ü¤������"���src/Composer/Util/ErrorHandler.phpL��6ÆeL��Q%Ìã¤������ ���src/Composer/Util/Filesystem.php–?��6Æe–?��ø½¯*¤���������src/Composer/Util/Git.php÷:��6Æe÷:��ÿe9¤���������src/Composer/Util/GitHub.php5��6Æe5��ðŸU¤���������src/Composer/Util/GitLab.phpÞ��6ÆeÞ��ÛF ¤���������src/Composer/Util/Hg.phpD��6ÆeD��ùºvA¤������)���src/Composer/Util/Http/CurlDownloader.phpnN��6ÆenN��Q·eM¤������'���src/Composer/Util/Http/CurlResponse.php•��6Æe•��’;©¹¤������&���src/Composer/Util/Http/ProxyHelper.php‘
  37. ��6Æe‘
  38. ��/\_ ¤������'���src/Composer/Util/Http/ProxyManager.phpz
  39. ��6Æez
  40. ��F¨Q¤������'���src/Composer/Util/Http/RequestProxy.phpg��6Æeg��̇òµ¤������#���src/Composer/Util/Http/Response.phpã��6Æeã��ÖmR^¤������$���src/Composer/Util/HttpDownloader.phpï)��6Æeï)��ó'kö¤���������src/Composer/Util/IniHelper.phpŽ��6ÆeŽ��™m®B¤���������src/Composer/Util/Loop.phpý��6Æeý��Ÿû£¤������&���src/Composer/Util/MetadataMinifier.phpC��6ÆeC��d ˜¤������$���src/Composer/Util/NoProxyPattern.php(��6Æe(��Mû ¡¤������!���src/Composer/Util/PackageInfo.phpà��6Æeà���RX¤������#���src/Composer/Util/PackageSorter.phpÅ��6ÆeÅ��öµ›ž¤���������src/Composer/Util/Perforce.php"4��6Æe"4��E�Q[¤���������src/Composer/Util/Platform.phpÔ��6ÆeÔ��ˆ“’ͤ������%���src/Composer/Util/ProcessExecutor.php› ��6Æe› ��®ŸûÞ¤������&���src/Composer/Util/RemoteFilesystem.phpÖ@��6ÆeÖ@��
  41. ŠRU¤���������src/Composer/Util/Silencer.phpü��6Æeü��Ðå•À¤������*���src/Composer/Util/StreamContextFactory.php€��6Æe€��ý)Ť���������src/Composer/Util/Svn.phpô��6Æeô��ÕL¥8¤������ ���src/Composer/Util/SyncHelper.phpÿ��6Æeÿ��ÐzA¤���������src/Composer/Util/Tar.php…��6Æe…��÷Ìt?¤���������src/Composer/Util/TlsHelper.phpj ��6Æej ��Ч†Q¤���������src/Composer/Util/Url.phpÙ ��6ÆeÙ ��Q—_O¤���������src/Composer/Util/Zip.php��6Æe��£DÙ‘¤���������src/bootstrap.php
  42. ��6Æe
  43. ��ÑÄ-Ȥ������%���src/Composer/Autoload/ClassLoader.phpú?��6Æeú?��2@u¤������"���src/Composer/InstalledVersions.php?��6Æe?�� 2ªÅ¤������#���res/composer-repository-schema.jsonñ��6Æeñ��|0à„¤���������res/composer-schema.jsonVÆ��6ÆeVÆ��ÈãFý¤���������vendor/autoload.phpo��6Æeo��ýzÿ¬¤���������vendor/composer/ClassLoader.php/��6Æe/��˜Õâ’¤������%���vendor/composer/InstalledVersions.php��6Æe���xG¤������%���vendor/composer/autoload_classmap.phpò��6Æeò��êðÙפ������"���vendor/composer/autoload_files.php��6Æe��‹ebd¤������'���vendor/composer/autoload_namespaces.phpZ���6ÆeZ���ë¦á–¤������!���vendor/composer/autoload_psr4.php®��6Æe®��úYI¤������!���vendor/composer/autoload_real.phpÆ��6ÆeÆ��¥dʤ������#���vendor/composer/autoload_static.php0��6Æe0��Üd¤������!���vendor/composer/ca-bundle/LICENSE��6Æe��G _¤������(���vendor/composer/ca-bundle/res/cacert.pemOu�6ÆeOu��¦â ¤������*���vendor/composer/ca-bundle/src/CaBundle.php•$��6Æe•$��ÛnÓ¤������+���vendor/composer/class-map-generator/LICENSE��6Æe��=ù¾õ¤������4���vendor/composer/class-map-generator/src/ClassMap.phpÀ��6ÆeÀ��c¾Ã[¤������=���vendor/composer/class-map-generator/src/ClassMapGenerator.php›��6Æe›��´A M¤������4���vendor/composer/class-map-generator/src/FileList.php$��6Æe$��hôSq¤������:���vendor/composer/class-map-generator/src/PhpFileCleaner.php��6Æe��š5]¤������9���vendor/composer/class-map-generator/src/PhpFileParser.phpQ ��6ÆeQ ��òoay¤���������vendor/composer/installed.json»#�6Æe»#�°ÆãÔ¤���������vendor/composer/installed.php� ��6Æe� ��ˆj`ʤ������)���vendor/composer/metadata-minifier/LICENSE��6Æe��½£ëǤ������:���vendor/composer/metadata-minifier/src/MetadataMinifier.phpÐ��6ÆeÐ��Â0&À¤���������vendor/composer/pcre/LICENSE��6Æe��½£ëǤ������+���vendor/composer/pcre/src/MatchAllResult.php��6Æe�� \9ÿ¤������7���vendor/composer/pcre/src/MatchAllStrictGroupsResult.php)��6Æe)��hIŸ…¤������6���vendor/composer/pcre/src/MatchAllWithOffsetsResult.php*��6Æe*��øA à¤������(���vendor/composer/pcre/src/MatchResult.phpï���6Æeï���<äÀ¤������4���vendor/composer/pcre/src/MatchStrictGroupsResult.phpû���6Æeû���§Ë0Q¤������3���vendor/composer/pcre/src/MatchWithOffsetsResult.phpü���6Æeü���{*,o¤������*���vendor/composer/pcre/src/PcreException.phpI��6ÆeI��Ìà
  44. 7¤������!���vendor/composer/pcre/src/Preg.phpû!��6Æeû!�� ƒƒ¤������"���vendor/composer/pcre/src/Regex.php ��6Æe ��à}]¤������*���vendor/composer/pcre/src/ReplaceResult.php��6Æe��'±Èð¤������9���vendor/composer/pcre/src/UnexpectedNullMatchException.php��6Æe�� îÀò¤���������vendor/composer/semver/LICENSE��6Æe��ÇSRm¤������)���vendor/composer/semver/src/Comparator.php��6Æe��^_E“¤������/���vendor/composer/semver/src/CompilingMatcher.phpc��6Æec��„€¦¤������/���vendor/composer/semver/src/Constraint/Bound.phpw��6Æew��W4]W¤������4���vendor/composer/semver/src/Constraint/Constraint.phpø��6Æeø��’‹ˆ½¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.php¡��6Æe¡��Ž5´y¤������<���vendor/composer/semver/src/Constraint/MatchAllConstraint.php¯��6Æe¯��²Eú¤������=���vendor/composer/semver/src/Constraint/MatchNoneConstraint.phpÉ��6ÆeÉ��֯خ¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.phpŠ��6ÆeŠ��ÍÕĤ������'���vendor/composer/semver/src/Interval.phpæ��6Æeæ��=[i¤������(���vendor/composer/semver/src/Intervals.php¤+��6Æe¤+��@1º«¤������%���vendor/composer/semver/src/Semver.phpù��6Æeù��á-i¤������,���vendor/composer/semver/src/VersionParser.phpÿ,��6Æeÿ,��¦3ªÐ¤������%���vendor/composer/spdx-licenses/LICENSE��6Æe��ÇSRm¤������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json��6Æe��"mÓê¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonï��6Æeï��
  45. ‘x ¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.php{��6Æe{��cE�¤������&���vendor/composer/xdebug-handler/LICENSE+��6Æe+��Öã@T¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php‰��6Æe‰��gÔ�v¤������.���vendor/composer/xdebug-handler/src/Process.phpÖ��6ÆeÖ��o7¾¤������-���vendor/composer/xdebug-handler/src/Status.phpº ��6Æeº ��xf17¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.phpr)��6Æer)��8Õc6¤������(���vendor/justinrainbow/json-schema/LICENSE"��6Æe"�� |»™¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��6Æe¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.phpƒ
  46. ��6Æeƒ
  47. ��ž¸=š¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.phpÁ ��6ÆeÁ ��–PFF¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��6Æe¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php\��6Æe\��_}ý¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpà ��6Æeà ��ë’_”¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.phps��6Æes��d Þ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpƒ ��6Æeƒ ��e� ¨¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php·��6Æe·��%l¬ö¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php& ��6Æe& ��78÷¬¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpz��6Æez��ùfÅ~¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��6Æea�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��6Æe—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��6Æe‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php*��6Æe*��1–4N¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpG"��6ÆeG"��@‹?¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��6Æeè��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���6ÆeI���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���6Æe•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���6Æel���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���6Æel���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���6Æeu���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���6Æew���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��6ÆeÞ��\¸
  48. ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���6Æeo���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���6Æe…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���6Æe€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���6Æej���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���6Æef���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��6Æeþ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��6Æe ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php“ ��6Æe“ ��&zß^¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��6Æe��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���6Æeá���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php£��6Æe£��Ç’ô¦¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php ��6Æe ��£Á¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��6Æe,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���6Æe®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��6Æe ��æP¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php@��6Æe@��5Î3¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���6Æeƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���6Æe…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phps��6Æes��ßÁ‘#¤���������vendor/psr/container/LICENSE{��6Æe{��ÕÓ�e¤������8���vendor/psr/container/src/ContainerExceptionInterface.phpN���6ÆeN���üLƒ¤������/���vendor/psr/container/src/ContainerInterface.php·���6Æe·���Šã¼¤������7���vendor/psr/container/src/NotFoundExceptionInterface.phpq���6Æeq���Rúõ¤���������vendor/psr/log/LICENSE?��6Æe?��„ù ¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��6Æe;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���6Æe`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���6Æeû���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���6Æe|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���6Æe§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��6ÆeÈ��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��6Æek��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.phpŸ���6ÆeŸ����Xóª¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���6Æep���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��6Æe ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��6Æe<��þ(åI¤���������vendor/react/promise/LICENSEi��6Æei��3}‹¤������%���vendor/react/promise/src/Deferred.phpR��6ÆeR��¶Ál¤������9���vendor/react/promise/src/Exception/CompositeException.phpŒ��6ÆeŒ��!ŒÏâ¤������6���vendor/react/promise/src/Exception/LengthException.php^���6Æe^���?q¤������7���vendor/react/promise/src/Internal/CancellationQueue.phpr��6Æer���x_±¤������6���vendor/react/promise/src/Internal/FulfilledPromise.phpu��6Æeu��oV™¤������5���vendor/react/promise/src/Internal/RejectedPromise.phpâ��6Æeâ��_ Û¤������$���vendor/react/promise/src/Promise.phpŠ��6ÆeŠ��ûãr¤������-���vendor/react/promise/src/PromiseInterface.phpi��6Æei��&](¤������&���vendor/react/promise/src/functions.phpÇ��6ÆeÇ��<îÂ`¤������.���vendor/react/promise/src/functions_include.php]���6Æe]���QÑ<¡¤���������vendor/seld/jsonlint/LICENSE$��6Æe$��4:‡~¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php|��6Æe|��šÊ ì¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php5��6Æe5��(æ¤������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php¥��6Æe¥��È»_¤¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php(��6Æe(��>Ûv}¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���6Æe>���ÿqŸŸ¤���������vendor/seld/phar-utils/LICENSE$��6Æe$��š,M§¤������%���vendor/seld/phar-utils/src/Linter.phpi��6Æei�� �Þ¤������)���vendor/seld/phar-utils/src/Timestamps.php^ ��6Æe^ ���åÃD¤������"���vendor/seld/signal-handler/LICENSE$��6Æe$��š,M§¤������0���vendor/seld/signal-handler/src/SignalHandler.php°��6Æe°����
  49. ¤������&���vendor/symfony/console/Application.phpq��6Æeq��%dé¤������.���vendor/symfony/console/Attribute/AsCommand.phpÔ��6ÆeÔ��½3Üþ¤������2���vendor/symfony/console/CI/GithubActionReporter.phpõ��6Æeõ��¾Û"g¤������ ���vendor/symfony/console/Color.phph��6Æeh��Gbç—¤������*���vendor/symfony/console/Command/Command.phpJ'��6ÆeJ'��� Úw¤������2���vendor/symfony/console/Command/CompleteCommand.php‹��6Æe‹��¾}¤������8���vendor/symfony/console/Command/DumpCompletionCommand.php���6Æe���9›9¤������.���vendor/symfony/console/Command/HelpCommand.php ��6Æe ��}—¥¤������.���vendor/symfony/console/Command/LazyCommand.php›��6Æe›��žmå¤������.���vendor/symfony/console/Command/ListCommand.php1 ��6Æe1 ��$D»|¤������0���vendor/symfony/console/Command/LockableTrait.php��6Æe��q5gj¤������=���vendor/symfony/console/Command/SignalableCommandInterface.phpÓ���6ÆeÓ���»B`¾¤������?���vendor/symfony/console/CommandLoader/CommandLoaderInterface.phpQ��6ÆeQ��›žH¤������?���vendor/symfony/console/CommandLoader/ContainerCommandLoader.phpU��6ÆeU��Ë_ü¤������=���vendor/symfony/console/CommandLoader/FactoryCommandLoader.php¯��6Æe¯��d¼"z¤������5���vendor/symfony/console/Completion/CompletionInput.php��6Æe��”$„k¤������;���vendor/symfony/console/Completion/CompletionSuggestions.phpÂ��6ÆeÂ��A¡¤������A���vendor/symfony/console/Completion/Output/BashCompletionOutput.phpg��6Æeg��‡ìùW¤������F���vendor/symfony/console/Completion/Output/CompletionOutputInterface.phpF��6ÆeF��Ô2nM¤������0���vendor/symfony/console/Completion/Suggestion.php3��6Æe3��̆ ¤������(���vendor/symfony/console/ConsoleEvents.phpÕ��6ÆeÕ���gw]¤������!���vendor/symfony/console/Cursor.php� ��6Æe� ��Æ«§Ž¤������D���vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.phpf��6Æef��#Ô $¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÙ ��6ÆeÙ ��çpC^¤������0���vendor/symfony/console/Descriptor/Descriptor.php}��6Æe}��±ê3^¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.php÷���6Æe÷���µå@à¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpë��6Æeë��1%è�¤������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.phpQ��6ÆeQ��t ˆv¤������4���vendor/symfony/console/Descriptor/TextDescriptor.phpç"��6Æeç"��ȸÌˤ������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��6Æe��uI@š¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.phpÉ��6ÆeÉ��°Öá¤������2���vendor/symfony/console/Event/ConsoleErrorEvent.phpý��6Æeý��é%˜¤������-���vendor/symfony/console/Event/ConsoleEvent.phpÆ��6ÆeÆ��ÅoÛÙ¤������3���vendor/symfony/console/Event/ConsoleSignalEvent.phpG��6ÆeG��Žû ¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.php~��6Æe~��hr½Ö¤������6���vendor/symfony/console/EventListener/ErrorListener.php'��6Æe'��𢡉¤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÛ��6ÆeÛ��K}ž¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpy���6Æey���Ù9[&¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���6Æe¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���6Æe¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���6Æe’���ÍO\e¤������:���vendor/symfony/console/Exception/MissingInputException.phpœ���6Æeœ���æS
  50. þ¤������?���vendor/symfony/console/Exception/NamespaceNotFoundException.php‹���6Æe‹���‚ón©¤������5���vendor/symfony/console/Exception/RuntimeException.php–���6Æe–���Ùí,6¤������8���vendor/symfony/console/Formatter/NullOutputFormatter.php���6Æe���!& u¤������=���vendor/symfony/console/Formatter/NullOutputFormatterStyle.php ��6Æe ��Ê0‡Ø¤������4���vendor/symfony/console/Formatter/OutputFormatter.php��6Æe��Ü楤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.php£��6Æe£��Y §ß¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpz��6Æez��ÿja­¤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.phpŸ��6ÆeŸ��ø€Äw¤������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php…��6Æe…��LÙኤ������F���vendor/symfony/console/Formatter/WrappableOutputFormatterInterface.phpÖ���6ÆeÖ���¡Z·¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.php¸��6Æe¸��¤ð6 ¤������2���vendor/symfony/console/Helper/DescriptorHelper.phpÀ��6ÆeÀ��¦gÌ„¤������(���vendor/symfony/console/Helper/Dumper.php��6Æe��Ÿ<Ëߤ������1���vendor/symfony/console/Helper/FormatterHelper.phpi��6Æei��¤¶€w¤������(���vendor/symfony/console/Helper/Helper.php� ��6Æe� ��Á”1T¤������1���vendor/symfony/console/Helper/HelperInterface.phpæ���6Æeæ���`RÂ\¤������+���vendor/symfony/console/Helper/HelperSet.phpI��6ÆeI��=‡âD¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��6Æec��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.php\ ��6Æe\ ��ÄzA¤������-���vendor/symfony/console/Helper/ProgressBar.phpM/��6ÆeM/��œ¼øܤ������3���vendor/symfony/console/Helper/ProgressIndicator.phpÀ��6ÆeÀ��‡Ëeõ¤������0���vendor/symfony/console/Helper/QuestionHelper.phpÁ.��6ÆeÁ.��Ú×ó¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php ��6Æe ��à�dÿ¤������'���vendor/symfony/console/Helper/Table.php=J��6Æe=J��PCù¤������+���vendor/symfony/console/Helper/TableCell.phpA��6ÆeA��èÓ ¤������0���vendor/symfony/console/Helper/TableCellStyle.phpî��6Æeî��Ñ�¹_¤������+���vendor/symfony/console/Helper/TableRows.php)��6Æe)��WŠ3z¤������0���vendor/symfony/console/Helper/TableSeparator.phpÅ���6ÆeÅ���¼õËü¤������,���vendor/symfony/console/Helper/TableStyle.php���6Æe���Wº¤������*���vendor/symfony/console/Input/ArgvInput.php+��6Æe+��F±¶Ñ¤������+���vendor/symfony/console/Input/ArrayInput.php ��6Æe ��ñ¦Ÿ.¤������&���vendor/symfony/console/Input/Input.php¤ ��6Æe¤ ��ÚÜo±¤������.���vendor/symfony/console/Input/InputArgument.php��6Æe��ΠÀú¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���6Æe˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php#��6Æe#�� Œ!3¤������/���vendor/symfony/console/Input/InputInterface.phpü��6Æeü��G¶ô¨¤������,���vendor/symfony/console/Input/InputOption.php��6Æe��ù�"ؤ������9���vendor/symfony/console/Input/StreamableInputInterface.phpÎ���6ÆeÎ���ÖÕB›¤������,���vendor/symfony/console/Input/StringInput.php?��6Æe?��±’ˤ���������vendor/symfony/console/LICENSE.��6Æe.��÷ºk¤������/���vendor/symfony/console/Logger/ConsoleLogger.php ��6Æe ��Ç Q¤������0���vendor/symfony/console/Output/BufferedOutput.phpl��6Æel��y:¸¤������/���vendor/symfony/console/Output/ConsoleOutput.php‘ ��6Æe‘ ��\Ýïb¤������8���vendor/symfony/console/Output/ConsoleOutputInterface.php��6Æe��‰ê÷´¤������6���vendor/symfony/console/Output/ConsoleSectionOutput.php” ��6Æe” ��Àgo@¤������,���vendor/symfony/console/Output/NullOutput.phpB��6ÆeB��%#RƤ������(���vendor/symfony/console/Output/Output.phpÈ ��6ÆeÈ ��ŸË8x¤������1���vendor/symfony/console/Output/OutputInterface.phpí��6Æeí��ðŽ¾¤������.���vendor/symfony/console/Output/StreamOutput.phpT��6ÆeT��¤2Ff¤������5���vendor/symfony/console/Output/TrimmedBufferOutput.phpÛ��6ÆeÛ��lkƒ~¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpÝ
  51. ��6ÆeÝ
  52. �� c䦤������8���vendor/symfony/console/Question/ConfirmationQuestion.php��6Æe��îyÅ„¤������,���vendor/symfony/console/Question/Question.php" ��6Æe" ��ÊÞ¹Û¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��6Æe�$��•�¥v¤������0���vendor/symfony/console/Resources/completion.bashÉ
  53. ��6ÆeÉ
  54. �� z(¤������8���vendor/symfony/console/SignalRegistry/SignalRegistry.php!��6Æe!��~.:¯¤������3���vendor/symfony/console/SingleCommandApplication.php7��6Æe7��Í1¾¤������,���vendor/symfony/console/Style/OutputStyle.phpt��6Æet��O;Ƥ������/���vendor/symfony/console/Style/StyleInterface.php��6Æe��\ž¤������-���vendor/symfony/console/Style/SymfonyStyle.php5'��6Æe5'��yl÷ô¤������#���vendor/symfony/console/Terminal.php„ ��6Æe„ ��Î9®?¤������3���vendor/symfony/console/Tester/ApplicationTester.phpŒ��6ÆeŒ��Iû¤������9���vendor/symfony/console/Tester/CommandCompletionTester.phpÚ��6ÆeÚ��Ê›;°¤������/���vendor/symfony/console/Tester/CommandTester.phpÙ��6ÆeÙ��D¶¤������@���vendor/symfony/console/Tester/Constraint/CommandIsSuccessful.phpÖ��6ÆeÖ��ƃ‚¤������-���vendor/symfony/console/Tester/TesterTrait.php¬ ��6Æe¬ ��2'L²¤������,���vendor/symfony/deprecation-contracts/LICENSE+��6Æe+��†vù±¤������1���vendor/symfony/deprecation-contracts/function.php=��6Æe=��žÁ´ ¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.php|���6Æe|����éD¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.phpÑ��6ÆeÑ��bæ}´¤������3���vendor/symfony/filesystem/Exception/IOException.php›��6Æe›��3_Ãê¤������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���6Æe¦���jÙwM¤������@���vendor/symfony/filesystem/Exception/InvalidArgumentException.php©���6Æe©����!Ǥ������8���vendor/symfony/filesystem/Exception/RuntimeException.php™���6Æe™���ÝUUH¤������(���vendor/symfony/filesystem/Filesystem.phpTA��6ÆeTA��|¯m…¤������!���vendor/symfony/filesystem/LICENSE.��6Æe.��÷ºk¤������"���vendor/symfony/filesystem/Path.php>'��6Æe>'��,œ"ɤ������/���vendor/symfony/finder/Comparator/Comparator.php4��6Æe4��"ì¼Õ¤������3���vendor/symfony/finder/Comparator/DateComparator.php��6Æe��Ï%úe¤������5���vendor/symfony/finder/Comparator/NumberComparator.phpz��6Æez��+¼�h¤������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���6Æe„���½¾sœ¤������>���vendor/symfony/finder/Exception/DirectoryNotFoundException.php‰���6Æe‰���a)ÿ¤������ ���vendor/symfony/finder/Finder.phpÖ'��6ÆeÖ'��Ž?ä¤������#���vendor/symfony/finder/Gitignore.php³��6Æe³��s 4¤���������vendor/symfony/finder/Glob.phpÇ��6ÆeÇ��Db‡³¤������7���vendor/symfony/finder/Iterator/CustomFilterIterator.phpc��6Æec��7ð™¤������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.php���6Æe���Pšs¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php��6Æe��§Ž¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php0��6Æe0��.wv¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpˆ��6Æeˆ��^¶"û¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.phpW��6ÆeW��ÂÅÙ¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.php”��6Æe”��=™Üô¤������/���vendor/symfony/finder/Iterator/LazyIterator.phpQ��6ÆeQ��n]¿¼¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php���6Æe���¢€×¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpò��6Æeò��g"_¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.phpæ��6Æeæ��Ú4ùD¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php|��6Æe|��3ÙŸ¤������3���vendor/symfony/finder/Iterator/SortableIterator.php(
  55. ��6Æe(
  56. ��Ó⮤������;���vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.phpw
  57. ��6Æew
  58. ��ŵ3¤���������vendor/symfony/finder/LICENSE.��6Æe.��÷ºk¤������%���vendor/symfony/finder/SplFileInfo.php½��6Æe½��y¤������'���vendor/symfony/polyfill-ctype/Ctype.php‡
  59. ��6Æe‡
  60. ��~¶d¸¤������%���vendor/symfony/polyfill-ctype/LICENSE.��6Æe.��¦¸©X¤������+���vendor/symfony/polyfill-ctype/bootstrap.php2��6Æe2��Èa­8¤������-���vendor/symfony/polyfill-ctype/bootstrap80.phph��6Æeh��K¿y¸¤������2���vendor/symfony/polyfill-intl-grapheme/Grapheme.phpÚ��6ÆeÚ��� ›¤������-���vendor/symfony/polyfill-intl-grapheme/LICENSE.��6Æe.��Ëk¤������3���vendor/symfony/polyfill-intl-grapheme/bootstrap.phpÏ��6ÆeÏ��ý9À|¤������5���vendor/symfony/polyfill-intl-grapheme/bootstrap80.phpY ��6ÆeY ��¨! ¤������/���vendor/symfony/polyfill-intl-normalizer/LICENSE.��6Æe.��Ëk¤������6���vendor/symfony/polyfill-intl-normalizer/Normalizer.phpö��6Æeö��êiÝe¤������F���vendor/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php.��6Æe.��Qs$—¤������R���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalComposition.php‰=��6Æe‰=��*ïo?¤������T���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalDecomposition.phpaˆ��6Æeaˆ��çR½}¤������L���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/combiningClass.phpt.��6Æet.�� q�ܤ������X���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/compatibilityDecomposition.php™è��6Æe™è��o”e)¤������5���vendor/symfony/polyfill-intl-normalizer/bootstrap.phpë��6Æeë��Pú£D¤������7���vendor/symfony/polyfill-intl-normalizer/bootstrap80.phpé��6Æeé��=år´¤������(���vendor/symfony/polyfill-mbstring/LICENSE.��6Æe.��Ëk¤������-���vendor/symfony/polyfill-mbstring/Mbstring.php˜S��6Æe˜S��3ê f¤������B���vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php•��6Æe•��ô¶³ã¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.phpùT��6ÆeùT��•±+¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��6Æeã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php8[��6Æe8[��+RØ*¤������.���vendor/symfony/polyfill-mbstring/bootstrap.phpÈ��6ÆeÈ��'w@0¤������0���vendor/symfony/polyfill-mbstring/bootstrap80.php×!��6Æe×!��ã .Ѥ������%���vendor/symfony/polyfill-php73/LICENSE.��6Æe.��¦¸©X¤������'���vendor/symfony/polyfill-php73/Php73.phpn��6Æen��Cs¥l¤������?���vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php[���6Æe[���M²Ü¤������+���vendor/symfony/polyfill-php73/bootstrap.phpù��6Æeù��AY8Ƥ������%���vendor/symfony/polyfill-php80/LICENSE.��6Æe.��äôˆ¤������'���vendor/symfony/polyfill-php80/Php80.php¡ ��6Æe¡ ��[Âk ¤������*���vendor/symfony/polyfill-php80/PhpToken.php��6Æe��M£�I¤������;���vendor/symfony/polyfill-php80/Resources/stubs/Attribute.phpÇ��6ÆeÇ��ÝÞíû¤������:���vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php����6Æe����Ú”ݤ������<���vendor/symfony/polyfill-php80/Resources/stubs/Stringable.phpk���6Æek���Ðý+¤������E���vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php]���6Æe]���ºgä������<���vendor/symfony/polyfill-php80/Resources/stubs/ValueError.phpT���6ÆeT���‘Öw—¤������+���vendor/symfony/polyfill-php80/bootstrap.phpú��6Æeú��×îå¤������%���vendor/symfony/polyfill-php81/LICENSE.��6Æe.��;c©§¤������'���vendor/symfony/polyfill-php81/Php81.php;��6Æe;��ù«d¤������@���vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.phpƒ��6Æeƒ��hؤ������F���vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.phpŸ���6ÆeŸ���ÎÀ¾ü¤������+���vendor/symfony/polyfill-php81/bootstrap.phpô��6Æeô��ˆÓÐ\¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpy���6Æey���qVXJ¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���6Æe¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���6Æe”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��6Æex��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessSignaledException.php��6Æe��Yשâ¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php1��6Æe1��‚'Z¤������5���vendor/symfony/process/Exception/RuntimeException.php˜���6Æe˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.phpº��6Æeº��ÝØå¤������&���vendor/symfony/process/InputStream.php0��6Æe0��Œ„>‡¤���������vendor/symfony/process/LICENSE.��6Æe.��÷ºk¤������.���vendor/symfony/process/PhpExecutableFinder.php•��6Æe•��½r�ɤ������%���vendor/symfony/process/PhpProcess.phpø��6Æeø��pÄX¤������.���vendor/symfony/process/Pipes/AbstractPipes.php ��6Æe ��kSQ¤������/���vendor/symfony/process/Pipes/PipesInterface.php™��6Æe™��fQÚ ¤������*���vendor/symfony/process/Pipes/UnixPipes.php€��6Æe€��¾”Vv¤������-���vendor/symfony/process/Pipes/WindowsPipes.php4 ��6Æe4 �� VÄà¤������"���vendor/symfony/process/Process.phpf��6Æef��nÊ�!¤������'���vendor/symfony/process/ProcessUtils.php��6Æe��ÓXì¤������7���vendor/symfony/service-contracts/Attribute/Required.php¨���6Æe¨���xj네������@���vendor/symfony/service-contracts/Attribute/SubscribedService.php
  61. ��6Æe
  62. ��1I®T¤������(���vendor/symfony/service-contracts/LICENSE+��6Æe+��JˆE ¤������3���vendor/symfony/service-contracts/ResetInterface.phpy���6Æey���°·jå¤������8���vendor/symfony/service-contracts/ServiceLocatorTrait.phpã ��6Æeã ��"�5é¤������=���vendor/symfony/service-contracts/ServiceProviderInterface.phpÞ���6ÆeÞ���úRèk¤������?���vendor/symfony/service-contracts/ServiceSubscriberInterface.php³���6Æe³���—öd ¤������;���vendor/symfony/service-contracts/ServiceSubscriberTrait.phpS
  63. ��6ÆeS
  64. ��ªë4£¤������<���vendor/symfony/service-contracts/Test/ServiceLocatorTest.php˜��6Æe˜��W7|G¤������(���vendor/symfony/string/AbstractString.php*4��6Æe*4��°J û¤������/���vendor/symfony/string/AbstractUnicodeString.php¼R��6Æe¼R��Ö)×ï¤������$���vendor/symfony/string/ByteString.phpÿ+��6Æeÿ+��K«Ó^¤������)���vendor/symfony/string/CodePointString.phpõ��6Æeõ��BÂ�¤������6���vendor/symfony/string/Exception/ExceptionInterface.phps���6Æes���qHV‘¤������<���vendor/symfony/string/Exception/InvalidArgumentException.php¢���6Æe¢���¥A¤������4���vendor/symfony/string/Exception/RuntimeException.php’���6Æe’���u‘g¤������4���vendor/symfony/string/Inflector/EnglishInflector.phpn��6Æen��ʤR}¤������3���vendor/symfony/string/Inflector/FrenchInflector.phpˆ
  65. ��6Æeˆ
  66. ��·ŠH¤������6���vendor/symfony/string/Inflector/InflectorInterface.php×���6Æe×���hD£¤���������vendor/symfony/string/LICENSE.��6Æe.��š?ôw¤������$���vendor/symfony/string/LazyString.phpH ��6ÆeH ��ÓOï¤������<���vendor/symfony/string/Resources/data/wcswidth_table_wide.phpÅ��6ÆeÅ��ð:†Ì¤������<���vendor/symfony/string/Resources/data/wcswidth_table_zero.php��6Æe�� k¤������-���vendor/symfony/string/Resources/functions.php��6Æe��cÚª"¤������.���vendor/symfony/string/Slugger/AsciiSlugger.phpì��6Æeì��}&ʤ������2���vendor/symfony/string/Slugger/SluggerInterface.php��6Æe���kñ¨¤������'���vendor/symfony/string/UnicodeString.phpí%��6Æeí%��ýÁ˜5¤������ ���bin/composer5 ��6Æe5 ��á?â¤���������LICENSE.��6Æe.�� Õ¤������<?php declare(strict_types=1);
  67. namespace Composer\Advisory;
  68. use Composer\IO\ConsoleIO;
  69. use Composer\IO\IOInterface;
  70. use Composer\Json\JsonFile;
  71. use Composer\Package\CompletePackageInterface;
  72. use Composer\Package\PackageInterface;
  73. use Composer\Repository\RepositorySet;
  74. use Composer\Util\PackageInfo;
  75. use Composer\Util\Platform;
  76. use InvalidArgumentException;
  77. use Symfony\Component\Console\Formatter\OutputFormatter;
  78. class Auditor
  79. {
  80. public const FORMAT_TABLE = 'table';
  81. public const FORMAT_PLAIN = 'plain';
  82. public const FORMAT_JSON = 'json';
  83. public const FORMAT_SUMMARY = 'summary';
  84. public const FORMATS = [
  85. self::FORMAT_TABLE,
  86. self::FORMAT_PLAIN,
  87. self::FORMAT_JSON,
  88. self::FORMAT_SUMMARY,
  89. ];
  90. public const ABANDONED_IGNORE = 'ignore';
  91. public const ABANDONED_REPORT = 'report';
  92. public const ABANDONED_FAIL = 'fail';
  93. public function audit(IOInterface $io, RepositorySet $repoSet, array $packages, string $format, bool $warningOnly = true, array $ignoreList = [], string $abandoned = self::ABANDONED_FAIL): int
  94. {
  95. $allAdvisories = $repoSet->getMatchingSecurityAdvisories($packages, $format === self::FORMAT_SUMMARY);
  96. if (count($allAdvisories) > 0 && $ignoreList !== [] && $format === self::FORMAT_SUMMARY) {
  97. $allAdvisories = $repoSet->getMatchingSecurityAdvisories($packages, false);
  98. }
  99. ['advisories' => $advisories, 'ignoredAdvisories' => $ignoredAdvisories] = $this->processAdvisories($allAdvisories, $ignoreList);
  100. $abandonedCount = 0;
  101. $affectedPackagesCount = 0;
  102. if ($abandoned === self::ABANDONED_IGNORE) {
  103. $abandonedPackages = [];
  104. } else {
  105. $abandonedPackages = $this->filterAbandonedPackages($packages);
  106. if ($abandoned === self::ABANDONED_FAIL) {
  107. $abandonedCount = count($abandonedPackages);
  108. }
  109. }
  110. if (self::FORMAT_JSON === $format) {
  111. $json = ['advisories' => $advisories];
  112. if ($ignoredAdvisories !== []) {
  113. $json['ignored-advisories'] = $ignoredAdvisories;
  114. }
  115. $json['abandoned'] = array_reduce($abandonedPackages, static function(array $carry, CompletePackageInterface $package): array {
  116. $carry[$package->getPrettyName()] = $package->getReplacementPackage();
  117. return $carry;
  118. }, []);
  119. $io->write(JsonFile::encode($json));
  120. return count($advisories) + $abandonedCount;
  121. }
  122. $errorOrWarn = $warningOnly ? 'warning' : 'error';
  123. if (count($advisories) > 0 || count($ignoredAdvisories) > 0) {
  124. $passes = [
  125. [$ignoredAdvisories, "<info>Found %d ignored security vulnerability advisor%s affecting %d package%s%s</info>"],
  126. [$advisories, "<$errorOrWarn>Found %d security vulnerability advisor%s affecting %d package%s%s</$errorOrWarn>"],
  127. ];
  128. foreach ($passes as [$advisoriesToOutput, $message]) {
  129. [$affectedPackagesCount, $totalAdvisoryCount] = $this->countAdvisories($advisoriesToOutput);
  130. if ($affectedPackagesCount > 0) {
  131. $plurality = $totalAdvisoryCount === 1 ? 'y' : 'ies';
  132. $pkgPlurality = $affectedPackagesCount === 1 ? '' : 's';
  133. $punctuation = $format === 'summary' ? '.' : ':';
  134. $io->writeError(sprintf($message, $totalAdvisoryCount, $plurality, $affectedPackagesCount, $pkgPlurality, $punctuation));
  135. $this->outputAdvisories($io, $advisoriesToOutput, $format);
  136. }
  137. }
  138. if ($format === self::FORMAT_SUMMARY) {
  139. $io->writeError('Run "composer audit" for a full list of advisories.');
  140. }
  141. } else {
  142. $io->writeError('<info>No security vulnerability advisories found.</info>');
  143. }
  144. if (count($abandonedPackages) > 0 && $format !== self::FORMAT_SUMMARY) {
  145. $this->outputAbandonedPackages($io, $abandonedPackages, $format);
  146. }
  147. return $affectedPackagesCount + $abandonedCount;
  148. }
  149. private function filterAbandonedPackages(array $packages): array
  150. {
  151. return array_filter($packages, static function (PackageInterface $pkg) {
  152. return $pkg instanceof CompletePackageInterface && $pkg->isAbandoned();
  153. });
  154. }
  155. private function processAdvisories(array $allAdvisories, array $ignoreList): array
  156. {
  157. if ($ignoreList === []) {
  158. return ['advisories' => $allAdvisories, 'ignoredAdvisories' => []];
  159. }
  160. if (\count($ignoreList) > 0 && !\array_is_list($ignoreList)) {
  161. $ignoredIds = array_keys($ignoreList);
  162. } else {
  163. $ignoredIds = $ignoreList;
  164. }
  165. $advisories = [];
  166. $ignored = [];
  167. $ignoreReason = null;
  168. foreach ($allAdvisories as $package => $pkgAdvisories) {
  169. foreach ($pkgAdvisories as $advisory) {
  170. $isActive = true;
  171. if (in_array($advisory->advisoryId, $ignoredIds, true)) {
  172. $isActive = false;
  173. $ignoreReason = $ignoreList[$advisory->advisoryId] ?? null;
  174. }
  175. if ($advisory instanceof SecurityAdvisory) {
  176. if (in_array($advisory->cve, $ignoredIds, true)) {
  177. $isActive = false;
  178. $ignoreReason = $ignoreList[$advisory->cve] ?? null;
  179. }
  180. foreach ($advisory->sources as $source) {
  181. if (in_array($source['remoteId'], $ignoredIds, true)) {
  182. $isActive = false;
  183. $ignoreReason = $ignoreList[$source['remoteId']] ?? null;
  184. break;
  185. }
  186. }
  187. }
  188. if ($isActive) {
  189. $advisories[$package][] = $advisory;
  190. continue;
  191. }
  192. if ($advisory instanceof SecurityAdvisory) {
  193. $advisory = $advisory->toIgnoredAdvisory($ignoreReason);
  194. }
  195. $ignored[$package][] = $advisory;
  196. }
  197. }
  198. return ['advisories' => $advisories, 'ignoredAdvisories' => $ignored];
  199. }
  200. private function countAdvisories(array $advisories): array
  201. {
  202. $count = 0;
  203. foreach ($advisories as $packageAdvisories) {
  204. $count += count($packageAdvisories);
  205. }
  206. return [count($advisories), $count];
  207. }
  208. private function outputAdvisories(IOInterface $io, array $advisories, string $format): void
  209. {
  210. switch ($format) {
  211. case self::FORMAT_TABLE:
  212. if (!($io instanceof ConsoleIO)) {
  213. throw new InvalidArgumentException('Cannot use table format with ' . get_class($io));
  214. }
  215. $this->outputAdvisoriesTable($io, $advisories);
  216. return;
  217. case self::FORMAT_PLAIN:
  218. $this->outputAdvisoriesPlain($io, $advisories);
  219. return;
  220. case self::FORMAT_SUMMARY:
  221. return;
  222. default:
  223. throw new InvalidArgumentException('Invalid format "'.$format.'".');
  224. }
  225. }
  226. private function outputAdvisoriesTable(ConsoleIO $io, array $advisories): void
  227. {
  228. foreach ($advisories as $packageAdvisories) {
  229. foreach ($packageAdvisories as $advisory) {
  230. $headers = [
  231. 'Package',
  232. 'Severity',
  233. 'CVE',
  234. 'Title',
  235. 'URL',
  236. 'Affected versions',
  237. 'Reported at',
  238. ];
  239. $row = [
  240. $advisory->packageName,
  241. $this->getSeverity($advisory),
  242. $this->getCVE($advisory),
  243. $advisory->title,
  244. $this->getURL($advisory),
  245. $advisory->affectedVersions->getPrettyString(),
  246. $advisory->reportedAt->format(DATE_ATOM),
  247. ];
  248. if ($advisory instanceof IgnoredSecurityAdvisory) {
  249. $headers[] = 'Ignore reason';
  250. $row[] = $advisory->ignoreReason ?? 'None specified';
  251. }
  252. $io->getTable()
  253. ->setHorizontal()
  254. ->setHeaders($headers)
  255. ->addRow($row)
  256. ->setColumnWidth(1, 80)
  257. ->setColumnMaxWidth(1, 80)
  258. ->render();
  259. }
  260. }
  261. }
  262. private function outputAdvisoriesPlain(IOInterface $io, array $advisories): void
  263. {
  264. $error = [];
  265. $firstAdvisory = true;
  266. foreach ($advisories as $packageAdvisories) {
  267. foreach ($packageAdvisories as $advisory) {
  268. if (!$firstAdvisory) {
  269. $error[] = '--------';
  270. }
  271. $error[] = "Package: ".$advisory->packageName;
  272. $error[] = "Severity: ".$this->getSeverity($advisory);
  273. $error[] = "CVE: ".$this->getCVE($advisory);
  274. $error[] = "Title: ".OutputFormatter::escape($advisory->title);
  275. $error[] = "URL: ".$this->getURL($advisory);
  276. $error[] = "Affected versions: ".OutputFormatter::escape($advisory->affectedVersions->getPrettyString());
  277. $error[] = "Reported at: ".$advisory->reportedAt->format(DATE_ATOM);
  278. if ($advisory instanceof IgnoredSecurityAdvisory) {
  279. $error[] = "Ignore reason: ".($advisory->ignoreReason ?? 'None specified');
  280. }
  281. $firstAdvisory = false;
  282. }
  283. }
  284. $io->writeError($error);
  285. }
  286. private function outputAbandonedPackages(IOInterface $io, array $packages, string $format): void
  287. {
  288. $io->writeError(sprintf('<error>Found %d abandoned package%s:</error>', count($packages), count($packages) > 1 ? 's' : ''));
  289. if ($format === self::FORMAT_PLAIN) {
  290. foreach ($packages as $pkg) {
  291. $replacement = $pkg->getReplacementPackage() !== null
  292. ? 'Use '.$pkg->getReplacementPackage().' instead'
  293. : 'No replacement was suggested';
  294. $io->writeError(sprintf(
  295. '%s is abandoned. %s.',
  296. $this->getPackageNameWithLink($pkg),
  297. $replacement
  298. ));
  299. }
  300. return;
  301. }
  302. if (!($io instanceof ConsoleIO)) {
  303. throw new InvalidArgumentException('Cannot use table format with ' . get_class($io));
  304. }
  305. $table = $io->getTable()
  306. ->setHeaders(['Abandoned Package', 'Suggested Replacement'])
  307. ->setColumnWidth(1, 80)
  308. ->setColumnMaxWidth(1, 80);
  309. foreach ($packages as $pkg) {
  310. $replacement = $pkg->getReplacementPackage() !== null ? $pkg->getReplacementPackage() : 'none';
  311. $table->addRow([$this->getPackageNameWithLink($pkg), $replacement]);
  312. }
  313. $table->render();
  314. }
  315. private function getPackageNameWithLink(PackageInterface $package): string
  316. {
  317. $packageUrl = PackageInfo::getViewSourceOrHomepageUrl($package);
  318. return $packageUrl !== null ? '<href=' . OutputFormatter::escape($packageUrl) . '>' . $package->getPrettyName() . '</>' : $package->getPrettyName();
  319. }
  320. private function getSeverity(SecurityAdvisory $advisory): string
  321. {
  322. if ($advisory->severity === null) {
  323. return '';
  324. }
  325. return $advisory->severity;
  326. }
  327. private function getCVE(SecurityAdvisory $advisory): string
  328. {
  329. if ($advisory->cve === null) {
  330. return 'NO CVE';
  331. }
  332. return '<href=https://cve.mitre.org/cgi-bin/cvename.cgi?name='.$advisory->cve.'>'.$advisory->cve.'</>';
  333. }
  334. private function getURL(SecurityAdvisory $advisory): string
  335. {
  336. if ($advisory->link === null) {
  337. return '';
  338. }
  339. return '<href='.OutputFormatter::escape($advisory->link).'>'.OutputFormatter::escape($advisory->link).'</>';
  340. }
  341. }
  342. <?php declare(strict_types=1);
  343. namespace Composer\Advisory;
  344. use Composer\Semver\Constraint\ConstraintInterface;
  345. use DateTimeImmutable;
  346. class IgnoredSecurityAdvisory extends SecurityAdvisory
  347. {
  348. public $ignoreReason;
  349. public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions, string $title, array $sources, DateTimeImmutable $reportedAt, ?string $cve = null, ?string $link = null, ?string $ignoreReason = null, ?string $severity = null)
  350. {
  351. parent::__construct($packageName, $advisoryId, $affectedVersions, $title, $sources, $reportedAt, $cve, $link, $severity);
  352. $this->ignoreReason = $ignoreReason;
  353. }
  354. #[\ReturnTypeWillChange]
  355. public function jsonSerialize()
  356. {
  357. $data = parent::jsonSerialize();
  358. if ($this->ignoreReason === NULL) {
  359. unset($data['ignoreReason']);
  360. }
  361. return $data;
  362. }
  363. }
  364. <?php declare(strict_types=1);
  365. namespace Composer\Advisory;
  366. use Composer\Semver\Constraint\ConstraintInterface;
  367. use Composer\Semver\VersionParser;
  368. use JsonSerializable;
  369. class PartialSecurityAdvisory implements JsonSerializable
  370. {
  371. public $advisoryId;
  372. public $packageName;
  373. public $affectedVersions;
  374. public static function create(string $packageName, array $data, VersionParser $parser): self
  375. {
  376. $constraint = $parser->parseConstraints($data['affectedVersions']);
  377. if (isset($data['title'], $data['sources'], $data['reportedAt'])) {
  378. return new SecurityAdvisory($packageName, $data['advisoryId'], $constraint, $data['title'], $data['sources'], new \DateTimeImmutable($data['reportedAt'], new \DateTimeZone('UTC')), $data['cve'] ?? null, $data['link'] ?? null, $data['severity'] ?? null);
  379. }
  380. return new self($packageName, $data['advisoryId'], $constraint);
  381. }
  382. public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions)
  383. {
  384. $this->advisoryId = $advisoryId;
  385. $this->packageName = $packageName;
  386. $this->affectedVersions = $affectedVersions;
  387. }
  388. #[\ReturnTypeWillChange]
  389. public function jsonSerialize()
  390. {
  391. $data = (array) $this;
  392. $data['affectedVersions'] = $data['affectedVersions']->getPrettyString();
  393. return $data;
  394. }
  395. }
  396. <?php declare(strict_types=1);
  397. namespace Composer\Advisory;
  398. use Composer\Semver\Constraint\ConstraintInterface;
  399. use DateTimeImmutable;
  400. class SecurityAdvisory extends PartialSecurityAdvisory
  401. {
  402. public $title;
  403. public $cve;
  404. public $link;
  405. public $reportedAt;
  406. public $sources;
  407. public $severity;
  408. public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions, string $title, array $sources, DateTimeImmutable $reportedAt, ?string $cve = null, ?string $link = null, ?string $severity = null)
  409. {
  410. parent::__construct($packageName, $advisoryId, $affectedVersions);
  411. $this->title = $title;
  412. $this->sources = $sources;
  413. $this->reportedAt = $reportedAt;
  414. $this->cve = $cve;
  415. $this->link = $link;
  416. $this->severity = $severity;
  417. }
  418. public function toIgnoredAdvisory(?string $ignoreReason): IgnoredSecurityAdvisory
  419. {
  420. return new IgnoredSecurityAdvisory(
  421. $this->packageName,
  422. $this->advisoryId,
  423. $this->affectedVersions,
  424. $this->title,
  425. $this->sources,
  426. $this->reportedAt,
  427. $this->cve,
  428. $this->link,
  429. $ignoreReason,
  430. $this->severity
  431. );
  432. }
  433. #[\ReturnTypeWillChange]
  434. public function jsonSerialize()
  435. {
  436. $data = parent::jsonSerialize();
  437. $data['reportedAt'] = $data['reportedAt']->format(DATE_RFC3339);
  438. return $data;
  439. }
  440. }
  441. <?php declare(strict_types=1);
  442. namespace Composer\Autoload;
  443. use Composer\ClassMapGenerator\ClassMap;
  444. use Composer\ClassMapGenerator\ClassMapGenerator;
  445. use Composer\Config;
  446. use Composer\EventDispatcher\EventDispatcher;
  447. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  448. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  449. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  450. use Composer\Installer\InstallationManager;
  451. use Composer\IO\IOInterface;
  452. use Composer\IO\NullIO;
  453. use Composer\Package\AliasPackage;
  454. use Composer\Package\PackageInterface;
  455. use Composer\Package\RootPackageInterface;
  456. use Composer\Pcre\Preg;
  457. use Composer\Repository\InstalledRepositoryInterface;
  458. use Composer\Semver\Constraint\Bound;
  459. use Composer\Util\Filesystem;
  460. use Composer\Util\Platform;
  461. use Composer\Script\ScriptEvents;
  462. use Composer\Util\PackageSorter;
  463. use Composer\Json\JsonFile;
  464. use Composer\Package\Locker;
  465. class AutoloadGenerator
  466. {
  467. private $eventDispatcher;
  468. private $io;
  469. private $devMode = null;
  470. private $classMapAuthoritative = false;
  471. private $apcu = false;
  472. private $apcuPrefix;
  473. private $dryRun = false;
  474. private $runScripts = false;
  475. private $platformRequirementFilter;
  476. public function __construct(EventDispatcher $eventDispatcher, ?IOInterface $io = null)
  477. {
  478. $this->eventDispatcher = $eventDispatcher;
  479. $this->io = $io ?? new NullIO();
  480. $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  481. }
  482. public function setDevMode(bool $devMode = true)
  483. {
  484. $this->devMode = $devMode;
  485. }
  486. public function setClassMapAuthoritative(bool $classMapAuthoritative)
  487. {
  488. $this->classMapAuthoritative = $classMapAuthoritative;
  489. }
  490. public function setApcu(bool $apcu, ?string $apcuPrefix = null)
  491. {
  492. $this->apcu = $apcu;
  493. $this->apcuPrefix = $apcuPrefix;
  494. }
  495. public function setRunScripts(bool $runScripts = true)
  496. {
  497. $this->runScripts = $runScripts;
  498. }
  499. public function setDryRun(bool $dryRun = true): void
  500. {
  501. $this->dryRun = $dryRun;
  502. }
  503. public function setIgnorePlatformRequirements($ignorePlatformReqs)
  504. {
  505. trigger_error('AutoloadGenerator::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
  506. $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
  507. }
  508. public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter)
  509. {
  510. $this->platformRequirementFilter = $platformRequirementFilter;
  511. }
  512. public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null, ?Locker $locker = null)
  513. {
  514. if ($this->classMapAuthoritative) {
  515. $scanPsrPackages = true;
  516. }
  517. if (null === $this->devMode) {
  518. $this->devMode = false;
  519. $installedJson = new JsonFile($config->get('vendor-dir').'/composer/installed.json');
  520. if ($installedJson->exists()) {
  521. $installedJson = $installedJson->read();
  522. if (isset($installedJson['dev'])) {
  523. $this->devMode = $installedJson['dev'];
  524. }
  525. }
  526. }
  527. if ($this->runScripts) {
  528. if (!isset($_SERVER['COMPOSER_DEV_MODE'])) {
  529. Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
  530. }
  531. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, [], [
  532. 'optimize' => $scanPsrPackages,
  533. ]);
  534. }
  535. $classMapGenerator = new ClassMapGenerator(['php', 'inc', 'hh']);
  536. $classMapGenerator->avoidDuplicateScans();
  537. $filesystem = new Filesystem();
  538. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  539. $basePath = $filesystem->normalizePath(realpath(realpath(Platform::getCwd())));
  540. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  541. $useGlobalIncludePath = $config->get('use-include-path');
  542. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  543. $targetDir = $vendorPath.'/'.$targetDir;
  544. $filesystem->ensureDirectoryExists($targetDir);
  545. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  546. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  547. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  548. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  549. $namespacesFile = <<<EOF
  550. <?php
  551. // autoload_namespaces.php @generated by Composer
  552. \$vendorDir = $vendorPathCode;
  553. \$baseDir = $appBaseDirCode;
  554. return array(
  555. EOF;
  556. $psr4File = <<<EOF
  557. <?php
  558. // autoload_psr4.php @generated by Composer
  559. \$vendorDir = $vendorPathCode;
  560. \$baseDir = $appBaseDirCode;
  561. return array(
  562. EOF;
  563. $devPackageNames = $localRepo->getDevPackageNames();
  564. $packageMap = $this->buildPackageMap($installationManager, $rootPackage, $localRepo->getCanonicalPackages());
  565. if ($this->devMode) {
  566. $filteredDevPackages = false;
  567. } else {
  568. $filteredDevPackages = $devPackageNames ?: true;
  569. }
  570. $autoloads = $this->parseAutoloads($packageMap, $rootPackage, $filteredDevPackages);
  571. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  572. $exportedPaths = [];
  573. foreach ($paths as $path) {
  574. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  575. }
  576. $exportedPrefix = var_export($namespace, true);
  577. $namespacesFile .= " $exportedPrefix => ";
  578. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  579. }
  580. $namespacesFile .= ");\n";
  581. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  582. $exportedPaths = [];
  583. foreach ($paths as $path) {
  584. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  585. }
  586. $exportedPrefix = var_export($namespace, true);
  587. $psr4File .= " $exportedPrefix => ";
  588. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  589. }
  590. $psr4File .= ");\n";
  591. $targetDirLoader = null;
  592. $mainAutoload = $rootPackage->getAutoload();
  593. if ($rootPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  594. $levels = substr_count($filesystem->normalizePath($rootPackage->getTargetDir()), '/') + 1;
  595. $prefixes = implode(', ', array_map(static function ($prefix): string {
  596. return var_export($prefix, true);
  597. }, array_keys($mainAutoload['psr-0'])));
  598. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  599. $targetDirLoader = <<<EOF
  600. public static function autoload(\$class)
  601. {
  602. \$dir = $baseDirFromTargetDirCode . '/';
  603. \$prefixes = array($prefixes);
  604. foreach (\$prefixes as \$prefix) {
  605. if (0 !== strpos(\$class, \$prefix)) {
  606. continue;
  607. }
  608. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  609. if (!\$path = stream_resolve_include_path(\$path)) {
  610. return false;
  611. }
  612. require \$path;
  613. return true;
  614. }
  615. }
  616. EOF;
  617. }
  618. $excluded = null;
  619. if (!empty($autoloads['exclude-from-classmap'])) {
  620. $excluded = $autoloads['exclude-from-classmap'];
  621. }
  622. foreach ($autoloads['classmap'] as $dir) {
  623. $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded));
  624. }
  625. if ($scanPsrPackages) {
  626. $namespacesToScan = [];
  627. foreach (['psr-4', 'psr-0'] as $psrType) {
  628. foreach ($autoloads[$psrType] as $namespace => $paths) {
  629. $namespacesToScan[$namespace][] = ['paths' => $paths, 'type' => $psrType];
  630. }
  631. }
  632. krsort($namespacesToScan);
  633. foreach ($namespacesToScan as $namespace => $groups) {
  634. foreach ($groups as $group) {
  635. foreach ($group['paths'] as $dir) {
  636. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  637. if (!is_dir($dir)) {
  638. continue;
  639. }
  640. $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded), $group['type'], $namespace);
  641. }
  642. }
  643. }
  644. }
  645. $classMap = $classMapGenerator->getClassMap();
  646. foreach ($classMap->getAmbiguousClasses() as $className => $ambiguousPaths) {
  647. if (count($ambiguousPaths) > 1) {
  648. $this->io->writeError(
  649. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  650. ' was found '. (count($ambiguousPaths) + 1) .'x: in "'.$classMap->getClassPath($className).'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
  651. );
  652. } else {
  653. $this->io->writeError(
  654. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  655. ' was found in both "'.$classMap->getClassPath($className).'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
  656. );
  657. }
  658. }
  659. foreach ($classMap->getPsrViolations() as $msg) {
  660. $this->io->writeError("<warning>$msg</warning>");
  661. }
  662. $classMap->addClass('Composer\InstalledVersions', $vendorPath . '/composer/InstalledVersions.php');
  663. $classMap->sort();
  664. $classmapFile = <<<EOF
  665. <?php
  666. // autoload_classmap.php @generated by Composer
  667. \$vendorDir = $vendorPathCode;
  668. \$baseDir = $appBaseDirCode;
  669. return array(
  670. EOF;
  671. foreach ($classMap->getMap() as $className => $path) {
  672. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  673. $classmapFile .= ' '.var_export($className, true).' => '.$pathCode;
  674. }
  675. $classmapFile .= ");\n";
  676. if ('' === $suffix) {
  677. $suffix = null;
  678. }
  679. if (null === $suffix) {
  680. $suffix = $config->get('autoloader-suffix');
  681. if (null === $suffix && Filesystem::isReadable($vendorPath.'/autoload.php')) {
  682. $content = file_get_contents($vendorPath.'/autoload.php');
  683. if (Preg::isMatch('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  684. $suffix = $match[1];
  685. }
  686. }
  687. if (null === $suffix) {
  688. $suffix = $locker !== null && $locker->isLocked() ? $locker->getLockData()['content-hash'] : md5(uniqid('', true));
  689. }
  690. }
  691. if ($this->dryRun) {
  692. return $classMap;
  693. }
  694. $filesystem->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  695. $filesystem->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  696. $filesystem->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  697. $includePathFilePath = $targetDir.'/include_paths.php';
  698. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
  699. $filesystem->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  700. } elseif (file_exists($includePathFilePath)) {
  701. unlink($includePathFilePath);
  702. }
  703. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  704. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
  705. $filesystem->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  706. } elseif (file_exists($includeFilesFilePath)) {
  707. unlink($includeFilesFilePath);
  708. }
  709. $filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));
  710. $checkPlatform = $config->get('platform-check') !== false && !($this->platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter);
  711. $platformCheckContent = null;
  712. if ($checkPlatform) {
  713. $platformCheckContent = $this->getPlatformCheck($packageMap, $config->get('platform-check'), $devPackageNames);
  714. if (null === $platformCheckContent) {
  715. $checkPlatform = false;
  716. }
  717. }
  718. if ($checkPlatform) {
  719. $filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);
  720. } elseif (file_exists($targetDir.'/platform_check.php')) {
  721. unlink($targetDir.'/platform_check.php');
  722. }
  723. $filesystem->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  724. $filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
  725. $filesystem->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  726. $filesystem->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  727. if ($this->runScripts) {
  728. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, [], [
  729. 'optimize' => $scanPsrPackages,
  730. ]);
  731. }
  732. return $classMap;
  733. }
  734. private function buildExclusionRegex(string $dir, ?array $excluded): ?string
  735. {
  736. if (null === $excluded) {
  737. return null;
  738. }
  739. if (file_exists($dir)) {
  740. $dirMatch = preg_quote(strtr(realpath($dir), '\\', '/'));
  741. foreach ($excluded as $index => $pattern) {
  742. $pattern = Preg::replace('{^(([^.+*?\[^\]$(){}=!<>|:\\\\#-]+|\\\\[.+*?\[^\]$(){}=!<>|:#-])*).*}', '$1', $pattern);
  743. if (0 !== strpos($pattern, $dirMatch) && 0 !== strpos($dirMatch, $pattern)) {
  744. unset($excluded[$index]);
  745. }
  746. }
  747. }
  748. return \count($excluded) > 0 ? '{(' . implode('|', $excluded) . ')}' : null;
  749. }
  750. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $rootPackage, array $packages)
  751. {
  752. $packageMap = [[$rootPackage, '']];
  753. foreach ($packages as $package) {
  754. if ($package instanceof AliasPackage) {
  755. continue;
  756. }
  757. $this->validatePackage($package);
  758. $packageMap[] = [
  759. $package,
  760. $installationManager->getInstallPath($package),
  761. ];
  762. }
  763. return $packageMap;
  764. }
  765. protected function validatePackage(PackageInterface $package)
  766. {
  767. $autoload = $package->getAutoload();
  768. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  769. $name = $package->getName();
  770. $package->getTargetDir();
  771. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  772. }
  773. if (!empty($autoload['psr-4'])) {
  774. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  775. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  776. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  777. }
  778. }
  779. }
  780. }
  781. public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)
  782. {
  783. $rootPackageMap = array_shift($packageMap);
  784. if (is_array($filteredDevPackages)) {
  785. $packageMap = array_filter($packageMap, static function ($item) use ($filteredDevPackages): bool {
  786. return !in_array($item[0]->getName(), $filteredDevPackages, true);
  787. });
  788. } elseif ($filteredDevPackages) {
  789. $packageMap = $this->filterPackageMap($packageMap, $rootPackage);
  790. }
  791. $sortedPackageMap = $this->sortPackageMap($packageMap);
  792. $sortedPackageMap[] = $rootPackageMap;
  793. array_unshift($packageMap, $rootPackageMap);
  794. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $rootPackage);
  795. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $rootPackage);
  796. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $rootPackage);
  797. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $rootPackage);
  798. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $rootPackage);
  799. krsort($psr0);
  800. krsort($psr4);
  801. return [
  802. 'psr-0' => $psr0,
  803. 'psr-4' => $psr4,
  804. 'classmap' => $classmap,
  805. 'files' => $files,
  806. 'exclude-from-classmap' => $exclude,
  807. ];
  808. }
  809. public function createLoader(array $autoloads, ?string $vendorDir = null)
  810. {
  811. $loader = new ClassLoader($vendorDir);
  812. if (isset($autoloads['psr-0'])) {
  813. foreach ($autoloads['psr-0'] as $namespace => $path) {
  814. $loader->add($namespace, $path);
  815. }
  816. }
  817. if (isset($autoloads['psr-4'])) {
  818. foreach ($autoloads['psr-4'] as $namespace => $path) {
  819. $loader->addPsr4($namespace, $path);
  820. }
  821. }
  822. if (isset($autoloads['classmap'])) {
  823. $excluded = null;
  824. if (!empty($autoloads['exclude-from-classmap'])) {
  825. $excluded = $autoloads['exclude-from-classmap'];
  826. }
  827. $classMapGenerator = new ClassMapGenerator(['php', 'inc', 'hh']);
  828. $classMapGenerator->avoidDuplicateScans();
  829. foreach ($autoloads['classmap'] as $dir) {
  830. try {
  831. $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded));
  832. } catch (\RuntimeException $e) {
  833. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  834. }
  835. }
  836. $loader->addClassMap($classMapGenerator->getClassMap()->getMap());
  837. }
  838. return $loader;
  839. }
  840. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
  841. {
  842. $includePaths = [];
  843. foreach ($packageMap as $item) {
  844. [$package, $installPath] = $item;
  845. if (null === $installPath) {
  846. continue;
  847. }
  848. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  849. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  850. }
  851. foreach ($package->getIncludePaths() as $includePath) {
  852. $includePath = trim($includePath, '/');
  853. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  854. }
  855. }
  856. if (!$includePaths) {
  857. return null;
  858. }
  859. $includePathsCode = '';
  860. foreach ($includePaths as $path) {
  861. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  862. }
  863. return <<<EOF
  864. <?php
  865. // include_paths.php @generated by Composer
  866. \$vendorDir = $vendorPathCode;
  867. \$baseDir = $appBaseDirCode;
  868. return array(
  869. $includePathsCode);
  870. EOF;
  871. }
  872. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
  873. {
  874. $files = array_map(
  875. function (string $functionFile) use ($filesystem, $basePath, $vendorPath): string {
  876. return $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile);
  877. },
  878. $files
  879. );
  880. $uniqueFiles = array_unique($files);
  881. if (count($uniqueFiles) < count($files)) {
  882. $this->io->writeError('<warning>The following "files" autoload rules are included multiple times, this may cause issues and should be resolved:</warning>');
  883. foreach (array_unique(array_diff_assoc($files, $uniqueFiles)) as $duplicateFile) {
  884. $this->io->writeError('<warning> - '.$duplicateFile.'</warning>');
  885. }
  886. }
  887. unset($uniqueFiles);
  888. $filesCode = '';
  889. foreach ($files as $fileIdentifier => $functionFile) {
  890. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => ' . $functionFile . ",\n";
  891. }
  892. if (!$filesCode) {
  893. return null;
  894. }
  895. return <<<EOF
  896. <?php
  897. // autoload_files.php @generated by Composer
  898. \$vendorDir = $vendorPathCode;
  899. \$baseDir = $appBaseDirCode;
  900. return array(
  901. $filesCode);
  902. EOF;
  903. }
  904. protected function getPathCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $path)
  905. {
  906. if (!$filesystem->isAbsolutePath($path)) {
  907. $path = $basePath . '/' . $path;
  908. }
  909. $path = $filesystem->normalizePath($path);
  910. $baseDir = '';
  911. if (strpos($path.'/', $vendorPath.'/') === 0) {
  912. $path = (string) substr($path, strlen($vendorPath));
  913. $baseDir = '$vendorDir . ';
  914. } else {
  915. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  916. if (!$filesystem->isAbsolutePath($path)) {
  917. $baseDir = '$baseDir . ';
  918. $path = '/' . $path;
  919. }
  920. }
  921. if (strpos($path, '.phar') !== false) {
  922. $baseDir = "'phar://' . " . $baseDir;
  923. }
  924. return $baseDir . var_export($path, true);
  925. }
  926. protected function getPlatformCheck(array $packageMap, $checkPlatform, array $devPackageNames)
  927. {
  928. $lowestPhpVersion = Bound::zero();
  929. $requiredPhp64bit = false;
  930. $requiredExtensions = [];
  931. $extensionProviders = [];
  932. foreach ($packageMap as $item) {
  933. $package = $item[0];
  934. foreach (array_merge($package->getReplaces(), $package->getProvides()) as $link) {
  935. if (Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
  936. $extensionProviders[$match[1]][] = $link->getConstraint();
  937. }
  938. }
  939. }
  940. foreach ($packageMap as $item) {
  941. $package = $item[0];
  942. if (in_array($package->getName(), $devPackageNames, true)) {
  943. continue;
  944. }
  945. foreach ($package->getRequires() as $link) {
  946. if ($this->platformRequirementFilter->isIgnored($link->getTarget())) {
  947. continue;
  948. }
  949. if (in_array($link->getTarget(), ['php', 'php-64bit'], true)) {
  950. $constraint = $link->getConstraint();
  951. if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
  952. $lowestPhpVersion = $constraint->getLowerBound();
  953. }
  954. }
  955. if ('php-64bit' === $link->getTarget()) {
  956. $requiredPhp64bit = true;
  957. }
  958. if ($checkPlatform === true && Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
  959. if (isset($extensionProviders[$match[1]])) {
  960. foreach ($extensionProviders[$match[1]] as $provided) {
  961. if ($provided->matches($link->getConstraint())) {
  962. continue 2;
  963. }
  964. }
  965. }
  966. if ($match[1] === 'zend-opcache') {
  967. $match[1] = 'zend opcache';
  968. }
  969. $extension = var_export($match[1], true);
  970. if ($match[1] === 'pcntl' || $match[1] === 'readline') {
  971. $requiredExtensions[$extension] = "PHP_SAPI !== 'cli' || extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
  972. } else {
  973. $requiredExtensions[$extension] = "extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
  974. }
  975. }
  976. }
  977. }
  978. ksort($requiredExtensions);
  979. $formatToPhpVersionId = static function (Bound $bound): int {
  980. if ($bound->isZero()) {
  981. return 0;
  982. }
  983. if ($bound->isPositiveInfinity()) {
  984. return 99999;
  985. }
  986. $version = str_replace('-', '.', $bound->getVersion());
  987. $chunks = array_map('intval', explode('.', $version));
  988. return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2];
  989. };
  990. $formatToHumanReadable = static function (Bound $bound) {
  991. if ($bound->isZero()) {
  992. return 0;
  993. }
  994. if ($bound->isPositiveInfinity()) {
  995. return 99999;
  996. }
  997. $version = str_replace('-', '.', $bound->getVersion());
  998. $chunks = explode('.', $version);
  999. $chunks = array_slice($chunks, 0, 3);
  1000. return implode('.', $chunks);
  1001. };
  1002. $requiredPhp = '';
  1003. $requiredPhpError = '';
  1004. if (!$lowestPhpVersion->isZero()) {
  1005. $operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
  1006. $requiredPhp = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
  1007. $requiredPhpError = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
  1008. }
  1009. if ($requiredPhp) {
  1010. $requiredPhp = <<<PHP_CHECK
  1011. if (!($requiredPhp)) {
  1012. \$issues[] = 'Your Composer dependencies require a PHP version $requiredPhpError. You are running ' . PHP_VERSION . '.';
  1013. }
  1014. PHP_CHECK;
  1015. }
  1016. if ($requiredPhp64bit) {
  1017. $requiredPhp .= <<<PHP_CHECK
  1018. if (PHP_INT_SIZE !== 8) {
  1019. \$issues[] = 'Your Composer dependencies require a 64-bit build of PHP.';
  1020. }
  1021. PHP_CHECK;
  1022. }
  1023. $requiredExtensions = implode('', $requiredExtensions);
  1024. if ('' !== $requiredExtensions) {
  1025. $requiredExtensions = <<<EXT_CHECKS
  1026. \$missingExtensions = array();
  1027. $requiredExtensions
  1028. if (\$missingExtensions) {
  1029. \$issues[] = 'Your Composer dependencies require the following PHP extensions to be installed: ' . implode(', ', \$missingExtensions) . '.';
  1030. }
  1031. EXT_CHECKS;
  1032. }
  1033. if (!$requiredPhp && !$requiredExtensions) {
  1034. return null;
  1035. }
  1036. return <<<PLATFORM_CHECK
  1037. <?php
  1038. // platform_check.php @generated by Composer
  1039. \$issues = array();
  1040. {$requiredPhp}{$requiredExtensions}
  1041. if (\$issues) {
  1042. if (!headers_sent()) {
  1043. header('HTTP/1.1 500 Internal Server Error');
  1044. }
  1045. if (!ini_get('display_errors')) {
  1046. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  1047. fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, \$issues) . PHP_EOL.PHP_EOL);
  1048. } elseif (!headers_sent()) {
  1049. echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, \$issues)) . PHP_EOL.PHP_EOL;
  1050. }
  1051. }
  1052. trigger_error(
  1053. 'Composer detected issues in your platform: ' . implode(' ', \$issues),
  1054. E_USER_ERROR
  1055. );
  1056. }
  1057. PLATFORM_CHECK;
  1058. }
  1059. protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix)
  1060. {
  1061. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  1062. if ("'" === $lastChar || '"' === $lastChar) {
  1063. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  1064. } else {
  1065. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  1066. }
  1067. return <<<AUTOLOAD
  1068. <?php
  1069. // autoload.php @generated by Composer
  1070. if (PHP_VERSION_ID < 50600) {
  1071. if (!headers_sent()) {
  1072. header('HTTP/1.1 500 Internal Server Error');
  1073. }
  1074. \$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  1075. if (!ini_get('display_errors')) {
  1076. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  1077. fwrite(STDERR, \$err);
  1078. } elseif (!headers_sent()) {
  1079. echo \$err;
  1080. }
  1081. }
  1082. trigger_error(
  1083. \$err,
  1084. E_USER_ERROR
  1085. );
  1086. }
  1087. require_once $vendorPathToTargetDirCode;
  1088. return ComposerAutoloaderInit$suffix::getLoader();
  1089. AUTOLOAD;
  1090. }
  1091. protected function getAutoloadRealFile(bool $useClassMap, bool $useIncludePath, ?string $targetDirLoader, bool $useIncludeFiles, string $vendorPathCode, string $appBaseDirCode, string $suffix, bool $useGlobalIncludePath, string $prependAutoloader, bool $checkPlatform)
  1092. {
  1093. $file = <<<HEADER
  1094. <?php
  1095. // autoload_real.php @generated by Composer
  1096. class ComposerAutoloaderInit$suffix
  1097. {
  1098. private static \$loader;
  1099. public static function loadClassLoader(\$class)
  1100. {
  1101. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  1102. require __DIR__ . '/ClassLoader.php';
  1103. }
  1104. }
  1105. /**
  1106. * @return \Composer\Autoload\ClassLoader
  1107. */
  1108. public static function getLoader()
  1109. {
  1110. if (null !== self::\$loader) {
  1111. return self::\$loader;
  1112. }
  1113. HEADER;
  1114. if ($checkPlatform) {
  1115. $file .= <<<'PLATFORM_CHECK'
  1116. require __DIR__ . '/platform_check.php';
  1117. PLATFORM_CHECK;
  1118. }
  1119. $file .= <<<CLASSLOADER_INIT
  1120. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  1121. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(__DIR__));
  1122. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  1123. CLASSLOADER_INIT;
  1124. if ($useIncludePath) {
  1125. $file .= <<<'INCLUDE_PATH'
  1126. $includePaths = require __DIR__ . '/include_paths.php';
  1127. $includePaths[] = get_include_path();
  1128. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  1129. INCLUDE_PATH;
  1130. }
  1131. $file .= <<<STATIC_INIT
  1132. require __DIR__ . '/autoload_static.php';
  1133. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  1134. STATIC_INIT;
  1135. if ($this->classMapAuthoritative) {
  1136. $file .= <<<'CLASSMAPAUTHORITATIVE'
  1137. $loader->setClassMapAuthoritative(true);
  1138. CLASSMAPAUTHORITATIVE;
  1139. }
  1140. if ($this->apcu) {
  1141. $apcuPrefix = var_export(($this->apcuPrefix !== null ? $this->apcuPrefix : substr(base64_encode(md5(uniqid('', true), true)), 0, -3)), true);
  1142. $file .= <<<APCU
  1143. \$loader->setApcuPrefix($apcuPrefix);
  1144. APCU;
  1145. }
  1146. if ($useGlobalIncludePath) {
  1147. $file .= <<<'INCLUDEPATH'
  1148. $loader->setUseIncludePath(true);
  1149. INCLUDEPATH;
  1150. }
  1151. if ($targetDirLoader) {
  1152. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  1153. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  1154. REGISTER_TARGET_DIR_AUTOLOAD;
  1155. }
  1156. $file .= <<<REGISTER_LOADER
  1157. \$loader->register($prependAutoloader);
  1158. REGISTER_LOADER;
  1159. if ($useIncludeFiles) {
  1160. $file .= <<<INCLUDE_FILES
  1161. \$filesToLoad = \Composer\Autoload\ComposerStaticInit$suffix::\$files;
  1162. \$requireFile = \Closure::bind(static function (\$fileIdentifier, \$file) {
  1163. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  1164. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  1165. require \$file;
  1166. }
  1167. }, null, null);
  1168. foreach (\$filesToLoad as \$fileIdentifier => \$file) {
  1169. \$requireFile(\$fileIdentifier, \$file);
  1170. }
  1171. INCLUDE_FILES;
  1172. }
  1173. $file .= <<<METHOD_FOOTER
  1174. return \$loader;
  1175. }
  1176. METHOD_FOOTER;
  1177. $file .= $targetDirLoader;
  1178. return $file . <<<FOOTER
  1179. }
  1180. FOOTER;
  1181. }
  1182. protected function getStaticFile(string $suffix, string $targetDir, string $vendorPath, string $basePath)
  1183. {
  1184. $file = <<<HEADER
  1185. <?php
  1186. // autoload_static.php @generated by Composer
  1187. namespace Composer\Autoload;
  1188. class ComposerStaticInit$suffix
  1189. {
  1190. HEADER;
  1191. $loader = new ClassLoader();
  1192. $map = require $targetDir . '/autoload_namespaces.php';
  1193. foreach ($map as $namespace => $path) {
  1194. $loader->set($namespace, $path);
  1195. }
  1196. $map = require $targetDir . '/autoload_psr4.php';
  1197. foreach ($map as $namespace => $path) {
  1198. $loader->setPsr4($namespace, $path);
  1199. }
  1200. $classMap = require $targetDir . '/autoload_classmap.php';
  1201. if ($classMap) {
  1202. $loader->addClassMap($classMap);
  1203. }
  1204. $filesystem = new Filesystem();
  1205. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  1206. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  1207. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  1208. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  1209. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  1210. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  1211. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  1212. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  1213. $initializer = '';
  1214. $prefix = "\0Composer\Autoload\ClassLoader\0";
  1215. $prefixLen = strlen($prefix);
  1216. if (file_exists($targetDir . '/autoload_files.php')) {
  1217. $maps = ['files' => require $targetDir . '/autoload_files.php'];
  1218. } else {
  1219. $maps = [];
  1220. }
  1221. foreach ((array) $loader as $prop => $value) {
  1222. if (!is_array($value) || \count($value) === 0 || !str_starts_with($prop, $prefix)) {
  1223. continue;
  1224. }
  1225. $maps[substr($prop, $prefixLen)] = $value;
  1226. }
  1227. foreach ($maps as $prop => $value) {
  1228. $value = strtr(
  1229. var_export($value, true),
  1230. [
  1231. $absoluteVendorPathCode => $vendorPathCode,
  1232. $absoluteVendorPharPathCode => $vendorPharPathCode,
  1233. $absoluteAppBaseDirCode => $appBaseDirCode,
  1234. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  1235. ]
  1236. );
  1237. $value = ltrim(Preg::replace('/^ */m', ' $0$0', $value));
  1238. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  1239. if ('files' !== $prop) {
  1240. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  1241. }
  1242. }
  1243. return $file . <<<INITIALIZER
  1244. public static function getInitializer(ClassLoader \$loader)
  1245. {
  1246. return \Closure::bind(function () use (\$loader) {
  1247. $initializer
  1248. }, null, ClassLoader::class);
  1249. }
  1250. }
  1251. INITIALIZER;
  1252. }
  1253. protected function parseAutoloadsType(array $packageMap, string $type, RootPackageInterface $rootPackage)
  1254. {
  1255. $autoloads = [];
  1256. foreach ($packageMap as $item) {
  1257. [$package, $installPath] = $item;
  1258. if (null === $installPath) {
  1259. continue;
  1260. }
  1261. $autoload = $package->getAutoload();
  1262. if ($this->devMode && $package === $rootPackage) {
  1263. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  1264. }
  1265. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  1266. continue;
  1267. }
  1268. if (null !== $package->getTargetDir() && $package !== $rootPackage) {
  1269. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  1270. }
  1271. foreach ($autoload[$type] as $namespace => $paths) {
  1272. foreach ((array) $paths as $path) {
  1273. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !Filesystem::isReadable($installPath.'/'.$path)) {
  1274. if ($package === $rootPackage) {
  1275. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(['/', '\\'], '<dirsep>', $package->getTargetDir())));
  1276. $path = ltrim(Preg::replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  1277. } else {
  1278. $path = $package->getTargetDir() . '/' . $path;
  1279. }
  1280. }
  1281. if ($type === 'exclude-from-classmap') {
  1282. $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  1283. $path = strtr($path, ['\\*\\*' => '.+?', '\\*' => '[^/]+?']);
  1284. $updir = null;
  1285. $path = Preg::replaceCallback(
  1286. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  1287. static function ($matches) use (&$updir): string {
  1288. if (isset($matches[1])) {
  1289. $updir = str_replace('\\.', '.', $matches[1]);
  1290. }
  1291. return '';
  1292. },
  1293. $path
  1294. );
  1295. if (empty($installPath)) {
  1296. $installPath = strtr(Platform::getCwd(), '\\', '/');
  1297. }
  1298. $resolvedPath = realpath($installPath . '/' . $updir);
  1299. if (false === $resolvedPath) {
  1300. continue;
  1301. }
  1302. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  1303. continue;
  1304. }
  1305. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  1306. if ($type === 'files') {
  1307. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  1308. continue;
  1309. }
  1310. if ($type === 'classmap') {
  1311. $autoloads[] = $relativePath;
  1312. continue;
  1313. }
  1314. $autoloads[$namespace][] = $relativePath;
  1315. }
  1316. }
  1317. }
  1318. return $autoloads;
  1319. }
  1320. protected function getFileIdentifier(PackageInterface $package, string $path)
  1321. {
  1322. return md5($package->getName() . ':' . $path);
  1323. }
  1324. protected function filterPackageMap(array $packageMap, RootPackageInterface $rootPackage)
  1325. {
  1326. $packages = [];
  1327. $include = [];
  1328. $replacedBy = [];
  1329. foreach ($packageMap as $item) {
  1330. $package = $item[0];
  1331. $name = $package->getName();
  1332. $packages[$name] = $package;
  1333. foreach ($package->getReplaces() as $replace) {
  1334. $replacedBy[$replace->getTarget()] = $name;
  1335. }
  1336. }
  1337. $add = static function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy): void {
  1338. foreach ($package->getRequires() as $link) {
  1339. $target = $link->getTarget();
  1340. if (isset($replacedBy[$target])) {
  1341. $target = $replacedBy[$target];
  1342. }
  1343. if (!isset($include[$target])) {
  1344. $include[$target] = true;
  1345. if (isset($packages[$target])) {
  1346. $add($packages[$target]);
  1347. }
  1348. }
  1349. }
  1350. };
  1351. $add($rootPackage);
  1352. return array_filter(
  1353. $packageMap,
  1354. static function ($item) use ($include): bool {
  1355. $package = $item[0];
  1356. foreach ($package->getNames() as $name) {
  1357. if (isset($include[$name])) {
  1358. return true;
  1359. }
  1360. }
  1361. return false;
  1362. }
  1363. );
  1364. }
  1365. protected function sortPackageMap(array $packageMap)
  1366. {
  1367. $packages = [];
  1368. $paths = [];
  1369. foreach ($packageMap as $item) {
  1370. [$package, $path] = $item;
  1371. $name = $package->getName();
  1372. $packages[$name] = $package;
  1373. $paths[$name] = $path;
  1374. }
  1375. $sortedPackages = PackageSorter::sortPackages($packages);
  1376. $sortedPackageMap = [];
  1377. foreach ($sortedPackages as $package) {
  1378. $name = $package->getName();
  1379. $sortedPackageMap[] = [$packages[$name], $paths[$name]];
  1380. }
  1381. return $sortedPackageMap;
  1382. }
  1383. }
  1384. function composerRequire(string $fileIdentifier, string $file): void
  1385. {
  1386. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  1387. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  1388. require $file;
  1389. }
  1390. }
  1391. <?php declare(strict_types=1);
  1392. namespace Composer\Autoload;
  1393. use Composer\ClassMapGenerator\FileList;
  1394. use Composer\IO\IOInterface;
  1395. class ClassMapGenerator
  1396. {
  1397. public static function dump(iterable $dirs, string $file): void
  1398. {
  1399. $maps = [];
  1400. foreach ($dirs as $dir) {
  1401. $maps = array_merge($maps, static::createMap($dir));
  1402. }
  1403. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  1404. }
  1405. public static function createMap($path, ?string $excluded = null, ?IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = []): array
  1406. {
  1407. $generator = new \Composer\ClassMapGenerator\ClassMapGenerator(['php', 'inc', 'hh']);
  1408. $fileList = new FileList();
  1409. $fileList->files = $scannedFiles;
  1410. $generator->avoidDuplicateScans($fileList);
  1411. $generator->scanPaths($path, $excluded, $autoloadType ?? 'classmap', $namespace);
  1412. $classMap = $generator->getClassMap();
  1413. $scannedFiles = $fileList->files;
  1414. if ($io !== null) {
  1415. foreach ($classMap->getPsrViolations() as $msg) {
  1416. $io->writeError("<warning>$msg</warning>");
  1417. }
  1418. foreach ($classMap->getAmbiguousClasses() as $class => $paths) {
  1419. if (count($paths) > 1) {
  1420. $io->writeError(
  1421. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  1422. ' was found '. (count($paths) + 1) .'x: in "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.</warning>'
  1423. );
  1424. } else {
  1425. $io->writeError(
  1426. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  1427. ' was found in both "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.</warning>'
  1428. );
  1429. }
  1430. }
  1431. }
  1432. return $classMap->getMap();
  1433. }
  1434. }
  1435. <?php declare(strict_types=1);
  1436. namespace Composer;
  1437. use Composer\IO\IOInterface;
  1438. use Composer\Pcre\Preg;
  1439. use Composer\Util\Filesystem;
  1440. use Composer\Util\Platform;
  1441. use Composer\Util\Silencer;
  1442. use Symfony\Component\Finder\Finder;
  1443. class Cache
  1444. {
  1445. private static $cacheCollected = null;
  1446. private $io;
  1447. private $root;
  1448. private $enabled = null;
  1449. private $allowlist;
  1450. private $filesystem;
  1451. private $readOnly;
  1452. public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9._', ?Filesystem $filesystem = null, bool $readOnly = false)
  1453. {
  1454. $this->io = $io;
  1455. $this->root = rtrim($cacheDir, '/\\') . '/';
  1456. $this->allowlist = $allowlist;
  1457. $this->filesystem = $filesystem ?: new Filesystem();
  1458. $this->readOnly = (bool) $readOnly;
  1459. if (!self::isUsable($cacheDir)) {
  1460. $this->enabled = false;
  1461. }
  1462. }
  1463. public function setReadOnly(bool $readOnly)
  1464. {
  1465. $this->readOnly = (bool) $readOnly;
  1466. }
  1467. public function isReadOnly()
  1468. {
  1469. return $this->readOnly;
  1470. }
  1471. public static function isUsable(string $path)
  1472. {
  1473. return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1474. }
  1475. public function isEnabled()
  1476. {
  1477. if ($this->enabled === null) {
  1478. $this->enabled = true;
  1479. if (
  1480. !$this->readOnly
  1481. && (
  1482. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1483. || !is_writable($this->root)
  1484. )
  1485. ) {
  1486. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache. See also cache-read-only config if your filesystem is read-only.</warning>');
  1487. $this->enabled = false;
  1488. }
  1489. }
  1490. return $this->enabled;
  1491. }
  1492. public function getRoot()
  1493. {
  1494. return $this->root;
  1495. }
  1496. public function read(string $file)
  1497. {
  1498. if ($this->isEnabled()) {
  1499. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1500. if (file_exists($this->root . $file)) {
  1501. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1502. return file_get_contents($this->root . $file);
  1503. }
  1504. }
  1505. return false;
  1506. }
  1507. public function write(string $file, string $contents)
  1508. {
  1509. $wasEnabled = $this->enabled === true;
  1510. if ($this->isEnabled() && !$this->readOnly) {
  1511. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1512. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1513. $tempFileName = $this->root . $file . uniqid('.', true) . '.tmp';
  1514. try {
  1515. return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);
  1516. } catch (\ErrorException $e) {
  1517. if ($wasEnabled) {
  1518. clearstatcache();
  1519. $this->enabled = null;
  1520. return $this->write($file, $contents);
  1521. }
  1522. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1523. if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1524. unlink($tempFileName);
  1525. $message = sprintf(
  1526. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$s bytes of free space available</warning>',
  1527. $tempFileName,
  1528. $m[1],
  1529. $m[2],
  1530. function_exists('disk_free_space') ? @disk_free_space(dirname($tempFileName)) : 'unknown'
  1531. );
  1532. $this->io->writeError($message);
  1533. return false;
  1534. }
  1535. throw $e;
  1536. }
  1537. }
  1538. return false;
  1539. }
  1540. public function copyFrom(string $file, string $source)
  1541. {
  1542. if ($this->isEnabled() && !$this->readOnly) {
  1543. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1544. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1545. if (!file_exists($source)) {
  1546. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1547. } elseif ($this->io->isDebug()) {
  1548. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1549. }
  1550. return copy($source, $this->root . $file);
  1551. }
  1552. return false;
  1553. }
  1554. public function copyTo(string $file, string $target)
  1555. {
  1556. if ($this->isEnabled()) {
  1557. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1558. if (file_exists($this->root . $file)) {
  1559. try {
  1560. touch($this->root . $file, (int) filemtime($this->root . $file), time());
  1561. } catch (\ErrorException $e) {
  1562. Silencer::call('touch', $this->root . $file);
  1563. }
  1564. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1565. return copy($this->root . $file, $target);
  1566. }
  1567. }
  1568. return false;
  1569. }
  1570. public function gcIsNecessary()
  1571. {
  1572. if (self::$cacheCollected) {
  1573. return false;
  1574. }
  1575. self::$cacheCollected = true;
  1576. if (Platform::getEnv('COMPOSER_TEST_SUITE')) {
  1577. return false;
  1578. }
  1579. if (Platform::isInputCompletionProcess()) {
  1580. return false;
  1581. }
  1582. return !random_int(0, 50);
  1583. }
  1584. public function remove(string $file)
  1585. {
  1586. if ($this->isEnabled() && !$this->readOnly) {
  1587. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1588. if (file_exists($this->root . $file)) {
  1589. return $this->filesystem->unlink($this->root . $file);
  1590. }
  1591. }
  1592. return false;
  1593. }
  1594. public function clear()
  1595. {
  1596. if ($this->isEnabled() && !$this->readOnly) {
  1597. $this->filesystem->emptyDirectory($this->root);
  1598. return true;
  1599. }
  1600. return false;
  1601. }
  1602. public function getAge(string $file)
  1603. {
  1604. if ($this->isEnabled()) {
  1605. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1606. if (file_exists($this->root . $file) && ($mtime = filemtime($this->root . $file)) !== false) {
  1607. return abs(time() - $mtime);
  1608. }
  1609. }
  1610. return false;
  1611. }
  1612. public function gc(int $ttl, int $maxSize)
  1613. {
  1614. if ($this->isEnabled() && !$this->readOnly) {
  1615. $expire = new \DateTime();
  1616. $expire->modify('-'.$ttl.' seconds');
  1617. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1618. foreach ($finder as $file) {
  1619. $this->filesystem->unlink($file->getPathname());
  1620. }
  1621. $totalSize = $this->filesystem->size($this->root);
  1622. if ($totalSize > $maxSize) {
  1623. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1624. while ($totalSize > $maxSize && $iterator->valid()) {
  1625. $filepath = $iterator->current()->getPathname();
  1626. $totalSize -= $this->filesystem->size($filepath);
  1627. $this->filesystem->unlink($filepath);
  1628. $iterator->next();
  1629. }
  1630. }
  1631. self::$cacheCollected = true;
  1632. return true;
  1633. }
  1634. return false;
  1635. }
  1636. public function gcVcsCache(int $ttl): bool
  1637. {
  1638. if ($this->isEnabled()) {
  1639. $expire = new \DateTime();
  1640. $expire->modify('-'.$ttl.' seconds');
  1641. $finder = Finder::create()->in($this->root)->directories()->depth(0)->date('until '.$expire->format('Y-m-d H:i:s'));
  1642. foreach ($finder as $file) {
  1643. $this->filesystem->removeDirectory($file->getPathname());
  1644. }
  1645. self::$cacheCollected = true;
  1646. return true;
  1647. }
  1648. return false;
  1649. }
  1650. public function sha1(string $file)
  1651. {
  1652. if ($this->isEnabled()) {
  1653. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1654. if (file_exists($this->root . $file)) {
  1655. return sha1_file($this->root . $file);
  1656. }
  1657. }
  1658. return false;
  1659. }
  1660. public function sha256(string $file)
  1661. {
  1662. if ($this->isEnabled()) {
  1663. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1664. if (file_exists($this->root . $file)) {
  1665. return hash_file('sha256', $this->root . $file);
  1666. }
  1667. }
  1668. return false;
  1669. }
  1670. protected function getFinder()
  1671. {
  1672. return Finder::create()->in($this->root)->files();
  1673. }
  1674. }
  1675. <?php declare(strict_types=1);
  1676. namespace Composer\Command;
  1677. use Composer\Composer;
  1678. use Symfony\Component\Console\Input\InputInterface;
  1679. use Symfony\Component\Console\Output\OutputInterface;
  1680. class AboutCommand extends BaseCommand
  1681. {
  1682. protected function configure(): void
  1683. {
  1684. $this
  1685. ->setName('about')
  1686. ->setDescription('Shows a short information about Composer')
  1687. ->setHelp(
  1688. <<<EOT
  1689. <info>php composer.phar about</info>
  1690. EOT
  1691. )
  1692. ;
  1693. }
  1694. protected function execute(InputInterface $input, OutputInterface $output): int
  1695. {
  1696. $composerVersion = Composer::getVersion();
  1697. $this->getIO()->write(
  1698. <<<EOT
  1699. <info>Composer - Dependency Manager for PHP - version $composerVersion</info>
  1700. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1701. See https://getcomposer.org/ for more information.</comment>
  1702. EOT
  1703. );
  1704. return 0;
  1705. }
  1706. }
  1707. <?php declare(strict_types=1);
  1708. namespace Composer\Command;
  1709. use Composer\Factory;
  1710. use Composer\IO\IOInterface;
  1711. use Composer\Config;
  1712. use Composer\Composer;
  1713. use Composer\Package\BasePackage;
  1714. use Composer\Package\CompletePackageInterface;
  1715. use Composer\Package\Version\VersionParser;
  1716. use Composer\Package\Version\VersionSelector;
  1717. use Composer\Pcre\Preg;
  1718. use Composer\Repository\CompositeRepository;
  1719. use Composer\Repository\RepositoryFactory;
  1720. use Composer\Repository\RepositorySet;
  1721. use Composer\Script\ScriptEvents;
  1722. use Composer\Plugin\CommandEvent;
  1723. use Composer\Plugin\PluginEvents;
  1724. use Composer\Util\Filesystem;
  1725. use Composer\Util\Loop;
  1726. use Composer\Util\Platform;
  1727. use Composer\Util\ProcessExecutor;
  1728. use Composer\Console\Input\InputArgument;
  1729. use Symfony\Component\Console\Input\InputInterface;
  1730. use Composer\Console\Input\InputOption;
  1731. use Symfony\Component\Console\Output\OutputInterface;
  1732. class ArchiveCommand extends BaseCommand
  1733. {
  1734. use CompletionTrait;
  1735. private const FORMATS = ['tar', 'tar.gz', 'tar.bz2', 'zip'];
  1736. protected function configure(): void
  1737. {
  1738. $this
  1739. ->setName('archive')
  1740. ->setDescription('Creates an archive of this composer package')
  1741. ->setDefinition([
  1742. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project', null, $this->suggestAvailablePackage()),
  1743. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1744. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar, tar.gz, tar.bz2 or zip (default tar)', null, self::FORMATS),
  1745. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1746. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1747. .' Note that the format will be appended.'),
  1748. new InputOption('ignore-filters', null, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1749. ])
  1750. ->setHelp(
  1751. <<<EOT
  1752. The <info>archive</info> command creates an archive of the specified format
  1753. containing the files and directories of the Composer project or the specified
  1754. package in the specified version and writes it to the specified directory.
  1755. <info>php composer.phar archive [--format=zip] [--dir=/foo] [--file=filename] [package [version]]</info>
  1756. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1757. EOT
  1758. )
  1759. ;
  1760. }
  1761. protected function execute(InputInterface $input, OutputInterface $output): int
  1762. {
  1763. $composer = $this->tryComposer();
  1764. $config = null;
  1765. if ($composer) {
  1766. $config = $composer->getConfig();
  1767. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1768. $eventDispatcher = $composer->getEventDispatcher();
  1769. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1770. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1771. }
  1772. if (!$config) {
  1773. $config = Factory::createConfig();
  1774. }
  1775. $format = $input->getOption('format') ?? $config->get('archive-format');
  1776. $dir = $input->getOption('dir') ?? $config->get('archive-dir');
  1777. $returnCode = $this->archive(
  1778. $this->getIO(),
  1779. $config,
  1780. $input->getArgument('package'),
  1781. $input->getArgument('version'),
  1782. $format,
  1783. $dir,
  1784. $input->getOption('file'),
  1785. $input->getOption('ignore-filters'),
  1786. $composer
  1787. );
  1788. if (0 === $returnCode && $composer) {
  1789. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1790. }
  1791. return $returnCode;
  1792. }
  1793. protected function archive(IOInterface $io, Config $config, ?string $packageName, ?string $version, string $format, string $dest, ?string $fileName, bool $ignoreFilters, ?Composer $composer): int
  1794. {
  1795. if ($composer) {
  1796. $archiveManager = $composer->getArchiveManager();
  1797. } else {
  1798. $factory = new Factory;
  1799. $process = new ProcessExecutor();
  1800. $httpDownloader = Factory::createHttpDownloader($io, $config);
  1801. $downloadManager = $factory->createDownloadManager($io, $config, $httpDownloader, $process);
  1802. $archiveManager = $factory->createArchiveManager($config, $downloadManager, new Loop($httpDownloader, $process));
  1803. }
  1804. if ($packageName) {
  1805. $package = $this->selectPackage($io, $packageName, $version);
  1806. if (!$package) {
  1807. return 1;
  1808. }
  1809. } else {
  1810. $package = $this->requireComposer()->getPackage();
  1811. }
  1812. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1813. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1814. $fs = new Filesystem;
  1815. $shortPath = $fs->findShortestPath(Platform::getCwd(), $packagePath, true);
  1816. $io->writeError('Created: ', false);
  1817. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1818. return 0;
  1819. }
  1820. protected function selectPackage(IOInterface $io, string $packageName, ?string $version = null)
  1821. {
  1822. $io->writeError('<info>Searching for the specified package.</info>');
  1823. if ($composer = $this->tryComposer()) {
  1824. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1825. $repo = new CompositeRepository(array_merge([$localRepo], $composer->getRepositoryManager()->getRepositories()));
  1826. $minStability = $composer->getPackage()->getMinimumStability();
  1827. } else {
  1828. $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
  1829. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1830. $repo = new CompositeRepository($defaultRepos);
  1831. $minStability = 'stable';
  1832. }
  1833. if ($version !== null && Preg::isMatchStrictGroups('{@(stable|RC|beta|alpha|dev)$}i', $version, $match)) {
  1834. $minStability = $match[1];
  1835. $version = (string) substr($version, 0, -strlen($match[0]));
  1836. }
  1837. $repoSet = new RepositorySet($minStability);
  1838. $repoSet->addRepository($repo);
  1839. $parser = new VersionParser();
  1840. $constraint = $version !== null ? $parser->parseConstraints($version) : null;
  1841. $packages = $repoSet->findPackages(strtolower($packageName), $constraint);
  1842. if (count($packages) > 1) {
  1843. $versionSelector = new VersionSelector($repoSet);
  1844. $package = $versionSelector->findBestCandidate(strtolower($packageName), $version, $minStability);
  1845. if ($package === false) {
  1846. $package = reset($packages);
  1847. }
  1848. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1849. $io->writeError('Alternatives were '.implode(', ', array_map(static function ($p): string {
  1850. return $p->getPrettyString();
  1851. }, $packages)).'.');
  1852. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1853. } elseif (count($packages) === 1) {
  1854. $package = reset($packages);
  1855. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1856. } else {
  1857. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1858. return false;
  1859. }
  1860. if (!$package instanceof CompletePackageInterface) {
  1861. throw new \LogicException('Expected a CompletePackageInterface instance but found '.get_class($package));
  1862. }
  1863. if (!$package instanceof BasePackage) {
  1864. throw new \LogicException('Expected a BasePackage instance but found '.get_class($package));
  1865. }
  1866. return $package;
  1867. }
  1868. }
  1869. <?php declare(strict_types=1);
  1870. namespace Composer\Command;
  1871. use Composer\Composer;
  1872. use Composer\Repository\RepositorySet;
  1873. use Composer\Repository\RepositoryUtils;
  1874. use Symfony\Component\Console\Input\InputInterface;
  1875. use Symfony\Component\Console\Output\OutputInterface;
  1876. use Composer\Package\PackageInterface;
  1877. use Composer\Repository\InstalledRepository;
  1878. use Composer\Advisory\Auditor;
  1879. use Composer\Console\Input\InputOption;
  1880. class AuditCommand extends BaseCommand
  1881. {
  1882. protected function configure(): void
  1883. {
  1884. $this
  1885. ->setName('audit')
  1886. ->setDescription('Checks for security vulnerability advisories for installed packages')
  1887. ->setDefinition([
  1888. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables auditing of require-dev packages.'),
  1889. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_TABLE, Auditor::FORMATS),
  1890. new InputOption('locked', null, InputOption::VALUE_NONE, 'Audit based on the lock file instead of the installed packages.'),
  1891. ])
  1892. ->setHelp(
  1893. <<<EOT
  1894. The <info>audit</info> command checks for security vulnerability advisories for installed packages.
  1895. If you do not want to include dev dependencies in the audit you can omit them with --no-dev
  1896. Read more at https://getcomposer.org/doc/03-cli.md#audit
  1897. EOT
  1898. )
  1899. ;
  1900. }
  1901. protected function execute(InputInterface $input, OutputInterface $output): int
  1902. {
  1903. $composer = $this->requireComposer();
  1904. $packages = $this->getPackages($composer, $input);
  1905. if (count($packages) === 0) {
  1906. $this->getIO()->writeError('No packages - skipping audit.');
  1907. return 0;
  1908. }
  1909. $auditor = new Auditor();
  1910. $repoSet = new RepositorySet();
  1911. foreach ($composer->getRepositoryManager()->getRepositories() as $repo) {
  1912. $repoSet->addRepository($repo);
  1913. }
  1914. $auditConfig = $composer->getConfig()->get('audit');
  1915. return min(255, $auditor->audit($this->getIO(), $repoSet, $packages, $this->getAuditFormat($input, 'format'), false, $auditConfig['ignore'] ?? [], $auditConfig['abandoned'] ?? Auditor::ABANDONED_FAIL));
  1916. }
  1917. private function getPackages(Composer $composer, InputInterface $input): array
  1918. {
  1919. if ($input->getOption('locked')) {
  1920. if (!$composer->getLocker()->isLocked()) {
  1921. throw new \UnexpectedValueException('Valid composer.json and composer.lock files are required to run this command with --locked');
  1922. }
  1923. $locker = $composer->getLocker();
  1924. return $locker->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1925. }
  1926. $rootPkg = $composer->getPackage();
  1927. $installedRepo = new InstalledRepository([$composer->getRepositoryManager()->getLocalRepository()]);
  1928. if ($input->getOption('no-dev')) {
  1929. return RepositoryUtils::filterRequiredPackages($installedRepo->getPackages(), $rootPkg);
  1930. }
  1931. return $installedRepo->getPackages();
  1932. }
  1933. }
  1934. <?php declare(strict_types=1);
  1935. namespace Composer\Command;
  1936. use Composer\Composer;
  1937. use Composer\Config;
  1938. use Composer\Console\Application;
  1939. use Composer\Console\Input\InputArgument;
  1940. use Composer\Console\Input\InputOption;
  1941. use Composer\Factory;
  1942. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  1943. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  1944. use Composer\IO\IOInterface;
  1945. use Composer\IO\NullIO;
  1946. use Composer\Plugin\PreCommandRunEvent;
  1947. use Composer\Package\Version\VersionParser;
  1948. use Composer\Plugin\PluginEvents;
  1949. use Composer\Advisory\Auditor;
  1950. use Composer\Util\Platform;
  1951. use Symfony\Component\Console\Completion\CompletionInput;
  1952. use Symfony\Component\Console\Completion\CompletionSuggestions;
  1953. use Symfony\Component\Console\Helper\Table;
  1954. use Symfony\Component\Console\Helper\TableSeparator;
  1955. use Symfony\Component\Console\Input\InputInterface;
  1956. use Symfony\Component\Console\Output\OutputInterface;
  1957. use Symfony\Component\Console\Command\Command;
  1958. use Symfony\Component\Console\Terminal;
  1959. abstract class BaseCommand extends Command
  1960. {
  1961. private $composer;
  1962. private $io;
  1963. public function getApplication(): Application
  1964. {
  1965. $application = parent::getApplication();
  1966. if (!$application instanceof Application) {
  1967. throw new \RuntimeException('Composer commands can only work with an '.Application::class.' instance set');
  1968. }
  1969. return $application;
  1970. }
  1971. public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null)
  1972. {
  1973. if ($required) {
  1974. return $this->requireComposer($disablePlugins, $disableScripts);
  1975. }
  1976. return $this->tryComposer($disablePlugins, $disableScripts);
  1977. }
  1978. public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): Composer
  1979. {
  1980. if (null === $this->composer) {
  1981. $application = parent::getApplication();
  1982. if ($application instanceof Application) {
  1983. $this->composer = $application->getComposer(true, $disablePlugins, $disableScripts);
  1984. assert($this->composer instanceof Composer);
  1985. } else {
  1986. throw new \RuntimeException(
  1987. 'Could not create a Composer\Composer instance, you must inject '.
  1988. 'one if this command is not used with a Composer\Console\Application instance'
  1989. );
  1990. }
  1991. }
  1992. return $this->composer;
  1993. }
  1994. public function tryComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
  1995. {
  1996. if (null === $this->composer) {
  1997. $application = parent::getApplication();
  1998. if ($application instanceof Application) {
  1999. $this->composer = $application->getComposer(false, $disablePlugins, $disableScripts);
  2000. }
  2001. }
  2002. return $this->composer;
  2003. }
  2004. public function setComposer(Composer $composer)
  2005. {
  2006. $this->composer = $composer;
  2007. }
  2008. public function resetComposer()
  2009. {
  2010. $this->composer = null;
  2011. $this->getApplication()->resetComposer();
  2012. }
  2013. public function isProxyCommand()
  2014. {
  2015. return false;
  2016. }
  2017. public function getIO()
  2018. {
  2019. if (null === $this->io) {
  2020. $application = parent::getApplication();
  2021. if ($application instanceof Application) {
  2022. $this->io = $application->getIO();
  2023. } else {
  2024. $this->io = new NullIO();
  2025. }
  2026. }
  2027. return $this->io;
  2028. }
  2029. public function setIO(IOInterface $io)
  2030. {
  2031. $this->io = $io;
  2032. }
  2033. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  2034. {
  2035. $definition = $this->getDefinition();
  2036. $name = (string) $input->getCompletionName();
  2037. if (CompletionInput::TYPE_OPTION_VALUE === $input->getCompletionType()
  2038. && $definition->hasOption($name)
  2039. && ($option = $definition->getOption($name)) instanceof InputOption
  2040. ) {
  2041. $option->complete($input, $suggestions);
  2042. } elseif (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
  2043. && $definition->hasArgument($name)
  2044. && ($argument = $definition->getArgument($name)) instanceof InputArgument
  2045. ) {
  2046. $argument->complete($input, $suggestions);
  2047. } else {
  2048. parent::complete($input, $suggestions);
  2049. }
  2050. }
  2051. protected function initialize(InputInterface $input, OutputInterface $output)
  2052. {
  2053. $disablePlugins = $input->hasParameterOption('--no-plugins');
  2054. $disableScripts = $input->hasParameterOption('--no-scripts');
  2055. $application = parent::getApplication();
  2056. if ($application instanceof Application && $application->getDisablePluginsByDefault()) {
  2057. $disablePlugins = true;
  2058. }
  2059. if ($application instanceof Application && $application->getDisableScriptsByDefault()) {
  2060. $disableScripts = true;
  2061. }
  2062. if ($this instanceof SelfUpdateCommand) {
  2063. $disablePlugins = true;
  2064. $disableScripts = true;
  2065. }
  2066. $composer = $this->tryComposer($disablePlugins, $disableScripts);
  2067. $io = $this->getIO();
  2068. if (null === $composer) {
  2069. $composer = Factory::createGlobal($this->getIO(), $disablePlugins, $disableScripts);
  2070. }
  2071. if ($composer) {
  2072. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  2073. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  2074. }
  2075. if (true === $input->hasParameterOption(['--no-ansi']) && $input->hasOption('no-progress')) {
  2076. $input->setOption('no-progress', true);
  2077. }
  2078. $envOptions = [
  2079. 'COMPOSER_NO_AUDIT' => ['no-audit'],
  2080. 'COMPOSER_NO_DEV' => ['no-dev', 'update-no-dev'],
  2081. 'COMPOSER_PREFER_STABLE' => ['prefer-stable'],
  2082. 'COMPOSER_PREFER_LOWEST' => ['prefer-lowest'],
  2083. 'COMPOSER_MINIMAL_CHANGES' => ['minimal-changes'],
  2084. ];
  2085. foreach ($envOptions as $envName => $optionNames) {
  2086. foreach ($optionNames as $optionName) {
  2087. if (true === $input->hasOption($optionName)) {
  2088. if (false === $input->getOption($optionName) && (bool) Platform::getEnv($envName)) {
  2089. $input->setOption($optionName, true);
  2090. }
  2091. }
  2092. }
  2093. }
  2094. if (true === $input->hasOption('ignore-platform-reqs')) {
  2095. if (!$input->getOption('ignore-platform-reqs') && (bool) Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQS')) {
  2096. $input->setOption('ignore-platform-reqs', true);
  2097. $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQS is set. You may experience unexpected errors.</warning>');
  2098. }
  2099. }
  2100. if (true === $input->hasOption('ignore-platform-req') && (!$input->hasOption('ignore-platform-reqs') || !$input->getOption('ignore-platform-reqs'))) {
  2101. $ignorePlatformReqEnv = Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQ');
  2102. if (0 === count($input->getOption('ignore-platform-req')) && is_string($ignorePlatformReqEnv) && '' !== $ignorePlatformReqEnv) {
  2103. $input->setOption('ignore-platform-req', explode(',', $ignorePlatformReqEnv));
  2104. $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQ is set to ignore '.$ignorePlatformReqEnv.'. You may experience unexpected errors.</warning>');
  2105. }
  2106. }
  2107. parent::initialize($input, $output);
  2108. }
  2109. protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false)
  2110. {
  2111. $preferSource = false;
  2112. $preferDist = false;
  2113. switch ($config->get('preferred-install')) {
  2114. case 'source':
  2115. $preferSource = true;
  2116. break;
  2117. case 'dist':
  2118. $preferDist = true;
  2119. break;
  2120. case 'auto':
  2121. default:
  2122. break;
  2123. }
  2124. if (!$input->hasOption('prefer-dist') || !$input->hasOption('prefer-source')) {
  2125. return [$preferSource, $preferDist];
  2126. }
  2127. if ($input->hasOption('prefer-install') && is_string($input->getOption('prefer-install'))) {
  2128. if ($input->getOption('prefer-source')) {
  2129. throw new \InvalidArgumentException('--prefer-source can not be used together with --prefer-install');
  2130. }
  2131. if ($input->getOption('prefer-dist')) {
  2132. throw new \InvalidArgumentException('--prefer-dist can not be used together with --prefer-install');
  2133. }
  2134. switch ($input->getOption('prefer-install')) {
  2135. case 'dist':
  2136. $input->setOption('prefer-dist', true);
  2137. break;
  2138. case 'source':
  2139. $input->setOption('prefer-source', true);
  2140. break;
  2141. case 'auto':
  2142. $preferDist = false;
  2143. $preferSource = false;
  2144. break;
  2145. default:
  2146. throw new \UnexpectedValueException('--prefer-install accepts one of "dist", "source" or "auto", got '.$input->getOption('prefer-install'));
  2147. }
  2148. }
  2149. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  2150. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  2151. $preferDist = $input->getOption('prefer-dist');
  2152. }
  2153. return [$preferSource, $preferDist];
  2154. }
  2155. protected function getPlatformRequirementFilter(InputInterface $input): PlatformRequirementFilterInterface
  2156. {
  2157. if (!$input->hasOption('ignore-platform-reqs') || !$input->hasOption('ignore-platform-req')) {
  2158. throw new \LogicException('Calling getPlatformRequirementFilter from a command which does not define the --ignore-platform-req[s] flags is not permitted.');
  2159. }
  2160. if (true === $input->getOption('ignore-platform-reqs')) {
  2161. return PlatformRequirementFilterFactory::ignoreAll();
  2162. }
  2163. $ignores = $input->getOption('ignore-platform-req');
  2164. if (count($ignores) > 0) {
  2165. return PlatformRequirementFilterFactory::fromBoolOrList($ignores);
  2166. }
  2167. return PlatformRequirementFilterFactory::ignoreNothing();
  2168. }
  2169. protected function formatRequirements(array $requirements)
  2170. {
  2171. $requires = [];
  2172. $requirements = $this->normalizeRequirements($requirements);
  2173. foreach ($requirements as $requirement) {
  2174. if (!isset($requirement['version'])) {
  2175. throw new \UnexpectedValueException('Option '.$requirement['name'] .' is missing a version constraint, use e.g. '.$requirement['name'].':^1.0');
  2176. }
  2177. $requires[$requirement['name']] = $requirement['version'];
  2178. }
  2179. return $requires;
  2180. }
  2181. protected function normalizeRequirements(array $requirements)
  2182. {
  2183. $parser = new VersionParser();
  2184. return $parser->parseNameVersionPairs($requirements);
  2185. }
  2186. protected function renderTable(array $table, OutputInterface $output)
  2187. {
  2188. $renderer = new Table($output);
  2189. $renderer->setStyle('compact');
  2190. $renderer->setRows($table)->render();
  2191. }
  2192. protected function getTerminalWidth()
  2193. {
  2194. $terminal = new Terminal();
  2195. $width = $terminal->getWidth();
  2196. if (Platform::isWindows()) {
  2197. $width--;
  2198. } else {
  2199. $width = max(80, $width);
  2200. }
  2201. return $width;
  2202. }
  2203. protected function getAuditFormat(InputInterface $input, string $optName = 'audit-format'): string
  2204. {
  2205. if (!$input->hasOption($optName)) {
  2206. throw new \LogicException('This should not be called on a Command which has no '.$optName.' option defined.');
  2207. }
  2208. $val = $input->getOption($optName);
  2209. if (!in_array($val, Auditor::FORMATS, true)) {
  2210. throw new \InvalidArgumentException('--'.$optName.' must be one of '.implode(', ', Auditor::FORMATS).'.');
  2211. }
  2212. return $val;
  2213. }
  2214. }
  2215. <?php declare(strict_types=1);
  2216. namespace Composer\Command;
  2217. use Composer\Package\Link;
  2218. use Composer\Package\PackageInterface;
  2219. use Composer\Package\CompletePackageInterface;
  2220. use Composer\Package\RootPackage;
  2221. use Composer\Repository\InstalledArrayRepository;
  2222. use Composer\Repository\CompositeRepository;
  2223. use Composer\Repository\RootPackageRepository;
  2224. use Composer\Repository\InstalledRepository;
  2225. use Composer\Repository\PlatformRepository;
  2226. use Composer\Repository\RepositoryFactory;
  2227. use Composer\Plugin\CommandEvent;
  2228. use Composer\Plugin\PluginEvents;
  2229. use Symfony\Component\Console\Formatter\OutputFormatter;
  2230. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  2231. use Composer\Package\Version\VersionParser;
  2232. use Symfony\Component\Console\Input\InputInterface;
  2233. use Symfony\Component\Console\Output\OutputInterface;
  2234. use Composer\Util\PackageInfo;
  2235. abstract class BaseDependencyCommand extends BaseCommand
  2236. {
  2237. protected const ARGUMENT_PACKAGE = 'package';
  2238. protected const ARGUMENT_CONSTRAINT = 'version';
  2239. protected const OPTION_RECURSIVE = 'recursive';
  2240. protected const OPTION_TREE = 'tree';
  2241. protected $colors;
  2242. protected function doExecute(InputInterface $input, OutputInterface $output, bool $inverted = false): int
  2243. {
  2244. $composer = $this->requireComposer();
  2245. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  2246. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2247. $repos = [];
  2248. $repos[] = new RootPackageRepository(clone $composer->getPackage());
  2249. if ($input->getOption('locked')) {
  2250. $locker = $composer->getLocker();
  2251. if (!$locker->isLocked()) {
  2252. throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --locked');
  2253. }
  2254. $repos[] = $locker->getLockedRepository(true);
  2255. $repos[] = new PlatformRepository([], $locker->getPlatformOverrides());
  2256. } else {
  2257. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  2258. $rootPkg = $composer->getPackage();
  2259. if (count($localRepo->getPackages()) === 0 && (count($rootPkg->getRequires()) > 0 || count($rootPkg->getDevRequires()) > 0)) {
  2260. $output->writeln('<warning>No dependencies installed. Try running composer install or update, or use --locked.</warning>');
  2261. return 1;
  2262. }
  2263. $repos[] = $localRepo;
  2264. $platformOverrides = $composer->getConfig()->get('platform') ?: [];
  2265. $repos[] = new PlatformRepository([], $platformOverrides);
  2266. }
  2267. $installedRepo = new InstalledRepository($repos);
  2268. $needle = $input->getArgument(self::ARGUMENT_PACKAGE);
  2269. $textConstraint = $input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*';
  2270. $packages = $installedRepo->findPackagesWithReplacersAndProviders($needle);
  2271. if (empty($packages)) {
  2272. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  2273. }
  2274. if (!$installedRepo->findPackage($needle, $textConstraint)) {
  2275. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager()));
  2276. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  2277. $installedRepo->addRepository(new InstalledArrayRepository([clone $match]));
  2278. } else {
  2279. $this->getIO()->writeError('<error>Package "'.$needle.'" could not be found with constraint "'.$textConstraint.'", results below will most likely be incomplete.</error>');
  2280. }
  2281. }
  2282. $needles = [$needle];
  2283. if ($inverted) {
  2284. foreach ($packages as $package) {
  2285. $needles = array_merge($needles, array_map(static function (Link $link): string {
  2286. return $link->getTarget();
  2287. }, $package->getReplaces()));
  2288. }
  2289. }
  2290. if ('*' !== $textConstraint) {
  2291. $versionParser = new VersionParser();
  2292. $constraint = $versionParser->parseConstraints($textConstraint);
  2293. } else {
  2294. $constraint = null;
  2295. }
  2296. $renderTree = $input->getOption(self::OPTION_TREE);
  2297. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  2298. $return = $inverted ? 1 : 0;
  2299. $results = $installedRepo->getDependents($needles, $constraint, $inverted, $recursive);
  2300. if (empty($results)) {
  2301. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  2302. $this->getIO()->writeError(sprintf(
  2303. '<info>There is no installed package depending on "%s"%s</info>',
  2304. $needle,
  2305. $extra
  2306. ));
  2307. $return = $inverted ? 0 : 1;
  2308. } elseif ($renderTree) {
  2309. $this->initStyles($output);
  2310. $root = $packages[0];
  2311. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root instanceof CompletePackageInterface ? $root->getDescription() : ''));
  2312. $this->printTree($results);
  2313. } else {
  2314. $this->printTable($output, $results);
  2315. }
  2316. if ($inverted && $input->hasArgument(self::ARGUMENT_CONSTRAINT)) {
  2317. $composerCommand = 'update';
  2318. foreach ($composer->getPackage()->getRequires() as $rootRequirement) {
  2319. if ($rootRequirement->getTarget() === $needle) {
  2320. $composerCommand = 'require';
  2321. break;
  2322. }
  2323. }
  2324. foreach ($composer->getPackage()->getDevRequires() as $rootRequirement) {
  2325. if ($rootRequirement->getTarget() === $needle) {
  2326. $composerCommand = 'require --dev';
  2327. break;
  2328. }
  2329. }
  2330. $this->getIO()->writeError('Not finding what you were looking for? Try calling `composer '.$composerCommand.' "'.$needle.':'.$textConstraint.'" --dry-run` to get another view on the problem.');
  2331. }
  2332. return $return;
  2333. }
  2334. protected function printTable(OutputInterface $output, $results): void
  2335. {
  2336. $table = [];
  2337. $doubles = [];
  2338. do {
  2339. $queue = [];
  2340. $rows = [];
  2341. foreach ($results as $result) {
  2342. [$package, $link, $children] = $result;
  2343. $unique = (string) $link;
  2344. if (isset($doubles[$unique])) {
  2345. continue;
  2346. }
  2347. $doubles[$unique] = true;
  2348. $version = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '-' : $package->getPrettyVersion();
  2349. $packageUrl = PackageInfo::getViewSourceOrHomepageUrl($package);
  2350. $nameWithLink = $packageUrl !== null ? '<href=' . OutputFormatter::escape($packageUrl) . '>' . $package->getPrettyName() . '</>' : $package->getPrettyName();
  2351. $rows[] = [$nameWithLink, $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint())];
  2352. if ($children) {
  2353. $queue = array_merge($queue, $children);
  2354. }
  2355. }
  2356. $results = $queue;
  2357. $table = array_merge($rows, $table);
  2358. } while (!empty($results));
  2359. $this->renderTable($table, $output);
  2360. }
  2361. protected function initStyles(OutputInterface $output): void
  2362. {
  2363. $this->colors = [
  2364. 'green',
  2365. 'yellow',
  2366. 'cyan',
  2367. 'magenta',
  2368. 'blue',
  2369. ];
  2370. foreach ($this->colors as $color) {
  2371. $style = new OutputFormatterStyle($color);
  2372. $output->getFormatter()->setStyle($color, $style);
  2373. }
  2374. }
  2375. protected function printTree(array $results, string $prefix = '', int $level = 1): void
  2376. {
  2377. $count = count($results);
  2378. $idx = 0;
  2379. foreach ($results as $result) {
  2380. [$package, $link, $children] = $result;
  2381. $color = $this->colors[$level % count($this->colors)];
  2382. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  2383. $isLast = (++$idx === $count);
  2384. $versionText = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '' : $package->getPrettyVersion();
  2385. $packageUrl = PackageInfo::getViewSourceOrHomepageUrl($package);
  2386. $nameWithLink = $packageUrl !== null ? '<href=' . OutputFormatter::escape($packageUrl) . '>' . $package->getPrettyName() . '</>' : $package->getPrettyName();
  2387. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $nameWithLink, $versionText));
  2388. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  2389. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  2390. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  2391. if ($children) {
  2392. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  2393. }
  2394. }
  2395. }
  2396. private function writeTreeLine(string $line): void
  2397. {
  2398. $io = $this->getIO();
  2399. if (!$io->isDecorated()) {
  2400. $line = str_replace(['└', '├', '──', '│'], ['`-', '|-', '-', '|'], $line);
  2401. }
  2402. $io->write($line);
  2403. }
  2404. }
  2405. <?php declare(strict_types=1);
  2406. namespace Composer\Command;
  2407. use Composer\Package\AliasPackage;
  2408. use Composer\Package\BasePackage;
  2409. use Composer\Package\Locker;
  2410. use Composer\Package\Version\VersionBumper;
  2411. use Composer\Pcre\Preg;
  2412. use Composer\Util\Filesystem;
  2413. use Symfony\Component\Console\Input\InputInterface;
  2414. use Composer\Console\Input\InputArgument;
  2415. use Composer\Console\Input\InputOption;
  2416. use Symfony\Component\Console\Output\OutputInterface;
  2417. use Composer\Factory;
  2418. use Composer\Json\JsonFile;
  2419. use Composer\Json\JsonManipulator;
  2420. use Composer\Repository\PlatformRepository;
  2421. use Composer\Util\Silencer;
  2422. final class BumpCommand extends BaseCommand
  2423. {
  2424. private const ERROR_GENERIC = 1;
  2425. private const ERROR_LOCK_OUTDATED = 2;
  2426. use CompletionTrait;
  2427. protected function configure(): void
  2428. {
  2429. $this
  2430. ->setName('bump')
  2431. ->setDescription('Increases the lower limit of your composer.json requirements to the currently installed versions')
  2432. ->setDefinition([
  2433. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name(s) to restrict which packages are bumped.', null, $this->suggestRootRequirement()),
  2434. new InputOption('dev-only', 'D', InputOption::VALUE_NONE, 'Only bump requirements in "require-dev".'),
  2435. new InputOption('no-dev-only', 'R', InputOption::VALUE_NONE, 'Only bump requirements in "require".'),
  2436. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the packages to bump, but will not execute anything.'),
  2437. ])
  2438. ->setHelp(
  2439. <<<EOT
  2440. The <info>bump</info> command increases the lower limit of your composer.json requirements
  2441. to the currently installed versions. This helps to ensure your dependencies do not
  2442. accidentally get downgraded due to some other conflict, and can slightly improve
  2443. dependency resolution performance as it limits the amount of package versions
  2444. Composer has to look at.
  2445. Running this blindly on libraries is **NOT** recommended as it will narrow down
  2446. your allowed dependencies, which may cause dependency hell for your users.
  2447. Running it with <info>--dev-only</info> on libraries may be fine however as dev requirements
  2448. are local to the library and do not affect consumers of the package.
  2449. EOT
  2450. )
  2451. ;
  2452. }
  2453. protected function execute(InputInterface $input, OutputInterface $output): int
  2454. {
  2455. $composerJsonPath = Factory::getComposerFile();
  2456. $io = $this->getIO();
  2457. if (!Filesystem::isReadable($composerJsonPath)) {
  2458. $io->writeError('<error>'.$composerJsonPath.' is not readable.</error>');
  2459. return self::ERROR_GENERIC;
  2460. }
  2461. $composerJson = new JsonFile($composerJsonPath);
  2462. $contents = file_get_contents($composerJson->getPath());
  2463. if (false === $contents) {
  2464. $io->writeError('<error>'.$composerJsonPath.' is not readable.</error>');
  2465. return self::ERROR_GENERIC;
  2466. }
  2467. if (!is_writable($composerJsonPath) && false === Silencer::call('file_put_contents', $composerJsonPath, $contents)) {
  2468. $io->writeError('<error>'.$composerJsonPath.' is not writable.</error>');
  2469. return self::ERROR_GENERIC;
  2470. }
  2471. unset($contents);
  2472. $composer = $this->requireComposer();
  2473. if ($composer->getLocker()->isLocked()) {
  2474. if (!$composer->getLocker()->isFresh()) {
  2475. $io->writeError('<error>The lock file is not up to date with the latest changes in composer.json. Run the appropriate `update` to fix that before you use the `bump` command.</error>');
  2476. return self::ERROR_LOCK_OUTDATED;
  2477. }
  2478. $repo = $composer->getLocker()->getLockedRepository(true);
  2479. } else {
  2480. $repo = $composer->getRepositoryManager()->getLocalRepository();
  2481. }
  2482. if ($composer->getPackage()->getType() !== 'project' && !$input->getOption('dev-only')) {
  2483. $io->writeError('<warning>Warning: Bumping dependency constraints is not recommended for libraries as it will narrow down your dependencies and may cause problems for your users.</warning>');
  2484. $contents = $composerJson->read();
  2485. if (!isset($contents['type'])) {
  2486. $io->writeError('<warning>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</warning>');
  2487. $io->writeError('<warning>Alternatively you can use --dev-only to only bump dependencies within "require-dev".</warning>');
  2488. }
  2489. unset($contents);
  2490. }
  2491. $bumper = new VersionBumper();
  2492. $tasks = [];
  2493. if (!$input->getOption('dev-only')) {
  2494. $tasks['require'] = $composer->getPackage()->getRequires();
  2495. }
  2496. if (!$input->getOption('no-dev-only')) {
  2497. $tasks['require-dev'] = $composer->getPackage()->getDevRequires();
  2498. }
  2499. $packagesFilter = $input->getArgument('packages');
  2500. if (count($packagesFilter) > 0) {
  2501. $pattern = BasePackage::packageNamesToRegexp(array_unique(array_map('strtolower', $packagesFilter)));
  2502. foreach ($tasks as $key => $reqs) {
  2503. foreach ($reqs as $pkgName => $link) {
  2504. if (!Preg::isMatch($pattern, $pkgName)) {
  2505. unset($tasks[$key][$pkgName]);
  2506. }
  2507. }
  2508. }
  2509. }
  2510. $updates = [];
  2511. foreach ($tasks as $key => $reqs) {
  2512. foreach ($reqs as $pkgName => $link) {
  2513. if (PlatformRepository::isPlatformPackage($pkgName)) {
  2514. continue;
  2515. }
  2516. $currentConstraint = $link->getPrettyConstraint();
  2517. $package = $repo->findPackage($pkgName, '*');
  2518. if (null === $package) {
  2519. continue;
  2520. }
  2521. while ($package instanceof AliasPackage) {
  2522. $package = $package->getAliasOf();
  2523. }
  2524. $bumped = $bumper->bumpRequirement($link->getConstraint(), $package);
  2525. if ($bumped === $currentConstraint) {
  2526. continue;
  2527. }
  2528. $updates[$key][$pkgName] = $bumped;
  2529. }
  2530. }
  2531. $dryRun = $input->getOption('dry-run');
  2532. if (!$dryRun && !$this->updateFileCleanly($composerJson, $updates)) {
  2533. $composerDefinition = $composerJson->read();
  2534. foreach ($updates as $key => $packages) {
  2535. foreach ($packages as $package => $version) {
  2536. $composerDefinition[$key][$package] = $version;
  2537. }
  2538. }
  2539. $composerJson->write($composerDefinition);
  2540. }
  2541. $changeCount = array_sum(array_map('count', $updates));
  2542. if ($changeCount > 0) {
  2543. if ($dryRun) {
  2544. $io->write('<info>' . $composerJsonPath . ' would be updated with:</info>');
  2545. foreach ($updates as $requireType => $packages) {
  2546. foreach ($packages as $package => $version) {
  2547. $io->write(sprintf('<info> - %s.%s: %s</info>', $requireType, $package, $version));
  2548. }
  2549. }
  2550. } else {
  2551. $io->write('<info>' . $composerJsonPath . ' has been updated (' . $changeCount . ' changes).</info>');
  2552. }
  2553. } else {
  2554. $io->write('<info>No requirements to update in '.$composerJsonPath.'.</info>');
  2555. }
  2556. if (!$dryRun && $composer->getLocker()->isLocked() && $changeCount > 0) {
  2557. $contents = file_get_contents($composerJson->getPath());
  2558. if (false === $contents) {
  2559. throw new \RuntimeException('Unable to read '.$composerJson->getPath().' contents to update the lock file hash.');
  2560. }
  2561. $lock = new JsonFile(Factory::getLockFile($composerJsonPath));
  2562. $lockData = $lock->read();
  2563. $lockData['content-hash'] = Locker::getContentHash($contents);
  2564. $lock->write($lockData);
  2565. }
  2566. if ($dryRun && $changeCount > 0) {
  2567. return self::ERROR_GENERIC;
  2568. }
  2569. return 0;
  2570. }
  2571. private function updateFileCleanly(JsonFile $json, array $updates): bool
  2572. {
  2573. $contents = file_get_contents($json->getPath());
  2574. if (false === $contents) {
  2575. throw new \RuntimeException('Unable to read '.$json->getPath().' contents.');
  2576. }
  2577. $manipulator = new JsonManipulator($contents);
  2578. foreach ($updates as $key => $packages) {
  2579. foreach ($packages as $package => $version) {
  2580. if (!$manipulator->addLink($key, $package, $version)) {
  2581. return false;
  2582. }
  2583. }
  2584. }
  2585. if (false === file_put_contents($json->getPath(), $manipulator->getContents())) {
  2586. throw new \RuntimeException('Unable to write new '.$json->getPath().' contents.');
  2587. }
  2588. return true;
  2589. }
  2590. }
  2591. <?php declare(strict_types=1);
  2592. namespace Composer\Command;
  2593. use Composer\Package\Link;
  2594. use Composer\Semver\Constraint\Constraint;
  2595. use Symfony\Component\Console\Input\InputInterface;
  2596. use Composer\Console\Input\InputOption;
  2597. use Symfony\Component\Console\Output\OutputInterface;
  2598. use Composer\Repository\PlatformRepository;
  2599. use Composer\Repository\RootPackageRepository;
  2600. use Composer\Repository\InstalledRepository;
  2601. use Composer\Json\JsonFile;
  2602. class CheckPlatformReqsCommand extends BaseCommand
  2603. {
  2604. protected function configure(): void
  2605. {
  2606. $this->setName('check-platform-reqs')
  2607. ->setDescription('Check that platform requirements are satisfied')
  2608. ->setDefinition([
  2609. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  2610. new InputOption('lock', null, InputOption::VALUE_NONE, 'Checks requirements only from the lock file, not from installed packages.'),
  2611. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  2612. ])
  2613. ->setHelp(
  2614. <<<EOT
  2615. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  2616. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  2617. <info>php composer.phar check-platform-reqs</info>
  2618. EOT
  2619. );
  2620. }
  2621. protected function execute(InputInterface $input, OutputInterface $output): int
  2622. {
  2623. $composer = $this->requireComposer();
  2624. $requires = [];
  2625. $removePackages = [];
  2626. if ($input->getOption('lock')) {
  2627. $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements using the lock file</info>');
  2628. $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
  2629. } else {
  2630. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  2631. if (!$installedRepo->getPackages()) {
  2632. $this->getIO()->writeError('<warning>No vendor dir present, checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements from the lock file</warning>');
  2633. $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
  2634. } else {
  2635. if ($input->getOption('no-dev')) {
  2636. $removePackages = $installedRepo->getDevPackageNames();
  2637. }
  2638. $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements for packages in the vendor dir</info>');
  2639. }
  2640. }
  2641. if (!$input->getOption('no-dev')) {
  2642. foreach ($composer->getPackage()->getDevRequires() as $require => $link) {
  2643. $requires[$require] = [$link];
  2644. }
  2645. }
  2646. $installedRepo = new InstalledRepository([$installedRepo, new RootPackageRepository(clone $composer->getPackage())]);
  2647. foreach ($installedRepo->getPackages() as $package) {
  2648. if (in_array($package->getName(), $removePackages, true)) {
  2649. continue;
  2650. }
  2651. foreach ($package->getRequires() as $require => $link) {
  2652. $requires[$require][] = $link;
  2653. }
  2654. }
  2655. ksort($requires);
  2656. $installedRepo->addRepository(new PlatformRepository([], []));
  2657. $results = [];
  2658. $exitCode = 0;
  2659. foreach ($requires as $require => $links) {
  2660. if (PlatformRepository::isPlatformPackage($require)) {
  2661. $candidates = $installedRepo->findPackagesWithReplacersAndProviders($require);
  2662. if ($candidates) {
  2663. $reqResults = [];
  2664. foreach ($candidates as $candidate) {
  2665. $candidateConstraint = null;
  2666. if ($candidate->getName() === $require) {
  2667. $candidateConstraint = new Constraint('=', $candidate->getVersion());
  2668. $candidateConstraint->setPrettyString($candidate->getPrettyVersion());
  2669. } else {
  2670. foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
  2671. if ($link->getTarget() === $require) {
  2672. $candidateConstraint = $link->getConstraint();
  2673. break;
  2674. }
  2675. }
  2676. }
  2677. if (!$candidateConstraint) {
  2678. continue;
  2679. }
  2680. foreach ($links as $link) {
  2681. if (!$link->getConstraint()->matches($candidateConstraint)) {
  2682. $reqResults[] = [
  2683. $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
  2684. $candidateConstraint->getPrettyString(),
  2685. $link,
  2686. '<error>failed</error>',
  2687. $candidate->getName() === $require ? '' : '<comment>provided by '.$candidate->getPrettyName().'</comment>',
  2688. ];
  2689. continue 2;
  2690. }
  2691. }
  2692. $results[] = [
  2693. $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
  2694. $candidateConstraint->getPrettyString(),
  2695. null,
  2696. '<info>success</info>',
  2697. $candidate->getName() === $require ? '' : '<comment>provided by '.$candidate->getPrettyName().'</comment>',
  2698. ];
  2699. continue 2;
  2700. }
  2701. $results = array_merge($results, $reqResults);
  2702. $exitCode = max($exitCode, 1);
  2703. continue;
  2704. }
  2705. $results[] = [
  2706. $require,
  2707. 'n/a',
  2708. $links[0],
  2709. '<error>missing</error>',
  2710. '',
  2711. ];
  2712. $exitCode = max($exitCode, 2);
  2713. }
  2714. }
  2715. $this->printTable($output, $results, $input->getOption('format'));
  2716. return $exitCode;
  2717. }
  2718. protected function printTable(OutputInterface $output, array $results, string $format): void
  2719. {
  2720. $rows = [];
  2721. foreach ($results as $result) {
  2722. [$platformPackage, $version, $link, $status, $provider] = $result;
  2723. if ('json' === $format) {
  2724. $rows[] = [
  2725. "name" => $platformPackage,
  2726. "version" => $version,
  2727. "status" => strip_tags($status),
  2728. "failed_requirement" => $link instanceof Link ? [
  2729. 'source' => $link->getSource(),
  2730. 'type' => $link->getDescription(),
  2731. 'target' => $link->getTarget(),
  2732. 'constraint' => $link->getPrettyConstraint(),
  2733. ] : null,
  2734. "provider" => $provider === '' ? null : strip_tags($provider),
  2735. ];
  2736. } else {
  2737. $rows[] = [
  2738. $platformPackage,
  2739. $version,
  2740. $link,
  2741. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  2742. rtrim($status.' '.$provider),
  2743. ];
  2744. }
  2745. }
  2746. if ('json' === $format) {
  2747. $this->getIO()->write(JsonFile::encode($rows));
  2748. } else {
  2749. $this->renderTable($rows, $output);
  2750. }
  2751. }
  2752. }
  2753. <?php declare(strict_types=1);
  2754. namespace Composer\Command;
  2755. use Composer\Cache;
  2756. use Composer\Factory;
  2757. use Symfony\Component\Console\Input\InputInterface;
  2758. use Symfony\Component\Console\Input\InputOption;
  2759. use Symfony\Component\Console\Output\OutputInterface;
  2760. class ClearCacheCommand extends BaseCommand
  2761. {
  2762. protected function configure(): void
  2763. {
  2764. $this
  2765. ->setName('clear-cache')
  2766. ->setAliases(['clearcache', 'cc'])
  2767. ->setDescription('Clears composer\'s internal package cache')
  2768. ->setDefinition([
  2769. new InputOption('gc', null, InputOption::VALUE_NONE, 'Only run garbage collection, not a full cache clear'),
  2770. ])
  2771. ->setHelp(
  2772. <<<EOT
  2773. The <info>clear-cache</info> deletes all cached packages from composer's
  2774. cache directory.
  2775. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  2776. EOT
  2777. )
  2778. ;
  2779. }
  2780. protected function execute(InputInterface $input, OutputInterface $output): int
  2781. {
  2782. $config = Factory::createConfig();
  2783. $io = $this->getIO();
  2784. $cachePaths = [
  2785. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  2786. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  2787. 'cache-files-dir' => $config->get('cache-files-dir'),
  2788. 'cache-dir' => $config->get('cache-dir'),
  2789. ];
  2790. foreach ($cachePaths as $key => $cachePath) {
  2791. if ($key === 'cache-dir' && $input->getOption('gc')) {
  2792. continue;
  2793. }
  2794. $cachePath = realpath($cachePath);
  2795. if (!$cachePath) {
  2796. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  2797. continue;
  2798. }
  2799. $cache = new Cache($io, $cachePath);
  2800. $cache->setReadOnly($config->get('cache-read-only'));
  2801. if (!$cache->isEnabled()) {
  2802. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  2803. continue;
  2804. }
  2805. if ($input->getOption('gc')) {
  2806. $io->writeError("<info>Garbage-collecting cache ($key): $cachePath</info>");
  2807. if ($key === 'cache-files-dir') {
  2808. $cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  2809. } elseif ($key === 'cache-repo-dir') {
  2810. $cache->gc($config->get('cache-ttl'), 1024 * 1024 * 1024 );
  2811. } elseif ($key === 'cache-vcs-dir') {
  2812. $cache->gcVcsCache($config->get('cache-ttl'));
  2813. }
  2814. } else {
  2815. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  2816. $cache->clear();
  2817. }
  2818. }
  2819. if ($input->getOption('gc')) {
  2820. $io->writeError('<info>All caches garbage-collected.</info>');
  2821. } else {
  2822. $io->writeError('<info>All caches cleared.</info>');
  2823. }
  2824. return 0;
  2825. }
  2826. }
  2827. <?php declare(strict_types=1);
  2828. namespace Composer\Command;
  2829. use Composer\Composer;
  2830. use Composer\Package\BasePackage;
  2831. use Composer\Package\PackageInterface;
  2832. use Composer\Pcre\Preg;
  2833. use Composer\Repository\CompositeRepository;
  2834. use Composer\Repository\InstalledRepository;
  2835. use Composer\Repository\PlatformRepository;
  2836. use Composer\Repository\RepositoryInterface;
  2837. use Composer\Repository\RootPackageRepository;
  2838. use Symfony\Component\Console\Completion\CompletionInput;
  2839. trait CompletionTrait
  2840. {
  2841. abstract public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): Composer;
  2842. private function suggestPreferInstall(): array
  2843. {
  2844. return ['dist', 'source', 'auto'];
  2845. }
  2846. private function suggestRootRequirement(): \Closure
  2847. {
  2848. return function (CompletionInput $input): array {
  2849. $composer = $this->requireComposer();
  2850. return array_merge(array_keys($composer->getPackage()->getRequires()), array_keys($composer->getPackage()->getDevRequires()));
  2851. };
  2852. }
  2853. private function suggestInstalledPackage(bool $includeRootPackage = true, bool $includePlatformPackages = false): \Closure
  2854. {
  2855. return function (CompletionInput $input) use ($includeRootPackage, $includePlatformPackages): array {
  2856. $composer = $this->requireComposer();
  2857. $installedRepos = [];
  2858. if ($includeRootPackage) {
  2859. $installedRepos[] = new RootPackageRepository(clone $composer->getPackage());
  2860. }
  2861. $locker = $composer->getLocker();
  2862. if ($locker->isLocked()) {
  2863. $installedRepos[] = $locker->getLockedRepository(true);
  2864. } else {
  2865. $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
  2866. }
  2867. $platformHint = [];
  2868. if ($includePlatformPackages) {
  2869. if ($locker->isLocked()) {
  2870. $platformRepo = new PlatformRepository([], $locker->getPlatformOverrides());
  2871. } else {
  2872. $platformRepo = new PlatformRepository([], $composer->getConfig()->get('platform'));
  2873. }
  2874. if ($input->getCompletionValue() === '') {
  2875. $hintsToFind = ['ext-' => 0, 'lib-' => 0, 'php' => 99, 'composer' => 99];
  2876. foreach ($platformRepo->getPackages() as $pkg) {
  2877. foreach ($hintsToFind as $hintPrefix => $hintCount) {
  2878. if (str_starts_with($pkg->getName(), $hintPrefix)) {
  2879. if ($hintCount === 0 || $hintCount >= 99) {
  2880. $platformHint[] = $pkg->getName();
  2881. $hintsToFind[$hintPrefix]++;
  2882. } elseif ($hintCount === 1) {
  2883. unset($hintsToFind[$hintPrefix]);
  2884. $platformHint[] = substr($pkg->getName(), 0, max(strlen($pkg->getName()) - 3, strlen($hintPrefix) + 1)).'...';
  2885. }
  2886. continue 2;
  2887. }
  2888. }
  2889. }
  2890. } else {
  2891. $installedRepos[] = $platformRepo;
  2892. }
  2893. }
  2894. $installedRepo = new InstalledRepository($installedRepos);
  2895. return array_merge(
  2896. array_map(static function (PackageInterface $package) {
  2897. return $package->getName();
  2898. }, $installedRepo->getPackages()),
  2899. $platformHint
  2900. );
  2901. };
  2902. }
  2903. private function suggestAvailablePackage(int $max = 99): \Closure
  2904. {
  2905. return function (CompletionInput $input) use ($max): array {
  2906. if ($max < 1) {
  2907. return [];
  2908. }
  2909. $composer = $this->requireComposer();
  2910. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  2911. $results = [];
  2912. $showVendors = false;
  2913. if (!str_contains($input->getCompletionValue(), '/')) {
  2914. $results = $repos->search('^' . preg_quote($input->getCompletionValue()), RepositoryInterface::SEARCH_VENDOR);
  2915. $showVendors = true;
  2916. }
  2917. if (\count($results) <= 1) {
  2918. $results = $repos->search('^'.preg_quote($input->getCompletionValue()), RepositoryInterface::SEARCH_NAME);
  2919. $showVendors = false;
  2920. }
  2921. $results = array_column($results, 'name');
  2922. if ($showVendors) {
  2923. $results = array_map(static function (string $name): string {
  2924. return $name.'/';
  2925. }, $results);
  2926. usort($results, static function (string $a, string $b) {
  2927. $lenA = \strlen($a);
  2928. $lenB = \strlen($b);
  2929. if ($lenA === $lenB) {
  2930. return $a <=> $b;
  2931. }
  2932. return $lenA - $lenB;
  2933. });
  2934. $pinned = [];
  2935. $completionInput = $input->getCompletionValue().'/';
  2936. if (false !== ($exactIndex = array_search($completionInput, $results, true))) {
  2937. $pinned[] = $completionInput;
  2938. array_splice($results, $exactIndex, 1);
  2939. }
  2940. return array_merge($pinned, array_slice($results, 0, $max - \count($pinned)));
  2941. }
  2942. return array_slice($results, 0, $max);
  2943. };
  2944. }
  2945. private function suggestAvailablePackageInclPlatform(): \Closure
  2946. {
  2947. return function (CompletionInput $input): array {
  2948. if (Preg::isMatch('{^(ext|lib|php)(-|$)|^com}', $input->getCompletionValue())) {
  2949. $matches = $this->suggestPlatformPackage()($input);
  2950. } else {
  2951. $matches = [];
  2952. }
  2953. return array_merge($matches, $this->suggestAvailablePackage(99 - \count($matches))($input));
  2954. };
  2955. }
  2956. private function suggestPlatformPackage(): \Closure
  2957. {
  2958. return function (CompletionInput $input): array {
  2959. $repos = new PlatformRepository([], $this->requireComposer()->getConfig()->get('platform'));
  2960. $pattern = BasePackage::packageNameToRegexp($input->getCompletionValue().'*');
  2961. return array_filter(array_map(static function (PackageInterface $package) {
  2962. return $package->getName();
  2963. }, $repos->getPackages()), static function (string $name) use ($pattern): bool {
  2964. return Preg::isMatch($pattern, $name);
  2965. });
  2966. };
  2967. }
  2968. }
  2969. <?php declare(strict_types=1);
  2970. namespace Composer\Command;
  2971. use Composer\Advisory\Auditor;
  2972. use Composer\Pcre\Preg;
  2973. use Composer\Util\Filesystem;
  2974. use Composer\Util\Platform;
  2975. use Composer\Util\Silencer;
  2976. use Symfony\Component\Console\Input\InputInterface;
  2977. use Composer\Console\Input\InputArgument;
  2978. use Symfony\Component\Console\Completion\CompletionInput;
  2979. use Symfony\Component\Console\Input\InputOption;
  2980. use Symfony\Component\Console\Output\OutputInterface;
  2981. use Composer\Config;
  2982. use Composer\Config\JsonConfigSource;
  2983. use Composer\Factory;
  2984. use Composer\IO\IOInterface;
  2985. use Composer\Json\JsonFile;
  2986. use Composer\Semver\VersionParser;
  2987. use Composer\Package\BasePackage;
  2988. class ConfigCommand extends BaseCommand
  2989. {
  2990. protected const CONFIGURABLE_PACKAGE_PROPERTIES = [
  2991. 'name',
  2992. 'type',
  2993. 'description',
  2994. 'homepage',
  2995. 'version',
  2996. 'minimum-stability',
  2997. 'prefer-stable',
  2998. 'keywords',
  2999. 'license',
  3000. 'repositories',
  3001. 'suggest',
  3002. 'extra',
  3003. ];
  3004. protected $config;
  3005. protected $configFile;
  3006. protected $configSource;
  3007. protected $authConfigFile;
  3008. protected $authConfigSource;
  3009. protected function configure(): void
  3010. {
  3011. $this
  3012. ->setName('config')
  3013. ->setDescription('Sets config options')
  3014. ->setDefinition([
  3015. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  3016. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  3017. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  3018. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  3019. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  3020. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  3021. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  3022. new InputOption('json', 'j', InputOption::VALUE_NONE, 'JSON decode the setting value, to be used with extra.* keys'),
  3023. new InputOption('merge', 'm', InputOption::VALUE_NONE, 'Merge the setting value with the current value, to be used with extra.* keys in combination with --json'),
  3024. new InputOption('append', null, InputOption::VALUE_NONE, 'When adding a repository, append it (lowest priority) to the existing ones instead of prepending it (highest priority)'),
  3025. new InputOption('source', null, InputOption::VALUE_NONE, 'Display where the config value is loaded from'),
  3026. new InputArgument('setting-key', null, 'Setting key', null, $this->suggestSettingKeys()),
  3027. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  3028. ])
  3029. ->setHelp(
  3030. <<<EOT
  3031. This command allows you to edit composer config settings and repositories
  3032. in either the local composer.json file or the global config.json file.
  3033. Additionally it lets you edit most properties in the local composer.json.
  3034. To set a config setting:
  3035. <comment>%command.full_name% bin-dir bin/</comment>
  3036. To read a config setting:
  3037. <comment>%command.full_name% bin-dir</comment>
  3038. Outputs: <info>bin</info>
  3039. To edit the global config.json file:
  3040. <comment>%command.full_name% --global</comment>
  3041. To add a repository:
  3042. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  3043. To remove a repository (repo is a short alias for repositories):
  3044. <comment>%command.full_name% --unset repo.foo</comment>
  3045. To disable packagist:
  3046. <comment>%command.full_name% repo.packagist false</comment>
  3047. You can alter repositories in the global config.json file by passing in the
  3048. <info>--global</info> option.
  3049. To add or edit suggested packages you can use:
  3050. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  3051. To add or edit extra properties you can use:
  3052. <comment>%command.full_name% extra.property value</comment>
  3053. Or to add a complex value you can use json with:
  3054. <comment>%command.full_name% extra.property --json '{"foo":true, "bar": []}'</comment>
  3055. To edit the file in an external editor:
  3056. <comment>%command.full_name% --editor</comment>
  3057. To choose your editor you can set the "EDITOR" env variable.
  3058. To get a list of configuration values in the file:
  3059. <comment>%command.full_name% --list</comment>
  3060. You can always pass more than one option. As an example, if you want to edit the
  3061. global config.json file.
  3062. <comment>%command.full_name% --editor --global</comment>
  3063. Read more at https://getcomposer.org/doc/03-cli.md#config
  3064. EOT
  3065. )
  3066. ;
  3067. }
  3068. protected function initialize(InputInterface $input, OutputInterface $output): void
  3069. {
  3070. parent::initialize($input, $output);
  3071. if ($input->getOption('global') && null !== $input->getOption('file')) {
  3072. throw new \RuntimeException('--file and --global can not be combined');
  3073. }
  3074. $io = $this->getIO();
  3075. $this->config = Factory::createConfig($io);
  3076. $configFile = $this->getComposerConfigFile($input, $this->config);
  3077. if (
  3078. ($configFile === 'composer.json' || $configFile === './composer.json')
  3079. && !file_exists($configFile)
  3080. && realpath(Platform::getCwd()) === realpath($this->config->get('home'))
  3081. ) {
  3082. file_put_contents($configFile, "{\n}\n");
  3083. }
  3084. $this->configFile = new JsonFile($configFile, null, $io);
  3085. $this->configSource = new JsonConfigSource($this->configFile);
  3086. $authConfigFile = $this->getAuthConfigFile($input, $this->config);
  3087. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  3088. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  3089. if ($input->getOption('global') && !$this->configFile->exists()) {
  3090. touch($this->configFile->getPath());
  3091. $this->configFile->write(['config' => new \ArrayObject]);
  3092. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  3093. }
  3094. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  3095. touch($this->authConfigFile->getPath());
  3096. $this->authConfigFile->write(['bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject]);
  3097. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  3098. }
  3099. if (!$this->configFile->exists()) {
  3100. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  3101. }
  3102. }
  3103. protected function execute(InputInterface $input, OutputInterface $output): int
  3104. {
  3105. if (true === $input->getOption('editor')) {
  3106. $editor = Platform::getEnv('EDITOR');
  3107. if (false === $editor || '' === $editor) {
  3108. if (Platform::isWindows()) {
  3109. $editor = 'notepad';
  3110. } else {
  3111. foreach (['editor', 'vim', 'vi', 'nano', 'pico', 'ed'] as $candidate) {
  3112. if (exec('which '.$candidate)) {
  3113. $editor = $candidate;
  3114. break;
  3115. }
  3116. }
  3117. }
  3118. } else {
  3119. $editor = escapeshellcmd($editor);
  3120. }
  3121. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  3122. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  3123. return 0;
  3124. }
  3125. if (false === $input->getOption('global')) {
  3126. $this->config->merge($this->configFile->read(), $this->configFile->getPath());
  3127. $this->config->merge(['config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : []], $this->authConfigFile->getPath());
  3128. }
  3129. $this->getIO()->loadConfiguration($this->config);
  3130. if (true === $input->getOption('list')) {
  3131. $this->listConfiguration($this->config->all(), $this->config->raw(), $output, null, $input->getOption('source'));
  3132. return 0;
  3133. }
  3134. $settingKey = $input->getArgument('setting-key');
  3135. if (!is_string($settingKey)) {
  3136. return 0;
  3137. }
  3138. if ([] !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  3139. throw new \RuntimeException('You can not combine a setting value with --unset');
  3140. }
  3141. if ([] === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  3142. $properties = self::CONFIGURABLE_PACKAGE_PROPERTIES;
  3143. $propertiesDefaults = [
  3144. 'type' => 'library',
  3145. 'description' => '',
  3146. 'homepage' => '',
  3147. 'minimum-stability' => 'stable',
  3148. 'prefer-stable' => false,
  3149. 'keywords' => [],
  3150. 'license' => [],
  3151. 'suggest' => [],
  3152. 'extra' => [],
  3153. ];
  3154. $rawData = $this->configFile->read();
  3155. $data = $this->config->all();
  3156. $source = $this->config->getSourceOfValue($settingKey);
  3157. if (Preg::isMatch('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  3158. if (!isset($matches[1]) || $matches[1] === '') {
  3159. $value = $data['repositories'] ?? [];
  3160. } else {
  3161. if (!isset($data['repositories'][$matches[1]])) {
  3162. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  3163. }
  3164. $value = $data['repositories'][$matches[1]];
  3165. }
  3166. } elseif (strpos($settingKey, '.')) {
  3167. $bits = explode('.', $settingKey);
  3168. if ($bits[0] === 'extra' || $bits[0] === 'suggest') {
  3169. $data = $rawData;
  3170. } else {
  3171. $data = $data['config'];
  3172. }
  3173. $match = false;
  3174. foreach ($bits as $bit) {
  3175. $key = isset($key) ? $key.'.'.$bit : $bit;
  3176. $match = false;
  3177. if (isset($data[$key])) {
  3178. $match = true;
  3179. $data = $data[$key];
  3180. unset($key);
  3181. }
  3182. }
  3183. if (!$match) {
  3184. throw new \RuntimeException($settingKey.' is not defined.');
  3185. }
  3186. $value = $data;
  3187. } elseif (isset($data['config'][$settingKey])) {
  3188. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  3189. if ($value === []) {
  3190. $schema = JsonFile::parseJson((string) file_get_contents(JsonFile::COMPOSER_SCHEMA_PATH));
  3191. if (
  3192. isset($schema['properties']['config']['properties'][$settingKey]['type'])
  3193. && in_array('object', (array) $schema['properties']['config']['properties'][$settingKey]['type'], true)
  3194. ) {
  3195. $value = new \stdClass;
  3196. }
  3197. }
  3198. } elseif (isset($rawData[$settingKey]) && in_array($settingKey, $properties, true)) {
  3199. $value = $rawData[$settingKey];
  3200. $source = $this->configFile->getPath();
  3201. } elseif (isset($propertiesDefaults[$settingKey])) {
  3202. $value = $propertiesDefaults[$settingKey];
  3203. $source = 'defaults';
  3204. } else {
  3205. throw new \RuntimeException($settingKey.' is not defined');
  3206. }
  3207. if (is_array($value) || is_object($value) || is_bool($value)) {
  3208. $value = JsonFile::encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  3209. }
  3210. $sourceOfConfigValue = '';
  3211. if ($input->getOption('source')) {
  3212. $sourceOfConfigValue = ' (' . $source . ')';
  3213. }
  3214. $this->getIO()->write($value . $sourceOfConfigValue, true, IOInterface::QUIET);
  3215. return 0;
  3216. }
  3217. $values = $input->getArgument('setting-value');
  3218. $booleanValidator = static function ($val): bool {
  3219. return in_array($val, ['true', 'false', '1', '0'], true);
  3220. };
  3221. $booleanNormalizer = static function ($val): bool {
  3222. return $val !== 'false' && (bool) $val;
  3223. };
  3224. $uniqueConfigValues = [
  3225. 'process-timeout' => ['is_numeric', 'intval'],
  3226. 'use-include-path' => [$booleanValidator, $booleanNormalizer],
  3227. 'use-github-api' => [$booleanValidator, $booleanNormalizer],
  3228. 'preferred-install' => [
  3229. static function ($val): bool {
  3230. return in_array($val, ['auto', 'source', 'dist'], true);
  3231. },
  3232. static function ($val) {
  3233. return $val;
  3234. },
  3235. ],
  3236. 'gitlab-protocol' => [
  3237. static function ($val): bool {
  3238. return in_array($val, ['git', 'http', 'https'], true);
  3239. },
  3240. static function ($val) {
  3241. return $val;
  3242. },
  3243. ],
  3244. 'store-auths' => [
  3245. static function ($val): bool {
  3246. return in_array($val, ['true', 'false', 'prompt'], true);
  3247. },
  3248. static function ($val) {
  3249. if ('prompt' === $val) {
  3250. return 'prompt';
  3251. }
  3252. return $val !== 'false' && (bool) $val;
  3253. },
  3254. ],
  3255. 'notify-on-install' => [$booleanValidator, $booleanNormalizer],
  3256. 'vendor-dir' => ['is_string', static function ($val) {
  3257. return $val;
  3258. }],
  3259. 'bin-dir' => ['is_string', static function ($val) {
  3260. return $val;
  3261. }],
  3262. 'archive-dir' => ['is_string', static function ($val) {
  3263. return $val;
  3264. }],
  3265. 'archive-format' => ['is_string', static function ($val) {
  3266. return $val;
  3267. }],
  3268. 'data-dir' => ['is_string', static function ($val) {
  3269. return $val;
  3270. }],
  3271. 'cache-dir' => ['is_string', static function ($val) {
  3272. return $val;
  3273. }],
  3274. 'cache-files-dir' => ['is_string', static function ($val) {
  3275. return $val;
  3276. }],
  3277. 'cache-repo-dir' => ['is_string', static function ($val) {
  3278. return $val;
  3279. }],
  3280. 'cache-vcs-dir' => ['is_string', static function ($val) {
  3281. return $val;
  3282. }],
  3283. 'cache-ttl' => ['is_numeric', 'intval'],
  3284. 'cache-files-ttl' => ['is_numeric', 'intval'],
  3285. 'cache-files-maxsize' => [
  3286. static function ($val): bool {
  3287. return Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val);
  3288. },
  3289. static function ($val) {
  3290. return $val;
  3291. },
  3292. ],
  3293. 'bin-compat' => [
  3294. static function ($val): bool {
  3295. return in_array($val, ['auto', 'full', 'proxy', 'symlink']);
  3296. },
  3297. static function ($val) {
  3298. return $val;
  3299. },
  3300. ],
  3301. 'discard-changes' => [
  3302. static function ($val): bool {
  3303. return in_array($val, ['stash', 'true', 'false', '1', '0'], true);
  3304. },
  3305. static function ($val) {
  3306. if ('stash' === $val) {
  3307. return 'stash';
  3308. }
  3309. return $val !== 'false' && (bool) $val;
  3310. },
  3311. ],
  3312. 'autoloader-suffix' => ['is_string', static function ($val) {
  3313. return $val === 'null' ? null : $val;
  3314. }],
  3315. 'sort-packages' => [$booleanValidator, $booleanNormalizer],
  3316. 'optimize-autoloader' => [$booleanValidator, $booleanNormalizer],
  3317. 'classmap-authoritative' => [$booleanValidator, $booleanNormalizer],
  3318. 'apcu-autoloader' => [$booleanValidator, $booleanNormalizer],
  3319. 'prepend-autoloader' => [$booleanValidator, $booleanNormalizer],
  3320. 'disable-tls' => [$booleanValidator, $booleanNormalizer],
  3321. 'secure-http' => [$booleanValidator, $booleanNormalizer],
  3322. 'cafile' => [
  3323. static function ($val): bool {
  3324. return file_exists($val) && Filesystem::isReadable($val);
  3325. },
  3326. static function ($val) {
  3327. return $val === 'null' ? null : $val;
  3328. },
  3329. ],
  3330. 'capath' => [
  3331. static function ($val): bool {
  3332. return is_dir($val) && Filesystem::isReadable($val);
  3333. },
  3334. static function ($val) {
  3335. return $val === 'null' ? null : $val;
  3336. },
  3337. ],
  3338. 'github-expose-hostname' => [$booleanValidator, $booleanNormalizer],
  3339. 'htaccess-protect' => [$booleanValidator, $booleanNormalizer],
  3340. 'lock' => [$booleanValidator, $booleanNormalizer],
  3341. 'allow-plugins' => [$booleanValidator, $booleanNormalizer],
  3342. 'platform-check' => [
  3343. static function ($val): bool {
  3344. return in_array($val, ['php-only', 'true', 'false', '1', '0'], true);
  3345. },
  3346. static function ($val) {
  3347. if ('php-only' === $val) {
  3348. return 'php-only';
  3349. }
  3350. return $val !== 'false' && (bool) $val;
  3351. },
  3352. ],
  3353. 'use-parent-dir' => [
  3354. static function ($val): bool {
  3355. return in_array($val, ['true', 'false', 'prompt'], true);
  3356. },
  3357. static function ($val) {
  3358. if ('prompt' === $val) {
  3359. return 'prompt';
  3360. }
  3361. return $val !== 'false' && (bool) $val;
  3362. },
  3363. ],
  3364. 'audit.abandoned' => [
  3365. static function ($val): bool {
  3366. return in_array($val, [Auditor::ABANDONED_IGNORE, Auditor::ABANDONED_REPORT, Auditor::ABANDONED_FAIL], true);
  3367. },
  3368. static function ($val) {
  3369. return $val;
  3370. },
  3371. ],
  3372. ];
  3373. $multiConfigValues = [
  3374. 'github-protocols' => [
  3375. static function ($vals) {
  3376. if (!is_array($vals)) {
  3377. return 'array expected';
  3378. }
  3379. foreach ($vals as $val) {
  3380. if (!in_array($val, ['git', 'https', 'ssh'])) {
  3381. return 'valid protocols include: git, https, ssh';
  3382. }
  3383. }
  3384. return true;
  3385. },
  3386. static function ($vals) {
  3387. return $vals;
  3388. },
  3389. ],
  3390. 'github-domains' => [
  3391. static function ($vals) {
  3392. if (!is_array($vals)) {
  3393. return 'array expected';
  3394. }
  3395. return true;
  3396. },
  3397. static function ($vals) {
  3398. return $vals;
  3399. },
  3400. ],
  3401. 'gitlab-domains' => [
  3402. static function ($vals) {
  3403. if (!is_array($vals)) {
  3404. return 'array expected';
  3405. }
  3406. return true;
  3407. },
  3408. static function ($vals) {
  3409. return $vals;
  3410. },
  3411. ],
  3412. 'audit.ignore' => [
  3413. static function ($vals) {
  3414. if (!is_array($vals)) {
  3415. return 'array expected';
  3416. }
  3417. return true;
  3418. },
  3419. static function ($vals) {
  3420. return $vals;
  3421. },
  3422. ],
  3423. ];
  3424. if ($input->getOption('unset') && $settingKey === 'audit') {
  3425. $this->configSource->removeConfigSetting($settingKey);
  3426. return 0;
  3427. }
  3428. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  3429. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  3430. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  3431. }
  3432. $this->configSource->removeConfigSetting($settingKey);
  3433. return 0;
  3434. }
  3435. if (isset($uniqueConfigValues[$settingKey])) {
  3436. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  3437. return 0;
  3438. }
  3439. if (isset($multiConfigValues[$settingKey])) {
  3440. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  3441. return 0;
  3442. }
  3443. if (Preg::isMatch('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  3444. if ($input->getOption('unset')) {
  3445. $this->configSource->removeConfigSetting($settingKey);
  3446. return 0;
  3447. }
  3448. [$validator] = $uniqueConfigValues['preferred-install'];
  3449. if (!$validator($values[0])) {
  3450. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  3451. }
  3452. $this->configSource->addConfigSetting($settingKey, $values[0]);
  3453. return 0;
  3454. }
  3455. if (Preg::isMatch('{^allow-plugins\.([a-zA-Z0-9/*-]+)}', $settingKey, $matches)) {
  3456. if ($input->getOption('unset')) {
  3457. $this->configSource->removeConfigSetting($settingKey);
  3458. return 0;
  3459. }
  3460. if (true !== $booleanValidator($values[0])) {
  3461. throw new \RuntimeException(sprintf(
  3462. '"%s" is an invalid value',
  3463. $values[0]
  3464. ));
  3465. }
  3466. $normalizedValue = $booleanNormalizer($values[0]);
  3467. $this->configSource->addConfigSetting($settingKey, $normalizedValue);
  3468. return 0;
  3469. }
  3470. $uniqueProps = [
  3471. 'name' => ['is_string', static function ($val) {
  3472. return $val;
  3473. }],
  3474. 'type' => ['is_string', static function ($val) {
  3475. return $val;
  3476. }],
  3477. 'description' => ['is_string', static function ($val) {
  3478. return $val;
  3479. }],
  3480. 'homepage' => ['is_string', static function ($val) {
  3481. return $val;
  3482. }],
  3483. 'version' => ['is_string', static function ($val) {
  3484. return $val;
  3485. }],
  3486. 'minimum-stability' => [
  3487. static function ($val): bool {
  3488. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  3489. },
  3490. static function ($val): string {
  3491. return VersionParser::normalizeStability($val);
  3492. },
  3493. ],
  3494. 'prefer-stable' => [$booleanValidator, $booleanNormalizer],
  3495. ];
  3496. $multiProps = [
  3497. 'keywords' => [
  3498. static function ($vals) {
  3499. if (!is_array($vals)) {
  3500. return 'array expected';
  3501. }
  3502. return true;
  3503. },
  3504. static function ($vals) {
  3505. return $vals;
  3506. },
  3507. ],
  3508. 'license' => [
  3509. static function ($vals) {
  3510. if (!is_array($vals)) {
  3511. return 'array expected';
  3512. }
  3513. return true;
  3514. },
  3515. static function ($vals) {
  3516. return $vals;
  3517. },
  3518. ],
  3519. ];
  3520. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
  3521. throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  3522. }
  3523. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  3524. $this->configSource->removeProperty($settingKey);
  3525. return 0;
  3526. }
  3527. if (isset($uniqueProps[$settingKey])) {
  3528. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  3529. return 0;
  3530. }
  3531. if (isset($multiProps[$settingKey])) {
  3532. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  3533. return 0;
  3534. }
  3535. if (Preg::isMatchStrictGroups('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  3536. if ($input->getOption('unset')) {
  3537. $this->configSource->removeRepository($matches[1]);
  3538. return 0;
  3539. }
  3540. if (2 === count($values)) {
  3541. $this->configSource->addRepository($matches[1], [
  3542. 'type' => $values[0],
  3543. 'url' => $values[1],
  3544. ], $input->getOption('append'));
  3545. return 0;
  3546. }
  3547. if (1 === count($values)) {
  3548. $value = strtolower($values[0]);
  3549. if (true === $booleanValidator($value)) {
  3550. if (false === $booleanNormalizer($value)) {
  3551. $this->configSource->addRepository($matches[1], false, $input->getOption('append'));
  3552. return 0;
  3553. }
  3554. } else {
  3555. $value = JsonFile::parseJson($values[0]);
  3556. $this->configSource->addRepository($matches[1], $value, $input->getOption('append'));
  3557. return 0;
  3558. }
  3559. }
  3560. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  3561. }
  3562. if (Preg::isMatch('/^extra\.(.+)/', $settingKey, $matches)) {
  3563. if ($input->getOption('unset')) {
  3564. $this->configSource->removeProperty($settingKey);
  3565. return 0;
  3566. }
  3567. $value = $values[0];
  3568. if ($input->getOption('json')) {
  3569. $value = JsonFile::parseJson($value);
  3570. if ($input->getOption('merge')) {
  3571. $currentValue = $this->configFile->read();
  3572. $bits = explode('.', $settingKey);
  3573. foreach ($bits as $bit) {
  3574. $currentValue = $currentValue[$bit] ?? null;
  3575. }
  3576. if (is_array($currentValue)) {
  3577. $value = array_merge($currentValue, $value);
  3578. }
  3579. }
  3580. }
  3581. $this->configSource->addProperty($settingKey, $value);
  3582. return 0;
  3583. }
  3584. if (Preg::isMatch('/^suggest\.(.+)/', $settingKey, $matches)) {
  3585. if ($input->getOption('unset')) {
  3586. $this->configSource->removeProperty($settingKey);
  3587. return 0;
  3588. }
  3589. $this->configSource->addProperty($settingKey, implode(' ', $values));
  3590. return 0;
  3591. }
  3592. if (in_array($settingKey, ['suggest', 'extra'], true) && $input->getOption('unset')) {
  3593. $this->configSource->removeProperty($settingKey);
  3594. return 0;
  3595. }
  3596. if (Preg::isMatch('/^platform\.(.+)/', $settingKey, $matches)) {
  3597. if ($input->getOption('unset')) {
  3598. $this->configSource->removeConfigSetting($settingKey);
  3599. return 0;
  3600. }
  3601. $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]);
  3602. return 0;
  3603. }
  3604. if ($settingKey === 'platform' && $input->getOption('unset')) {
  3605. $this->configSource->removeConfigSetting($settingKey);
  3606. return 0;
  3607. }
  3608. if (Preg::isMatch('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  3609. if ($input->getOption('unset')) {
  3610. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3611. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3612. return 0;
  3613. }
  3614. if ($matches[1] === 'bitbucket-oauth') {
  3615. if (2 !== count($values)) {
  3616. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  3617. }
  3618. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3619. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['consumer-key' => $values[0], 'consumer-secret' => $values[1]]);
  3620. } elseif ($matches[1] === 'gitlab-token' && 2 === count($values)) {
  3621. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3622. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['username' => $values[0], 'token' => $values[1]]);
  3623. } elseif (in_array($matches[1], ['github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'], true)) {
  3624. if (1 !== count($values)) {
  3625. throw new \RuntimeException('Too many arguments, expected only one token');
  3626. }
  3627. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3628. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  3629. } elseif ($matches[1] === 'http-basic') {
  3630. if (2 !== count($values)) {
  3631. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  3632. }
  3633. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3634. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['username' => $values[0], 'password' => $values[1]]);
  3635. }
  3636. return 0;
  3637. }
  3638. if (Preg::isMatch('/^scripts\.(.+)/', $settingKey, $matches)) {
  3639. if ($input->getOption('unset')) {
  3640. $this->configSource->removeProperty($settingKey);
  3641. return 0;
  3642. }
  3643. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  3644. return 0;
  3645. }
  3646. if ($input->getOption('unset')) {
  3647. $this->configSource->removeProperty($settingKey);
  3648. return 0;
  3649. }
  3650. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  3651. }
  3652. protected function handleSingleValue(string $key, array $callbacks, array $values, string $method): void
  3653. {
  3654. [$validator, $normalizer] = $callbacks;
  3655. if (1 !== count($values)) {
  3656. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  3657. }
  3658. if (true !== $validation = $validator($values[0])) {
  3659. throw new \RuntimeException(sprintf(
  3660. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  3661. $values[0]
  3662. ));
  3663. }
  3664. $normalizedValue = $normalizer($values[0]);
  3665. if ($key === 'disable-tls') {
  3666. if (!$normalizedValue && $this->config->get('disable-tls')) {
  3667. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  3668. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  3669. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  3670. }
  3671. }
  3672. call_user_func([$this->configSource, $method], $key, $normalizedValue);
  3673. }
  3674. protected function handleMultiValue(string $key, array $callbacks, array $values, string $method): void
  3675. {
  3676. [$validator, $normalizer] = $callbacks;
  3677. if (true !== $validation = $validator($values)) {
  3678. throw new \RuntimeException(sprintf(
  3679. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  3680. json_encode($values)
  3681. ));
  3682. }
  3683. call_user_func([$this->configSource, $method], $key, $normalizer($values));
  3684. }
  3685. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, ?string $k = null, bool $showSource = false): void
  3686. {
  3687. $origK = $k;
  3688. $io = $this->getIO();
  3689. foreach ($contents as $key => $value) {
  3690. if ($k === null && !in_array($key, ['config', 'repositories'])) {
  3691. continue;
  3692. }
  3693. $rawVal = $rawContents[$key] ?? null;
  3694. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  3695. $k .= Preg::replace('{^config\.}', '', $key . '.');
  3696. $this->listConfiguration($value, $rawVal, $output, $k, $showSource);
  3697. $k = $origK;
  3698. continue;
  3699. }
  3700. if (is_array($value)) {
  3701. $value = array_map(static function ($val) {
  3702. return is_array($val) ? json_encode($val) : $val;
  3703. }, $value);
  3704. $value = '['.implode(', ', $value).']';
  3705. }
  3706. if (is_bool($value)) {
  3707. $value = var_export($value, true);
  3708. }
  3709. $source = '';
  3710. if ($showSource) {
  3711. $source = ' (' . $this->config->getSourceOfValue($k . $key) . ')';
  3712. }
  3713. if (null !== $k && 0 === strpos($k, 'repositories')) {
  3714. $link = 'https://getcomposer.org/doc/05-repositories.md';
  3715. } else {
  3716. $id = Preg::replace('{\..*$}', '', $k === '' || $k === null ? (string) $key : $k);
  3717. $id = Preg::replace('{[^a-z0-9]}i', '-', strtolower(trim($id)));
  3718. $id = Preg::replace('{-+}', '-', $id);
  3719. $link = 'https://getcomposer.org/doc/06-config.md#' . $id;
  3720. }
  3721. if (is_string($rawVal) && $rawVal !== $value) {
  3722. $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $rawVal . ' (' . $value . ')</info>' . $source, true, IOInterface::QUIET);
  3723. } else {
  3724. $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $value . '</info>' . $source, true, IOInterface::QUIET);
  3725. }
  3726. }
  3727. }
  3728. private function getComposerConfigFile(InputInterface $input, Config $config): string
  3729. {
  3730. return $input->getOption('global')
  3731. ? ($config->get('home') . '/config.json')
  3732. : ($input->getOption('file') ?: Factory::getComposerFile())
  3733. ;
  3734. }
  3735. private function getAuthConfigFile(InputInterface $input, Config $config): string
  3736. {
  3737. return $input->getOption('global')
  3738. ? ($config->get('home') . '/auth.json')
  3739. : dirname($this->getComposerConfigFile($input, $config)) . '/auth.json'
  3740. ;
  3741. }
  3742. private function suggestSettingKeys(): \Closure
  3743. {
  3744. return function (CompletionInput $input): array {
  3745. if ($input->getOption('list') || $input->getOption('editor') || $input->getOption('auth')) {
  3746. return [];
  3747. }
  3748. $config = Factory::createConfig();
  3749. $configFile = new JsonFile($this->getComposerConfigFile($input, $config));
  3750. if ($configFile->exists()) {
  3751. $config->merge($configFile->read(), $configFile->getPath());
  3752. }
  3753. $authConfigFile = new JsonFile($this->getAuthConfigFile($input, $config));
  3754. if ($authConfigFile->exists()) {
  3755. $config->merge(['config' => $authConfigFile->read()], $authConfigFile->getPath());
  3756. }
  3757. $rawConfig = $config->raw();
  3758. $keys = array_merge(
  3759. $this->flattenSettingKeys($rawConfig['config']),
  3760. $this->flattenSettingKeys($rawConfig['repositories'], 'repositories.')
  3761. );
  3762. if ($input->getOption('unset')) {
  3763. $sources = [$configFile->getPath(), $authConfigFile->getPath()];
  3764. $keys = array_filter(
  3765. $keys,
  3766. static function (string $key) use ($config, $sources): bool {
  3767. return in_array($config->getSourceOfValue($key), $sources, true);
  3768. }
  3769. );
  3770. } else {
  3771. $keys = array_merge($keys, self::CONFIGURABLE_PACKAGE_PROPERTIES);
  3772. }
  3773. if ($configFile->exists()) {
  3774. $properties = array_filter(
  3775. $configFile->read(),
  3776. static function (string $key): bool {
  3777. return in_array($key, self::CONFIGURABLE_PACKAGE_PROPERTIES, true);
  3778. },
  3779. ARRAY_FILTER_USE_KEY
  3780. );
  3781. $keys = array_merge(
  3782. $keys,
  3783. $this->flattenSettingKeys($properties)
  3784. );
  3785. }
  3786. $completionValue = $input->getCompletionValue();
  3787. if ($completionValue !== '') {
  3788. $keys = array_filter(
  3789. $keys,
  3790. static function (string $key) use ($completionValue): bool {
  3791. return str_starts_with($key, $completionValue);
  3792. }
  3793. );
  3794. }
  3795. sort($keys);
  3796. return array_unique($keys);
  3797. };
  3798. }
  3799. private function flattenSettingKeys(array $config, string $prefix = ''): array
  3800. {
  3801. $keys = [];
  3802. foreach ($config as $key => $value) {
  3803. $keys[] = [$prefix . $key];
  3804. if (is_array($value) && !array_is_list($value) && $prefix !== 'repositories.') {
  3805. $keys[] = $this->flattenSettingKeys($value, $prefix . $key . '.');
  3806. }
  3807. }
  3808. return array_merge(...$keys);
  3809. }
  3810. }
  3811. <?php declare(strict_types=1);
  3812. namespace Composer\Command;
  3813. use Composer\Config;
  3814. use Composer\Factory;
  3815. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  3816. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  3817. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  3818. use Composer\Installer;
  3819. use Composer\Installer\ProjectInstaller;
  3820. use Composer\Installer\SuggestedPackagesReporter;
  3821. use Composer\IO\IOInterface;
  3822. use Composer\Package\BasePackage;
  3823. use Composer\DependencyResolver\Operation\InstallOperation;
  3824. use Composer\Package\Version\VersionSelector;
  3825. use Composer\Package\AliasPackage;
  3826. use Composer\Pcre\Preg;
  3827. use Composer\Plugin\PluginBlockedException;
  3828. use Composer\Repository\RepositoryFactory;
  3829. use Composer\Repository\CompositeRepository;
  3830. use Composer\Repository\PlatformRepository;
  3831. use Composer\Repository\InstalledArrayRepository;
  3832. use Composer\Repository\RepositorySet;
  3833. use Composer\Script\ScriptEvents;
  3834. use Composer\Util\Silencer;
  3835. use Composer\Console\Input\InputArgument;
  3836. use Seld\Signal\SignalHandler;
  3837. use Symfony\Component\Console\Input\InputInterface;
  3838. use Composer\Console\Input\InputOption;
  3839. use Symfony\Component\Console\Output\OutputInterface;
  3840. use Symfony\Component\Finder\Finder;
  3841. use Composer\Json\JsonFile;
  3842. use Composer\Config\JsonConfigSource;
  3843. use Composer\Util\Filesystem;
  3844. use Composer\Util\Platform;
  3845. use Composer\Util\ProcessExecutor;
  3846. use Composer\Package\Version\VersionParser;
  3847. use Composer\Advisory\Auditor;
  3848. class CreateProjectCommand extends BaseCommand
  3849. {
  3850. use CompletionTrait;
  3851. protected $suggestedPackagesReporter;
  3852. protected function configure(): void
  3853. {
  3854. $this
  3855. ->setName('create-project')
  3856. ->setDescription('Creates new project from a package into given directory')
  3857. ->setDefinition([
  3858. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed', null, $this->suggestAvailablePackage()),
  3859. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  3860. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  3861. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  3862. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3863. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  3864. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  3865. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories to look the package up, either by URL or using JSON arrays'),
  3866. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  3867. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the custom repository in the composer.json. If a lock file is present it will be deleted and an update will be run instead of install.'),
  3868. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3869. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3870. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3871. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  3872. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3873. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  3874. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  3875. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  3876. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  3877. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Whether to skip auditing of the installed package dependencies (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  3878. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json" or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  3879. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  3880. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  3881. new InputOption('ask', null, InputOption::VALUE_NONE, 'Whether to ask for project directory.'),
  3882. ])
  3883. ->setHelp(
  3884. <<<EOT
  3885. The <info>create-project</info> command creates a new project from a given
  3886. package into a new directory. If executed without params and in a directory
  3887. with a composer.json file it installs the packages for the current project.
  3888. You can use this command to bootstrap new projects or setup a clean
  3889. version-controlled installation for developers of your project.
  3890. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  3891. You can also specify the version with the package name using = or : as separator.
  3892. <info>php composer.phar create-project vendor/project:version target-directory</info>
  3893. To install unstable packages, either specify the version you want, or use the
  3894. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  3895. To setup a developer workable version you should create the project using the source
  3896. controlled code by appending the <info>'--prefer-source'</info> flag.
  3897. To install a package from another repository than the default one you
  3898. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  3899. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  3900. EOT
  3901. )
  3902. ;
  3903. }
  3904. protected function execute(InputInterface $input, OutputInterface $output): int
  3905. {
  3906. $config = Factory::createConfig();
  3907. $io = $this->getIO();
  3908. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input, true);
  3909. if ($input->getOption('dev')) {
  3910. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3911. }
  3912. if ($input->getOption('no-custom-installers')) {
  3913. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3914. $input->setOption('no-plugins', true);
  3915. }
  3916. if ($input->isInteractive() && $input->getOption('ask')) {
  3917. $package = $input->getArgument('package');
  3918. if (null === $package) {
  3919. throw new \RuntimeException('Not enough arguments (missing: "package").');
  3920. }
  3921. $parts = explode("/", strtolower($package), 2);
  3922. $input->setArgument('directory', $io->ask('New project directory [<comment>'.array_pop($parts).'</comment>]: '));
  3923. }
  3924. return $this->installProject(
  3925. $io,
  3926. $config,
  3927. $input,
  3928. $input->getArgument('package'),
  3929. $input->getArgument('directory'),
  3930. $input->getArgument('version'),
  3931. $input->getOption('stability'),
  3932. $preferSource,
  3933. $preferDist,
  3934. !$input->getOption('no-dev'),
  3935. \count($input->getOption('repository')) > 0 ? $input->getOption('repository') : $input->getOption('repository-url'),
  3936. $input->getOption('no-plugins'),
  3937. $input->getOption('no-scripts'),
  3938. $input->getOption('no-progress'),
  3939. $input->getOption('no-install'),
  3940. $this->getPlatformRequirementFilter($input),
  3941. !$input->getOption('no-secure-http'),
  3942. $input->getOption('add-repository')
  3943. );
  3944. }
  3945. public function installProject(IOInterface $io, Config $config, InputInterface $input, ?string $packageName = null, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $noInstall = false, ?PlatformRequirementFilterInterface $platformRequirementFilter = null, bool $secureHttp = true, bool $addRepository = false): int
  3946. {
  3947. $oldCwd = Platform::getCwd();
  3948. if ($repositories !== null && !is_array($repositories)) {
  3949. $repositories = (array) $repositories;
  3950. }
  3951. $platformRequirementFilter = $platformRequirementFilter ?? PlatformRequirementFilterFactory::ignoreNothing();
  3952. $io->loadConfiguration($config);
  3953. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  3954. if ($packageName !== null) {
  3955. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $platformRequirementFilter, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositories, $disablePlugins, $disableScripts, $noProgress, $secureHttp);
  3956. } else {
  3957. $installedFromVcs = false;
  3958. }
  3959. if ($repositories !== null && $addRepository && is_file('composer.lock')) {
  3960. unlink('composer.lock');
  3961. }
  3962. $composer = Factory::create($io, null, $disablePlugins, $disableScripts);
  3963. if ($repositories !== null && $addRepository) {
  3964. foreach ($repositories as $index => $repo) {
  3965. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repo, true);
  3966. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  3967. $name = RepositoryFactory::generateRepositoryName($index, $repoConfig, $composerJsonRepositoriesConfig);
  3968. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  3969. if (
  3970. (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
  3971. || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
  3972. ) {
  3973. $configSource->addRepository('packagist.org', false);
  3974. } else {
  3975. $configSource->addRepository($name, $repoConfig, false);
  3976. }
  3977. $composer = Factory::create($io, null, $disablePlugins);
  3978. }
  3979. }
  3980. $process = $composer->getLoop()->getProcessExecutor();
  3981. $fs = new Filesystem($process);
  3982. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  3983. $config = $composer->getConfig();
  3984. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  3985. if ($noInstall === false) {
  3986. $composer->getInstallationManager()->setOutputProgress(!$noProgress);
  3987. $installer = Installer::create($io, $composer);
  3988. $installer->setPreferSource($preferSource)
  3989. ->setPreferDist($preferDist)
  3990. ->setDevMode($installDevPackages)
  3991. ->setPlatformRequirementFilter($platformRequirementFilter)
  3992. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  3993. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  3994. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  3995. ->setApcuAutoloader($config->get('apcu-autoloader'))
  3996. ->setAudit(!$input->getOption('no-audit'))
  3997. ->setAuditFormat($this->getAuditFormat($input));
  3998. if (!$composer->getLocker()->isLocked()) {
  3999. $installer->setUpdate(true);
  4000. }
  4001. if ($disablePlugins) {
  4002. $installer->disablePlugins();
  4003. }
  4004. try {
  4005. $status = $installer->run();
  4006. if (0 !== $status) {
  4007. return $status;
  4008. }
  4009. } catch (PluginBlockedException $e) {
  4010. $io->writeError('<error>Hint: To allow running the config command recommended below before dependencies are installed, run create-project with --no-install.</error>');
  4011. $io->writeError('<error>You can then cd into '.getcwd().', configure allow-plugins, and finally run a composer install to complete the process.</error>');
  4012. throw $e;
  4013. }
  4014. }
  4015. $hasVcs = $installedFromVcs;
  4016. if (
  4017. !$input->getOption('keep-vcs')
  4018. && $installedFromVcs
  4019. && (
  4020. $input->getOption('remove-vcs')
  4021. || !$io->isInteractive()
  4022. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ')
  4023. )
  4024. ) {
  4025. $finder = new Finder();
  4026. $finder->depth(0)->directories()->in(Platform::getCwd())->ignoreVCS(false)->ignoreDotFiles(false);
  4027. foreach (['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_'] as $vcsName) {
  4028. $finder->name($vcsName);
  4029. }
  4030. try {
  4031. $dirs = iterator_to_array($finder);
  4032. unset($finder);
  4033. foreach ($dirs as $dir) {
  4034. if (!$fs->removeDirectory((string) $dir)) {
  4035. throw new \RuntimeException('Could not remove '.$dir);
  4036. }
  4037. }
  4038. } catch (\Exception $e) {
  4039. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  4040. }
  4041. $hasVcs = false;
  4042. }
  4043. if (!$hasVcs) {
  4044. $package = $composer->getPackage();
  4045. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  4046. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  4047. foreach ($package->{'get'.$meta['method']}() as $link) {
  4048. if ($link->getPrettyConstraint() === 'self.version') {
  4049. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  4050. }
  4051. }
  4052. }
  4053. }
  4054. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  4055. chdir($oldCwd);
  4056. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  4057. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  4058. Silencer::call('rmdir', $vendorComposerDir);
  4059. $vendorDir = $config->get('vendor-dir');
  4060. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  4061. Silencer::call('rmdir', $vendorDir);
  4062. }
  4063. }
  4064. return 0;
  4065. }
  4066. protected function installRootPackage(IOInterface $io, Config $config, string $packageName, PlatformRequirementFilterInterface $platformRequirementFilter, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, ?array $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $secureHttp = true): bool
  4067. {
  4068. if (!$secureHttp) {
  4069. $config->merge(['config' => ['secure-http' => false]], Config::SOURCE_COMMAND);
  4070. }
  4071. $parser = new VersionParser();
  4072. $requirements = $parser->parseNameVersionPairs([$packageName]);
  4073. $name = strtolower($requirements[0]['name']);
  4074. if (!$packageVersion && isset($requirements[0]['version'])) {
  4075. $packageVersion = $requirements[0]['version'];
  4076. }
  4077. if (null === $directory) {
  4078. $parts = explode("/", $name, 2);
  4079. $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  4080. }
  4081. $process = new ProcessExecutor($io);
  4082. $fs = new Filesystem($process);
  4083. if (!$fs->isAbsolutePath($directory)) {
  4084. $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . $directory;
  4085. }
  4086. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(Platform::getCwd(), $directory, true) . '"</info>');
  4087. if (file_exists($directory)) {
  4088. if (!is_dir($directory)) {
  4089. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  4090. }
  4091. if (!$fs->isDirEmpty($directory)) {
  4092. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  4093. }
  4094. }
  4095. if (null === $stability) {
  4096. if (null === $packageVersion) {
  4097. $stability = 'stable';
  4098. } elseif (Preg::isMatchStrictGroups('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  4099. $stability = $match[1];
  4100. } else {
  4101. $stability = VersionParser::parseStability($packageVersion);
  4102. }
  4103. }
  4104. $stability = VersionParser::normalizeStability($stability);
  4105. if (!isset(BasePackage::$stabilities[$stability])) {
  4106. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  4107. }
  4108. $composer = Factory::create($io, $config->all(), $disablePlugins, $disableScripts);
  4109. $config = $composer->getConfig();
  4110. $rm = $composer->getRepositoryManager();
  4111. $repositorySet = new RepositorySet($stability);
  4112. if (null === $repositories) {
  4113. $repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)));
  4114. } else {
  4115. foreach ($repositories as $repo) {
  4116. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
  4117. if (
  4118. (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
  4119. || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
  4120. ) {
  4121. continue;
  4122. }
  4123. $repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig, $rm));
  4124. }
  4125. }
  4126. $platformOverrides = $config->get('platform');
  4127. $platformRepo = new PlatformRepository([], $platformOverrides);
  4128. $versionSelector = new VersionSelector($repositorySet, $platformRepo);
  4129. $package = $versionSelector->findBestCandidate($name, $packageVersion, $stability, $platformRequirementFilter, 0, $io);
  4130. if (!$package) {
  4131. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  4132. if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && $versionSelector->findBestCandidate($name, $packageVersion, $stability, PlatformRequirementFilterFactory::ignoreAll())) {
  4133. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version, PHP extensions and Composer version.');
  4134. }
  4135. throw new \InvalidArgumentException($errorMessage .'.');
  4136. }
  4137. @mkdir($directory, 0777, true);
  4138. if (false !== ($realDir = realpath($directory))) {
  4139. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) use ($realDir) {
  4140. $this->getIO()->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  4141. $fs = new Filesystem();
  4142. $fs->removeDirectory($realDir);
  4143. $handler->exitWithLastSignal();
  4144. });
  4145. }
  4146. if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  4147. $package = $package->getAliasOf();
  4148. }
  4149. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  4150. if ($disablePlugins) {
  4151. $io->writeError('<info>Plugins have been disabled.</info>');
  4152. }
  4153. if ($package instanceof AliasPackage) {
  4154. $package = $package->getAliasOf();
  4155. }
  4156. $dm = $composer->getDownloadManager();
  4157. $dm->setPreferSource($preferSource)
  4158. ->setPreferDist($preferDist);
  4159. $projectInstaller = new ProjectInstaller($directory, $dm, $fs);
  4160. $im = $composer->getInstallationManager();
  4161. $im->setOutputProgress(!$noProgress);
  4162. $im->addInstaller($projectInstaller);
  4163. $im->execute(new InstalledArrayRepository(), [new InstallOperation($package)]);
  4164. $im->notifyInstalls($io);
  4165. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  4166. $installedFromVcs = 'source' === $package->getInstallationSource();
  4167. $io->writeError('<info>Created project in ' . $directory . '</info>');
  4168. chdir($directory);
  4169. if (file_exists($directory.'/composer.json') && Platform::getEnv('COMPOSER') !== false) {
  4170. Platform::clearEnv('COMPOSER');
  4171. }
  4172. Platform::putEnv('COMPOSER_ROOT_VERSION', $package->getPrettyVersion());
  4173. if (isset($signalHandler)) {
  4174. $signalHandler->unregister();
  4175. }
  4176. return $installedFromVcs;
  4177. }
  4178. }
  4179. <?php declare(strict_types=1);
  4180. namespace Composer\Command;
  4181. use Symfony\Component\Console\Input\InputInterface;
  4182. use Symfony\Component\Console\Output\OutputInterface;
  4183. use Composer\Console\Input\InputArgument;
  4184. use Composer\Console\Input\InputOption;
  4185. class DependsCommand extends BaseDependencyCommand
  4186. {
  4187. use CompletionTrait;
  4188. protected function configure(): void
  4189. {
  4190. $this
  4191. ->setName('depends')
  4192. ->setAliases(['why'])
  4193. ->setDescription('Shows which packages cause the given package to be installed')
  4194. ->setDefinition([
  4195. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect', null, $this->suggestInstalledPackage(true, true)),
  4196. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  4197. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  4198. new InputOption('locked', null, InputOption::VALUE_NONE, 'Read dependency information from composer.lock'),
  4199. ])
  4200. ->setHelp(
  4201. <<<EOT
  4202. Displays detailed information about where a package is referenced.
  4203. <info>php composer.phar depends composer/composer</info>
  4204. Read more at https://getcomposer.org/doc/03-cli.md#depends-why
  4205. EOT
  4206. )
  4207. ;
  4208. }
  4209. protected function execute(InputInterface $input, OutputInterface $output): int
  4210. {
  4211. return parent::doExecute($input, $output);
  4212. }
  4213. }
  4214. <?php declare(strict_types=1);
  4215. namespace Composer\Command;
  4216. use Composer\Advisory\Auditor;
  4217. use Composer\Composer;
  4218. use Composer\Factory;
  4219. use Composer\Config;
  4220. use Composer\Downloader\TransportException;
  4221. use Composer\IO\BufferIO;
  4222. use Composer\Json\JsonFile;
  4223. use Composer\Package\RootPackage;
  4224. use Composer\Package\Version\VersionParser;
  4225. use Composer\Pcre\Preg;
  4226. use Composer\Repository\ComposerRepository;
  4227. use Composer\Repository\FilesystemRepository;
  4228. use Composer\Repository\PlatformRepository;
  4229. use Composer\Plugin\CommandEvent;
  4230. use Composer\Plugin\PluginEvents;
  4231. use Composer\Repository\RepositorySet;
  4232. use Composer\Repository\RootPackageRepository;
  4233. use Composer\Util\ConfigValidator;
  4234. use Composer\Util\Git;
  4235. use Composer\Util\IniHelper;
  4236. use Composer\Util\ProcessExecutor;
  4237. use Composer\Util\HttpDownloader;
  4238. use Composer\Util\StreamContextFactory;
  4239. use Composer\Util\Platform;
  4240. use Composer\SelfUpdate\Keys;
  4241. use Composer\SelfUpdate\Versions;
  4242. use Composer\IO\NullIO;
  4243. use Composer\Package\CompletePackageInterface;
  4244. use Composer\XdebugHandler\XdebugHandler;
  4245. use Symfony\Component\Console\Input\InputInterface;
  4246. use Symfony\Component\Console\Output\OutputInterface;
  4247. use Symfony\Component\Process\ExecutableFinder;
  4248. class DiagnoseCommand extends BaseCommand
  4249. {
  4250. protected $httpDownloader;
  4251. protected $process;
  4252. protected $exitCode = 0;
  4253. protected function configure(): void
  4254. {
  4255. $this
  4256. ->setName('diagnose')
  4257. ->setDescription('Diagnoses the system to identify common errors')
  4258. ->setHelp(
  4259. <<<EOT
  4260. The <info>diagnose</info> command checks common errors to help debugging problems.
  4261. The process exit code will be 1 in case of warnings and 2 for errors.
  4262. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  4263. EOT
  4264. )
  4265. ;
  4266. }
  4267. protected function execute(InputInterface $input, OutputInterface $output): int
  4268. {
  4269. $composer = $this->tryComposer();
  4270. $io = $this->getIO();
  4271. if ($composer) {
  4272. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  4273. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4274. $io->write('Checking composer.json: ', false);
  4275. $this->outputResult($this->checkComposerSchema());
  4276. $this->process = $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io);
  4277. } else {
  4278. $this->process = new ProcessExecutor($io);
  4279. }
  4280. if ($composer) {
  4281. $config = $composer->getConfig();
  4282. } else {
  4283. $config = Factory::createConfig();
  4284. }
  4285. $config->merge(['config' => ['secure-http' => false]], Config::SOURCE_COMMAND);
  4286. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  4287. $this->httpDownloader = Factory::createHttpDownloader($io, $config);
  4288. $io->write('Checking platform settings: ', false);
  4289. $this->outputResult($this->checkPlatform());
  4290. $io->write('Checking git settings: ', false);
  4291. $this->outputResult($this->checkGit());
  4292. $io->write('Checking http connectivity to packagist: ', false);
  4293. $this->outputResult($this->checkHttp('http', $config));
  4294. $io->write('Checking https connectivity to packagist: ', false);
  4295. $this->outputResult($this->checkHttp('https', $config));
  4296. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  4297. if (!empty($opts['http']['proxy'])) {
  4298. $io->write('Checking HTTP proxy: ', false);
  4299. $this->outputResult($this->checkHttpProxy());
  4300. }
  4301. if (count($oauth = $config->get('github-oauth')) > 0) {
  4302. foreach ($oauth as $domain => $token) {
  4303. $io->write('Checking '.$domain.' oauth access: ', false);
  4304. $this->outputResult($this->checkGithubOauth($domain, $token));
  4305. }
  4306. } else {
  4307. $io->write('Checking github.com rate limit: ', false);
  4308. try {
  4309. $rate = $this->getGithubRateLimit('github.com');
  4310. if (!is_array($rate)) {
  4311. $this->outputResult($rate);
  4312. } elseif (10 > $rate['remaining']) {
  4313. $io->write('<warning>WARNING</warning>');
  4314. $io->write(sprintf(
  4315. '<comment>Github has a rate limit on their API. '
  4316. . 'You currently have <options=bold>%u</options=bold> '
  4317. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  4318. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  4319. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  4320. $rate['remaining'],
  4321. $rate['limit']
  4322. ));
  4323. } else {
  4324. $this->outputResult(true);
  4325. }
  4326. } catch (\Exception $e) {
  4327. if ($e instanceof TransportException && $e->getCode() === 401) {
  4328. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  4329. } else {
  4330. $this->outputResult($e);
  4331. }
  4332. }
  4333. }
  4334. $io->write('Checking disk free space: ', false);
  4335. $this->outputResult($this->checkDiskSpace($config));
  4336. if (strpos(__FILE__, 'phar:') === 0) {
  4337. $io->write('Checking pubkeys: ', false);
  4338. $this->outputResult($this->checkPubKeys($config));
  4339. $io->write('Checking Composer version: ', false);
  4340. $this->outputResult($this->checkVersion($config));
  4341. }
  4342. $io->write('Checking Composer and its dependencies for vulnerabilities: ', false);
  4343. $this->outputResult($this->checkComposerAudit($config));
  4344. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::getVersion()));
  4345. $platformOverrides = $config->get('platform') ?: [];
  4346. $platformRepo = new PlatformRepository([], $platformOverrides);
  4347. $phpPkg = $platformRepo->findPackage('php', '*');
  4348. $phpVersion = $phpPkg->getPrettyVersion();
  4349. if ($phpPkg instanceof CompletePackageInterface && str_contains((string) $phpPkg->getDescription(), 'overridden')) {
  4350. $phpVersion .= ' - ' . $phpPkg->getDescription();
  4351. }
  4352. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  4353. if (defined('PHP_BINARY')) {
  4354. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  4355. }
  4356. $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>'));
  4357. $io->write('cURL version: ' . $this->getCurlVersion());
  4358. $finder = new ExecutableFinder;
  4359. $hasSystemUnzip = (bool) $finder->find('unzip');
  4360. $bin7zip = '';
  4361. if ($hasSystem7zip = (bool) $finder->find('7z', null, ['C:\Program Files\7-Zip'])) {
  4362. $bin7zip = '7z';
  4363. }
  4364. if (!Platform::isWindows() && !$hasSystem7zip && $hasSystem7zip = (bool) $finder->find('7zz')) {
  4365. $bin7zip = '7zz';
  4366. }
  4367. $io->write(
  4368. 'zip: ' . (extension_loaded('zip') ? '<comment>extension present</comment>' : '<comment>extension not loaded</comment>')
  4369. . ', ' . ($hasSystemUnzip ? '<comment>unzip present</comment>' : '<comment>unzip not available</comment>')
  4370. . ', ' . ($hasSystem7zip ? '<comment>7-Zip present ('.$bin7zip.')</comment>' : '<comment>7-Zip not available</comment>')
  4371. . (($hasSystem7zip || $hasSystemUnzip) && !function_exists('proc_open') ? ', <warning>proc_open is disabled or not present, unzip/7-z will not be usable</warning>' : '')
  4372. );
  4373. return $this->exitCode;
  4374. }
  4375. private function checkComposerSchema()
  4376. {
  4377. $validator = new ConfigValidator($this->getIO());
  4378. [$errors, , $warnings] = $validator->validate(Factory::getComposerFile());
  4379. if ($errors || $warnings) {
  4380. $messages = [
  4381. 'error' => $errors,
  4382. 'warning' => $warnings,
  4383. ];
  4384. $output = '';
  4385. foreach ($messages as $style => $msgs) {
  4386. foreach ($msgs as $msg) {
  4387. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  4388. }
  4389. }
  4390. return rtrim($output);
  4391. }
  4392. return true;
  4393. }
  4394. private function checkGit(): string
  4395. {
  4396. if (!function_exists('proc_open')) {
  4397. return '<comment>proc_open is not available, git cannot be used</comment>';
  4398. }
  4399. $this->process->execute('git config color.ui', $output);
  4400. if (strtolower(trim($output)) === 'always') {
  4401. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  4402. }
  4403. $gitVersion = Git::getVersion($this->process);
  4404. if (null === $gitVersion) {
  4405. return '<comment>No git process found</>';
  4406. }
  4407. if (version_compare('2.24.0', $gitVersion, '>')) {
  4408. return '<warning>Your git version ('.$gitVersion.') is too old and possibly will cause issues. Please upgrade to git 2.24 or above</>';
  4409. }
  4410. return '<info>OK</> <comment>git version '.$gitVersion.'</>';
  4411. }
  4412. private function checkHttp(string $proto, Config $config)
  4413. {
  4414. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4415. if ($result !== true) {
  4416. return $result;
  4417. }
  4418. $result = [];
  4419. if ($proto === 'https' && $config->get('disable-tls') === true) {
  4420. $tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  4421. }
  4422. try {
  4423. $this->httpDownloader->get($proto . '://repo.packagist.org/packages.json');
  4424. } catch (TransportException $e) {
  4425. $hints = HttpDownloader::getExceptionHints($e);
  4426. if (null !== $hints && count($hints) > 0) {
  4427. foreach ($hints as $hint) {
  4428. $result[] = $hint;
  4429. }
  4430. }
  4431. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  4432. }
  4433. if (isset($tlsWarning)) {
  4434. $result[] = $tlsWarning;
  4435. }
  4436. if (count($result) > 0) {
  4437. return $result;
  4438. }
  4439. return true;
  4440. }
  4441. private function checkHttpProxy()
  4442. {
  4443. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4444. if ($result !== true) {
  4445. return $result;
  4446. }
  4447. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  4448. try {
  4449. $json = $this->httpDownloader->get($protocol . '://repo.packagist.org/packages.json')->decodeJson();
  4450. $hash = reset($json['provider-includes']);
  4451. $hash = $hash['sha256'];
  4452. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  4453. $provider = $this->httpDownloader->get($protocol . '://repo.packagist.org/'.$path)->getBody();
  4454. if (hash('sha256', $provider) !== $hash) {
  4455. return 'It seems that your proxy is modifying http traffic on the fly';
  4456. }
  4457. } catch (\Exception $e) {
  4458. return $e;
  4459. }
  4460. return true;
  4461. }
  4462. private function checkGithubOauth(string $domain, string $token)
  4463. {
  4464. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4465. if ($result !== true) {
  4466. return $result;
  4467. }
  4468. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  4469. try {
  4470. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  4471. $response = $this->httpDownloader->get($url, [
  4472. 'retry-auth-failure' => false,
  4473. ]);
  4474. $expiration = $response->getHeader('github-authentication-token-expiration');
  4475. if ($expiration === null) {
  4476. return '<info>OK</> <comment>does not expire</>';
  4477. }
  4478. return '<info>OK</> <comment>expires on '. $expiration .'</>';
  4479. } catch (\Exception $e) {
  4480. if ($e instanceof TransportException && $e->getCode() === 401) {
  4481. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  4482. }
  4483. return $e;
  4484. }
  4485. }
  4486. private function getGithubRateLimit(string $domain, ?string $token = null)
  4487. {
  4488. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4489. if ($result !== true) {
  4490. return $result;
  4491. }
  4492. if ($token) {
  4493. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  4494. }
  4495. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  4496. $data = $this->httpDownloader->get($url, ['retry-auth-failure' => false])->decodeJson();
  4497. return $data['resources']['core'];
  4498. }
  4499. private function checkDiskSpace(Config $config)
  4500. {
  4501. if (!function_exists('disk_free_space')) {
  4502. return true;
  4503. }
  4504. $minSpaceFree = 1024 * 1024;
  4505. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  4506. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  4507. ) {
  4508. return '<error>The disk hosting '.$dir.' is full</error>';
  4509. }
  4510. return true;
  4511. }
  4512. private function checkPubKeys(Config $config)
  4513. {
  4514. $home = $config->get('home');
  4515. $errors = [];
  4516. $io = $this->getIO();
  4517. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  4518. $io->write('');
  4519. }
  4520. if (file_exists($home.'/keys.tags.pub')) {
  4521. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  4522. } else {
  4523. $errors[] = '<error>Missing pubkey for tags verification</error>';
  4524. }
  4525. if (file_exists($home.'/keys.dev.pub')) {
  4526. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  4527. } else {
  4528. $errors[] = '<error>Missing pubkey for dev verification</error>';
  4529. }
  4530. if ($errors) {
  4531. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  4532. }
  4533. return $errors ?: true;
  4534. }
  4535. private function checkVersion(Config $config)
  4536. {
  4537. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4538. if ($result !== true) {
  4539. return $result;
  4540. }
  4541. $versionsUtil = new Versions($config, $this->httpDownloader);
  4542. try {
  4543. $latest = $versionsUtil->getLatest();
  4544. } catch (\Exception $e) {
  4545. return $e;
  4546. }
  4547. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  4548. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  4549. }
  4550. return true;
  4551. }
  4552. private function checkComposerAudit(Config $config)
  4553. {
  4554. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4555. if ($result !== true) {
  4556. return $result;
  4557. }
  4558. $auditor = new Auditor();
  4559. $repoSet = new RepositorySet();
  4560. $installedJson = new JsonFile(__DIR__ . '/../../../vendor/composer/installed.json');
  4561. if (!$installedJson->exists()) {
  4562. return '<warning>Could not find Composer\'s installed.json, this must be a non-standard Composer installation.</>';
  4563. }
  4564. $localRepo = new FilesystemRepository($installedJson);
  4565. $version = Composer::getVersion();
  4566. $packages = $localRepo->getCanonicalPackages();
  4567. if ($version !== '@package_version@') {
  4568. $versionParser = new VersionParser();
  4569. $normalizedVersion = $versionParser->normalize($version);
  4570. $rootPkg = new RootPackage('composer/composer', $normalizedVersion, $version);
  4571. $packages[] = $rootPkg;
  4572. }
  4573. $repoSet->addRepository(new ComposerRepository(['type' => 'composer', 'url' => 'https://packagist.org'], new NullIO(), $config, $this->httpDownloader));
  4574. try {
  4575. $io = new BufferIO();
  4576. $result = $auditor->audit($io, $repoSet, $packages, Auditor::FORMAT_TABLE, true, [], Auditor::ABANDONED_IGNORE);
  4577. } catch (\Throwable $e) {
  4578. return '<warning>Failed performing audit: '.$e->getMessage().'</>';
  4579. }
  4580. if ($result > 0) {
  4581. return '<error>Audit found some issues:</>' . PHP_EOL . $io->getOutput();
  4582. }
  4583. return true;
  4584. }
  4585. private function getCurlVersion(): string
  4586. {
  4587. if (extension_loaded('curl')) {
  4588. if (!HttpDownloader::isCurlEnabled()) {
  4589. return '<error>disabled via disable_functions, using php streams fallback, which reduces performance</error>';
  4590. }
  4591. $version = curl_version();
  4592. return '<comment>'.$version['version'].'</comment> '.
  4593. 'libz <comment>'.(!empty($version['libz_version']) ? $version['libz_version'] : 'missing').'</comment> '.
  4594. 'ssl <comment>'.($version['ssl_version'] ?? 'missing').'</comment>';
  4595. }
  4596. return '<error>missing, using php streams fallback, which reduces performance</error>';
  4597. }
  4598. private function outputResult($result): void
  4599. {
  4600. $io = $this->getIO();
  4601. if (true === $result) {
  4602. $io->write('<info>OK</info>');
  4603. return;
  4604. }
  4605. $hadError = false;
  4606. $hadWarning = false;
  4607. if ($result instanceof \Exception) {
  4608. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  4609. }
  4610. if (!$result) {
  4611. $hadError = true;
  4612. } else {
  4613. if (!is_array($result)) {
  4614. $result = [$result];
  4615. }
  4616. foreach ($result as $message) {
  4617. if (false !== strpos($message, '<error>')) {
  4618. $hadError = true;
  4619. } elseif (false !== strpos($message, '<warning>')) {
  4620. $hadWarning = true;
  4621. }
  4622. }
  4623. }
  4624. if ($hadError) {
  4625. $io->write('<error>FAIL</error>');
  4626. $this->exitCode = max($this->exitCode, 2);
  4627. } elseif ($hadWarning) {
  4628. $io->write('<warning>WARNING</warning>');
  4629. $this->exitCode = max($this->exitCode, 1);
  4630. }
  4631. if ($result) {
  4632. foreach ($result as $message) {
  4633. $io->write(trim($message));
  4634. }
  4635. }
  4636. }
  4637. private function checkPlatform()
  4638. {
  4639. $output = '';
  4640. $out = static function ($msg, $style) use (&$output): void {
  4641. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  4642. };
  4643. $errors = [];
  4644. $warnings = [];
  4645. $displayIniMessage = false;
  4646. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  4647. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  4648. if (!function_exists('json_decode')) {
  4649. $errors['json'] = true;
  4650. }
  4651. if (!extension_loaded('Phar')) {
  4652. $errors['phar'] = true;
  4653. }
  4654. if (!extension_loaded('filter')) {
  4655. $errors['filter'] = true;
  4656. }
  4657. if (!extension_loaded('hash')) {
  4658. $errors['hash'] = true;
  4659. }
  4660. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  4661. $errors['iconv_mbstring'] = true;
  4662. }
  4663. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  4664. $errors['allow_url_fopen'] = true;
  4665. }
  4666. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  4667. $errors['ioncube'] = ioncube_loader_version();
  4668. }
  4669. if (PHP_VERSION_ID < 70205) {
  4670. $errors['php'] = PHP_VERSION;
  4671. }
  4672. if (!extension_loaded('openssl')) {
  4673. $errors['openssl'] = true;
  4674. }
  4675. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  4676. $warnings['openssl_version'] = true;
  4677. }
  4678. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  4679. $warnings['apc_cli'] = true;
  4680. }
  4681. if (!extension_loaded('zlib')) {
  4682. $warnings['zlib'] = true;
  4683. }
  4684. ob_start();
  4685. phpinfo(INFO_GENERAL);
  4686. $phpinfo = ob_get_clean();
  4687. if (is_string($phpinfo) && Preg::isMatchStrictGroups('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  4688. $configure = $match[1];
  4689. if (str_contains($configure, '--enable-sigchild')) {
  4690. $warnings['sigchild'] = true;
  4691. }
  4692. if (str_contains($configure, '--with-curlwrappers')) {
  4693. $warnings['curlwrappers'] = true;
  4694. }
  4695. }
  4696. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  4697. $warnings['xdebug_profile'] = true;
  4698. } elseif (XdebugHandler::isXdebugActive()) {
  4699. $warnings['xdebug_loaded'] = true;
  4700. }
  4701. if (defined('PHP_WINDOWS_VERSION_BUILD')
  4702. && (version_compare(PHP_VERSION, '7.2.23', '<')
  4703. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  4704. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  4705. $warnings['onedrive'] = PHP_VERSION;
  4706. }
  4707. if (!empty($errors)) {
  4708. foreach ($errors as $error => $current) {
  4709. switch ($error) {
  4710. case 'json':
  4711. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  4712. $text .= "Install it or recompile php without --disable-json";
  4713. break;
  4714. case 'phar':
  4715. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  4716. $text .= "Install it or recompile php without --disable-phar";
  4717. break;
  4718. case 'filter':
  4719. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  4720. $text .= "Install it or recompile php without --disable-filter";
  4721. break;
  4722. case 'hash':
  4723. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  4724. $text .= "Install it or recompile php without --disable-hash";
  4725. break;
  4726. case 'iconv_mbstring':
  4727. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  4728. $text .= "Install either of them or recompile php without --disable-iconv";
  4729. break;
  4730. case 'php':
  4731. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 7.2.5 or higher.";
  4732. break;
  4733. case 'allow_url_fopen':
  4734. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  4735. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  4736. $text .= " allow_url_fopen = On";
  4737. $displayIniMessage = true;
  4738. break;
  4739. case 'ioncube':
  4740. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  4741. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  4742. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  4743. $displayIniMessage = true;
  4744. break;
  4745. case 'openssl':
  4746. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  4747. $text .= "If possible you should enable it or recompile php with --with-openssl";
  4748. break;
  4749. default:
  4750. throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown error type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $error));
  4751. }
  4752. $out($text, 'error');
  4753. }
  4754. $output .= PHP_EOL;
  4755. }
  4756. if (!empty($warnings)) {
  4757. foreach ($warnings as $warning => $current) {
  4758. switch ($warning) {
  4759. case 'apc_cli':
  4760. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  4761. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  4762. $text .= " apc.enable_cli = Off";
  4763. $displayIniMessage = true;
  4764. break;
  4765. case 'zlib':
  4766. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  4767. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  4768. $displayIniMessage = true;
  4769. break;
  4770. case 'sigchild':
  4771. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  4772. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  4773. $text .= " https://bugs.php.net/bug.php?id=22999";
  4774. break;
  4775. case 'curlwrappers':
  4776. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  4777. $text .= " Recompile it without this flag if possible";
  4778. break;
  4779. case 'openssl_version':
  4780. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  4781. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  4782. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  4783. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  4784. break;
  4785. case 'xdebug_loaded':
  4786. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  4787. $text .= " Disabling it when using Composer is recommended.";
  4788. break;
  4789. case 'xdebug_profile':
  4790. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  4791. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  4792. $text .= " xdebug.profiler_enabled = 0";
  4793. $displayIniMessage = true;
  4794. break;
  4795. case 'onedrive':
  4796. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  4797. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  4798. break;
  4799. default:
  4800. throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown warning type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $warning));
  4801. }
  4802. $out($text, 'comment');
  4803. }
  4804. }
  4805. if ($displayIniMessage) {
  4806. $out($iniMessage, 'comment');
  4807. }
  4808. if (in_array(Platform::getEnv('COMPOSER_IPRESOLVE'), ['4', '6'], true)) {
  4809. $warnings['ipresolve'] = true;
  4810. $out('The COMPOSER_IPRESOLVE env var is set to ' . Platform::getEnv('COMPOSER_IPRESOLVE') .' which may result in network failures below.', 'comment');
  4811. }
  4812. return count($warnings) === 0 && count($errors) === 0 ? true : $output;
  4813. }
  4814. private function checkConnectivity()
  4815. {
  4816. if (!ini_get('allow_url_fopen')) {
  4817. return '<info>SKIP</> <comment>Because allow_url_fopen is missing.</>';
  4818. }
  4819. return true;
  4820. }
  4821. private function checkConnectivityAndComposerNetworkHttpEnablement()
  4822. {
  4823. $result = $this->checkConnectivity();
  4824. if ($result !== true) {
  4825. return $result;
  4826. }
  4827. $result = $this->checkComposerNetworkHttpEnablement();
  4828. if ($result !== true) {
  4829. return $result;
  4830. }
  4831. return true;
  4832. }
  4833. private function checkComposerNetworkHttpEnablement()
  4834. {
  4835. if ((bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  4836. return '<info>SKIP</> <comment>Network is disabled by COMPOSER_DISABLE_NETWORK.</>';
  4837. }
  4838. return true;
  4839. }
  4840. }
  4841. <?php declare(strict_types=1);
  4842. namespace Composer\Command;
  4843. use Composer\Plugin\CommandEvent;
  4844. use Composer\Plugin\PluginEvents;
  4845. use Symfony\Component\Console\Input\InputInterface;
  4846. use Symfony\Component\Console\Input\InputOption;
  4847. use Symfony\Component\Console\Output\OutputInterface;
  4848. class DumpAutoloadCommand extends BaseCommand
  4849. {
  4850. protected function configure()
  4851. {
  4852. $this
  4853. ->setName('dump-autoload')
  4854. ->setAliases(['dumpautoload'])
  4855. ->setDescription('Dumps the autoloader')
  4856. ->setDefinition([
  4857. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  4858. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  4859. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4860. new InputOption('apcu-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu'),
  4861. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything.'),
  4862. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables autoload-dev rules. Composer will by default infer this automatically according to the last install or update --no-dev state.'),
  4863. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules. Composer will by default infer this automatically according to the last install or update --no-dev state.'),
  4864. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  4865. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  4866. new InputOption('strict-psr', null, InputOption::VALUE_NONE, 'Return a failed status code (1) if PSR-4 or PSR-0 mapping errors are present. Requires --optimize to work.'),
  4867. ])
  4868. ->setHelp(
  4869. <<<EOT
  4870. <info>php composer.phar dump-autoload</info>
  4871. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload
  4872. EOT
  4873. )
  4874. ;
  4875. }
  4876. protected function execute(InputInterface $input, OutputInterface $output): int
  4877. {
  4878. $composer = $this->requireComposer();
  4879. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  4880. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4881. $installationManager = $composer->getInstallationManager();
  4882. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4883. $package = $composer->getPackage();
  4884. $config = $composer->getConfig();
  4885. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  4886. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4887. $apcuPrefix = $input->getOption('apcu-prefix');
  4888. $apcu = $apcuPrefix !== null || $input->getOption('apcu') || $config->get('apcu-autoloader');
  4889. if ($input->getOption('strict-psr') && !$optimize && !$authoritative) {
  4890. throw new \InvalidArgumentException('--strict-psr mode only works with optimized autoloader, use --optimize or --classmap-authoritative if you want a strict return value.');
  4891. }
  4892. if ($authoritative) {
  4893. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  4894. } elseif ($optimize) {
  4895. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  4896. } else {
  4897. $this->getIO()->write('<info>Generating autoload files</info>');
  4898. }
  4899. $generator = $composer->getAutoloadGenerator();
  4900. if ($input->getOption('dry-run')) {
  4901. $generator->setDryRun(true);
  4902. }
  4903. if ($input->getOption('no-dev')) {
  4904. $generator->setDevMode(false);
  4905. }
  4906. if ($input->getOption('dev')) {
  4907. if ($input->getOption('no-dev')) {
  4908. throw new \InvalidArgumentException('You can not use both --no-dev and --dev as they conflict with each other.');
  4909. }
  4910. $generator->setDevMode(true);
  4911. }
  4912. $generator->setClassMapAuthoritative($authoritative);
  4913. $generator->setRunScripts(true);
  4914. $generator->setApcu($apcu, $apcuPrefix);
  4915. $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
  4916. $classMap = $generator->dump(
  4917. $config,
  4918. $localRepo,
  4919. $package,
  4920. $installationManager,
  4921. 'composer',
  4922. $optimize,
  4923. null,
  4924. $composer->getLocker()
  4925. );
  4926. $numberOfClasses = count($classMap);
  4927. if ($authoritative) {
  4928. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  4929. } elseif ($optimize) {
  4930. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  4931. } else {
  4932. $this->getIO()->write('<info>Generated autoload files</info>');
  4933. }
  4934. if ($input->getOption('strict-psr') && count($classMap->getPsrViolations()) > 0) {
  4935. return 1;
  4936. }
  4937. return 0;
  4938. }
  4939. }
  4940. <?php declare(strict_types=1);
  4941. namespace Composer\Command;
  4942. use Symfony\Component\Console\Input\InputInterface;
  4943. use Composer\Console\Input\InputOption;
  4944. use Symfony\Component\Console\Output\OutputInterface;
  4945. use Composer\Console\Input\InputArgument;
  4946. class ExecCommand extends BaseCommand
  4947. {
  4948. protected function configure()
  4949. {
  4950. $this
  4951. ->setName('exec')
  4952. ->setDescription('Executes a vendored binary/script')
  4953. ->setDefinition([
  4954. new InputOption('list', 'l', InputOption::VALUE_NONE),
  4955. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit', null, function () {
  4956. return $this->getBinaries(false);
  4957. }),
  4958. new InputArgument(
  4959. 'args',
  4960. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  4961. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  4962. ),
  4963. ])
  4964. ->setHelp(
  4965. <<<EOT
  4966. Executes a vendored binary/script.
  4967. Read more at https://getcomposer.org/doc/03-cli.md#exec
  4968. EOT
  4969. )
  4970. ;
  4971. }
  4972. protected function interact(InputInterface $input, OutputInterface $output): void
  4973. {
  4974. $binaries = $this->getBinaries(false);
  4975. if (count($binaries) === 0) {
  4976. return;
  4977. }
  4978. if ($input->getArgument('binary') !== null || $input->getOption('list')) {
  4979. return;
  4980. }
  4981. $io = $this->getIO();
  4982. $binary = $io->select(
  4983. 'Binary to run: ',
  4984. $binaries,
  4985. '',
  4986. 1,
  4987. 'Invalid binary name "%s"'
  4988. );
  4989. $input->setArgument('binary', $binaries[$binary]);
  4990. }
  4991. protected function execute(InputInterface $input, OutputInterface $output): int
  4992. {
  4993. $composer = $this->requireComposer();
  4994. if ($input->getOption('list') || null === $input->getArgument('binary')) {
  4995. $bins = $this->getBinaries(true);
  4996. if ([] === $bins) {
  4997. $binDir = $composer->getConfig()->get('bin-dir');
  4998. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  4999. }
  5000. $this->getIO()->write(
  5001. <<<EOT
  5002. <comment>Available binaries:</comment>
  5003. EOT
  5004. );
  5005. foreach ($bins as $bin) {
  5006. $this->getIO()->write(
  5007. <<<EOT
  5008. <info>- $bin</info>
  5009. EOT
  5010. );
  5011. }
  5012. return 0;
  5013. }
  5014. $binary = $input->getArgument('binary');
  5015. $dispatcher = $composer->getEventDispatcher();
  5016. $dispatcher->addListener('__exec_command', $binary);
  5017. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory() && $this->getApplication()->getInitialWorkingDirectory() !== false) {
  5018. try {
  5019. chdir($this->getApplication()->getInitialWorkingDirectory());
  5020. } catch (\Exception $e) {
  5021. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  5022. }
  5023. }
  5024. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  5025. }
  5026. private function getBinaries(bool $forDisplay): array
  5027. {
  5028. $composer = $this->requireComposer();
  5029. $binDir = $composer->getConfig()->get('bin-dir');
  5030. $bins = glob($binDir . '/*');
  5031. $localBins = $composer->getPackage()->getBinaries();
  5032. if ($forDisplay) {
  5033. $localBins = array_map(static function ($e) {
  5034. return "$e (local)";
  5035. }, $localBins);
  5036. }
  5037. $binaries = [];
  5038. foreach (array_merge($bins, $localBins) as $bin) {
  5039. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  5040. continue;
  5041. }
  5042. $previousBin = $bin;
  5043. $binaries[] = basename($bin);
  5044. }
  5045. return $binaries;
  5046. }
  5047. }
  5048. <?php declare(strict_types=1);
  5049. namespace Composer\Command;
  5050. use Composer\Json\JsonFile;
  5051. use Composer\Package\AliasPackage;
  5052. use Composer\Package\BasePackage;
  5053. use Composer\Package\CompletePackageInterface;
  5054. use Composer\Pcre\Preg;
  5055. use Composer\Repository\CompositeRepository;
  5056. use Composer\Semver\Constraint\MatchAllConstraint;
  5057. use Symfony\Component\Console\Formatter\OutputFormatter;
  5058. use Symfony\Component\Console\Input\InputInterface;
  5059. use Composer\Console\Input\InputOption;
  5060. use Symfony\Component\Console\Output\OutputInterface;
  5061. class FundCommand extends BaseCommand
  5062. {
  5063. protected function configure(): void
  5064. {
  5065. $this->setName('fund')
  5066. ->setDescription('Discover how to help fund the maintenance of your dependencies')
  5067. ->setDefinition([
  5068. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['text', 'json']),
  5069. ])
  5070. ;
  5071. }
  5072. protected function execute(InputInterface $input, OutputInterface $output): int
  5073. {
  5074. $composer = $this->requireComposer();
  5075. $repo = $composer->getRepositoryManager()->getLocalRepository();
  5076. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5077. $fundings = [];
  5078. $packagesToLoad = [];
  5079. foreach ($repo->getPackages() as $package) {
  5080. if ($package instanceof AliasPackage) {
  5081. continue;
  5082. }
  5083. $packagesToLoad[$package->getName()] = new MatchAllConstraint();
  5084. }
  5085. $result = $remoteRepos->loadPackages($packagesToLoad, ['dev' => BasePackage::STABILITY_DEV], []);
  5086. foreach ($result['packages'] as $package) {
  5087. if (
  5088. !$package instanceof AliasPackage
  5089. && $package instanceof CompletePackageInterface
  5090. && $package->isDefaultBranch()
  5091. && $package->getFunding()
  5092. && isset($packagesToLoad[$package->getName()])
  5093. ) {
  5094. $fundings = $this->insertFundingData($fundings, $package);
  5095. unset($packagesToLoad[$package->getName()]);
  5096. }
  5097. }
  5098. foreach ($repo->getPackages() as $package) {
  5099. if ($package instanceof AliasPackage || !isset($packagesToLoad[$package->getName()])) {
  5100. continue;
  5101. }
  5102. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  5103. $fundings = $this->insertFundingData($fundings, $package);
  5104. }
  5105. }
  5106. ksort($fundings);
  5107. $io = $this->getIO();
  5108. $format = $input->getOption('format');
  5109. if (!in_array($format, ['text', 'json'])) {
  5110. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5111. return 1;
  5112. }
  5113. if ($fundings && $format === 'text') {
  5114. $prev = null;
  5115. $io->write('The following packages were found in your dependencies which publish funding information:');
  5116. foreach ($fundings as $vendor => $links) {
  5117. $io->write('');
  5118. $io->write(sprintf("<comment>%s</comment>", $vendor));
  5119. foreach ($links as $url => $packages) {
  5120. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  5121. if ($prev !== $line) {
  5122. $io->write($line);
  5123. $prev = $line;
  5124. }
  5125. $io->write(sprintf(' <href=%s>%s</>', OutputFormatter::escape($url), $url));
  5126. }
  5127. }
  5128. $io->write("");
  5129. $io->write("Please consider following these links and sponsoring the work of package authors!");
  5130. $io->write("Thank you!");
  5131. } elseif ($format === 'json') {
  5132. $io->write(JsonFile::encode($fundings));
  5133. } else {
  5134. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  5135. }
  5136. return 0;
  5137. }
  5138. private function insertFundingData(array $fundings, CompletePackageInterface $package): array
  5139. {
  5140. foreach ($package->getFunding() as $fundingOption) {
  5141. [$vendor, $packageName] = explode('/', $package->getPrettyName());
  5142. if (empty($fundingOption['url'])) {
  5143. continue;
  5144. }
  5145. $url = $fundingOption['url'];
  5146. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && Preg::isMatch('{^https://github.com/([^/]+)$}', $url, $match)) {
  5147. $url = 'https://github.com/sponsors/'.$match[1];
  5148. }
  5149. $fundings[$vendor][$url][] = $packageName;
  5150. }
  5151. return $fundings;
  5152. }
  5153. }
  5154. <?php declare(strict_types=1);
  5155. namespace Composer\Command;
  5156. use Composer\Factory;
  5157. use Composer\Pcre\Preg;
  5158. use Composer\Util\Filesystem;
  5159. use Composer\Util\Platform;
  5160. use Symfony\Component\Console\Command\Command;
  5161. use Symfony\Component\Console\Completion\CompletionInput;
  5162. use Symfony\Component\Console\Completion\CompletionSuggestions;
  5163. use Symfony\Component\Console\Input\InputInterface;
  5164. use Composer\Console\Input\InputArgument;
  5165. use Symfony\Component\Console\Input\StringInput;
  5166. use Symfony\Component\Console\Output\OutputInterface;
  5167. class GlobalCommand extends BaseCommand
  5168. {
  5169. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  5170. {
  5171. $application = $this->getApplication();
  5172. if ($input->mustSuggestArgumentValuesFor('command-name')) {
  5173. $suggestions->suggestValues(array_values(array_filter(array_map(static function (Command $command) {
  5174. return $command->isHidden() ? null : $command->getName();
  5175. }, $application->all()))));
  5176. return;
  5177. }
  5178. if ($application->has($commandName = $input->getArgument('command-name'))) {
  5179. $input = $this->prepareSubcommandInput($input, true);
  5180. $input = CompletionInput::fromString($input->__toString(), 2);
  5181. $command = $application->find($commandName);
  5182. $command->mergeApplicationDefinition();
  5183. $input->bind($command->getDefinition());
  5184. $command->complete($input, $suggestions);
  5185. }
  5186. }
  5187. protected function configure(): void
  5188. {
  5189. $this
  5190. ->setName('global')
  5191. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME)')
  5192. ->setDefinition([
  5193. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  5194. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5195. ])
  5196. ->setHelp(
  5197. <<<EOT
  5198. Use this command as a wrapper to run other Composer commands
  5199. within the global context of COMPOSER_HOME.
  5200. You can use this to install CLI utilities globally, all you need
  5201. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  5202. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  5203. and /home/<user>/.composer on unix systems.
  5204. If your system uses freedesktop.org standards, then it will first check
  5205. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  5206. Note: This path may vary depending on customizations to bin-dir in
  5207. composer.json or the environmental variable COMPOSER_BIN_DIR.
  5208. Read more at https://getcomposer.org/doc/03-cli.md#global
  5209. EOT
  5210. )
  5211. ;
  5212. }
  5213. public function run(InputInterface $input, OutputInterface $output): int
  5214. {
  5215. if (!method_exists($input, '__toString')) {
  5216. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  5217. }
  5218. $tokens = Preg::split('{\s+}', $input->__toString());
  5219. $args = [];
  5220. foreach ($tokens as $token) {
  5221. if ($token && $token[0] !== '-') {
  5222. $args[] = $token;
  5223. if (count($args) >= 2) {
  5224. break;
  5225. }
  5226. }
  5227. }
  5228. if (count($args) < 2) {
  5229. return parent::run($input, $output);
  5230. }
  5231. $input = $this->prepareSubcommandInput($input);
  5232. return $this->getApplication()->run($input, $output);
  5233. }
  5234. private function prepareSubcommandInput(InputInterface $input, bool $quiet = false): StringInput
  5235. {
  5236. if (!method_exists($input, '__toString')) {
  5237. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  5238. }
  5239. if (Platform::getEnv('COMPOSER')) {
  5240. Platform::clearEnv('COMPOSER');
  5241. }
  5242. $config = Factory::createConfig();
  5243. $home = $config->get('home');
  5244. if (!is_dir($home)) {
  5245. $fs = new Filesystem();
  5246. $fs->ensureDirectoryExists($home);
  5247. if (!is_dir($home)) {
  5248. throw new \RuntimeException('Could not create home directory');
  5249. }
  5250. }
  5251. try {
  5252. chdir($home);
  5253. } catch (\Exception $e) {
  5254. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  5255. }
  5256. if (!$quiet) {
  5257. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  5258. }
  5259. $input = new StringInput(Preg::replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  5260. $this->getApplication()->resetComposer();
  5261. return $input;
  5262. }
  5263. public function isProxyCommand(): bool
  5264. {
  5265. return true;
  5266. }
  5267. }
  5268. <?php declare(strict_types=1);
  5269. namespace Composer\Command;
  5270. use Composer\Package\CompletePackageInterface;
  5271. use Composer\Repository\RepositoryInterface;
  5272. use Composer\Repository\RootPackageRepository;
  5273. use Composer\Repository\RepositoryFactory;
  5274. use Composer\Util\Platform;
  5275. use Composer\Util\ProcessExecutor;
  5276. use Composer\Console\Input\InputArgument;
  5277. use Composer\Console\Input\InputOption;
  5278. use Symfony\Component\Console\Input\InputInterface;
  5279. use Symfony\Component\Console\Output\OutputInterface;
  5280. class HomeCommand extends BaseCommand
  5281. {
  5282. use CompletionTrait;
  5283. protected function configure(): void
  5284. {
  5285. $this
  5286. ->setName('browse')
  5287. ->setAliases(['home'])
  5288. ->setDescription('Opens the package\'s repository URL or homepage in your browser')
  5289. ->setDefinition([
  5290. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.', null, $this->suggestInstalledPackage()),
  5291. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  5292. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  5293. ])
  5294. ->setHelp(
  5295. <<<EOT
  5296. The home command opens or shows a package's repository URL or
  5297. homepage in your default browser.
  5298. To open the homepage by default, use -H or --homepage.
  5299. To show instead of open the repository or homepage URL, use -s or --show.
  5300. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  5301. EOT
  5302. );
  5303. }
  5304. protected function execute(InputInterface $input, OutputInterface $output): int
  5305. {
  5306. $repos = $this->initializeRepos();
  5307. $io = $this->getIO();
  5308. $return = 0;
  5309. $packages = $input->getArgument('packages');
  5310. if (count($packages) === 0) {
  5311. $io->writeError('No package specified, opening homepage for the root package');
  5312. $packages = [$this->requireComposer()->getPackage()->getName()];
  5313. }
  5314. foreach ($packages as $packageName) {
  5315. $handled = false;
  5316. $packageExists = false;
  5317. foreach ($repos as $repo) {
  5318. foreach ($repo->findPackages($packageName) as $package) {
  5319. $packageExists = true;
  5320. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  5321. $handled = true;
  5322. break 2;
  5323. }
  5324. }
  5325. }
  5326. if (!$packageExists) {
  5327. $return = 1;
  5328. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  5329. }
  5330. if (!$handled) {
  5331. $return = 1;
  5332. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  5333. }
  5334. }
  5335. return $return;
  5336. }
  5337. private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly): bool
  5338. {
  5339. $support = $package->getSupport();
  5340. $url = $support['source'] ?? $package->getSourceUrl();
  5341. if (!$url || $showHomepage) {
  5342. $url = $package->getHomepage();
  5343. }
  5344. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  5345. return false;
  5346. }
  5347. if ($showOnly) {
  5348. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  5349. } else {
  5350. $this->openBrowser($url);
  5351. }
  5352. return true;
  5353. }
  5354. private function openBrowser(string $url): void
  5355. {
  5356. $url = ProcessExecutor::escape($url);
  5357. $process = new ProcessExecutor($this->getIO());
  5358. if (Platform::isWindows()) {
  5359. $process->execute('start "web" explorer ' . $url, $output);
  5360. return;
  5361. }
  5362. $linux = $process->execute('which xdg-open', $output);
  5363. $osx = $process->execute('which open', $output);
  5364. if (0 === $linux) {
  5365. $process->execute('xdg-open ' . $url, $output);
  5366. } elseif (0 === $osx) {
  5367. $process->execute('open ' . $url, $output);
  5368. } else {
  5369. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  5370. }
  5371. }
  5372. private function initializeRepos(): array
  5373. {
  5374. $composer = $this->tryComposer();
  5375. if ($composer) {
  5376. return array_merge(
  5377. [new RootPackageRepository(clone $composer->getPackage())],
  5378. [$composer->getRepositoryManager()->getLocalRepository()],
  5379. $composer->getRepositoryManager()->getRepositories()
  5380. );
  5381. }
  5382. return RepositoryFactory::defaultReposWithDefaultManager($this->getIO());
  5383. }
  5384. }
  5385. <?php declare(strict_types=1);
  5386. namespace Composer\Command;
  5387. use Composer\Factory;
  5388. use Composer\Json\JsonFile;
  5389. use Composer\Json\JsonValidationException;
  5390. use Composer\Package\BasePackage;
  5391. use Composer\Package\Package;
  5392. use Composer\Pcre\Preg;
  5393. use Composer\Repository\CompositeRepository;
  5394. use Composer\Repository\PlatformRepository;
  5395. use Composer\Repository\RepositoryFactory;
  5396. use Composer\Util\Filesystem;
  5397. use Composer\Util\Silencer;
  5398. use Symfony\Component\Console\Input\ArrayInput;
  5399. use Symfony\Component\Console\Input\InputInterface;
  5400. use Composer\Console\Input\InputOption;
  5401. use Symfony\Component\Console\Output\OutputInterface;
  5402. use Symfony\Component\Process\ExecutableFinder;
  5403. use Symfony\Component\Process\Process;
  5404. use Symfony\Component\Console\Helper\FormatterHelper;
  5405. class InitCommand extends BaseCommand
  5406. {
  5407. use CompletionTrait;
  5408. use PackageDiscoveryTrait;
  5409. private $gitConfig;
  5410. protected function configure()
  5411. {
  5412. $this
  5413. ->setName('init')
  5414. ->setDescription('Creates a basic composer.json file in current directory')
  5415. ->setDefinition([
  5416. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  5417. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  5418. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  5419. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  5420. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  5421. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"', null, $this->suggestAvailablePackageInclPlatform()),
  5422. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"', null, $this->suggestAvailablePackageInclPlatform()),
  5423. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  5424. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  5425. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  5426. new InputOption('autoload', 'a', InputOption::VALUE_REQUIRED, 'Add PSR-4 autoload mapping. Maps your package\'s namespace to the provided directory. (Expects a relative path, e.g. src/)'),
  5427. ])
  5428. ->setHelp(
  5429. <<<EOT
  5430. The <info>init</info> command creates a basic composer.json file
  5431. in the current directory.
  5432. <info>php composer.phar init</info>
  5433. Read more at https://getcomposer.org/doc/03-cli.md#init
  5434. EOT
  5435. )
  5436. ;
  5437. }
  5438. protected function execute(InputInterface $input, OutputInterface $output): int
  5439. {
  5440. $io = $this->getIO();
  5441. $allowlist = ['name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license', 'autoload'];
  5442. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowlist)));
  5443. if (isset($options['name']) && !Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $options['name'])) {
  5444. throw new \InvalidArgumentException(
  5445. 'The package name '.$options['name'].' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  5446. );
  5447. }
  5448. if (isset($options['author'])) {
  5449. $options['authors'] = $this->formatAuthors($options['author']);
  5450. unset($options['author']);
  5451. }
  5452. $repositories = $input->getOption('repository');
  5453. if (count($repositories) > 0) {
  5454. $config = Factory::createConfig($io);
  5455. foreach ($repositories as $repo) {
  5456. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo, true);
  5457. }
  5458. }
  5459. if (isset($options['stability'])) {
  5460. $options['minimum-stability'] = $options['stability'];
  5461. unset($options['stability']);
  5462. }
  5463. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  5464. if ([] === $options['require']) {
  5465. $options['require'] = new \stdClass;
  5466. }
  5467. if (isset($options['require-dev'])) {
  5468. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  5469. if ([] === $options['require-dev']) {
  5470. $options['require-dev'] = new \stdClass;
  5471. }
  5472. }
  5473. $autoloadPath = null;
  5474. if (isset($options['autoload'])) {
  5475. $autoloadPath = $options['autoload'];
  5476. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  5477. $options['autoload'] = (object) [
  5478. 'psr-4' => [
  5479. $namespace . '\\' => $autoloadPath,
  5480. ],
  5481. ];
  5482. }
  5483. $file = new JsonFile(Factory::getComposerFile());
  5484. $json = JsonFile::encode($options);
  5485. if ($input->isInteractive()) {
  5486. $io->writeError(['', $json, '']);
  5487. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ')) {
  5488. $io->writeError('<error>Command aborted</error>');
  5489. return 1;
  5490. }
  5491. } else {
  5492. if (json_encode($options) === '{"require":{}}') {
  5493. throw new \RuntimeException('You have to run this command in interactive mode, or specify at least some data using --name, --require, etc.');
  5494. }
  5495. $io->writeError('Writing '.$file->getPath());
  5496. }
  5497. $file->write($options);
  5498. try {
  5499. $file->validateSchema(JsonFile::LAX_SCHEMA);
  5500. } catch (JsonValidationException $e) {
  5501. $io->writeError('<error>Schema validation error, aborting</error>');
  5502. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  5503. $io->writeError($e->getMessage() . ':' . PHP_EOL . $errors);
  5504. Silencer::call('unlink', $file->getPath());
  5505. return 1;
  5506. }
  5507. if ($autoloadPath) {
  5508. $filesystem = new Filesystem();
  5509. $filesystem->ensureDirectoryExists($autoloadPath);
  5510. if (!$this->hasDependencies($options)) {
  5511. $this->runDumpAutoloadCommand($output);
  5512. }
  5513. }
  5514. if ($input->isInteractive() && is_dir('.git')) {
  5515. $ignoreFile = realpath('.gitignore');
  5516. if (false === $ignoreFile) {
  5517. $ignoreFile = realpath('.') . '/.gitignore';
  5518. }
  5519. if (!$this->hasVendorIgnore($ignoreFile)) {
  5520. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  5521. if ($io->askConfirmation($question)) {
  5522. $this->addVendorIgnore($ignoreFile);
  5523. }
  5524. }
  5525. }
  5526. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  5527. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) {
  5528. $this->updateDependencies($output);
  5529. }
  5530. if ($autoloadPath) {
  5531. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  5532. $io->writeError('PSR-4 autoloading configured. Use "<comment>namespace '.$namespace.';</comment>" in '.$autoloadPath);
  5533. $io->writeError('Include the Composer autoloader with: <comment>require \'vendor/autoload.php\';</comment>');
  5534. }
  5535. return 0;
  5536. }
  5537. protected function interact(InputInterface $input, OutputInterface $output)
  5538. {
  5539. $git = $this->getGitConfig();
  5540. $io = $this->getIO();
  5541. $formatter = $this->getHelperSet()->get('formatter');
  5542. $repositories = $input->getOption('repository');
  5543. if (count($repositories) > 0) {
  5544. $config = Factory::createConfig($io);
  5545. $io->loadConfiguration($config);
  5546. $repoManager = RepositoryFactory::manager($io, $config);
  5547. $repos = [new PlatformRepository];
  5548. $createDefaultPackagistRepo = true;
  5549. foreach ($repositories as $repo) {
  5550. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
  5551. if (
  5552. (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
  5553. || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
  5554. ) {
  5555. $createDefaultPackagistRepo = false;
  5556. continue;
  5557. }
  5558. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig, $repoManager);
  5559. }
  5560. if ($createDefaultPackagistRepo) {
  5561. $repos[] = RepositoryFactory::createRepo($io, $config, [
  5562. 'type' => 'composer',
  5563. 'url' => 'https://repo.packagist.org',
  5564. ], $repoManager);
  5565. }
  5566. $this->repos = new CompositeRepository($repos);
  5567. unset($repos, $config, $repositories);
  5568. }
  5569. $io->writeError([
  5570. '',
  5571. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  5572. '',
  5573. ]);
  5574. $io->writeError([
  5575. '',
  5576. 'This command will guide you through creating your composer.json config.',
  5577. '',
  5578. ]);
  5579. $cwd = realpath(".");
  5580. $name = $input->getOption('name');
  5581. if (null === $name) {
  5582. $name = basename($cwd);
  5583. $name = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  5584. $name = strtolower($name);
  5585. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  5586. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  5587. } elseif (isset($git['github.user'])) {
  5588. $name = $git['github.user'] . '/' . $name;
  5589. } elseif (!empty($_SERVER['USERNAME'])) {
  5590. $name = $_SERVER['USERNAME'] . '/' . $name;
  5591. } elseif (!empty($_SERVER['USER'])) {
  5592. $name = $_SERVER['USER'] . '/' . $name;
  5593. } elseif (get_current_user()) {
  5594. $name = get_current_user() . '/' . $name;
  5595. } else {
  5596. $name .= '/' . $name;
  5597. }
  5598. $name = strtolower($name);
  5599. }
  5600. $name = $io->askAndValidate(
  5601. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  5602. static function ($value) use ($name) {
  5603. if (null === $value) {
  5604. return $name;
  5605. }
  5606. if (!Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  5607. throw new \InvalidArgumentException(
  5608. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  5609. );
  5610. }
  5611. return $value;
  5612. },
  5613. null,
  5614. $name
  5615. );
  5616. $input->setOption('name', $name);
  5617. $description = $input->getOption('description') ?: null;
  5618. $description = $io->ask(
  5619. 'Description [<comment>'.$description.'</comment>]: ',
  5620. $description
  5621. );
  5622. $input->setOption('description', $description);
  5623. if (null === $author = $input->getOption('author')) {
  5624. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  5625. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  5626. } elseif (isset($git['user.name'])) {
  5627. $author_name = $git['user.name'];
  5628. }
  5629. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  5630. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  5631. } elseif (isset($git['user.email'])) {
  5632. $author_email = $git['user.email'];
  5633. }
  5634. if (isset($author_name, $author_email)) {
  5635. $author = sprintf('%s <%s>', $author_name, $author_email);
  5636. }
  5637. }
  5638. $author = $io->askAndValidate(
  5639. 'Author ['.(is_string($author) ? '<comment>'.$author.'</comment>, ' : '') . 'n to skip]: ',
  5640. function ($value) use ($author) {
  5641. if ($value === 'n' || $value === 'no') {
  5642. return;
  5643. }
  5644. $value = $value ?: $author;
  5645. $author = $this->parseAuthorString($value ?? '');
  5646. if ($author['email'] === null) {
  5647. return $author['name'];
  5648. }
  5649. return sprintf('%s <%s>', $author['name'], $author['email']);
  5650. },
  5651. null,
  5652. $author
  5653. );
  5654. $input->setOption('author', $author);
  5655. $minimumStability = $input->getOption('stability') ?: null;
  5656. $minimumStability = $io->askAndValidate(
  5657. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  5658. static function ($value) use ($minimumStability) {
  5659. if (null === $value) {
  5660. return $minimumStability;
  5661. }
  5662. if (!isset(BasePackage::$stabilities[$value])) {
  5663. throw new \InvalidArgumentException(
  5664. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  5665. implode(', ', array_keys(BasePackage::$stabilities))
  5666. );
  5667. }
  5668. return $value;
  5669. },
  5670. null,
  5671. $minimumStability
  5672. );
  5673. $input->setOption('stability', $minimumStability);
  5674. $type = $input->getOption('type') ?: false;
  5675. $type = $io->ask(
  5676. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  5677. $type
  5678. );
  5679. $input->setOption('type', $type);
  5680. if (null === $license = $input->getOption('license')) {
  5681. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  5682. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  5683. }
  5684. }
  5685. $license = $io->ask(
  5686. 'License [<comment>'.$license.'</comment>]: ',
  5687. $license
  5688. );
  5689. $input->setOption('license', $license);
  5690. $io->writeError(['', 'Define your dependencies.', '']);
  5691. $repos = $this->getRepos();
  5692. $preferredStability = $minimumStability ?: 'stable';
  5693. $platformRepo = null;
  5694. if ($repos instanceof CompositeRepository) {
  5695. foreach ($repos->getRepositories() as $candidateRepo) {
  5696. if ($candidateRepo instanceof PlatformRepository) {
  5697. $platformRepo = $candidateRepo;
  5698. break;
  5699. }
  5700. }
  5701. }
  5702. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  5703. $require = $input->getOption('require');
  5704. $requirements = [];
  5705. if (count($require) > 0 || $io->askConfirmation($question)) {
  5706. $requirements = $this->determineRequirements($input, $output, $require, $platformRepo, $preferredStability);
  5707. }
  5708. $input->setOption('require', $requirements);
  5709. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  5710. $requireDev = $input->getOption('require-dev');
  5711. $devRequirements = [];
  5712. if (count($requireDev) > 0 || $io->askConfirmation($question)) {
  5713. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $platformRepo, $preferredStability);
  5714. }
  5715. $input->setOption('require-dev', $devRequirements);
  5716. $autoload = $input->getOption('autoload') ?: 'src/';
  5717. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  5718. $autoload = $io->askAndValidate(
  5719. 'Add PSR-4 autoload mapping? Maps namespace "'.$namespace.'" to the entered relative path. [<comment>'.$autoload.'</comment>, n to skip]: ',
  5720. static function ($value) use ($autoload) {
  5721. if (null === $value) {
  5722. return $autoload;
  5723. }
  5724. if ($value === 'n' || $value === 'no') {
  5725. return;
  5726. }
  5727. $value = $value ?: $autoload;
  5728. if (!Preg::isMatch('{^[^/][A-Za-z0-9\-_/]+/$}', $value)) {
  5729. throw new \InvalidArgumentException(sprintf(
  5730. 'The src folder name "%s" is invalid. Please add a relative path with tailing forward slash. [A-Za-z0-9_-/]+/',
  5731. $value
  5732. ));
  5733. }
  5734. return $value;
  5735. },
  5736. null,
  5737. $autoload
  5738. );
  5739. $input->setOption('autoload', $autoload);
  5740. }
  5741. private function parseAuthorString(string $author): array
  5742. {
  5743. if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+)(?:\s+<(?P<email>.+?)>)?$/u', $author, $match)) {
  5744. assert(is_string($match['name']));
  5745. if (null !== $match['email'] && !$this->isValidEmail($match['email'])) {
  5746. throw new \InvalidArgumentException('Invalid email "'.$match['email'].'"');
  5747. }
  5748. return [
  5749. 'name' => trim($match['name']),
  5750. 'email' => $match['email'],
  5751. ];
  5752. }
  5753. throw new \InvalidArgumentException(
  5754. 'Invalid author string. Must be in the formats: '.
  5755. 'Jane Doe or John Smith <john@example.com>'
  5756. );
  5757. }
  5758. protected function formatAuthors(string $author): array
  5759. {
  5760. $author = $this->parseAuthorString($author);
  5761. if (null === $author['email']) {
  5762. unset($author['email']);
  5763. }
  5764. return [$author];
  5765. }
  5766. public function namespaceFromPackageName(string $packageName): ?string
  5767. {
  5768. if (!$packageName || strpos($packageName, '/') === false) {
  5769. return null;
  5770. }
  5771. $namespace = array_map(
  5772. static function ($part): string {
  5773. $part = Preg::replace('/[^a-z0-9]/i', ' ', $part);
  5774. $part = ucwords($part);
  5775. return str_replace(' ', '', $part);
  5776. },
  5777. explode('/', $packageName)
  5778. );
  5779. return implode('\\', $namespace);
  5780. }
  5781. protected function getGitConfig(): array
  5782. {
  5783. if (null !== $this->gitConfig) {
  5784. return $this->gitConfig;
  5785. }
  5786. $finder = new ExecutableFinder();
  5787. $gitBin = $finder->find('git');
  5788. $cmd = new Process([$gitBin, 'config', '-l']);
  5789. $cmd->run();
  5790. if ($cmd->isSuccessful()) {
  5791. $this->gitConfig = [];
  5792. Preg::matchAllStrictGroups('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches);
  5793. foreach ($matches[1] as $key => $match) {
  5794. $this->gitConfig[$match] = $matches[2][$key];
  5795. }
  5796. return $this->gitConfig;
  5797. }
  5798. return $this->gitConfig = [];
  5799. }
  5800. protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor'): bool
  5801. {
  5802. if (!file_exists($ignoreFile)) {
  5803. return false;
  5804. }
  5805. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  5806. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  5807. foreach ($lines as $line) {
  5808. if (Preg::isMatch($pattern, $line)) {
  5809. return true;
  5810. }
  5811. }
  5812. return false;
  5813. }
  5814. protected function addVendorIgnore(string $ignoreFile, string $vendor = '/vendor/'): void
  5815. {
  5816. $contents = "";
  5817. if (file_exists($ignoreFile)) {
  5818. $contents = file_get_contents($ignoreFile);
  5819. if (strpos($contents, "\n") !== 0) {
  5820. $contents .= "\n";
  5821. }
  5822. }
  5823. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  5824. }
  5825. protected function isValidEmail(string $email): bool
  5826. {
  5827. if (!function_exists('filter_var')) {
  5828. return true;
  5829. }
  5830. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  5831. }
  5832. private function updateDependencies(OutputInterface $output): void
  5833. {
  5834. try {
  5835. $updateCommand = $this->getApplication()->find('update');
  5836. $this->getApplication()->resetComposer();
  5837. $updateCommand->run(new ArrayInput([]), $output);
  5838. } catch (\Exception $e) {
  5839. $this->getIO()->writeError('Could not update dependencies. Run `composer update` to see more information.');
  5840. }
  5841. }
  5842. private function runDumpAutoloadCommand(OutputInterface $output): void
  5843. {
  5844. try {
  5845. $command = $this->getApplication()->find('dump-autoload');
  5846. $this->getApplication()->resetComposer();
  5847. $command->run(new ArrayInput([]), $output);
  5848. } catch (\Exception $e) {
  5849. $this->getIO()->writeError('Could not run dump-autoload.');
  5850. }
  5851. }
  5852. private function hasDependencies(array $options): bool
  5853. {
  5854. $requires = (array) $options['require'];
  5855. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : [];
  5856. return !empty($requires) || !empty($devRequires);
  5857. }
  5858. }
  5859. <?php declare(strict_types=1);
  5860. namespace Composer\Command;
  5861. use Composer\Installer;
  5862. use Composer\Plugin\CommandEvent;
  5863. use Composer\Plugin\PluginEvents;
  5864. use Composer\Advisory\Auditor;
  5865. use Composer\Util\HttpDownloader;
  5866. use Symfony\Component\Console\Input\InputInterface;
  5867. use Composer\Console\Input\InputOption;
  5868. use Composer\Console\Input\InputArgument;
  5869. use Symfony\Component\Console\Output\OutputInterface;
  5870. class InstallCommand extends BaseCommand
  5871. {
  5872. use CompletionTrait;
  5873. protected function configure()
  5874. {
  5875. $this
  5876. ->setName('install')
  5877. ->setAliases(['i'])
  5878. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json')
  5879. ->setDefinition([
  5880. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5881. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  5882. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  5883. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5884. new InputOption('download-only', null, InputOption::VALUE_NONE, 'Download only, do not install packages.'),
  5885. new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5886. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  5887. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5888. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5889. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5890. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Do not use, only defined here to catch misuse of the install command.'),
  5891. new InputOption('audit', null, InputOption::VALUE_NONE, 'Run an audit after installation is complete.'),
  5892. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  5893. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5894. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  5895. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5896. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5897. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  5898. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  5899. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  5900. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  5901. ])
  5902. ->setHelp(
  5903. <<<EOT
  5904. The <info>install</info> command reads the composer.lock file from
  5905. the current directory, processes it, and downloads and installs all the
  5906. libraries and dependencies outlined in that file. If the file does not
  5907. exist it will look for composer.json and do the same.
  5908. <info>php composer.phar install</info>
  5909. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  5910. EOT
  5911. )
  5912. ;
  5913. }
  5914. protected function execute(InputInterface $input, OutputInterface $output): int
  5915. {
  5916. $io = $this->getIO();
  5917. if ($input->getOption('dev')) {
  5918. $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
  5919. }
  5920. if ($input->getOption('no-suggest')) {
  5921. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  5922. }
  5923. $args = $input->getArgument('packages');
  5924. if (count($args) > 0) {
  5925. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  5926. return 1;
  5927. }
  5928. if ($input->getOption('no-install')) {
  5929. $io->writeError('<error>Invalid option "--no-install". Use "composer update --no-install" instead if you are trying to update the composer.lock file.</error>');
  5930. return 1;
  5931. }
  5932. $composer = $this->requireComposer();
  5933. if (!$composer->getLocker()->isLocked() && !HttpDownloader::isCurlEnabled()) {
  5934. $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
  5935. }
  5936. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  5937. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5938. $install = Installer::create($io, $composer);
  5939. $config = $composer->getConfig();
  5940. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  5941. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5942. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5943. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  5944. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5945. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  5946. $install
  5947. ->setDryRun($input->getOption('dry-run'))
  5948. ->setDownloadOnly($input->getOption('download-only'))
  5949. ->setVerbose($input->getOption('verbose'))
  5950. ->setPreferSource($preferSource)
  5951. ->setPreferDist($preferDist)
  5952. ->setDevMode(!$input->getOption('no-dev'))
  5953. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5954. ->setOptimizeAutoloader($optimize)
  5955. ->setClassMapAuthoritative($authoritative)
  5956. ->setApcuAutoloader($apcu, $apcuPrefix)
  5957. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  5958. ->setAudit($input->getOption('audit'))
  5959. ->setErrorOnAudit($input->getOption('audit'))
  5960. ->setAuditFormat($this->getAuditFormat($input))
  5961. ;
  5962. if ($input->getOption('no-plugins')) {
  5963. $install->disablePlugins();
  5964. }
  5965. return $install->run();
  5966. }
  5967. }
  5968. <?php declare(strict_types=1);
  5969. namespace Composer\Command;
  5970. use Composer\Console\Input\InputOption;
  5971. use Composer\Json\JsonFile;
  5972. use Composer\Package\CompletePackageInterface;
  5973. use Composer\Plugin\CommandEvent;
  5974. use Composer\Plugin\PluginEvents;
  5975. use Composer\Repository\RepositoryUtils;
  5976. use Composer\Util\PackageInfo;
  5977. use Composer\Util\PackageSorter;
  5978. use Symfony\Component\Console\Formatter\OutputFormatter;
  5979. use Symfony\Component\Console\Helper\Table;
  5980. use Symfony\Component\Console\Input\InputInterface;
  5981. use Symfony\Component\Console\Output\OutputInterface;
  5982. use Symfony\Component\Console\Style\SymfonyStyle;
  5983. class LicensesCommand extends BaseCommand
  5984. {
  5985. protected function configure(): void
  5986. {
  5987. $this
  5988. ->setName('licenses')
  5989. ->setDescription('Shows information about licenses of dependencies')
  5990. ->setDefinition([
  5991. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text, json or summary', 'text', ['text', 'json', 'summary']),
  5992. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  5993. ])
  5994. ->setHelp(
  5995. <<<EOT
  5996. The license command displays detailed information about the licenses of
  5997. the installed dependencies.
  5998. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  5999. EOT
  6000. )
  6001. ;
  6002. }
  6003. protected function execute(InputInterface $input, OutputInterface $output): int
  6004. {
  6005. $composer = $this->requireComposer();
  6006. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  6007. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6008. $root = $composer->getPackage();
  6009. $repo = $composer->getRepositoryManager()->getLocalRepository();
  6010. if ($input->getOption('no-dev')) {
  6011. $packages = RepositoryUtils::filterRequiredPackages($repo->getPackages(), $root);
  6012. } else {
  6013. $packages = $repo->getPackages();
  6014. }
  6015. $packages = PackageSorter::sortPackagesAlphabetically($packages);
  6016. $io = $this->getIO();
  6017. switch ($format = $input->getOption('format')) {
  6018. case 'text':
  6019. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  6020. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  6021. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  6022. $io->write('Dependencies:');
  6023. $io->write('');
  6024. $table = new Table($output);
  6025. $table->setStyle('compact');
  6026. $table->setHeaders(['Name', 'Version', 'Licenses']);
  6027. foreach ($packages as $package) {
  6028. $link = PackageInfo::getViewSourceOrHomepageUrl($package);
  6029. if ($link !== null) {
  6030. $name = '<href='.OutputFormatter::escape($link).'>'.$package->getPrettyName().'</>';
  6031. } else {
  6032. $name = $package->getPrettyName();
  6033. }
  6034. $table->addRow([
  6035. $name,
  6036. $package->getFullPrettyVersion(),
  6037. implode(', ', $package instanceof CompletePackageInterface ? $package->getLicense() : []) ?: 'none',
  6038. ]);
  6039. }
  6040. $table->render();
  6041. break;
  6042. case 'json':
  6043. $dependencies = [];
  6044. foreach ($packages as $package) {
  6045. $dependencies[$package->getPrettyName()] = [
  6046. 'version' => $package->getFullPrettyVersion(),
  6047. 'license' => $package instanceof CompletePackageInterface ? $package->getLicense() : [],
  6048. ];
  6049. }
  6050. $io->write(JsonFile::encode([
  6051. 'name' => $root->getPrettyName(),
  6052. 'version' => $root->getFullPrettyVersion(),
  6053. 'license' => $root->getLicense(),
  6054. 'dependencies' => $dependencies,
  6055. ]));
  6056. break;
  6057. case 'summary':
  6058. $usedLicenses = [];
  6059. foreach ($packages as $package) {
  6060. $licenses = $package instanceof CompletePackageInterface ? $package->getLicense() : [];
  6061. if (count($licenses) === 0) {
  6062. $licenses[] = 'none';
  6063. }
  6064. foreach ($licenses as $licenseName) {
  6065. if (!isset($usedLicenses[$licenseName])) {
  6066. $usedLicenses[$licenseName] = 0;
  6067. }
  6068. $usedLicenses[$licenseName]++;
  6069. }
  6070. }
  6071. arsort($usedLicenses, SORT_NUMERIC);
  6072. $rows = [];
  6073. foreach ($usedLicenses as $usedLicense => $numberOfDependencies) {
  6074. $rows[] = [$usedLicense, $numberOfDependencies];
  6075. }
  6076. $symfonyIo = new SymfonyStyle($input, $output);
  6077. $symfonyIo->table(
  6078. ['License', 'Number of dependencies'],
  6079. $rows
  6080. );
  6081. break;
  6082. default:
  6083. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  6084. }
  6085. return 0;
  6086. }
  6087. }
  6088. <?php declare(strict_types=1);
  6089. namespace Composer\Command;
  6090. use Symfony\Component\Console\Input\InputInterface;
  6091. use Composer\Console\Input\InputArgument;
  6092. use Symfony\Component\Console\Input\ArrayInput;
  6093. use Composer\Console\Input\InputOption;
  6094. use Symfony\Component\Console\Output\OutputInterface;
  6095. class OutdatedCommand extends BaseCommand
  6096. {
  6097. use CompletionTrait;
  6098. protected function configure(): void
  6099. {
  6100. $this
  6101. ->setName('outdated')
  6102. ->setDescription('Shows a list of installed packages that have updates available, including their latest version')
  6103. ->setDefinition([
  6104. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.', null, $this->suggestInstalledPackage(false)),
  6105. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  6106. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  6107. new InputOption('locked', null, InputOption::VALUE_NONE, 'Shows updates for packages from the lock file, regardless of what is currently in vendor dir'),
  6108. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  6109. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  6110. new InputOption('major-only', 'M', InputOption::VALUE_NONE, 'Show only packages that have major SemVer-compatible updates.'),
  6111. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates.'),
  6112. new InputOption('patch-only', 'p', InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates.'),
  6113. new InputOption('sort-by-age', 'A', InputOption::VALUE_NONE, 'Displays the installed version\'s age, and sorts packages oldest first.'),
  6114. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  6115. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Can contain wildcards (*). Use it if you don\'t want to be informed about new versions of some packages.', null, $this->suggestInstalledPackage(false)),
  6116. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  6117. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages). Use with the --outdated option'),
  6118. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
  6119. ])
  6120. ->setHelp(
  6121. <<<EOT
  6122. The outdated command is just a proxy for `composer show -l`
  6123. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  6124. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  6125. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  6126. compatibility breaks according to semver, so upgrade when you can but it
  6127. may involve work.
  6128. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  6129. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  6130. EOT
  6131. )
  6132. ;
  6133. }
  6134. protected function execute(InputInterface $input, OutputInterface $output): int
  6135. {
  6136. $args = [
  6137. 'command' => 'show',
  6138. '--latest' => true,
  6139. ];
  6140. if (!$input->getOption('all')) {
  6141. $args['--outdated'] = true;
  6142. }
  6143. if ($input->getOption('direct')) {
  6144. $args['--direct'] = true;
  6145. }
  6146. if (null !== $input->getArgument('package')) {
  6147. $args['package'] = $input->getArgument('package');
  6148. }
  6149. if ($input->getOption('strict')) {
  6150. $args['--strict'] = true;
  6151. }
  6152. if ($input->getOption('major-only')) {
  6153. $args['--major-only'] = true;
  6154. }
  6155. if ($input->getOption('minor-only')) {
  6156. $args['--minor-only'] = true;
  6157. }
  6158. if ($input->getOption('patch-only')) {
  6159. $args['--patch-only'] = true;
  6160. }
  6161. if ($input->getOption('locked')) {
  6162. $args['--locked'] = true;
  6163. }
  6164. if ($input->getOption('no-dev')) {
  6165. $args['--no-dev'] = true;
  6166. }
  6167. if ($input->getOption('sort-by-age')) {
  6168. $args['--sort-by-age'] = true;
  6169. }
  6170. $args['--ignore-platform-req'] = $input->getOption('ignore-platform-req');
  6171. if ($input->getOption('ignore-platform-reqs')) {
  6172. $args['--ignore-platform-reqs'] = true;
  6173. }
  6174. $args['--format'] = $input->getOption('format');
  6175. $args['--ignore'] = $input->getOption('ignore');
  6176. $input = new ArrayInput($args);
  6177. return $this->getApplication()->run($input, $output);
  6178. }
  6179. public function isProxyCommand(): bool
  6180. {
  6181. return true;
  6182. }
  6183. }
  6184. <?php declare(strict_types=1);
  6185. namespace Composer\Command;
  6186. use Composer\Factory;
  6187. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  6188. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  6189. use Composer\IO\IOInterface;
  6190. use Composer\Package\CompletePackageInterface;
  6191. use Composer\Package\PackageInterface;
  6192. use Composer\Package\Version\VersionParser;
  6193. use Composer\Package\Version\VersionSelector;
  6194. use Composer\Pcre\Preg;
  6195. use Composer\Repository\CompositeRepository;
  6196. use Composer\Repository\PlatformRepository;
  6197. use Composer\Repository\RepositoryFactory;
  6198. use Composer\Repository\RepositorySet;
  6199. use Composer\Semver\Constraint\Constraint;
  6200. use Composer\Util\Filesystem;
  6201. use Symfony\Component\Console\Input\InputInterface;
  6202. use Symfony\Component\Console\Output\OutputInterface;
  6203. trait PackageDiscoveryTrait
  6204. {
  6205. private $repos;
  6206. private $repositorySets;
  6207. protected function getRepos(): CompositeRepository
  6208. {
  6209. if (null === $this->repos) {
  6210. $this->repos = new CompositeRepository(array_merge(
  6211. [new PlatformRepository],
  6212. RepositoryFactory::defaultReposWithDefaultManager($this->getIO())
  6213. ));
  6214. }
  6215. return $this->repos;
  6216. }
  6217. private function getRepositorySet(InputInterface $input, ?string $minimumStability = null): RepositorySet
  6218. {
  6219. $key = $minimumStability ?? 'default';
  6220. if (!isset($this->repositorySets[$key])) {
  6221. $this->repositorySets[$key] = $repositorySet = new RepositorySet($minimumStability ?? $this->getMinimumStability($input));
  6222. $repositorySet->addRepository($this->getRepos());
  6223. }
  6224. return $this->repositorySets[$key];
  6225. }
  6226. private function getMinimumStability(InputInterface $input): string
  6227. {
  6228. if ($input->hasOption('stability')) {
  6229. return VersionParser::normalizeStability($input->getOption('stability') ?? 'stable');
  6230. }
  6231. $file = Factory::getComposerFile();
  6232. if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) {
  6233. if (isset($composer['minimum-stability'])) {
  6234. return VersionParser::normalizeStability($composer['minimum-stability']);
  6235. }
  6236. }
  6237. return 'stable';
  6238. }
  6239. final protected function determineRequirements(InputInterface $input, OutputInterface $output, array $requires = [], ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $useBestVersionConstraint = true, bool $fixed = false): array
  6240. {
  6241. if (count($requires) > 0) {
  6242. $requires = $this->normalizeRequirements($requires);
  6243. $result = [];
  6244. $io = $this->getIO();
  6245. foreach ($requires as $requirement) {
  6246. if (isset($requirement['version']) && Preg::isMatch('{^\d+(\.\d+)?$}', $requirement['version'])) {
  6247. $io->writeError('<warning>The "'.$requirement['version'].'" constraint for "'.$requirement['name'].'" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints');
  6248. }
  6249. if (!isset($requirement['version'])) {
  6250. [$name, $version] = $this->findBestVersionAndNameForPackage($this->getIO(), $input, $requirement['name'], $platformRepo, $preferredStability, $fixed);
  6251. $requirement['name'] = $name;
  6252. if ($useBestVersionConstraint) {
  6253. $requirement['version'] = $version;
  6254. $io->writeError(sprintf(
  6255. 'Using version <info>%s</info> for <info>%s</info>',
  6256. $requirement['version'],
  6257. $requirement['name']
  6258. ));
  6259. } else {
  6260. $requirement['version'] = 'guess';
  6261. }
  6262. }
  6263. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  6264. }
  6265. return $result;
  6266. }
  6267. $versionParser = new VersionParser();
  6268. $composer = $this->tryComposer();
  6269. $installedRepo = null;
  6270. if (null !== $composer) {
  6271. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6272. }
  6273. $existingPackages = [];
  6274. if (null !== $installedRepo) {
  6275. foreach ($installedRepo->getPackages() as $package) {
  6276. $existingPackages[] = $package->getName();
  6277. }
  6278. }
  6279. unset($composer, $installedRepo);
  6280. $io = $this->getIO();
  6281. while (null !== $package = $io->ask('Search for a package: ')) {
  6282. $matches = $this->getRepos()->search($package);
  6283. if (count($matches) > 0) {
  6284. foreach ($matches as $position => $foundPackage) {
  6285. if (in_array($foundPackage['name'], $existingPackages, true)) {
  6286. unset($matches[$position]);
  6287. }
  6288. }
  6289. $matches = array_values($matches);
  6290. $exactMatch = false;
  6291. foreach ($matches as $match) {
  6292. if ($match['name'] === $package) {
  6293. $exactMatch = true;
  6294. break;
  6295. }
  6296. }
  6297. if (!$exactMatch) {
  6298. $providers = $this->getRepos()->getProviders($package);
  6299. if (count($providers) > 0) {
  6300. array_unshift($matches, ['name' => $package, 'description' => '']);
  6301. }
  6302. $choices = [];
  6303. foreach ($matches as $position => $foundPackage) {
  6304. $abandoned = '';
  6305. if (isset($foundPackage['abandoned'])) {
  6306. if (is_string($foundPackage['abandoned'])) {
  6307. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  6308. } else {
  6309. $replacement = 'No replacement was suggested';
  6310. }
  6311. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  6312. }
  6313. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  6314. }
  6315. $io->writeError([
  6316. '',
  6317. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  6318. '',
  6319. ]);
  6320. $io->writeError($choices);
  6321. $io->writeError('');
  6322. $validator = static function (string $selection) use ($matches, $versionParser) {
  6323. if ('' === $selection) {
  6324. return false;
  6325. }
  6326. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  6327. $package = $matches[(int) $selection];
  6328. return $package['name'];
  6329. }
  6330. if (Preg::isMatch('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  6331. if (isset($packageMatches['version'])) {
  6332. $versionParser->parseConstraints($packageMatches['version']);
  6333. return $packageMatches['name'].' '.$packageMatches['version'];
  6334. }
  6335. return $packageMatches['name'];
  6336. }
  6337. throw new \Exception('Not a valid selection');
  6338. };
  6339. $package = $io->askAndValidate(
  6340. 'Enter package # to add, or the complete package name if it is not listed: ',
  6341. $validator,
  6342. 3,
  6343. ''
  6344. );
  6345. }
  6346. if (false !== $package && false === strpos($package, ' ')) {
  6347. $validator = static function (string $input) {
  6348. $input = trim($input);
  6349. return strlen($input) > 0 ? $input : false;
  6350. };
  6351. $constraint = $io->askAndValidate(
  6352. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  6353. $validator,
  6354. 3,
  6355. ''
  6356. );
  6357. if (false === $constraint) {
  6358. [, $constraint] = $this->findBestVersionAndNameForPackage($this->getIO(), $input, $package, $platformRepo, $preferredStability);
  6359. $io->writeError(sprintf(
  6360. 'Using version <info>%s</info> for <info>%s</info>',
  6361. $constraint,
  6362. $package
  6363. ));
  6364. }
  6365. $package .= ' '.$constraint;
  6366. }
  6367. if (false !== $package) {
  6368. $requires[] = $package;
  6369. $existingPackages[] = explode(' ', $package)[0];
  6370. }
  6371. }
  6372. }
  6373. return $requires;
  6374. }
  6375. private function findBestVersionAndNameForPackage(IOInterface $io, InputInterface $input, string $name, ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $fixed = false): array
  6376. {
  6377. if ($input->hasOption('ignore-platform-reqs') && $input->hasOption('ignore-platform-req')) {
  6378. $platformRequirementFilter = $this->getPlatformRequirementFilter($input);
  6379. } else {
  6380. $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  6381. }
  6382. $repoSet = $this->getRepositorySet($input);
  6383. $versionSelector = new VersionSelector($repoSet, $platformRepo);
  6384. $effectiveMinimumStability = $this->getMinimumStability($input);
  6385. $package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, 0, $this->getIO());
  6386. if (false === $package) {
  6387. if ($platformRequirementFilter->isIgnored($name)) {
  6388. return [$name, '*'];
  6389. }
  6390. $providers = $repoSet->getProviders($name);
  6391. if (count($providers) > 0) {
  6392. $constraint = '*';
  6393. if ($input->isInteractive()) {
  6394. $constraint = $this->getIO()->askAndValidate('Package "<info>'.$name.'</info>" does not exist but is provided by '.count($providers).' packages. Which version constraint would you like to use? [<info>*</info>] ', static function ($value) {
  6395. $parser = new VersionParser();
  6396. $parser->parseConstraints($value);
  6397. return $value;
  6398. }, 3, '*');
  6399. }
  6400. return [$name, $constraint];
  6401. }
  6402. if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll()))) {
  6403. throw new \InvalidArgumentException(sprintf(
  6404. 'Package %s has requirements incompatible with your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo),
  6405. $name
  6406. ));
  6407. }
  6408. if (false !== ($package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
  6409. if (false !== ($allReposPackage = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_SHADOWED_REPOSITORIES))) {
  6410. throw new \InvalidArgumentException(
  6411. 'Package '.$name.' exists in '.$allReposPackage->getRepository()->getRepoName().' and '.$package->getRepository()->getRepoName().' which has a higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'
  6412. );
  6413. }
  6414. throw new \InvalidArgumentException(sprintf(
  6415. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  6416. $name,
  6417. $effectiveMinimumStability
  6418. ));
  6419. }
  6420. if (!$platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll(), RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
  6421. $additional = '';
  6422. if (false === $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll())) {
  6423. $additional = PHP_EOL.PHP_EOL.'Additionally, the package was only found with a stability of "'.$candidate->getStability().'" while your minimum stability is "'.$effectiveMinimumStability.'".';
  6424. }
  6425. throw new \InvalidArgumentException(sprintf(
  6426. 'Could not find package %s in any version matching your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo) . '%s',
  6427. $name,
  6428. $additional
  6429. ));
  6430. }
  6431. $similar = $this->findSimilar($name);
  6432. if (count($similar) > 0) {
  6433. if (in_array($name, $similar, true)) {
  6434. throw new \InvalidArgumentException(sprintf(
  6435. "Could not find package %s. It was however found via repository search, which indicates a consistency issue with the repository.",
  6436. $name
  6437. ));
  6438. }
  6439. if ($input->isInteractive()) {
  6440. $result = $io->select("<error>Could not find package $name.</error>\nPick one of these or leave empty to abort:", $similar, false, 1);
  6441. if ($result !== false) {
  6442. return $this->findBestVersionAndNameForPackage($io, $input, $similar[$result], $platformRepo, $preferredStability, $fixed);
  6443. }
  6444. }
  6445. throw new \InvalidArgumentException(sprintf(
  6446. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  6447. $name,
  6448. implode("\n ", $similar)
  6449. ));
  6450. }
  6451. throw new \InvalidArgumentException(sprintf(
  6452. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  6453. $name,
  6454. $effectiveMinimumStability
  6455. ));
  6456. }
  6457. return [
  6458. $package->getPrettyName(),
  6459. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  6460. ];
  6461. }
  6462. private function findSimilar(string $package): array
  6463. {
  6464. try {
  6465. if (null === $this->repos) {
  6466. throw new \LogicException('findSimilar was called before $this->repos was initialized');
  6467. }
  6468. $results = $this->repos->search($package);
  6469. } catch (\Throwable $e) {
  6470. if ($e instanceof \LogicException) {
  6471. throw $e;
  6472. }
  6473. return [];
  6474. }
  6475. $similarPackages = [];
  6476. $installedRepo = $this->requireComposer()->getRepositoryManager()->getLocalRepository();
  6477. foreach ($results as $result) {
  6478. if (null !== $installedRepo->findPackage($result['name'], '*')) {
  6479. continue;
  6480. }
  6481. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  6482. }
  6483. asort($similarPackages);
  6484. return array_keys(array_slice($similarPackages, 0, 5));
  6485. }
  6486. private function getPlatformExceptionDetails(PackageInterface $candidate, ?PlatformRepository $platformRepo = null): string
  6487. {
  6488. $details = [];
  6489. if (null === $platformRepo) {
  6490. return '';
  6491. }
  6492. foreach ($candidate->getRequires() as $link) {
  6493. if (!PlatformRepository::isPlatformPackage($link->getTarget())) {
  6494. continue;
  6495. }
  6496. $platformPkg = $platformRepo->findPackage($link->getTarget(), '*');
  6497. if (null === $platformPkg) {
  6498. if ($platformRepo->isPlatformPackageDisabled($link->getTarget())) {
  6499. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is disabled by your platform config. Enable it again with "composer config platform.'.$link->getTarget().' --unset".';
  6500. } else {
  6501. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is not present.';
  6502. }
  6503. continue;
  6504. }
  6505. if (!$link->getConstraint()->matches(new Constraint('==', $platformPkg->getVersion()))) {
  6506. $platformPkgVersion = $platformPkg->getPrettyVersion();
  6507. $platformExtra = $platformPkg->getExtra();
  6508. if (isset($platformExtra['config.platform']) && $platformPkg instanceof CompletePackageInterface) {
  6509. $platformPkgVersion .= ' ('.$platformPkg->getDescription().')';
  6510. }
  6511. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' which does not match your installed version '.$platformPkgVersion.'.';
  6512. }
  6513. }
  6514. if (count($details) === 0) {
  6515. return '';
  6516. }
  6517. return ':'.PHP_EOL.' - ' . implode(PHP_EOL.' - ', $details);
  6518. }
  6519. }
  6520. <?php declare(strict_types=1);
  6521. namespace Composer\Command;
  6522. use Symfony\Component\Console\Input\InputInterface;
  6523. use Symfony\Component\Console\Output\OutputInterface;
  6524. use Composer\Console\Input\InputArgument;
  6525. use Composer\Console\Input\InputOption;
  6526. class ProhibitsCommand extends BaseDependencyCommand
  6527. {
  6528. use CompletionTrait;
  6529. protected function configure(): void
  6530. {
  6531. $this
  6532. ->setName('prohibits')
  6533. ->setAliases(['why-not'])
  6534. ->setDescription('Shows which packages prevent the given package from being installed')
  6535. ->setDefinition([
  6536. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect', null, $this->suggestAvailablePackage()),
  6537. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::REQUIRED, 'Version constraint, which version you expected to be installed'),
  6538. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  6539. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  6540. new InputOption('locked', null, InputOption::VALUE_NONE, 'Read dependency information from composer.lock'),
  6541. ])
  6542. ->setHelp(
  6543. <<<EOT
  6544. Displays detailed information about why a package cannot be installed.
  6545. <info>php composer.phar prohibits composer/composer</info>
  6546. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not
  6547. EOT
  6548. )
  6549. ;
  6550. }
  6551. protected function execute(InputInterface $input, OutputInterface $output): int
  6552. {
  6553. return parent::doExecute($input, $output, true);
  6554. }
  6555. }
  6556. <?php declare(strict_types=1);
  6557. namespace Composer\Command;
  6558. use Composer\DependencyResolver\Operation\InstallOperation;
  6559. use Composer\DependencyResolver\Operation\UninstallOperation;
  6560. use Composer\DependencyResolver\Transaction;
  6561. use Composer\Package\AliasPackage;
  6562. use Composer\Package\BasePackage;
  6563. use Composer\Pcre\Preg;
  6564. use Composer\Plugin\CommandEvent;
  6565. use Composer\Plugin\PluginEvents;
  6566. use Composer\Script\ScriptEvents;
  6567. use Composer\Util\Platform;
  6568. use Symfony\Component\Console\Input\InputInterface;
  6569. use Composer\Console\Input\InputOption;
  6570. use Composer\Console\Input\InputArgument;
  6571. use Symfony\Component\Console\Output\OutputInterface;
  6572. class ReinstallCommand extends BaseCommand
  6573. {
  6574. use CompletionTrait;
  6575. protected function configure(): void
  6576. {
  6577. $this
  6578. ->setName('reinstall')
  6579. ->setDescription('Uninstalls and reinstalls the given package names')
  6580. ->setDefinition([
  6581. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6582. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  6583. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  6584. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6585. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6586. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  6587. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6588. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6589. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  6590. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  6591. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  6592. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'List of package names to reinstall, can include a wildcard (*) to match any substring.', null, $this->suggestInstalledPackage(false)),
  6593. ])
  6594. ->setHelp(
  6595. <<<EOT
  6596. The <info>reinstall</info> command looks up installed packages by name,
  6597. uninstalls them and reinstalls them. This lets you do a clean install
  6598. of a package if you messed with its files, or if you wish to change
  6599. the installation type using --prefer-install.
  6600. <info>php composer.phar reinstall acme/foo "acme/bar-*"</info>
  6601. Read more at https://getcomposer.org/doc/03-cli.md#reinstall
  6602. EOT
  6603. )
  6604. ;
  6605. }
  6606. protected function execute(InputInterface $input, OutputInterface $output): int
  6607. {
  6608. $io = $this->getIO();
  6609. $composer = $this->requireComposer();
  6610. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6611. $packagesToReinstall = [];
  6612. $packageNamesToReinstall = [];
  6613. foreach ($input->getArgument('packages') as $pattern) {
  6614. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  6615. $matched = false;
  6616. foreach ($localRepo->getCanonicalPackages() as $package) {
  6617. if (Preg::isMatch($patternRegexp, $package->getName())) {
  6618. $matched = true;
  6619. $packagesToReinstall[] = $package;
  6620. $packageNamesToReinstall[] = $package->getName();
  6621. }
  6622. }
  6623. if (!$matched) {
  6624. $io->writeError('<warning>Pattern "' . $pattern . '" does not match any currently installed packages.</warning>');
  6625. }
  6626. }
  6627. if (!$packagesToReinstall) {
  6628. $io->writeError('<warning>Found no packages to reinstall, aborting.</warning>');
  6629. return 1;
  6630. }
  6631. $uninstallOperations = [];
  6632. foreach ($packagesToReinstall as $package) {
  6633. $uninstallOperations[] = new UninstallOperation($package);
  6634. }
  6635. $presentPackages = $localRepo->getPackages();
  6636. $resultPackages = $presentPackages;
  6637. foreach ($presentPackages as $index => $package) {
  6638. if (in_array($package->getName(), $packageNamesToReinstall, true)) {
  6639. unset($presentPackages[$index]);
  6640. }
  6641. }
  6642. $transaction = new Transaction($presentPackages, $resultPackages);
  6643. $installOperations = $transaction->getOperations();
  6644. $installOrder = [];
  6645. foreach ($installOperations as $index => $op) {
  6646. if ($op instanceof InstallOperation && !$op->getPackage() instanceof AliasPackage) {
  6647. $installOrder[$op->getPackage()->getName()] = $index;
  6648. }
  6649. }
  6650. usort($uninstallOperations, static function ($a, $b) use ($installOrder): int {
  6651. return $installOrder[$b->getPackage()->getName()] - $installOrder[$a->getPackage()->getName()];
  6652. });
  6653. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'reinstall', $input, $output);
  6654. $eventDispatcher = $composer->getEventDispatcher();
  6655. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  6656. $config = $composer->getConfig();
  6657. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  6658. $installationManager = $composer->getInstallationManager();
  6659. $downloadManager = $composer->getDownloadManager();
  6660. $package = $composer->getPackage();
  6661. $installationManager->setOutputProgress(!$input->getOption('no-progress'));
  6662. if ($input->getOption('no-plugins')) {
  6663. $installationManager->disablePlugins();
  6664. }
  6665. $downloadManager->setPreferSource($preferSource);
  6666. $downloadManager->setPreferDist($preferDist);
  6667. $devMode = $localRepo->getDevMode() !== null ? $localRepo->getDevMode() : true;
  6668. Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
  6669. $eventDispatcher->dispatchScript(ScriptEvents::PRE_INSTALL_CMD, $devMode);
  6670. $installationManager->execute($localRepo, $uninstallOperations, $devMode);
  6671. $installationManager->execute($localRepo, $installOperations, $devMode);
  6672. if (!$input->getOption('no-autoloader')) {
  6673. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6674. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6675. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  6676. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6677. $generator = $composer->getAutoloadGenerator();
  6678. $generator->setClassMapAuthoritative($authoritative);
  6679. $generator->setApcu($apcu, $apcuPrefix);
  6680. $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
  6681. $generator->dump(
  6682. $config,
  6683. $localRepo,
  6684. $package,
  6685. $installationManager,
  6686. 'composer',
  6687. $optimize,
  6688. null,
  6689. $composer->getLocker()
  6690. );
  6691. }
  6692. $eventDispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, $devMode);
  6693. return 0;
  6694. }
  6695. }
  6696. <?php declare(strict_types=1);
  6697. namespace Composer\Command;
  6698. use Composer\Config\JsonConfigSource;
  6699. use Composer\DependencyResolver\Request;
  6700. use Composer\Installer;
  6701. use Composer\Pcre\Preg;
  6702. use Composer\Plugin\CommandEvent;
  6703. use Composer\Plugin\PluginEvents;
  6704. use Composer\Json\JsonFile;
  6705. use Composer\Factory;
  6706. use Symfony\Component\Console\Exception\InvalidArgumentException;
  6707. use Symfony\Component\Console\Input\InputInterface;
  6708. use Composer\Console\Input\InputOption;
  6709. use Composer\Console\Input\InputArgument;
  6710. use Symfony\Component\Console\Output\OutputInterface;
  6711. use Composer\Package\BasePackage;
  6712. use Composer\Advisory\Auditor;
  6713. class RemoveCommand extends BaseCommand
  6714. {
  6715. use CompletionTrait;
  6716. protected function configure()
  6717. {
  6718. $this
  6719. ->setName('remove')
  6720. ->setAliases(['rm'])
  6721. ->setDescription('Removes a package from the require or require-dev')
  6722. ->setDefinition([
  6723. new InputArgument('packages', InputArgument::IS_ARRAY, 'Packages that should be removed.', null, $this->suggestRootRequirement()),
  6724. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  6725. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6726. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6727. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
  6728. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  6729. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  6730. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  6731. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  6732. new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecated, is now default behavior)'),
  6733. new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  6734. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
  6735. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  6736. new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During an update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'),
  6737. new InputOption('unused', null, InputOption::VALUE_NONE, 'Remove all packages which are locked but not required by any other package.'),
  6738. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  6739. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  6740. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  6741. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6742. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6743. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  6744. ])
  6745. ->setHelp(
  6746. <<<EOT
  6747. The <info>remove</info> command removes a package from the current
  6748. list of installed packages
  6749. <info>php composer.phar remove</info>
  6750. Read more at https://getcomposer.org/doc/03-cli.md#remove-rm
  6751. EOT
  6752. )
  6753. ;
  6754. }
  6755. protected function execute(InputInterface $input, OutputInterface $output): int
  6756. {
  6757. if ($input->getArgument('packages') === [] && !$input->getOption('unused')) {
  6758. throw new InvalidArgumentException('Not enough arguments (missing: "packages").');
  6759. }
  6760. $packages = $input->getArgument('packages');
  6761. $packages = array_map('strtolower', $packages);
  6762. if ($input->getOption('unused')) {
  6763. $composer = $this->requireComposer();
  6764. $locker = $composer->getLocker();
  6765. if (!$locker->isLocked()) {
  6766. throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --unused');
  6767. }
  6768. $lockedPackages = $locker->getLockedRepository()->getPackages();
  6769. $required = [];
  6770. foreach (array_merge($composer->getPackage()->getRequires(), $composer->getPackage()->getDevRequires()) as $link) {
  6771. $required[$link->getTarget()] = true;
  6772. }
  6773. do {
  6774. $found = false;
  6775. foreach ($lockedPackages as $index => $package) {
  6776. foreach ($package->getNames() as $name) {
  6777. if (isset($required[$name])) {
  6778. foreach ($package->getRequires() as $link) {
  6779. $required[$link->getTarget()] = true;
  6780. }
  6781. $found = true;
  6782. unset($lockedPackages[$index]);
  6783. break;
  6784. }
  6785. }
  6786. }
  6787. } while ($found);
  6788. $unused = [];
  6789. foreach ($lockedPackages as $package) {
  6790. $unused[] = $package->getName();
  6791. }
  6792. $packages = array_merge($packages, $unused);
  6793. if (count($packages) === 0) {
  6794. $this->getIO()->writeError('<info>No unused packages to remove</info>');
  6795. return 0;
  6796. }
  6797. }
  6798. $file = Factory::getComposerFile();
  6799. $jsonFile = new JsonFile($file);
  6800. $composer = $jsonFile->read();
  6801. $composerBackup = file_get_contents($jsonFile->getPath());
  6802. $json = new JsonConfigSource($jsonFile);
  6803. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  6804. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  6805. $io = $this->getIO();
  6806. if ($input->getOption('update-with-dependencies')) {
  6807. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  6808. }
  6809. foreach (['require', 'require-dev'] as $linkType) {
  6810. if (isset($composer[$linkType])) {
  6811. foreach ($composer[$linkType] as $name => $version) {
  6812. $composer[$linkType][strtolower($name)] = $name;
  6813. }
  6814. }
  6815. }
  6816. $dryRun = $input->getOption('dry-run');
  6817. $toRemove = [];
  6818. foreach ($packages as $package) {
  6819. if (isset($composer[$type][$package])) {
  6820. if ($dryRun) {
  6821. $toRemove[$type][] = $composer[$type][$package];
  6822. } else {
  6823. $json->removeLink($type, $composer[$type][$package]);
  6824. }
  6825. } elseif (isset($composer[$altType][$package])) {
  6826. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  6827. if ($io->isInteractive()) {
  6828. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
  6829. if ($dryRun) {
  6830. $toRemove[$altType][] = $composer[$altType][$package];
  6831. } else {
  6832. $json->removeLink($altType, $composer[$altType][$package]);
  6833. }
  6834. }
  6835. }
  6836. } elseif (isset($composer[$type]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) > 0) {
  6837. foreach ($matches as $matchedPackage) {
  6838. if ($dryRun) {
  6839. $toRemove[$type][] = $matchedPackage;
  6840. } else {
  6841. $json->removeLink($type, $matchedPackage);
  6842. }
  6843. }
  6844. } elseif (isset($composer[$altType]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) > 0) {
  6845. foreach ($matches as $matchedPackage) {
  6846. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  6847. if ($io->isInteractive()) {
  6848. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
  6849. if ($dryRun) {
  6850. $toRemove[$altType][] = $matchedPackage;
  6851. } else {
  6852. $json->removeLink($altType, $matchedPackage);
  6853. }
  6854. }
  6855. }
  6856. }
  6857. } else {
  6858. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  6859. }
  6860. }
  6861. $io->writeError('<info>'.$file.' has been updated</info>');
  6862. if ($input->getOption('no-update')) {
  6863. return 0;
  6864. }
  6865. if ($composer = $this->tryComposer()) {
  6866. $composer->getPluginManager()->deactivateInstalledPlugins();
  6867. }
  6868. $this->resetComposer();
  6869. $composer = $this->requireComposer();
  6870. if ($dryRun) {
  6871. $rootPackage = $composer->getPackage();
  6872. $links = [
  6873. 'require' => $rootPackage->getRequires(),
  6874. 'require-dev' => $rootPackage->getDevRequires(),
  6875. ];
  6876. foreach ($toRemove as $type => $names) {
  6877. foreach ($names as $name) {
  6878. unset($links[$type][$name]);
  6879. }
  6880. }
  6881. $rootPackage->setRequires($links['require']);
  6882. $rootPackage->setDevRequires($links['require-dev']);
  6883. }
  6884. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  6885. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6886. $allowPlugins = $composer->getConfig()->get('allow-plugins');
  6887. $removedPlugins = is_array($allowPlugins) ? array_intersect(array_keys($allowPlugins), $packages) : [];
  6888. if (!$dryRun && is_array($allowPlugins) && count($removedPlugins) > 0) {
  6889. if (count($allowPlugins) === count($removedPlugins)) {
  6890. $json->removeConfigSetting('allow-plugins');
  6891. } else {
  6892. foreach ($removedPlugins as $plugin) {
  6893. $json->removeConfigSetting('allow-plugins.'.$plugin);
  6894. }
  6895. }
  6896. }
  6897. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  6898. $install = Installer::create($io, $composer);
  6899. $updateDevMode = !$input->getOption('update-no-dev');
  6900. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  6901. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  6902. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  6903. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  6904. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  6905. $flags = '';
  6906. if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
  6907. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  6908. $flags .= ' --with-all-dependencies';
  6909. } elseif ($input->getOption('no-update-with-dependencies')) {
  6910. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  6911. $flags .= ' --with-dependencies';
  6912. }
  6913. $io->writeError('<info>Running composer update '.implode(' ', $packages).$flags.'</info>');
  6914. $install
  6915. ->setVerbose($input->getOption('verbose'))
  6916. ->setDevMode($updateDevMode)
  6917. ->setOptimizeAutoloader($optimize)
  6918. ->setClassMapAuthoritative($authoritative)
  6919. ->setApcuAutoloader($apcu, $apcuPrefix)
  6920. ->setUpdate(true)
  6921. ->setInstall(!$input->getOption('no-install'))
  6922. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  6923. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  6924. ->setDryRun($dryRun)
  6925. ->setAudit(!$input->getOption('no-audit'))
  6926. ->setAuditFormat($this->getAuditFormat($input))
  6927. ->setMinimalUpdate($input->getOption('minimal-changes'))
  6928. ;
  6929. if ($composer->getLocker()->isLocked()) {
  6930. $install->setUpdateAllowList($packages);
  6931. }
  6932. $status = $install->run();
  6933. if ($status !== 0) {
  6934. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  6935. file_put_contents($jsonFile->getPath(), $composerBackup);
  6936. }
  6937. if (!$dryRun) {
  6938. foreach ($packages as $package) {
  6939. if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
  6940. $io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
  6941. return 2;
  6942. }
  6943. }
  6944. }
  6945. return $status;
  6946. }
  6947. }
  6948. <?php declare(strict_types=1);
  6949. namespace Composer\Command;
  6950. use Composer\DependencyResolver\Request;
  6951. use Composer\Package\AliasPackage;
  6952. use Composer\Package\CompletePackageInterface;
  6953. use Composer\Package\Loader\RootPackageLoader;
  6954. use Composer\Package\Locker;
  6955. use Composer\Package\PackageInterface;
  6956. use Composer\Package\Version\VersionBumper;
  6957. use Composer\Package\Version\VersionSelector;
  6958. use Composer\Pcre\Preg;
  6959. use Composer\Repository\RepositorySet;
  6960. use Composer\Util\Filesystem;
  6961. use Composer\Util\PackageSorter;
  6962. use Seld\Signal\SignalHandler;
  6963. use Symfony\Component\Console\Input\InputInterface;
  6964. use Composer\Console\Input\InputArgument;
  6965. use Composer\Console\Input\InputOption;
  6966. use Symfony\Component\Console\Output\OutputInterface;
  6967. use Composer\Factory;
  6968. use Composer\Installer;
  6969. use Composer\Installer\InstallerEvents;
  6970. use Composer\Json\JsonFile;
  6971. use Composer\Json\JsonManipulator;
  6972. use Composer\Package\Version\VersionParser;
  6973. use Composer\Package\Loader\ArrayLoader;
  6974. use Composer\Package\BasePackage;
  6975. use Composer\Plugin\CommandEvent;
  6976. use Composer\Plugin\PluginEvents;
  6977. use Composer\Repository\CompositeRepository;
  6978. use Composer\Repository\PlatformRepository;
  6979. use Composer\IO\IOInterface;
  6980. use Composer\Advisory\Auditor;
  6981. use Composer\Util\Silencer;
  6982. class RequireCommand extends BaseCommand
  6983. {
  6984. use CompletionTrait;
  6985. use PackageDiscoveryTrait;
  6986. private $newlyCreated;
  6987. private $firstRequire;
  6988. private $json;
  6989. private $file;
  6990. private $composerBackup;
  6991. private $lock;
  6992. private $lockBackup;
  6993. private $dependencyResolutionCompleted = false;
  6994. protected function configure()
  6995. {
  6996. $this
  6997. ->setName('require')
  6998. ->setAliases(['r'])
  6999. ->setDescription('Adds required packages to your composer.json and installs them')
  7000. ->setDefinition([
  7001. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"', null, $this->suggestAvailablePackageInclPlatform()),
  7002. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  7003. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  7004. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  7005. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  7006. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  7007. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  7008. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  7009. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  7010. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
  7011. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  7012. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  7013. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  7014. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  7015. new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  7016. new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  7017. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-dependencies'),
  7018. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
  7019. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  7020. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  7021. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies (can also be set via the COMPOSER_PREFER_STABLE=1 env var).'),
  7022. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies (can also be set via the COMPOSER_PREFER_LOWEST=1 env var).'),
  7023. new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During an update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'),
  7024. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  7025. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  7026. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  7027. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  7028. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  7029. ])
  7030. ->setHelp(
  7031. <<<EOT
  7032. The require command adds required packages to your composer.json and installs them.
  7033. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  7034. matches to require.
  7035. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  7036. If you do not want to install the new dependencies immediately you can call it with --no-update
  7037. Read more at https://getcomposer.org/doc/03-cli.md#require-r
  7038. EOT
  7039. )
  7040. ;
  7041. }
  7042. protected function execute(InputInterface $input, OutputInterface $output): int
  7043. {
  7044. $this->file = Factory::getComposerFile();
  7045. $io = $this->getIO();
  7046. if ($input->getOption('no-suggest')) {
  7047. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  7048. }
  7049. $this->newlyCreated = !file_exists($this->file);
  7050. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  7051. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  7052. return 1;
  7053. }
  7054. if (!Filesystem::isReadable($this->file)) {
  7055. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  7056. return 1;
  7057. }
  7058. if (filesize($this->file) === 0) {
  7059. file_put_contents($this->file, "{\n}\n");
  7060. }
  7061. $this->json = new JsonFile($this->file);
  7062. $this->lock = Factory::getLockFile($this->file);
  7063. $this->composerBackup = file_get_contents($this->json->getPath());
  7064. $this->lockBackup = file_exists($this->lock) ? file_get_contents($this->lock) : null;
  7065. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) {
  7066. $this->getIO()->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  7067. $this->revertComposerFile();
  7068. $handler->exitWithLastSignal();
  7069. });
  7070. if (!is_writable($this->file) && false === Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  7071. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  7072. return 1;
  7073. }
  7074. if ($input->getOption('fixed') === true) {
  7075. $config = $this->json->read();
  7076. $packageType = empty($config['type']) ? 'library' : $config['type'];
  7077. if ($packageType !== 'project' && !$input->getOption('dev')) {
  7078. $io->writeError('<error>The "--fixed" option is only allowed for packages with a "project" type or for dev dependencies to prevent possible misuses.</error>');
  7079. if (!isset($config['type'])) {
  7080. $io->writeError('<error>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</error>');
  7081. }
  7082. return 1;
  7083. }
  7084. }
  7085. $composer = $this->requireComposer();
  7086. $repos = $composer->getRepositoryManager()->getRepositories();
  7087. $platformOverrides = $composer->getConfig()->get('platform');
  7088. $this->repos = new CompositeRepository(array_merge(
  7089. [$platformRepo = new PlatformRepository([], $platformOverrides)],
  7090. $repos
  7091. ));
  7092. if ($composer->getPackage()->getPreferStable()) {
  7093. $preferredStability = 'stable';
  7094. } else {
  7095. $preferredStability = $composer->getPackage()->getMinimumStability();
  7096. }
  7097. try {
  7098. $requirements = $this->determineRequirements(
  7099. $input,
  7100. $output,
  7101. $input->getArgument('packages'),
  7102. $platformRepo,
  7103. $preferredStability,
  7104. $input->getOption('no-update'),
  7105. $input->getOption('fixed')
  7106. );
  7107. } catch (\Exception $e) {
  7108. if ($this->newlyCreated) {
  7109. $this->revertComposerFile();
  7110. throw new \RuntimeException('No composer.json present in the current directory ('.$this->file.'), this may be the cause of the following exception.', 0, $e);
  7111. }
  7112. throw $e;
  7113. }
  7114. $requirements = $this->formatRequirements($requirements);
  7115. if (!$input->getOption('dev') && $io->isInteractive()) {
  7116. $devPackages = [];
  7117. $devTags = ['dev', 'testing', 'static analysis'];
  7118. $currentRequiresByKey = $this->getPackagesByRequireKey();
  7119. foreach ($requirements as $name => $version) {
  7120. if (isset($currentRequiresByKey[$name])) {
  7121. continue;
  7122. }
  7123. $pkg = PackageSorter::getMostCurrentVersion($this->getRepos()->findPackages($name));
  7124. if ($pkg instanceof CompletePackageInterface) {
  7125. $pkgDevTags = array_intersect($devTags, array_map('strtolower', $pkg->getKeywords()));
  7126. if (count($pkgDevTags) > 0) {
  7127. $devPackages[] = $pkgDevTags;
  7128. }
  7129. }
  7130. }
  7131. if (count($devPackages) === count($requirements)) {
  7132. $plural = count($requirements) > 1 ? 's' : '';
  7133. $plural2 = count($requirements) > 1 ? 'are' : 'is';
  7134. $plural3 = count($requirements) > 1 ? 'they are' : 'it is';
  7135. $pkgDevTags = array_unique(array_merge(...$devPackages));
  7136. $io->warning('The package'.$plural.' you required '.$plural2.' recommended to be placed in require-dev (because '.$plural3.' tagged as "'.implode('", "', $pkgDevTags).'") but you did not use --dev.');
  7137. if ($io->askConfirmation('<info>Do you want to re-run the command with --dev?</> [<comment>yes</>]? ')) {
  7138. $input->setOption('dev', true);
  7139. }
  7140. }
  7141. unset($devPackages, $pkgDevTags);
  7142. }
  7143. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  7144. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  7145. $requirementsToGuess = [];
  7146. foreach ($requirements as $package => $constraint) {
  7147. if ($constraint === 'guess') {
  7148. $requirements[$package] = '*';
  7149. $requirementsToGuess[] = $package;
  7150. }
  7151. }
  7152. $versionParser = new VersionParser();
  7153. foreach ($requirements as $package => $constraint) {
  7154. if (strtolower($package) === $composer->getPackage()->getName()) {
  7155. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  7156. return 1;
  7157. }
  7158. if ($constraint === 'self.version') {
  7159. continue;
  7160. }
  7161. $versionParser->parseConstraints($constraint);
  7162. }
  7163. $inconsistentRequireKeys = $this->getInconsistentRequireKeys($requirements, $requireKey);
  7164. if (count($inconsistentRequireKeys) > 0) {
  7165. foreach ($inconsistentRequireKeys as $package) {
  7166. $io->warning(sprintf(
  7167. '%s is currently present in the %s key and you ran the command %s the --dev flag, which will move it to the %s key.',
  7168. $package,
  7169. $removeKey,
  7170. $input->getOption('dev') ? 'with' : 'without',
  7171. $requireKey
  7172. ));
  7173. }
  7174. if ($io->isInteractive()) {
  7175. if (!$io->askConfirmation(sprintf('<info>Do you want to move %s?</info> [<comment>no</comment>]? ', count($inconsistentRequireKeys) > 1 ? 'these requirements' : 'this requirement'), false)) {
  7176. if (!$io->askConfirmation(sprintf('<info>Do you want to re-run the command %s --dev?</info> [<comment>yes</comment>]? ', $input->getOption('dev') ? 'without' : 'with'), true)) {
  7177. return 0;
  7178. }
  7179. $input->setOption('dev', true);
  7180. [$requireKey, $removeKey] = [$removeKey, $requireKey];
  7181. }
  7182. }
  7183. }
  7184. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  7185. $this->firstRequire = $this->newlyCreated;
  7186. if (!$this->firstRequire) {
  7187. $composerDefinition = $this->json->read();
  7188. if (count($composerDefinition['require'] ?? []) === 0 && count($composerDefinition['require-dev'] ?? []) === 0) {
  7189. $this->firstRequire = true;
  7190. }
  7191. }
  7192. if (!$input->getOption('dry-run')) {
  7193. $this->updateFile($this->json, $requirements, $requireKey, $removeKey, $sortPackages);
  7194. }
  7195. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  7196. if ($input->getOption('no-update')) {
  7197. return 0;
  7198. }
  7199. $composer->getPluginManager()->deactivateInstalledPlugins();
  7200. try {
  7201. $result = $this->doUpdate($input, $output, $io, $requirements, $requireKey, $removeKey);
  7202. if ($result === 0 && count($requirementsToGuess) > 0) {
  7203. $result = $this->updateRequirementsAfterResolution($requirementsToGuess, $requireKey, $removeKey, $sortPackages, $input->getOption('dry-run'), $input->getOption('fixed'));
  7204. }
  7205. return $result;
  7206. } catch (\Exception $e) {
  7207. if (!$this->dependencyResolutionCompleted) {
  7208. $this->revertComposerFile();
  7209. }
  7210. throw $e;
  7211. } finally {
  7212. if ($input->getOption('dry-run') && $this->newlyCreated) {
  7213. @unlink($this->json->getPath());
  7214. }
  7215. $signalHandler->unregister();
  7216. }
  7217. }
  7218. private function getInconsistentRequireKeys(array $newRequirements, string $requireKey): array
  7219. {
  7220. $requireKeys = $this->getPackagesByRequireKey();
  7221. $inconsistentRequirements = [];
  7222. foreach ($requireKeys as $package => $packageRequireKey) {
  7223. if (!isset($newRequirements[$package])) {
  7224. continue;
  7225. }
  7226. if ($requireKey !== $packageRequireKey) {
  7227. $inconsistentRequirements[] = $package;
  7228. }
  7229. }
  7230. return $inconsistentRequirements;
  7231. }
  7232. private function getPackagesByRequireKey(): array
  7233. {
  7234. $composerDefinition = $this->json->read();
  7235. $require = [];
  7236. $requireDev = [];
  7237. if (isset($composerDefinition['require'])) {
  7238. $require = $composerDefinition['require'];
  7239. }
  7240. if (isset($composerDefinition['require-dev'])) {
  7241. $requireDev = $composerDefinition['require-dev'];
  7242. }
  7243. return array_merge(
  7244. array_fill_keys(array_keys($require), 'require'),
  7245. array_fill_keys(array_keys($requireDev), 'require-dev')
  7246. );
  7247. }
  7248. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, string $requireKey, string $removeKey): int
  7249. {
  7250. $this->resetComposer();
  7251. $composer = $this->requireComposer();
  7252. $this->dependencyResolutionCompleted = false;
  7253. $composer->getEventDispatcher()->addListener(InstallerEvents::PRE_OPERATIONS_EXEC, function (): void {
  7254. $this->dependencyResolutionCompleted = true;
  7255. }, 10000);
  7256. if ($input->getOption('dry-run')) {
  7257. $rootPackage = $composer->getPackage();
  7258. $links = [
  7259. 'require' => $rootPackage->getRequires(),
  7260. 'require-dev' => $rootPackage->getDevRequires(),
  7261. ];
  7262. $loader = new ArrayLoader();
  7263. $newLinks = $loader->parseLinks($rootPackage->getName(), $rootPackage->getPrettyVersion(), BasePackage::$supportedLinkTypes[$requireKey]['method'], $requirements);
  7264. $links[$requireKey] = array_merge($links[$requireKey], $newLinks);
  7265. foreach ($requirements as $package => $constraint) {
  7266. unset($links[$removeKey][$package]);
  7267. }
  7268. $rootPackage->setRequires($links['require']);
  7269. $rootPackage->setDevRequires($links['require-dev']);
  7270. $references = $rootPackage->getReferences();
  7271. $references = RootPackageLoader::extractReferences($requirements, $references);
  7272. $rootPackage->setReferences($references);
  7273. $stabilityFlags = $rootPackage->getStabilityFlags();
  7274. $stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $rootPackage->getMinimumStability(), $stabilityFlags);
  7275. $rootPackage->setStabilityFlags($stabilityFlags);
  7276. unset($stabilityFlags, $references);
  7277. }
  7278. $updateDevMode = !$input->getOption('update-no-dev');
  7279. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  7280. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  7281. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  7282. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  7283. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  7284. $flags = '';
  7285. if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
  7286. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  7287. $flags .= ' --with-all-dependencies';
  7288. } elseif ($input->getOption('update-with-dependencies') || $input->getOption('with-dependencies')) {
  7289. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  7290. $flags .= ' --with-dependencies';
  7291. }
  7292. $io->writeError('<info>Running composer update '.implode(' ', array_keys($requirements)).$flags.'</info>');
  7293. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  7294. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7295. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  7296. $install = Installer::create($io, $composer);
  7297. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($composer->getConfig(), $input);
  7298. $install
  7299. ->setDryRun($input->getOption('dry-run'))
  7300. ->setVerbose($input->getOption('verbose'))
  7301. ->setPreferSource($preferSource)
  7302. ->setPreferDist($preferDist)
  7303. ->setDevMode($updateDevMode)
  7304. ->setOptimizeAutoloader($optimize)
  7305. ->setClassMapAuthoritative($authoritative)
  7306. ->setApcuAutoloader($apcu, $apcuPrefix)
  7307. ->setUpdate(true)
  7308. ->setInstall(!$input->getOption('no-install'))
  7309. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  7310. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  7311. ->setPreferStable($input->getOption('prefer-stable'))
  7312. ->setPreferLowest($input->getOption('prefer-lowest'))
  7313. ->setAudit(!$input->getOption('no-audit'))
  7314. ->setAuditFormat($this->getAuditFormat($input))
  7315. ->setMinimalUpdate($input->getOption('minimal-changes'))
  7316. ;
  7317. if (!$this->firstRequire && $composer->getLocker()->isLocked()) {
  7318. $install->setUpdateAllowList(array_keys($requirements));
  7319. }
  7320. $status = $install->run();
  7321. if ($status !== 0 && $status !== Installer::ERROR_AUDIT_FAILED) {
  7322. if ($status === Installer::ERROR_DEPENDENCY_RESOLUTION_FAILED) {
  7323. foreach ($this->normalizeRequirements($input->getArgument('packages')) as $req) {
  7324. if (!isset($req['version'])) {
  7325. $io->writeError('You can also try re-running composer require with an explicit version constraint, e.g. "composer require '.$req['name'].':*" to figure out if any version is installable, or "composer require '.$req['name'].':^2.1" if you know which you need.');
  7326. break;
  7327. }
  7328. }
  7329. }
  7330. $this->revertComposerFile();
  7331. }
  7332. return $status;
  7333. }
  7334. private function updateRequirementsAfterResolution(array $requirementsToUpdate, string $requireKey, string $removeKey, bool $sortPackages, bool $dryRun, bool $fixed): int
  7335. {
  7336. $composer = $this->requireComposer();
  7337. $locker = $composer->getLocker();
  7338. $requirements = [];
  7339. $versionSelector = new VersionSelector(new RepositorySet());
  7340. $repo = $locker->isLocked() ? $composer->getLocker()->getLockedRepository(true) : $composer->getRepositoryManager()->getLocalRepository();
  7341. foreach ($requirementsToUpdate as $packageName) {
  7342. $package = $repo->findPackage($packageName, '*');
  7343. while ($package instanceof AliasPackage) {
  7344. $package = $package->getAliasOf();
  7345. }
  7346. if (!$package instanceof PackageInterface) {
  7347. continue;
  7348. }
  7349. if ($fixed) {
  7350. $requirements[$packageName] = $package->getPrettyVersion();
  7351. } else {
  7352. $requirements[$packageName] = $versionSelector->findRecommendedRequireVersion($package);
  7353. }
  7354. $this->getIO()->writeError(sprintf(
  7355. 'Using version <info>%s</info> for <info>%s</info>',
  7356. $requirements[$packageName],
  7357. $packageName
  7358. ));
  7359. if (Preg::isMatch('{^dev-(?!main$|master$|trunk$|latest$)}', $requirements[$packageName])) {
  7360. $this->getIO()->warning('Version '.$requirements[$packageName].' looks like it may be a feature branch which is unlikely to keep working in the long run and may be in an unstable state');
  7361. if ($this->getIO()->isInteractive() && !$this->getIO()->askConfirmation('Are you sure you want to use this constraint (<comment>Y</comment>) or would you rather abort (<comment>n</comment>) the whole operation [<comment>Y,n</comment>]? ')) {
  7362. $this->revertComposerFile();
  7363. return 1;
  7364. }
  7365. }
  7366. }
  7367. if (!$dryRun) {
  7368. $this->updateFile($this->json, $requirements, $requireKey, $removeKey, $sortPackages);
  7369. if ($locker->isLocked()) {
  7370. $contents = file_get_contents($this->json->getPath());
  7371. if (false === $contents) {
  7372. throw new \RuntimeException('Unable to read '.$this->json->getPath().' contents to update the lock file hash.');
  7373. }
  7374. $lockFile = Factory::getLockFile($this->json->getPath());
  7375. if (file_exists($lockFile)) {
  7376. $lockMtime = filemtime($lockFile);
  7377. $lock = new JsonFile($lockFile);
  7378. $lockData = $lock->read();
  7379. $lockData['content-hash'] = Locker::getContentHash($contents);
  7380. $lock->write($lockData);
  7381. if (is_int($lockMtime)) {
  7382. @touch($lockFile, $lockMtime);
  7383. }
  7384. }
  7385. }
  7386. }
  7387. return 0;
  7388. }
  7389. private function updateFile(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): void
  7390. {
  7391. if ($this->updateFileCleanly($json, $new, $requireKey, $removeKey, $sortPackages)) {
  7392. return;
  7393. }
  7394. $composerDefinition = $this->json->read();
  7395. foreach ($new as $package => $version) {
  7396. $composerDefinition[$requireKey][$package] = $version;
  7397. unset($composerDefinition[$removeKey][$package]);
  7398. if (isset($composerDefinition[$removeKey]) && count($composerDefinition[$removeKey]) === 0) {
  7399. unset($composerDefinition[$removeKey]);
  7400. }
  7401. }
  7402. $this->json->write($composerDefinition);
  7403. }
  7404. private function updateFileCleanly(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): bool
  7405. {
  7406. $contents = file_get_contents($json->getPath());
  7407. $manipulator = new JsonManipulator($contents);
  7408. foreach ($new as $package => $constraint) {
  7409. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  7410. return false;
  7411. }
  7412. if (!$manipulator->removeSubNode($removeKey, $package)) {
  7413. return false;
  7414. }
  7415. }
  7416. $manipulator->removeMainKeyIfEmpty($removeKey);
  7417. file_put_contents($json->getPath(), $manipulator->getContents());
  7418. return true;
  7419. }
  7420. protected function interact(InputInterface $input, OutputInterface $output): void
  7421. {
  7422. }
  7423. private function revertComposerFile(): void
  7424. {
  7425. $io = $this->getIO();
  7426. if ($this->newlyCreated) {
  7427. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  7428. unlink($this->json->getPath());
  7429. if (file_exists($this->lock)) {
  7430. unlink($this->lock);
  7431. }
  7432. } else {
  7433. $msg = ' to its ';
  7434. if ($this->lockBackup) {
  7435. $msg = ' and '.$this->lock.' to their ';
  7436. }
  7437. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.$msg.'original content.</error>');
  7438. file_put_contents($this->json->getPath(), $this->composerBackup);
  7439. if ($this->lockBackup) {
  7440. file_put_contents($this->lock, $this->lockBackup);
  7441. }
  7442. }
  7443. }
  7444. }
  7445. <?php declare(strict_types=1);
  7446. namespace Composer\Command;
  7447. use Composer\Script\Event as ScriptEvent;
  7448. use Composer\Script\ScriptEvents;
  7449. use Composer\Util\ProcessExecutor;
  7450. use Composer\Util\Platform;
  7451. use Symfony\Component\Console\Input\InputInterface;
  7452. use Composer\Console\Input\InputOption;
  7453. use Composer\Console\Input\InputArgument;
  7454. use Symfony\Component\Console\Output\OutputInterface;
  7455. class RunScriptCommand extends BaseCommand
  7456. {
  7457. protected $scriptEvents = [
  7458. ScriptEvents::PRE_INSTALL_CMD,
  7459. ScriptEvents::POST_INSTALL_CMD,
  7460. ScriptEvents::PRE_UPDATE_CMD,
  7461. ScriptEvents::POST_UPDATE_CMD,
  7462. ScriptEvents::PRE_STATUS_CMD,
  7463. ScriptEvents::POST_STATUS_CMD,
  7464. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  7465. ScriptEvents::POST_CREATE_PROJECT_CMD,
  7466. ScriptEvents::PRE_ARCHIVE_CMD,
  7467. ScriptEvents::POST_ARCHIVE_CMD,
  7468. ScriptEvents::PRE_AUTOLOAD_DUMP,
  7469. ScriptEvents::POST_AUTOLOAD_DUMP,
  7470. ];
  7471. protected function configure(): void
  7472. {
  7473. $this
  7474. ->setName('run-script')
  7475. ->setAliases(['run'])
  7476. ->setDescription('Runs the scripts defined in composer.json')
  7477. ->setDefinition([
  7478. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.', null, function () {
  7479. return array_map(static function ($script) { return $script['name']; }, $this->getScripts());
  7480. }),
  7481. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  7482. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  7483. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  7484. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  7485. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  7486. ])
  7487. ->setHelp(
  7488. <<<EOT
  7489. The <info>run-script</info> command runs scripts defined in composer.json:
  7490. <info>php composer.phar run-script post-update-cmd</info>
  7491. Read more at https://getcomposer.org/doc/03-cli.md#run-script-run
  7492. EOT
  7493. )
  7494. ;
  7495. }
  7496. protected function interact(InputInterface $input, OutputInterface $output): void
  7497. {
  7498. $scripts = $this->getScripts();
  7499. if (count($scripts) === 0) {
  7500. return;
  7501. }
  7502. if ($input->getArgument('script') !== null || $input->getOption('list')) {
  7503. return;
  7504. }
  7505. $options = [];
  7506. foreach ($scripts as $script) {
  7507. $options[$script['name']] = $script['description'];
  7508. }
  7509. $io = $this->getIO();
  7510. $script = $io->select(
  7511. 'Script to run: ',
  7512. $options,
  7513. '',
  7514. 1,
  7515. 'Invalid script name "%s"'
  7516. );
  7517. $input->setArgument('script', $script);
  7518. }
  7519. protected function execute(InputInterface $input, OutputInterface $output): int
  7520. {
  7521. if ($input->getOption('list')) {
  7522. return $this->listScripts($output);
  7523. }
  7524. $script = $input->getArgument('script');
  7525. if ($script === null) {
  7526. throw new \RuntimeException('Missing required argument "script"');
  7527. }
  7528. if (!in_array($script, $this->scriptEvents)) {
  7529. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7530. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  7531. }
  7532. }
  7533. $composer = $this->requireComposer();
  7534. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  7535. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  7536. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  7537. if (!$hasListeners) {
  7538. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  7539. }
  7540. $args = $input->getArgument('args');
  7541. if (null !== $timeout = $input->getOption('timeout')) {
  7542. if (!ctype_digit($timeout)) {
  7543. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  7544. }
  7545. ProcessExecutor::setTimeout((int) $timeout);
  7546. }
  7547. Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
  7548. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  7549. }
  7550. protected function listScripts(OutputInterface $output): int
  7551. {
  7552. $scripts = $this->getScripts();
  7553. if (count($scripts) === 0) {
  7554. return 0;
  7555. }
  7556. $io = $this->getIO();
  7557. $io->writeError('<info>scripts:</info>');
  7558. $table = [];
  7559. foreach ($scripts as $script) {
  7560. $table[] = [' '.$script['name'], $script['description']];
  7561. }
  7562. $this->renderTable($table, $output);
  7563. return 0;
  7564. }
  7565. private function getScripts(): array
  7566. {
  7567. $scripts = $this->requireComposer()->getPackage()->getScripts();
  7568. if (count($scripts) === 0) {
  7569. return [];
  7570. }
  7571. $result = [];
  7572. foreach ($scripts as $name => $script) {
  7573. $description = '';
  7574. try {
  7575. $cmd = $this->getApplication()->find($name);
  7576. if ($cmd instanceof ScriptAliasCommand) {
  7577. $description = $cmd->getDescription();
  7578. }
  7579. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  7580. }
  7581. $result[] = ['name' => $name, 'description' => $description];
  7582. }
  7583. return $result;
  7584. }
  7585. }
  7586. <?php declare(strict_types=1);
  7587. namespace Composer\Command;
  7588. use Composer\Pcre\Preg;
  7589. use Symfony\Component\Console\Input\InputInterface;
  7590. use Composer\Console\Input\InputOption;
  7591. use Composer\Console\Input\InputArgument;
  7592. use Symfony\Component\Console\Output\OutputInterface;
  7593. class ScriptAliasCommand extends BaseCommand
  7594. {
  7595. private $script;
  7596. private $description;
  7597. private $aliases;
  7598. public function __construct(string $script, ?string $description, array $aliases = [])
  7599. {
  7600. $this->script = $script;
  7601. $this->description = $description ?? 'Runs the '.$script.' script as defined in composer.json';
  7602. $this->aliases = $aliases;
  7603. foreach ($this->aliases as $alias) {
  7604. if (!is_string($alias)) {
  7605. throw new \InvalidArgumentException('"scripts-aliases" element array values should contain only strings');
  7606. }
  7607. }
  7608. $this->ignoreValidationErrors();
  7609. parent::__construct();
  7610. }
  7611. protected function configure(): void
  7612. {
  7613. $this
  7614. ->setName($this->script)
  7615. ->setDescription($this->description)
  7616. ->setAliases($this->aliases)
  7617. ->setDefinition([
  7618. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  7619. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  7620. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  7621. ])
  7622. ->setHelp(
  7623. <<<EOT
  7624. The <info>run-script</info> command runs scripts defined in composer.json:
  7625. <info>php composer.phar run-script post-update-cmd</info>
  7626. Read more at https://getcomposer.org/doc/03-cli.md#run-script-run
  7627. EOT
  7628. )
  7629. ;
  7630. }
  7631. protected function execute(InputInterface $input, OutputInterface $output): int
  7632. {
  7633. $composer = $this->requireComposer();
  7634. $args = $input->getArguments();
  7635. if (!method_exists($input, '__toString')) {
  7636. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  7637. }
  7638. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args'], ['script-alias-input' => Preg::replace('{^\S+ ?}', '', $input->__toString(), 1)]);
  7639. }
  7640. }
  7641. <?php declare(strict_types=1);
  7642. namespace Composer\Command;
  7643. use Composer\Factory;
  7644. use Composer\Json\JsonFile;
  7645. use Symfony\Component\Console\Formatter\OutputFormatter;
  7646. use Symfony\Component\Console\Input\InputInterface;
  7647. use Composer\Console\Input\InputArgument;
  7648. use Composer\Console\Input\InputOption;
  7649. use Symfony\Component\Console\Output\OutputInterface;
  7650. use Composer\Repository\CompositeRepository;
  7651. use Composer\Repository\PlatformRepository;
  7652. use Composer\Repository\RepositoryInterface;
  7653. use Composer\Plugin\CommandEvent;
  7654. use Composer\Plugin\PluginEvents;
  7655. class SearchCommand extends BaseCommand
  7656. {
  7657. protected function configure(): void
  7658. {
  7659. $this
  7660. ->setName('search')
  7661. ->setDescription('Searches for packages')
  7662. ->setDefinition([
  7663. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in package names'),
  7664. new InputOption('only-vendor', 'O', InputOption::VALUE_NONE, 'Search only for vendor / organization names, returns only "vendor" as result'),
  7665. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  7666. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  7667. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  7668. ])
  7669. ->setHelp(
  7670. <<<EOT
  7671. The search command searches for packages by its name
  7672. <info>php composer.phar search symfony composer</info>
  7673. Read more at https://getcomposer.org/doc/03-cli.md#search
  7674. EOT
  7675. )
  7676. ;
  7677. }
  7678. protected function execute(InputInterface $input, OutputInterface $output): int
  7679. {
  7680. $platformRepo = new PlatformRepository;
  7681. $io = $this->getIO();
  7682. $format = $input->getOption('format');
  7683. if (!in_array($format, ['text', 'json'])) {
  7684. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  7685. return 1;
  7686. }
  7687. if (!($composer = $this->tryComposer())) {
  7688. $composer = Factory::create($this->getIO(), [], $input->hasParameterOption('--no-plugins'));
  7689. }
  7690. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7691. $installedRepo = new CompositeRepository([$localRepo, $platformRepo]);
  7692. $repos = new CompositeRepository(array_merge([$installedRepo], $composer->getRepositoryManager()->getRepositories()));
  7693. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  7694. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7695. $mode = RepositoryInterface::SEARCH_FULLTEXT;
  7696. if ($input->getOption('only-name') === true) {
  7697. if ($input->getOption('only-vendor') === true) {
  7698. throw new \InvalidArgumentException('--only-name and --only-vendor cannot be used together');
  7699. }
  7700. $mode = RepositoryInterface::SEARCH_NAME;
  7701. } elseif ($input->getOption('only-vendor') === true) {
  7702. $mode = RepositoryInterface::SEARCH_VENDOR;
  7703. }
  7704. $type = $input->getOption('type');
  7705. $query = implode(' ', $input->getArgument('tokens'));
  7706. if ($mode !== RepositoryInterface::SEARCH_FULLTEXT) {
  7707. $query = preg_quote($query);
  7708. }
  7709. $results = $repos->search($query, $mode, $type);
  7710. if (\count($results) > 0 && $format === 'text') {
  7711. $width = $this->getTerminalWidth();
  7712. $nameLength = 0;
  7713. foreach ($results as $result) {
  7714. $nameLength = max(strlen($result['name']), $nameLength);
  7715. }
  7716. $nameLength += 1;
  7717. foreach ($results as $result) {
  7718. $description = $result['description'] ?? '';
  7719. $warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : '';
  7720. $remaining = $width - $nameLength - strlen($warning) - 2;
  7721. if (strlen($description) > $remaining) {
  7722. $description = substr($description, 0, $remaining - 3) . '...';
  7723. }
  7724. $link = $result['url'] ?? null;
  7725. if ($link !== null) {
  7726. $io->write('<href='.OutputFormatter::escape($link).'>'.$result['name'].'</>'. str_repeat(' ', $nameLength - strlen($result['name'])) . $warning . $description);
  7727. } else {
  7728. $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description);
  7729. }
  7730. }
  7731. } elseif ($format === 'json') {
  7732. $io->write(JsonFile::encode($results));
  7733. }
  7734. return 0;
  7735. }
  7736. }
  7737. <?php declare(strict_types=1);
  7738. namespace Composer\Command;
  7739. use Composer\Composer;
  7740. use Composer\Factory;
  7741. use Composer\Config;
  7742. use Composer\Pcre\Preg;
  7743. use Composer\Util\Filesystem;
  7744. use Composer\Util\Platform;
  7745. use Composer\SelfUpdate\Keys;
  7746. use Composer\SelfUpdate\Versions;
  7747. use Composer\IO\IOInterface;
  7748. use Composer\Downloader\FilesystemException;
  7749. use Composer\Downloader\TransportException;
  7750. use Symfony\Component\Console\Input\InputInterface;
  7751. use Composer\Console\Input\InputOption;
  7752. use Composer\Console\Input\InputArgument;
  7753. use Symfony\Component\Console\Output\OutputInterface;
  7754. use Symfony\Component\Finder\Finder;
  7755. class SelfUpdateCommand extends BaseCommand
  7756. {
  7757. private const HOMEPAGE = 'getcomposer.org';
  7758. private const OLD_INSTALL_EXT = '-old.phar';
  7759. protected function configure(): void
  7760. {
  7761. $this
  7762. ->setName('self-update')
  7763. ->setAliases(['selfupdate'])
  7764. ->setDescription('Updates composer.phar to the latest version')
  7765. ->setDefinition([
  7766. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  7767. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  7768. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  7769. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  7770. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  7771. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  7772. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  7773. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  7774. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  7775. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  7776. new InputOption('2.2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.2.x LTS versions'),
  7777. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  7778. ])
  7779. ->setHelp(
  7780. <<<EOT
  7781. The <info>self-update</info> command checks getcomposer.org for newer
  7782. versions of composer and if found, installs the latest.
  7783. <info>php composer.phar self-update</info>
  7784. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate
  7785. EOT
  7786. )
  7787. ;
  7788. }
  7789. protected function execute(InputInterface $input, OutputInterface $output): int
  7790. {
  7791. if ($_SERVER['argv'][0] === 'Standard input code') {
  7792. return 1;
  7793. }
  7794. class_exists('Composer\Util\Platform');
  7795. class_exists('Composer\Downloader\FilesystemException');
  7796. $config = Factory::createConfig();
  7797. if ($config->get('disable-tls') === true) {
  7798. $baseUrl = 'http://' . self::HOMEPAGE;
  7799. } else {
  7800. $baseUrl = 'https://' . self::HOMEPAGE;
  7801. }
  7802. $io = $this->getIO();
  7803. $httpDownloader = Factory::createHttpDownloader($io, $config);
  7804. $versionsUtil = new Versions($config, $httpDownloader);
  7805. $requestedChannel = null;
  7806. foreach (Versions::CHANNELS as $channel) {
  7807. if ($input->getOption($channel)) {
  7808. $requestedChannel = $channel;
  7809. $versionsUtil->setChannel($channel, $io);
  7810. break;
  7811. }
  7812. }
  7813. if ($input->getOption('set-channel-only')) {
  7814. return 0;
  7815. }
  7816. $cacheDir = $config->get('cache-dir');
  7817. $rollbackDir = $config->get('data-dir');
  7818. $home = $config->get('home');
  7819. $localFilename = realpath($_SERVER['argv'][0]);
  7820. if (false === $localFilename) {
  7821. $localFilename = $_SERVER['argv'][0];
  7822. }
  7823. if ($input->getOption('update-keys')) {
  7824. $this->fetchKeys($io, $config);
  7825. return 0;
  7826. }
  7827. if (!file_exists($localFilename)) {
  7828. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  7829. }
  7830. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  7831. if (!is_writable($tmpDir)) {
  7832. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  7833. }
  7834. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  7835. $composerUser = posix_getpwuid(posix_geteuid());
  7836. $homeDirOwnerId = fileowner($home);
  7837. if (is_array($composerUser) && $homeDirOwnerId !== false) {
  7838. $homeOwner = posix_getpwuid($homeDirOwnerId);
  7839. if (is_array($homeOwner) && isset($composerUser['name'], $homeOwner['name']) && $composerUser['name'] !== $homeOwner['name']) {
  7840. $io->writeError('<warning>You are running Composer as "'.$composerUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  7841. }
  7842. }
  7843. }
  7844. if ($input->getOption('rollback')) {
  7845. return $this->rollback($output, $rollbackDir, $localFilename);
  7846. }
  7847. if ($input->getArgument('command') === 'self' && $input->getArgument('version') === 'update') {
  7848. $input->setArgument('version', null);
  7849. }
  7850. $latest = $versionsUtil->getLatest();
  7851. $latestStable = $versionsUtil->getLatest('stable');
  7852. try {
  7853. $latestPreview = $versionsUtil->getLatest('preview');
  7854. } catch (\UnexpectedValueException $e) {
  7855. $latestPreview = $latestStable;
  7856. }
  7857. $latestVersion = $latest['version'];
  7858. $updateVersion = $input->getArgument('version') ?? $latestVersion;
  7859. $currentMajorVersion = Preg::replace('{^(\d+).*}', '$1', Composer::getVersion());
  7860. $updateMajorVersion = Preg::replace('{^(\d+).*}', '$1', $updateVersion);
  7861. $previewMajorVersion = Preg::replace('{^(\d+).*}', '$1', $latestPreview['version']);
  7862. if ($versionsUtil->getChannel() === 'stable' && null === $input->getArgument('version')) {
  7863. if ($currentMajorVersion < $updateMajorVersion) {
  7864. $skippedVersion = $updateVersion;
  7865. $versionsUtil->setChannel($currentMajorVersion);
  7866. $latest = $versionsUtil->getLatest();
  7867. $latestStable = $versionsUtil->getLatest('stable');
  7868. $latestVersion = $latest['version'];
  7869. $updateVersion = $latestVersion;
  7870. $io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://getcomposer.org/'.$updateMajorVersion.'</warning>');
  7871. } elseif ($currentMajorVersion < $previewMajorVersion) {
  7872. $io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>');
  7873. }
  7874. }
  7875. $effectiveChannel = $requestedChannel === null ? $versionsUtil->getChannel() : $requestedChannel;
  7876. if (is_numeric($effectiveChannel) && strpos($latestStable['version'], $effectiveChannel) !== 0) {
  7877. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$effectiveChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  7878. }
  7879. if (isset($latest['eol'])) {
  7880. $io->writeError('<warning>Warning: Version '.$latestVersion.' is EOL / End of Life. '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  7881. }
  7882. if (Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  7883. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  7884. return 1;
  7885. }
  7886. $channelString = $versionsUtil->getChannel();
  7887. if (is_numeric($channelString)) {
  7888. $channelString .= '.x';
  7889. }
  7890. if (Composer::VERSION === $updateVersion) {
  7891. $io->writeError(
  7892. sprintf(
  7893. '<info>You are already using the latest available Composer version %s (%s channel).</info>',
  7894. $updateVersion,
  7895. $channelString
  7896. )
  7897. );
  7898. if ($input->getOption('clean-backups')) {
  7899. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  7900. }
  7901. return 0;
  7902. }
  7903. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp'.random_int(0, 10000000).'.phar';
  7904. $backupFile = sprintf(
  7905. '%s/%s-%s%s',
  7906. $rollbackDir,
  7907. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  7908. Preg::replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  7909. self::OLD_INSTALL_EXT
  7910. );
  7911. $updatingToTag = !Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion);
  7912. $io->write(sprintf("Upgrading to version <info>%s</info> (%s channel).", $updateVersion, $channelString));
  7913. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  7914. try {
  7915. $signature = $httpDownloader->get($remoteFilename.'.sig')->getBody();
  7916. } catch (TransportException $e) {
  7917. if ($e->getStatusCode() === 404) {
  7918. throw new \InvalidArgumentException('Version "'.$updateVersion.'" could not be found.', 0, $e);
  7919. }
  7920. throw $e;
  7921. }
  7922. $io->writeError(' ', false);
  7923. $httpDownloader->copy($remoteFilename, $tempFilename);
  7924. $io->writeError('');
  7925. if (!file_exists($tempFilename) || null === $signature || '' === $signature) {
  7926. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  7927. return 1;
  7928. }
  7929. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  7930. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  7931. } else {
  7932. if (!extension_loaded('openssl')) {
  7933. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  7934. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  7935. }
  7936. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  7937. if (!file_exists($sigFile)) {
  7938. file_put_contents(
  7939. $home.'/keys.dev.pub',
  7940. <<<DEVPUBKEY
  7941. -----BEGIN PUBLIC KEY-----
  7942. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  7943. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  7944. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  7945. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  7946. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  7947. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  7948. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  7949. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  7950. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  7951. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  7952. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  7953. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  7954. -----END PUBLIC KEY-----
  7955. DEVPUBKEY
  7956. );
  7957. file_put_contents(
  7958. $home.'/keys.tags.pub',
  7959. <<<TAGSPUBKEY
  7960. -----BEGIN PUBLIC KEY-----
  7961. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  7962. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  7963. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  7964. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  7965. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  7966. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  7967. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  7968. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  7969. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  7970. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  7971. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  7972. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  7973. -----END PUBLIC KEY-----
  7974. TAGSPUBKEY
  7975. );
  7976. }
  7977. $pubkeyid = openssl_pkey_get_public($sigFile);
  7978. if (false === $pubkeyid) {
  7979. throw new \RuntimeException('Failed loading the public key from '.$sigFile);
  7980. }
  7981. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  7982. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()), true)) {
  7983. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  7984. }
  7985. $signatureData = json_decode($signature, true);
  7986. $signatureSha384 = base64_decode($signatureData['sha384'], true);
  7987. if (false === $signatureSha384) {
  7988. throw new \RuntimeException('Failed loading the phar signature from '.$remoteFilename.'.sig, got '.$signature);
  7989. }
  7990. $verified = 1 === openssl_verify((string) file_get_contents($tempFilename), $signatureSha384, $pubkeyid, $algo);
  7991. if (PHP_VERSION_ID < 80000) {
  7992. openssl_free_key($pubkeyid);
  7993. }
  7994. if (!$verified) {
  7995. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  7996. }
  7997. }
  7998. if ($input->getOption('clean-backups')) {
  7999. $this->cleanBackups($rollbackDir);
  8000. }
  8001. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  8002. @unlink($tempFilename);
  8003. return 1;
  8004. }
  8005. if (file_exists($backupFile)) {
  8006. $io->writeError(sprintf(
  8007. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  8008. Composer::VERSION
  8009. ));
  8010. } else {
  8011. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  8012. }
  8013. return 0;
  8014. }
  8015. protected function fetchKeys(IOInterface $io, Config $config): void
  8016. {
  8017. if (!$io->isInteractive()) {
  8018. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  8019. }
  8020. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  8021. $validator = static function ($value): string {
  8022. $value = (string) $value;
  8023. if (!Preg::isMatch('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  8024. throw new \UnexpectedValueException('Invalid input');
  8025. }
  8026. return trim($value)."\n";
  8027. };
  8028. $devKey = '';
  8029. while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  8030. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  8031. while ($line = $io->ask('', '')) {
  8032. $devKey .= trim($line)."\n";
  8033. if (trim($line) === '-----END PUBLIC KEY-----') {
  8034. break;
  8035. }
  8036. }
  8037. }
  8038. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  8039. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  8040. $tagsKey = '';
  8041. while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  8042. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  8043. while ($line = $io->ask('', '')) {
  8044. $tagsKey .= trim($line)."\n";
  8045. if (trim($line) === '-----END PUBLIC KEY-----') {
  8046. break;
  8047. }
  8048. }
  8049. }
  8050. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  8051. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  8052. $io->write('Public keys stored in '.$config->get('home'));
  8053. }
  8054. protected function rollback(OutputInterface $output, string $rollbackDir, string $localFilename): int
  8055. {
  8056. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  8057. if (null === $rollbackVersion) {
  8058. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  8059. }
  8060. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  8061. if (!is_file($oldFile)) {
  8062. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  8063. }
  8064. if (!Filesystem::isReadable($oldFile)) {
  8065. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  8066. }
  8067. $io = $this->getIO();
  8068. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  8069. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  8070. return 1;
  8071. }
  8072. return 0;
  8073. }
  8074. protected function setLocalPhar(string $localFilename, string $newFilename, ?string $backupTarget = null): bool
  8075. {
  8076. $io = $this->getIO();
  8077. $perms = @fileperms($localFilename);
  8078. if ($perms !== false) {
  8079. @chmod($newFilename, $perms);
  8080. }
  8081. if (!$this->validatePhar($newFilename, $error)) {
  8082. $io->writeError('<error>The '.($backupTarget !== null ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  8083. if ($backupTarget !== null) {
  8084. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  8085. }
  8086. return false;
  8087. }
  8088. if ($backupTarget !== null) {
  8089. @copy($localFilename, $backupTarget);
  8090. }
  8091. try {
  8092. if (Platform::isWindows()) {
  8093. copy($newFilename, $localFilename);
  8094. @unlink($newFilename);
  8095. } else {
  8096. rename($newFilename, $localFilename);
  8097. }
  8098. return true;
  8099. } catch (\Exception $e) {
  8100. if (!is_writable(dirname($localFilename))
  8101. && $io->isInteractive()
  8102. && $this->isWindowsNonAdminUser()) {
  8103. return $this->tryAsWindowsAdmin($localFilename, $newFilename);
  8104. }
  8105. @unlink($newFilename);
  8106. $action = 'Composer '.($backupTarget !== null ? 'update' : 'rollback');
  8107. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  8108. }
  8109. }
  8110. protected function cleanBackups(string $rollbackDir, ?string $except = null): void
  8111. {
  8112. $finder = $this->getOldInstallationFinder($rollbackDir);
  8113. $io = $this->getIO();
  8114. $fs = new Filesystem;
  8115. foreach ($finder as $file) {
  8116. if ($file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  8117. continue;
  8118. }
  8119. $file = (string) $file;
  8120. $io->writeError('<info>Removing: '.$file.'</info>');
  8121. $fs->remove($file);
  8122. }
  8123. }
  8124. protected function getLastBackupVersion(string $rollbackDir): ?string
  8125. {
  8126. $finder = $this->getOldInstallationFinder($rollbackDir);
  8127. $finder->sortByName();
  8128. $files = iterator_to_array($finder);
  8129. if (count($files) > 0) {
  8130. return end($files)->getBasename(self::OLD_INSTALL_EXT);
  8131. }
  8132. return null;
  8133. }
  8134. protected function getOldInstallationFinder(string $rollbackDir): Finder
  8135. {
  8136. return Finder::create()
  8137. ->depth(0)
  8138. ->files()
  8139. ->name('*' . self::OLD_INSTALL_EXT)
  8140. ->in($rollbackDir);
  8141. }
  8142. protected function validatePhar(string $pharFile, ?string &$error): bool
  8143. {
  8144. if ((bool) ini_get('phar.readonly')) {
  8145. return true;
  8146. }
  8147. try {
  8148. $phar = new \Phar($pharFile);
  8149. unset($phar);
  8150. $result = true;
  8151. } catch (\Exception $e) {
  8152. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  8153. throw $e;
  8154. }
  8155. $error = $e->getMessage();
  8156. $result = false;
  8157. }
  8158. return $result;
  8159. }
  8160. protected function isWindowsNonAdminUser(): bool
  8161. {
  8162. if (!Platform::isWindows()) {
  8163. return false;
  8164. }
  8165. exec('fltmc.exe filters', $output, $exitCode);
  8166. return $exitCode !== 0;
  8167. }
  8168. protected function tryAsWindowsAdmin(string $localFilename, string $newFilename): bool
  8169. {
  8170. $io = $this->getIO();
  8171. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  8172. $helpMessage = 'Please run the self-update command as an Administrator.';
  8173. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  8174. if (!$io->askConfirmation($question, true)) {
  8175. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  8176. return false;
  8177. }
  8178. $tmpFile = tempnam(sys_get_temp_dir(), '');
  8179. if (false === $tmpFile) {
  8180. $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
  8181. return false;
  8182. }
  8183. $script = $tmpFile.'.vbs';
  8184. rename($tmpFile, $script);
  8185. $checksum = hash_file('sha256', $newFilename);
  8186. $source = str_replace('/', '\\', $newFilename);
  8187. $destination = str_replace('/', '\\', $localFilename);
  8188. $vbs = <<<EOT
  8189. Set UAC = CreateObject("Shell.Application")
  8190. UAC.ShellExecute "cmd.exe", "/c copy /b /y ""$source"" ""$destination""", "", "runas", 0
  8191. Wscript.Sleep(300)
  8192. EOT;
  8193. file_put_contents($script, $vbs);
  8194. exec('"'.$script.'"');
  8195. @unlink($script);
  8196. if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
  8197. $io->writeError('<info>Operation succeeded.</info>');
  8198. @unlink($newFilename);
  8199. } else {
  8200. $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
  8201. }
  8202. return $result;
  8203. }
  8204. }
  8205. <?php declare(strict_types=1);
  8206. namespace Composer\Command;
  8207. use Composer\Composer;
  8208. use Composer\DependencyResolver\DefaultPolicy;
  8209. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  8210. use Composer\IO\IOInterface;
  8211. use Composer\Json\JsonFile;
  8212. use Composer\Package\BasePackage;
  8213. use Composer\Package\CompletePackageInterface;
  8214. use Composer\Package\Link;
  8215. use Composer\Package\AliasPackage;
  8216. use Composer\Package\PackageInterface;
  8217. use Composer\Package\Version\VersionParser;
  8218. use Composer\Package\Version\VersionSelector;
  8219. use Composer\Pcre\Preg;
  8220. use Composer\Plugin\CommandEvent;
  8221. use Composer\Plugin\PluginEvents;
  8222. use Composer\Repository\ArrayRepository;
  8223. use Composer\Repository\InstalledArrayRepository;
  8224. use Composer\Repository\ComposerRepository;
  8225. use Composer\Repository\CompositeRepository;
  8226. use Composer\Repository\FilterRepository;
  8227. use Composer\Repository\PlatformRepository;
  8228. use Composer\Repository\RepositoryFactory;
  8229. use Composer\Repository\InstalledRepository;
  8230. use Composer\Repository\RepositoryInterface;
  8231. use Composer\Repository\RepositorySet;
  8232. use Composer\Repository\RepositoryUtils;
  8233. use Composer\Repository\RootPackageRepository;
  8234. use Composer\Semver\Constraint\ConstraintInterface;
  8235. use Composer\Semver\Semver;
  8236. use Composer\Spdx\SpdxLicenses;
  8237. use Composer\Util\PackageInfo;
  8238. use Symfony\Component\Console\Completion\CompletionInput;
  8239. use Symfony\Component\Console\Formatter\OutputFormatter;
  8240. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  8241. use Composer\Console\Input\InputArgument;
  8242. use Symfony\Component\Console\Input\InputInterface;
  8243. use Composer\Console\Input\InputOption;
  8244. use Symfony\Component\Console\Output\OutputInterface;
  8245. class ShowCommand extends BaseCommand
  8246. {
  8247. use CompletionTrait;
  8248. protected $versionParser;
  8249. protected $colors;
  8250. private $repositorySet;
  8251. protected function configure()
  8252. {
  8253. $this
  8254. ->setName('show')
  8255. ->setAliases(['info'])
  8256. ->setDescription('Shows information about packages')
  8257. ->setDefinition([
  8258. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.', null, $this->suggestPackageBasedOnMode()),
  8259. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  8260. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  8261. new InputOption('locked', null, InputOption::VALUE_NONE, 'List all locked packages'),
  8262. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  8263. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  8264. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  8265. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  8266. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  8267. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  8268. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  8269. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  8270. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  8271. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Can contain wildcards (*). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.', null, $this->suggestInstalledPackage(false)),
  8272. new InputOption('major-only', 'M', InputOption::VALUE_NONE, 'Show only packages that have major SemVer-compatible updates. Use with the --latest or --outdated option.'),
  8273. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --latest or --outdated option.'),
  8274. new InputOption('patch-only', null, InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates. Use with the --latest or --outdated option.'),
  8275. new InputOption('sort-by-age', 'A', InputOption::VALUE_NONE, 'Displays the installed version\'s age, and sorts packages oldest first. Use with the --latest or --outdated option.'),
  8276. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  8277. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  8278. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  8279. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  8280. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages). Use with the --outdated option'),
  8281. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
  8282. ])
  8283. ->setHelp(
  8284. <<<EOT
  8285. The show command displays detailed information about a package, or
  8286. lists all packages available.
  8287. Read more at https://getcomposer.org/doc/03-cli.md#show-info
  8288. EOT
  8289. )
  8290. ;
  8291. }
  8292. protected function suggestPackageBasedOnMode(): \Closure
  8293. {
  8294. return function (CompletionInput $input) {
  8295. if ($input->getOption('available') || $input->getOption('all')) {
  8296. return $this->suggestAvailablePackageInclPlatform()($input);
  8297. }
  8298. if ($input->getOption('platform')) {
  8299. return $this->suggestPlatformPackage()($input);
  8300. }
  8301. return $this->suggestInstalledPackage(false)($input);
  8302. };
  8303. }
  8304. protected function execute(InputInterface $input, OutputInterface $output): int
  8305. {
  8306. $this->versionParser = new VersionParser;
  8307. if ($input->getOption('tree')) {
  8308. $this->initStyles($output);
  8309. }
  8310. $composer = $this->tryComposer();
  8311. $io = $this->getIO();
  8312. if ($input->getOption('installed') && !$input->getOption('self')) {
  8313. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  8314. }
  8315. if ($input->getOption('outdated')) {
  8316. $input->setOption('latest', true);
  8317. } elseif (count($input->getOption('ignore')) > 0) {
  8318. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  8319. }
  8320. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  8321. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  8322. return 1;
  8323. }
  8324. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  8325. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  8326. return 1;
  8327. }
  8328. if (count(array_filter([$input->getOption('patch-only'), $input->getOption('minor-only'), $input->getOption('major-only')])) > 1) {
  8329. $io->writeError('Only one of --major-only, --minor-only or --patch-only can be used at once');
  8330. return 1;
  8331. }
  8332. if ($input->getOption('tree') && $input->getOption('latest')) {
  8333. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  8334. return 1;
  8335. }
  8336. if ($input->getOption('tree') && $input->getOption('path')) {
  8337. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  8338. return 1;
  8339. }
  8340. $format = $input->getOption('format');
  8341. if (!in_array($format, ['text', 'json'])) {
  8342. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  8343. return 1;
  8344. }
  8345. $platformReqFilter = $this->getPlatformRequirementFilter($input);
  8346. $platformOverrides = [];
  8347. if ($composer) {
  8348. $platformOverrides = $composer->getConfig()->get('platform');
  8349. }
  8350. $platformRepo = new PlatformRepository([], $platformOverrides);
  8351. $lockedRepo = null;
  8352. if ($input->getOption('self') && !$input->getOption('installed') && !$input->getOption('locked')) {
  8353. $package = clone $this->requireComposer()->getPackage();
  8354. if ($input->getOption('name-only')) {
  8355. $io->write($package->getName());
  8356. return 0;
  8357. }
  8358. if ($input->getArgument('package')) {
  8359. throw new \InvalidArgumentException('You cannot use --self together with a package name');
  8360. }
  8361. $repos = $installedRepo = new InstalledRepository([new RootPackageRepository($package)]);
  8362. } elseif ($input->getOption('platform')) {
  8363. $repos = $installedRepo = new InstalledRepository([$platformRepo]);
  8364. } elseif ($input->getOption('available')) {
  8365. $installedRepo = new InstalledRepository([$platformRepo]);
  8366. if ($composer) {
  8367. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  8368. $installedRepo->addRepository($composer->getRepositoryManager()->getLocalRepository());
  8369. } else {
  8370. $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
  8371. $repos = new CompositeRepository($defaultRepos);
  8372. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  8373. }
  8374. } elseif ($input->getOption('all') && $composer) {
  8375. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  8376. $locker = $composer->getLocker();
  8377. if ($locker->isLocked()) {
  8378. $lockedRepo = $locker->getLockedRepository(true);
  8379. $installedRepo = new InstalledRepository([$lockedRepo, $localRepo, $platformRepo]);
  8380. } else {
  8381. $installedRepo = new InstalledRepository([$localRepo, $platformRepo]);
  8382. }
  8383. $repos = new CompositeRepository(array_merge([new FilterRepository($installedRepo, ['canonical' => false])], $composer->getRepositoryManager()->getRepositories()));
  8384. } elseif ($input->getOption('all')) {
  8385. $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
  8386. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  8387. $installedRepo = new InstalledRepository([$platformRepo]);
  8388. $repos = new CompositeRepository(array_merge([$installedRepo], $defaultRepos));
  8389. } elseif ($input->getOption('locked')) {
  8390. if (!$composer || !$composer->getLocker()->isLocked()) {
  8391. throw new \UnexpectedValueException('A valid composer.json and composer.lock files is required to run this command with --locked');
  8392. }
  8393. $locker = $composer->getLocker();
  8394. $lockedRepo = $locker->getLockedRepository(!$input->getOption('no-dev'));
  8395. if ($input->getOption('self')) {
  8396. $lockedRepo->addPackage(clone $composer->getPackage());
  8397. }
  8398. $repos = $installedRepo = new InstalledRepository([$lockedRepo]);
  8399. } else {
  8400. if (!$composer) {
  8401. $composer = $this->requireComposer();
  8402. }
  8403. $rootPkg = $composer->getPackage();
  8404. $rootRepo = new InstalledArrayRepository();
  8405. if ($input->getOption('self')) {
  8406. $rootRepo = new RootPackageRepository(clone $rootPkg);
  8407. }
  8408. if ($input->getOption('no-dev')) {
  8409. $packages = RepositoryUtils::filterRequiredPackages($composer->getRepositoryManager()->getLocalRepository()->getPackages(), $rootPkg);
  8410. $repos = $installedRepo = new InstalledRepository([$rootRepo, new InstalledArrayRepository(array_map(static function ($pkg): PackageInterface {
  8411. return clone $pkg;
  8412. }, $packages))]);
  8413. } else {
  8414. $repos = $installedRepo = new InstalledRepository([$rootRepo, $composer->getRepositoryManager()->getLocalRepository()]);
  8415. }
  8416. if (!$installedRepo->getPackages()) {
  8417. $hasNonPlatformReqs = static function (array $reqs): bool {
  8418. return (bool) array_filter(array_keys($reqs), function (string $name) {
  8419. return !PlatformRepository::isPlatformPackage($name);
  8420. });
  8421. };
  8422. if ($hasNonPlatformReqs($rootPkg->getRequires()) || $hasNonPlatformReqs($rootPkg->getDevRequires())) {
  8423. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  8424. }
  8425. }
  8426. }
  8427. if ($composer) {
  8428. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  8429. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  8430. }
  8431. if ($input->getOption('latest') && null === $composer) {
  8432. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  8433. $input->setOption('latest', false);
  8434. }
  8435. $packageFilter = $input->getArgument('package');
  8436. if (isset($package)) {
  8437. $versions = [$package->getPrettyVersion() => $package->getVersion()];
  8438. } elseif (null !== $packageFilter && !str_contains($packageFilter, '*')) {
  8439. [$package, $versions] = $this->getPackage($installedRepo, $repos, $packageFilter, $input->getArgument('version'));
  8440. if (isset($package) && $input->getOption('direct')) {
  8441. if (!in_array($package->getName(), $this->getRootRequires(), true)) {
  8442. throw new \InvalidArgumentException('Package "' . $package->getName() . '" is installed but not a direct dependent of the root package.');
  8443. }
  8444. }
  8445. if (!isset($package)) {
  8446. $options = $input->getOptions();
  8447. $hint = '';
  8448. if ($input->getOption('locked')) {
  8449. $hint .= ' in lock file';
  8450. }
  8451. if (isset($options['working-dir'])) {
  8452. $hint .= ' in ' . $options['working-dir'] . '/composer.json';
  8453. }
  8454. if (PlatformRepository::isPlatformPackage($packageFilter) && !$input->getOption('platform')) {
  8455. $hint .= ', try using --platform (-p) to show platform packages';
  8456. }
  8457. if (!$input->getOption('all') && !$input->getOption('available')) {
  8458. $hint .= ', try using --available (-a) to show all available packages';
  8459. }
  8460. throw new \InvalidArgumentException('Package "' . $packageFilter . '" not found'.$hint.'.');
  8461. }
  8462. }
  8463. if (isset($package)) {
  8464. assert(isset($versions));
  8465. $exitCode = 0;
  8466. if ($input->getOption('tree')) {
  8467. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  8468. if ('json' === $format) {
  8469. $io->write(JsonFile::encode(['installed' => [$arrayTree]]));
  8470. } else {
  8471. $this->displayPackageTree([$arrayTree]);
  8472. }
  8473. return $exitCode;
  8474. }
  8475. $latestPackage = null;
  8476. if ($input->getOption('latest')) {
  8477. $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $input->getOption('major-only'), $input->getOption('minor-only'), $input->getOption('patch-only'), $platformReqFilter);
  8478. }
  8479. if (
  8480. $input->getOption('outdated')
  8481. && $input->getOption('strict')
  8482. && null !== $latestPackage
  8483. && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
  8484. && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
  8485. ) {
  8486. $exitCode = 1;
  8487. }
  8488. if ($input->getOption('path')) {
  8489. $io->write($package->getName(), false);
  8490. $path = $composer->getInstallationManager()->getInstallPath($package);
  8491. if (is_string($path)) {
  8492. $io->write(' ' . strtok(realpath($path), "\r\n"));
  8493. } else {
  8494. $io->write(' null');
  8495. }
  8496. return $exitCode;
  8497. }
  8498. if ('json' === $format) {
  8499. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  8500. } else {
  8501. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  8502. }
  8503. return $exitCode;
  8504. }
  8505. if ($input->getOption('tree')) {
  8506. $rootRequires = $this->getRootRequires();
  8507. $packages = $installedRepo->getPackages();
  8508. usort($packages, static function (BasePackage $a, BasePackage $b): int {
  8509. return strcmp((string) $a, (string) $b);
  8510. });
  8511. $arrayTree = [];
  8512. foreach ($packages as $package) {
  8513. if (in_array($package->getName(), $rootRequires, true)) {
  8514. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  8515. }
  8516. }
  8517. if ('json' === $format) {
  8518. $io->write(JsonFile::encode(['installed' => $arrayTree]));
  8519. } else {
  8520. $this->displayPackageTree($arrayTree);
  8521. }
  8522. return 0;
  8523. }
  8524. $packages = [];
  8525. $packageFilterRegex = null;
  8526. if (null !== $packageFilter) {
  8527. $packageFilterRegex = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  8528. }
  8529. $packageListFilter = null;
  8530. if ($input->getOption('direct')) {
  8531. $packageListFilter = $this->getRootRequires();
  8532. }
  8533. if ($input->getOption('path') && null === $composer) {
  8534. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  8535. $input->setOption('path', false);
  8536. }
  8537. foreach (RepositoryUtils::flattenRepositories($repos) as $repo) {
  8538. if ($repo === $platformRepo) {
  8539. $type = 'platform';
  8540. } elseif ($lockedRepo !== null && $repo === $lockedRepo) {
  8541. $type = 'locked';
  8542. } elseif ($repo === $installedRepo || in_array($repo, $installedRepo->getRepositories(), true)) {
  8543. $type = 'installed';
  8544. } else {
  8545. $type = 'available';
  8546. }
  8547. if ($repo instanceof ComposerRepository) {
  8548. foreach ($repo->getPackageNames($packageFilter) as $name) {
  8549. $packages[$type][$name] = $name;
  8550. }
  8551. } else {
  8552. foreach ($repo->getPackages() as $package) {
  8553. if (!isset($packages[$type][$package->getName()])
  8554. || !is_object($packages[$type][$package->getName()])
  8555. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  8556. ) {
  8557. while ($package instanceof AliasPackage) {
  8558. $package = $package->getAliasOf();
  8559. }
  8560. if (!$packageFilterRegex || Preg::isMatch($packageFilterRegex, $package->getName())) {
  8561. if (null === $packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  8562. $packages[$type][$package->getName()] = $package;
  8563. }
  8564. }
  8565. }
  8566. }
  8567. if ($repo === $platformRepo) {
  8568. foreach ($platformRepo->getDisabledPackages() as $name => $package) {
  8569. $packages[$type][$name] = $package;
  8570. }
  8571. }
  8572. }
  8573. }
  8574. $showAllTypes = $input->getOption('all');
  8575. $showLatest = $input->getOption('latest');
  8576. $showMajorOnly = $input->getOption('major-only');
  8577. $showMinorOnly = $input->getOption('minor-only');
  8578. $showPatchOnly = $input->getOption('patch-only');
  8579. $ignoredPackagesRegex = BasePackage::packageNamesToRegexp(array_map('strtolower', $input->getOption('ignore')));
  8580. $indent = $showAllTypes ? ' ' : '';
  8581. $latestPackages = [];
  8582. $exitCode = 0;
  8583. $viewData = [];
  8584. $viewMetaData = [];
  8585. $writeVersion = false;
  8586. $writeDescription = false;
  8587. foreach (['platform' => true, 'locked' => true, 'available' => false, 'installed' => true] as $type => $showVersion) {
  8588. if (isset($packages[$type])) {
  8589. ksort($packages[$type]);
  8590. $nameLength = $versionLength = $latestLength = $releaseDateLength = 0;
  8591. if ($showLatest && $showVersion) {
  8592. foreach ($packages[$type] as $package) {
  8593. if (is_object($package)) {
  8594. $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMajorOnly, $showMinorOnly, $showPatchOnly, $platformReqFilter);
  8595. if ($latestPackage === null) {
  8596. continue;
  8597. }
  8598. $latestPackages[$package->getPrettyName()] = $latestPackage;
  8599. }
  8600. }
  8601. }
  8602. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  8603. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  8604. $writeLatest = $writeVersion && $showLatest;
  8605. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  8606. $writeReleaseDate = $writeLatest && $input->getOption('sort-by-age');
  8607. $hasOutdatedPackages = false;
  8608. if ($input->getOption('sort-by-age')) {
  8609. usort($packages[$type], function ($a, $b) {
  8610. if (is_object($a) && is_object($b)) {
  8611. return $a->getReleaseDate() <=> $b->getReleaseDate();
  8612. }
  8613. return 0;
  8614. });
  8615. }
  8616. $viewData[$type] = [];
  8617. foreach ($packages[$type] as $package) {
  8618. $packageViewData = [];
  8619. if (is_object($package)) {
  8620. $latestPackage = null;
  8621. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  8622. $latestPackage = $latestPackages[$package->getPrettyName()];
  8623. }
  8624. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned());
  8625. $packageIsUpToDate = $packageIsUpToDate || ($latestPackage === null && $showMajorOnly);
  8626. $packageIsIgnored = Preg::isMatch($ignoredPackagesRegex, $package->getPrettyName());
  8627. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  8628. continue;
  8629. }
  8630. if ($input->getOption('outdated') || $input->getOption('strict')) {
  8631. $hasOutdatedPackages = true;
  8632. }
  8633. $packageViewData['name'] = $package->getPrettyName();
  8634. $packageViewData['direct-dependency'] = in_array($package->getName(), $this->getRootRequires(), true);
  8635. if ($format !== 'json' || true !== $input->getOption('name-only')) {
  8636. $packageViewData['homepage'] = $package instanceof CompletePackageInterface ? $package->getHomepage() : null;
  8637. $packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
  8638. }
  8639. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  8640. if ($writeVersion) {
  8641. $packageViewData['version'] = $package->getFullPrettyVersion();
  8642. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  8643. }
  8644. if ($writeReleaseDate) {
  8645. if ($package->getReleaseDate() !== null) {
  8646. $packageViewData['release-age'] = str_replace(' ago', ' old', $this->getRelativeTime($package->getReleaseDate()));
  8647. if (!str_contains($packageViewData['release-age'], ' old')) {
  8648. $packageViewData['release-age'] = 'from '.$packageViewData['release-age'];
  8649. }
  8650. $releaseDateLength = max($releaseDateLength, strlen($packageViewData['release-age']));
  8651. } else {
  8652. $packageViewData['release-age'] = '';
  8653. }
  8654. }
  8655. if ($writeLatest && $latestPackage) {
  8656. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  8657. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  8658. $latestLength = max($latestLength, strlen($packageViewData['latest']));
  8659. } elseif ($writeLatest) {
  8660. $packageViewData['latest'] = '[none matched]';
  8661. $packageViewData['latest-status'] = 'up-to-date';
  8662. $latestLength = max($latestLength, strlen($packageViewData['latest']));
  8663. }
  8664. if ($writeDescription && $package instanceof CompletePackageInterface) {
  8665. $packageViewData['description'] = $package->getDescription();
  8666. }
  8667. if ($writePath) {
  8668. $path = $composer->getInstallationManager()->getInstallPath($package);
  8669. if (is_string($path)) {
  8670. $packageViewData['path'] = strtok(realpath($path), "\r\n");
  8671. } else {
  8672. $packageViewData['path'] = null;
  8673. }
  8674. }
  8675. $packageIsAbandoned = false;
  8676. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  8677. $replacementPackageName = $latestPackage->getReplacementPackage();
  8678. $replacement = $replacementPackageName !== null
  8679. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  8680. : 'No replacement was suggested';
  8681. $packageWarning = sprintf(
  8682. 'Package %s is abandoned, you should avoid using it. %s.',
  8683. $package->getPrettyName(),
  8684. $replacement
  8685. );
  8686. $packageViewData['warning'] = $packageWarning;
  8687. $packageIsAbandoned = $replacementPackageName ?? true;
  8688. }
  8689. $packageViewData['abandoned'] = $packageIsAbandoned;
  8690. } else {
  8691. $packageViewData['name'] = $package;
  8692. $nameLength = max($nameLength, strlen($package));
  8693. }
  8694. $viewData[$type][] = $packageViewData;
  8695. }
  8696. $viewMetaData[$type] = [
  8697. 'nameLength' => $nameLength,
  8698. 'versionLength' => $versionLength,
  8699. 'latestLength' => $latestLength,
  8700. 'releaseDateLength' => $releaseDateLength,
  8701. 'writeLatest' => $writeLatest,
  8702. 'writeReleaseDate' => $writeReleaseDate,
  8703. ];
  8704. if ($input->getOption('strict') && $hasOutdatedPackages) {
  8705. $exitCode = 1;
  8706. break;
  8707. }
  8708. }
  8709. }
  8710. if ('json' === $format) {
  8711. $io->write(JsonFile::encode($viewData));
  8712. } else {
  8713. if ($input->getOption('latest') && array_filter($viewData)) {
  8714. if (!$io->isDecorated()) {
  8715. $io->writeError('Legend:');
  8716. $io->writeError('! patch or minor release available - update recommended');
  8717. $io->writeError('~ major release available - update possible');
  8718. if (!$input->getOption('outdated')) {
  8719. $io->writeError('= up to date version');
  8720. }
  8721. } else {
  8722. $io->writeError('<info>Color legend:</info>');
  8723. $io->writeError('- <highlight>patch or minor</highlight> release available - update recommended');
  8724. $io->writeError('- <comment>major</comment> release available - update possible');
  8725. if (!$input->getOption('outdated')) {
  8726. $io->writeError('- <info>up to date</info> version');
  8727. }
  8728. }
  8729. }
  8730. $width = $this->getTerminalWidth();
  8731. foreach ($viewData as $type => $packages) {
  8732. $nameLength = $viewMetaData[$type]['nameLength'];
  8733. $versionLength = $viewMetaData[$type]['versionLength'];
  8734. $latestLength = $viewMetaData[$type]['latestLength'];
  8735. $releaseDateLength = $viewMetaData[$type]['releaseDateLength'];
  8736. $writeLatest = $viewMetaData[$type]['writeLatest'];
  8737. $writeReleaseDate = $viewMetaData[$type]['writeReleaseDate'];
  8738. $versionFits = $nameLength + $versionLength + 3 <= $width;
  8739. $latestFits = $nameLength + $versionLength + $latestLength + 3 <= $width;
  8740. $releaseDateFits = $nameLength + $versionLength + $latestLength + $releaseDateLength + 3 <= $width;
  8741. $descriptionFits = $nameLength + $versionLength + $latestLength + $releaseDateLength + 24 <= $width;
  8742. if ($latestFits && !$io->isDecorated()) {
  8743. $latestLength += 2;
  8744. }
  8745. if ($showAllTypes) {
  8746. if ('available' === $type) {
  8747. $io->write('<comment>' . $type . '</comment>:');
  8748. } else {
  8749. $io->write('<info>' . $type . '</info>:');
  8750. }
  8751. }
  8752. if ($writeLatest && !$input->getOption('direct')) {
  8753. $directDeps = [];
  8754. $transitiveDeps = [];
  8755. foreach ($packages as $pkg) {
  8756. if ($pkg['direct-dependency'] ?? false) {
  8757. $directDeps[] = $pkg;
  8758. } else {
  8759. $transitiveDeps[] = $pkg;
  8760. }
  8761. }
  8762. $io->writeError('');
  8763. $io->writeError('<info>Direct dependencies required in composer.json:</>');
  8764. if (\count($directDeps) > 0) {
  8765. $this->printPackages($io, $directDeps, $indent, $writeVersion && $versionFits, $latestFits, $writeDescription && $descriptionFits, $width, $versionLength, $nameLength, $latestLength, $writeReleaseDate && $releaseDateFits, $releaseDateLength);
  8766. } else {
  8767. $io->writeError('Everything up to date');
  8768. }
  8769. $io->writeError('');
  8770. $io->writeError('<info>Transitive dependencies not required in composer.json:</>');
  8771. if (\count($transitiveDeps) > 0) {
  8772. $this->printPackages($io, $transitiveDeps, $indent, $writeVersion && $versionFits, $latestFits, $writeDescription && $descriptionFits, $width, $versionLength, $nameLength, $latestLength, $writeReleaseDate && $releaseDateFits, $releaseDateLength);
  8773. } else {
  8774. $io->writeError('Everything up to date');
  8775. }
  8776. } else {
  8777. if ($writeLatest && \count($packages) === 0) {
  8778. $io->writeError('All your direct dependencies are up to date');
  8779. } else {
  8780. $this->printPackages($io, $packages, $indent, $writeVersion && $versionFits, $writeLatest && $latestFits, $writeDescription && $descriptionFits, $width, $versionLength, $nameLength, $latestLength, $writeReleaseDate && $releaseDateFits, $releaseDateLength);
  8781. }
  8782. }
  8783. if ($showAllTypes) {
  8784. $io->write('');
  8785. }
  8786. }
  8787. }
  8788. return $exitCode;
  8789. }
  8790. private function printPackages(IOInterface $io, array $packages, string $indent, bool $writeVersion, bool $writeLatest, bool $writeDescription, int $width, int $versionLength, int $nameLength, int $latestLength, bool $writeReleaseDate, int $releaseDateLength): void
  8791. {
  8792. $padName = $writeVersion || $writeLatest || $writeReleaseDate || $writeDescription;
  8793. $padVersion = $writeLatest || $writeReleaseDate || $writeDescription;
  8794. $padLatest = $writeDescription || $writeReleaseDate;
  8795. $padReleaseDate = $writeDescription;
  8796. foreach ($packages as $package) {
  8797. $link = $package['source'] ?? $package['homepage'] ?? '';
  8798. if ($link !== '') {
  8799. $io->write($indent . '<href='.OutputFormatter::escape($link).'>'.$package['name'].'</>'. str_repeat(' ', ($padName ? $nameLength - strlen($package['name']) : 0)), false);
  8800. } else {
  8801. $io->write($indent . str_pad($package['name'], ($padName ? $nameLength : 0), ' '), false);
  8802. }
  8803. if (isset($package['version']) && $writeVersion) {
  8804. $io->write(' ' . str_pad($package['version'], ($padVersion ? $versionLength : 0), ' '), false);
  8805. }
  8806. if (isset($package['latest']) && isset($package['latest-status']) && $writeLatest) {
  8807. $latestVersion = $package['latest'];
  8808. $updateStatus = $package['latest-status'];
  8809. $style = $this->updateStatusToVersionStyle($updateStatus);
  8810. if (!$io->isDecorated()) {
  8811. $latestVersion = str_replace(['up-to-date', 'semver-safe-update', 'update-possible'], ['=', '!', '~'], $updateStatus) . ' ' . $latestVersion;
  8812. }
  8813. $io->write(' <' . $style . '>' . str_pad($latestVersion, ($padLatest ? $latestLength : 0), ' ') . '</' . $style . '>', false);
  8814. if ($writeReleaseDate && isset($package['release-age'])) {
  8815. $io->write(' '.str_pad($package['release-age'], ($padReleaseDate ? $releaseDateLength : 0), ' '), false);
  8816. }
  8817. }
  8818. if (isset($package['description']) && $writeDescription) {
  8819. $description = strtok($package['description'], "\r\n");
  8820. $remaining = $width - $nameLength - $versionLength - $releaseDateLength - 4;
  8821. if ($writeLatest) {
  8822. $remaining -= $latestLength;
  8823. }
  8824. if (strlen($description) > $remaining) {
  8825. $description = substr($description, 0, $remaining - 3) . '...';
  8826. }
  8827. $io->write(' ' . $description, false);
  8828. }
  8829. if (array_key_exists('path', $package)) {
  8830. $io->write(' '.(is_string($package['path']) ? $package['path'] : 'null'), false);
  8831. }
  8832. $io->write('');
  8833. if (isset($package['warning'])) {
  8834. $io->write('<warning>' . $package['warning'] . '</warning>');
  8835. }
  8836. }
  8837. }
  8838. protected function getRootRequires(): array
  8839. {
  8840. $composer = $this->tryComposer();
  8841. if ($composer === null) {
  8842. return [];
  8843. }
  8844. $rootPackage = $composer->getPackage();
  8845. return array_map(
  8846. 'strtolower',
  8847. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  8848. );
  8849. }
  8850. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  8851. {
  8852. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  8853. }
  8854. protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, string $name, $version = null): array
  8855. {
  8856. $name = strtolower($name);
  8857. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  8858. $policy = new DefaultPolicy();
  8859. $repositorySet = new RepositorySet('dev');
  8860. $repositorySet->allowInstalledRepositories();
  8861. $repositorySet->addRepository($repos);
  8862. $matchedPackage = null;
  8863. $versions = [];
  8864. if (PlatformRepository::isPlatformPackage($name)) {
  8865. $pool = $repositorySet->createPoolWithAllPackages();
  8866. } else {
  8867. $pool = $repositorySet->createPoolForPackage($name);
  8868. }
  8869. $matches = $pool->whatProvides($name, $constraint);
  8870. foreach ($matches as $index => $package) {
  8871. if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  8872. $package = $package->getAliasOf();
  8873. }
  8874. if (null === $version && $installedRepo->hasPackage($package)) {
  8875. $matchedPackage = $package;
  8876. }
  8877. $versions[$package->getPrettyVersion()] = $package->getVersion();
  8878. $matches[$index] = $package->getId();
  8879. }
  8880. if (null === $matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, $matches)) {
  8881. $matchedPackage = $pool->literalToPackage($preferred[0]);
  8882. }
  8883. if ($matchedPackage !== null && !$matchedPackage instanceof CompletePackageInterface) {
  8884. throw new \LogicException('ShowCommand::getPackage can only work with CompletePackageInterface, but got '.get_class($matchedPackage));
  8885. }
  8886. return [$matchedPackage, $versions];
  8887. }
  8888. protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
  8889. {
  8890. $io = $this->getIO();
  8891. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  8892. $this->printLinks($package, Link::TYPE_REQUIRE);
  8893. $this->printLinks($package, Link::TYPE_DEV_REQUIRE, 'requires (dev)');
  8894. if ($package->getSuggests()) {
  8895. $io->write("\n<info>suggests</info>");
  8896. foreach ($package->getSuggests() as $suggested => $reason) {
  8897. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  8898. }
  8899. }
  8900. $this->printLinks($package, Link::TYPE_PROVIDE);
  8901. $this->printLinks($package, Link::TYPE_CONFLICT);
  8902. $this->printLinks($package, Link::TYPE_REPLACE);
  8903. }
  8904. protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
  8905. {
  8906. $isInstalledPackage = !PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package);
  8907. $io = $this->getIO();
  8908. $io->write('<info>name</info> : ' . $package->getPrettyName());
  8909. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  8910. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: []));
  8911. $this->printVersions($package, $versions, $installedRepo);
  8912. if ($isInstalledPackage && $package->getReleaseDate() !== null) {
  8913. $io->write('<info>released</info> : ' . $package->getReleaseDate()->format('Y-m-d') . ', ' . $this->getRelativeTime($package->getReleaseDate()));
  8914. }
  8915. if ($latestPackage) {
  8916. $style = $this->getVersionStyle($latestPackage, $package);
  8917. $releasedTime = $latestPackage->getReleaseDate() === null ? '' : ' released ' . $latestPackage->getReleaseDate()->format('Y-m-d') . ', ' . $this->getRelativeTime($latestPackage->getReleaseDate());
  8918. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>' . $releasedTime);
  8919. } else {
  8920. $latestPackage = $package;
  8921. }
  8922. $io->write('<info>type</info> : ' . $package->getType());
  8923. $this->printLicenses($package);
  8924. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  8925. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  8926. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  8927. if ($isInstalledPackage) {
  8928. $path = $this->requireComposer()->getInstallationManager()->getInstallPath($package);
  8929. if (is_string($path)) {
  8930. $io->write('<info>path</info> : ' . realpath($path));
  8931. } else {
  8932. $io->write('<info>path</info> : null');
  8933. }
  8934. }
  8935. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  8936. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  8937. $replacement = ($latestPackage->getReplacementPackage() !== null)
  8938. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  8939. : null;
  8940. $io->writeError(
  8941. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  8942. );
  8943. }
  8944. if ($package->getSupport()) {
  8945. $io->write("\n<info>support</info>");
  8946. foreach ($package->getSupport() as $type => $value) {
  8947. $io->write('<comment>' . $type . '</comment> : '.$value);
  8948. }
  8949. }
  8950. if (\count($package->getAutoload()) > 0) {
  8951. $io->write("\n<info>autoload</info>");
  8952. $autoloadConfig = $package->getAutoload();
  8953. foreach ($autoloadConfig as $type => $autoloads) {
  8954. $io->write('<comment>' . $type . '</comment>');
  8955. if ($type === 'psr-0' || $type === 'psr-4') {
  8956. foreach ($autoloads as $name => $path) {
  8957. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  8958. }
  8959. } elseif ($type === 'classmap') {
  8960. $io->write(implode(', ', $autoloadConfig[$type]));
  8961. }
  8962. }
  8963. if ($package->getIncludePaths()) {
  8964. $io->write('<comment>include-path</comment>');
  8965. $io->write(implode(', ', $package->getIncludePaths()));
  8966. }
  8967. }
  8968. }
  8969. protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo): void
  8970. {
  8971. $versions = array_keys($versions);
  8972. $versions = Semver::rsort($versions);
  8973. if ($installedPackages = $installedRepo->findPackages($package->getName())) {
  8974. foreach ($installedPackages as $installedPackage) {
  8975. $installedVersion = $installedPackage->getPrettyVersion();
  8976. $key = array_search($installedVersion, $versions);
  8977. if (false !== $key) {
  8978. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  8979. }
  8980. }
  8981. }
  8982. $versions = implode(', ', $versions);
  8983. $this->getIO()->write('<info>versions</info> : ' . $versions);
  8984. }
  8985. protected function printLinks(CompletePackageInterface $package, string $linkType, ?string $title = null): void
  8986. {
  8987. $title = $title ?: $linkType;
  8988. $io = $this->getIO();
  8989. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  8990. $io->write("\n<info>" . $title . "</info>");
  8991. foreach ($links as $link) {
  8992. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  8993. }
  8994. }
  8995. }
  8996. protected function printLicenses(CompletePackageInterface $package): void
  8997. {
  8998. $spdxLicenses = new SpdxLicenses();
  8999. $licenses = $package->getLicense();
  9000. $io = $this->getIO();
  9001. foreach ($licenses as $licenseId) {
  9002. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  9003. if (!$license) {
  9004. $out = $licenseId;
  9005. } else {
  9006. if ($license[1] === true) {
  9007. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  9008. } else {
  9009. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  9010. }
  9011. }
  9012. $io->write('<info>license</info> : ' . $out);
  9013. }
  9014. }
  9015. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
  9016. {
  9017. $json = [
  9018. 'name' => $package->getPrettyName(),
  9019. 'description' => $package->getDescription(),
  9020. 'keywords' => $package->getKeywords() ?: [],
  9021. 'type' => $package->getType(),
  9022. 'homepage' => $package->getHomepage(),
  9023. 'names' => $package->getNames(),
  9024. ];
  9025. $json = $this->appendVersions($json, $versions);
  9026. $json = $this->appendLicenses($json, $package);
  9027. if ($latestPackage) {
  9028. $json['latest'] = $latestPackage->getPrettyVersion();
  9029. } else {
  9030. $latestPackage = $package;
  9031. }
  9032. if (null !== $package->getSourceType()) {
  9033. $json['source'] = [
  9034. 'type' => $package->getSourceType(),
  9035. 'url' => $package->getSourceUrl(),
  9036. 'reference' => $package->getSourceReference(),
  9037. ];
  9038. }
  9039. if (null !== $package->getDistType()) {
  9040. $json['dist'] = [
  9041. 'type' => $package->getDistType(),
  9042. 'url' => $package->getDistUrl(),
  9043. 'reference' => $package->getDistReference(),
  9044. ];
  9045. }
  9046. if (!PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package)) {
  9047. $path = $this->requireComposer()->getInstallationManager()->getInstallPath($package);
  9048. if (is_string($path)) {
  9049. $path = realpath($path);
  9050. if ($path !== false) {
  9051. $json['path'] = $path;
  9052. }
  9053. } else {
  9054. $json['path'] = null;
  9055. }
  9056. if ($package->getReleaseDate() !== null) {
  9057. $json['released'] = $package->getReleaseDate()->format(DATE_ATOM);
  9058. }
  9059. }
  9060. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  9061. $json['replacement'] = $latestPackage->getReplacementPackage();
  9062. }
  9063. if ($package->getSuggests()) {
  9064. $json['suggests'] = $package->getSuggests();
  9065. }
  9066. if ($package->getSupport()) {
  9067. $json['support'] = $package->getSupport();
  9068. }
  9069. $json = $this->appendAutoload($json, $package);
  9070. if ($package->getIncludePaths()) {
  9071. $json['include_path'] = $package->getIncludePaths();
  9072. }
  9073. $json = $this->appendLinks($json, $package);
  9074. $this->getIO()->write(JsonFile::encode($json));
  9075. }
  9076. private function appendVersions(array $json, array $versions): array
  9077. {
  9078. uasort($versions, 'version_compare');
  9079. $versions = array_keys(array_reverse($versions));
  9080. $json['versions'] = $versions;
  9081. return $json;
  9082. }
  9083. private function appendLicenses(array $json, CompletePackageInterface $package): array
  9084. {
  9085. if ($licenses = $package->getLicense()) {
  9086. $spdxLicenses = new SpdxLicenses();
  9087. $json['licenses'] = array_map(static function ($licenseId) use ($spdxLicenses) {
  9088. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  9089. if (!$license) {
  9090. return $licenseId;
  9091. }
  9092. return [
  9093. 'name' => $license[0],
  9094. 'osi' => $licenseId,
  9095. 'url' => $license[2],
  9096. ];
  9097. }, $licenses);
  9098. }
  9099. return $json;
  9100. }
  9101. private function appendAutoload(array $json, CompletePackageInterface $package): array
  9102. {
  9103. if (\count($package->getAutoload()) > 0) {
  9104. $autoload = [];
  9105. foreach ($package->getAutoload() as $type => $autoloads) {
  9106. if ($type === 'psr-0' || $type === 'psr-4') {
  9107. $psr = [];
  9108. foreach ($autoloads as $name => $path) {
  9109. if (!$path) {
  9110. $path = '.';
  9111. }
  9112. $psr[$name ?: '*'] = $path;
  9113. }
  9114. $autoload[$type] = $psr;
  9115. } elseif ($type === 'classmap') {
  9116. $autoload['classmap'] = $autoloads;
  9117. }
  9118. }
  9119. $json['autoload'] = $autoload;
  9120. }
  9121. return $json;
  9122. }
  9123. private function appendLinks(array $json, CompletePackageInterface $package): array
  9124. {
  9125. foreach (Link::$TYPES as $linkType) {
  9126. $json = $this->appendLink($json, $package, $linkType);
  9127. }
  9128. return $json;
  9129. }
  9130. private function appendLink(array $json, CompletePackageInterface $package, string $linkType): array
  9131. {
  9132. $links = $package->{'get' . ucfirst($linkType)}();
  9133. if ($links) {
  9134. $json[$linkType] = [];
  9135. foreach ($links as $link) {
  9136. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  9137. }
  9138. }
  9139. return $json;
  9140. }
  9141. protected function initStyles(OutputInterface $output): void
  9142. {
  9143. $this->colors = [
  9144. 'green',
  9145. 'yellow',
  9146. 'cyan',
  9147. 'magenta',
  9148. 'blue',
  9149. ];
  9150. foreach ($this->colors as $color) {
  9151. $style = new OutputFormatterStyle($color);
  9152. $output->getFormatter()->setStyle($color, $style);
  9153. }
  9154. }
  9155. protected function displayPackageTree(array $arrayTree): void
  9156. {
  9157. $io = $this->getIO();
  9158. foreach ($arrayTree as $package) {
  9159. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  9160. $io->write(' ' . $package['version'], false);
  9161. if (isset($package['description'])) {
  9162. $io->write(' ' . strtok($package['description'], "\r\n"));
  9163. } else {
  9164. $io->write('');
  9165. }
  9166. if (isset($package['requires'])) {
  9167. $requires = $package['requires'];
  9168. $treeBar = '├';
  9169. $j = 0;
  9170. $total = count($requires);
  9171. foreach ($requires as $require) {
  9172. $requireName = $require['name'];
  9173. $j++;
  9174. if ($j === $total) {
  9175. $treeBar = 'â””';
  9176. }
  9177. $level = 1;
  9178. $color = $this->colors[$level];
  9179. $info = sprintf(
  9180. '%s──<%s>%s</%s> %s',
  9181. $treeBar,
  9182. $color,
  9183. $requireName,
  9184. $color,
  9185. $require['version']
  9186. );
  9187. $this->writeTreeLine($info);
  9188. $treeBar = str_replace('â””', ' ', $treeBar);
  9189. $packagesInTree = [$package['name'], $requireName];
  9190. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  9191. }
  9192. }
  9193. }
  9194. }
  9195. protected function generatePackageTree(
  9196. PackageInterface $package,
  9197. InstalledRepository $installedRepo,
  9198. RepositoryInterface $remoteRepos
  9199. ): array {
  9200. $requires = $package->getRequires();
  9201. ksort($requires);
  9202. $children = [];
  9203. foreach ($requires as $requireName => $require) {
  9204. $packagesInTree = [$package->getName(), $requireName];
  9205. $treeChildDesc = [
  9206. 'name' => $requireName,
  9207. 'version' => $require->getPrettyConstraint(),
  9208. ];
  9209. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $packagesInTree);
  9210. if ($deepChildren) {
  9211. $treeChildDesc['requires'] = $deepChildren;
  9212. }
  9213. $children[] = $treeChildDesc;
  9214. }
  9215. $tree = [
  9216. 'name' => $package->getPrettyName(),
  9217. 'version' => $package->getPrettyVersion(),
  9218. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : '',
  9219. ];
  9220. if ($children) {
  9221. $tree['requires'] = $children;
  9222. }
  9223. return $tree;
  9224. }
  9225. protected function displayTree(
  9226. $package,
  9227. array $packagesInTree,
  9228. string $previousTreeBar = '├',
  9229. int $level = 1
  9230. ): void {
  9231. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  9232. if (is_array($package) && isset($package['requires'])) {
  9233. $requires = $package['requires'];
  9234. $treeBar = $previousTreeBar . ' ├';
  9235. $i = 0;
  9236. $total = count($requires);
  9237. foreach ($requires as $require) {
  9238. $currentTree = $packagesInTree;
  9239. $i++;
  9240. if ($i === $total) {
  9241. $treeBar = $previousTreeBar . ' â””';
  9242. }
  9243. $colorIdent = $level % count($this->colors);
  9244. $color = $this->colors[$colorIdent];
  9245. assert(is_string($require['name']));
  9246. assert(is_string($require['version']));
  9247. $circularWarn = in_array(
  9248. $require['name'],
  9249. $currentTree,
  9250. true
  9251. ) ? '(circular dependency aborted here)' : '';
  9252. $info = rtrim(sprintf(
  9253. '%s──<%s>%s</%s> %s %s',
  9254. $treeBar,
  9255. $color,
  9256. $require['name'],
  9257. $color,
  9258. $require['version'],
  9259. $circularWarn
  9260. ));
  9261. $this->writeTreeLine($info);
  9262. $treeBar = str_replace('â””', ' ', $treeBar);
  9263. $currentTree[] = $require['name'];
  9264. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  9265. }
  9266. }
  9267. }
  9268. protected function addTree(
  9269. string $name,
  9270. Link $link,
  9271. InstalledRepository $installedRepo,
  9272. RepositoryInterface $remoteRepos,
  9273. array $packagesInTree
  9274. ): array {
  9275. $children = [];
  9276. [$package] = $this->getPackage(
  9277. $installedRepo,
  9278. $remoteRepos,
  9279. $name,
  9280. $link->getPrettyConstraint() === 'self.version' ? $link->getConstraint() : $link->getPrettyConstraint()
  9281. );
  9282. if (is_object($package)) {
  9283. $requires = $package->getRequires();
  9284. ksort($requires);
  9285. foreach ($requires as $requireName => $require) {
  9286. $currentTree = $packagesInTree;
  9287. $treeChildDesc = [
  9288. 'name' => $requireName,
  9289. 'version' => $require->getPrettyConstraint(),
  9290. ];
  9291. if (!in_array($requireName, $currentTree, true)) {
  9292. $currentTree[] = $requireName;
  9293. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $currentTree);
  9294. if ($deepChildren) {
  9295. $treeChildDesc['requires'] = $deepChildren;
  9296. }
  9297. }
  9298. $children[] = $treeChildDesc;
  9299. }
  9300. }
  9301. return $children;
  9302. }
  9303. private function updateStatusToVersionStyle(string $updateStatus): string
  9304. {
  9305. return str_replace(['up-to-date', 'semver-safe-update', 'update-possible'], ['info', 'highlight', 'comment'], $updateStatus);
  9306. }
  9307. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package): string
  9308. {
  9309. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  9310. return 'up-to-date';
  9311. }
  9312. $constraint = $package->getVersion();
  9313. if (0 !== strpos($constraint, 'dev-')) {
  9314. $constraint = '^'.$constraint;
  9315. }
  9316. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  9317. return 'semver-safe-update';
  9318. }
  9319. return 'update-possible';
  9320. }
  9321. private function writeTreeLine(string $line): void
  9322. {
  9323. $io = $this->getIO();
  9324. if (!$io->isDecorated()) {
  9325. $line = str_replace(['└', '├', '──', '│'], ['`-', '|-', '-', '|'], $line);
  9326. }
  9327. $io->write($line);
  9328. }
  9329. private function findLatestPackage(PackageInterface $package, Composer $composer, PlatformRepository $platformRepo, bool $majorOnly, bool $minorOnly, bool $patchOnly, PlatformRequirementFilterInterface $platformReqFilter): ?PackageInterface
  9330. {
  9331. $name = $package->getName();
  9332. $versionSelector = new VersionSelector($this->getRepositorySet($composer), $platformRepo);
  9333. $stability = $composer->getPackage()->getMinimumStability();
  9334. $flags = $composer->getPackage()->getStabilityFlags();
  9335. if (isset($flags[$name])) {
  9336. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  9337. }
  9338. $bestStability = $stability;
  9339. if ($composer->getPackage()->getPreferStable()) {
  9340. $bestStability = $package->getStability();
  9341. }
  9342. $targetVersion = null;
  9343. if (0 === strpos($package->getVersion(), 'dev-')) {
  9344. $targetVersion = $package->getVersion();
  9345. if ($majorOnly) {
  9346. return null;
  9347. }
  9348. }
  9349. if ($targetVersion === null) {
  9350. if ($majorOnly && Preg::isMatch('{^(?P<zero_major>(?:0\.)+)?(?P<first_meaningful>\d+)\.}', $package->getVersion(), $match)) {
  9351. $targetVersion = '>='.$match['zero_major'].(((int) $match['first_meaningful']) + 1).',<9999999-dev';
  9352. }
  9353. if ($minorOnly) {
  9354. $targetVersion = '^'.$package->getVersion();
  9355. }
  9356. if ($patchOnly) {
  9357. $trimmedVersion = Preg::replace('{(\.0)+$}D', '', $package->getVersion());
  9358. $partsNeeded = substr($trimmedVersion, 0, 1) === '0' ? 4 : 3;
  9359. while (substr_count($trimmedVersion, '.') + 1 < $partsNeeded) {
  9360. $trimmedVersion .= '.0';
  9361. }
  9362. $targetVersion = '~'.$trimmedVersion;
  9363. }
  9364. }
  9365. if ($this->getIO()->isVerbose()) {
  9366. $showWarnings = true;
  9367. } else {
  9368. $showWarnings = static function (PackageInterface $candidate) use ($package): bool {
  9369. if (str_starts_with($candidate->getVersion(), 'dev-') || str_starts_with($package->getVersion(), 'dev-')) {
  9370. return false;
  9371. }
  9372. return version_compare($candidate->getVersion(), $package->getVersion(), '<=');
  9373. };
  9374. }
  9375. $candidate = $versionSelector->findBestCandidate($name, $targetVersion, $bestStability, $platformReqFilter, 0, $this->getIO(), $showWarnings);
  9376. while ($candidate instanceof AliasPackage) {
  9377. $candidate = $candidate->getAliasOf();
  9378. }
  9379. return $candidate !== false ? $candidate : null;
  9380. }
  9381. private function getRepositorySet(Composer $composer): RepositorySet
  9382. {
  9383. if (!$this->repositorySet) {
  9384. $this->repositorySet = new RepositorySet($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  9385. $this->repositorySet->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  9386. }
  9387. return $this->repositorySet;
  9388. }
  9389. private function getRelativeTime(\DateTimeInterface $releaseDate): string
  9390. {
  9391. if ($releaseDate->format('Ymd') === date('Ymd')) {
  9392. return 'today';
  9393. }
  9394. $diff = $releaseDate->diff(new \DateTimeImmutable());
  9395. if ($diff->days < 7) {
  9396. return 'this week';
  9397. }
  9398. if ($diff->days < 14) {
  9399. return 'last week';
  9400. }
  9401. if ($diff->m < 1 && $diff->days < 31) {
  9402. return floor($diff->days / 7) . ' weeks ago';
  9403. }
  9404. if ($diff->y < 1) {
  9405. return $diff->m . ' month' . ($diff->m > 1 ? 's' : '') . ' ago';
  9406. }
  9407. return $diff->y . ' year' . ($diff->y > 1 ? 's' : '') . ' ago';
  9408. }
  9409. }
  9410. <?php declare(strict_types=1);
  9411. namespace Composer\Command;
  9412. use Symfony\Component\Console\Input\InputInterface;
  9413. use Composer\Console\Input\InputOption;
  9414. use Symfony\Component\Console\Output\OutputInterface;
  9415. use Composer\Downloader\ChangeReportInterface;
  9416. use Composer\Downloader\DvcsDownloaderInterface;
  9417. use Composer\Downloader\VcsCapableDownloaderInterface;
  9418. use Composer\Package\Dumper\ArrayDumper;
  9419. use Composer\Package\Version\VersionGuesser;
  9420. use Composer\Package\Version\VersionParser;
  9421. use Composer\Plugin\CommandEvent;
  9422. use Composer\Plugin\PluginEvents;
  9423. use Composer\Script\ScriptEvents;
  9424. use Composer\Util\ProcessExecutor;
  9425. class StatusCommand extends BaseCommand
  9426. {
  9427. private const EXIT_CODE_ERRORS = 1;
  9428. private const EXIT_CODE_UNPUSHED_CHANGES = 2;
  9429. private const EXIT_CODE_VERSION_CHANGES = 4;
  9430. protected function configure(): void
  9431. {
  9432. $this
  9433. ->setName('status')
  9434. ->setDescription('Shows a list of locally modified packages')
  9435. ->setDefinition([
  9436. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  9437. ])
  9438. ->setHelp(
  9439. <<<EOT
  9440. The status command displays a list of dependencies that have
  9441. been modified locally.
  9442. Read more at https://getcomposer.org/doc/03-cli.md#status
  9443. EOT
  9444. )
  9445. ;
  9446. }
  9447. protected function execute(InputInterface $input, OutputInterface $output): int
  9448. {
  9449. $composer = $this->requireComposer();
  9450. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  9451. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  9452. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  9453. $exitCode = $this->doExecute($input);
  9454. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  9455. return $exitCode;
  9456. }
  9457. private function doExecute(InputInterface $input): int
  9458. {
  9459. $composer = $this->requireComposer();
  9460. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  9461. $dm = $composer->getDownloadManager();
  9462. $im = $composer->getInstallationManager();
  9463. $errors = [];
  9464. $io = $this->getIO();
  9465. $unpushedChanges = [];
  9466. $vcsVersionChanges = [];
  9467. $parser = new VersionParser;
  9468. $guesser = new VersionGuesser($composer->getConfig(), $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io), $parser);
  9469. $dumper = new ArrayDumper;
  9470. foreach ($installedRepo->getCanonicalPackages() as $package) {
  9471. $downloader = $dm->getDownloaderForPackage($package);
  9472. $targetDir = $im->getInstallPath($package);
  9473. if ($targetDir === null) {
  9474. continue;
  9475. }
  9476. if ($downloader instanceof ChangeReportInterface) {
  9477. if (is_link($targetDir)) {
  9478. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  9479. }
  9480. if (null !== ($changes = $downloader->getLocalChanges($package, $targetDir))) {
  9481. $errors[$targetDir] = $changes;
  9482. }
  9483. }
  9484. if ($downloader instanceof VcsCapableDownloaderInterface) {
  9485. if ($downloader->getVcsReference($package, $targetDir)) {
  9486. switch ($package->getInstallationSource()) {
  9487. case 'source':
  9488. $previousRef = $package->getSourceReference();
  9489. break;
  9490. case 'dist':
  9491. $previousRef = $package->getDistReference();
  9492. break;
  9493. default:
  9494. $previousRef = null;
  9495. }
  9496. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  9497. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef && $currentVersion['pretty_version'] !== $previousRef) {
  9498. $vcsVersionChanges[$targetDir] = [
  9499. 'previous' => [
  9500. 'version' => $package->getPrettyVersion(),
  9501. 'ref' => $previousRef,
  9502. ],
  9503. 'current' => [
  9504. 'version' => $currentVersion['pretty_version'],
  9505. 'ref' => $currentVersion['commit'],
  9506. ],
  9507. ];
  9508. }
  9509. }
  9510. }
  9511. if ($downloader instanceof DvcsDownloaderInterface) {
  9512. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  9513. $unpushedChanges[$targetDir] = $unpushed;
  9514. }
  9515. }
  9516. }
  9517. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  9518. $io->writeError('<info>No local changes</info>');
  9519. return 0;
  9520. }
  9521. if ($errors) {
  9522. $io->writeError('<error>You have changes in the following dependencies:</error>');
  9523. foreach ($errors as $path => $changes) {
  9524. if ($input->getOption('verbose')) {
  9525. $indentedChanges = implode("\n", array_map(static function ($line): string {
  9526. return ' ' . ltrim($line);
  9527. }, explode("\n", $changes)));
  9528. $io->write('<info>'.$path.'</info>:');
  9529. $io->write($indentedChanges);
  9530. } else {
  9531. $io->write($path);
  9532. }
  9533. }
  9534. }
  9535. if ($unpushedChanges) {
  9536. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  9537. foreach ($unpushedChanges as $path => $changes) {
  9538. if ($input->getOption('verbose')) {
  9539. $indentedChanges = implode("\n", array_map(static function ($line): string {
  9540. return ' ' . ltrim($line);
  9541. }, explode("\n", $changes)));
  9542. $io->write('<info>'.$path.'</info>:');
  9543. $io->write($indentedChanges);
  9544. } else {
  9545. $io->write($path);
  9546. }
  9547. }
  9548. }
  9549. if ($vcsVersionChanges) {
  9550. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  9551. foreach ($vcsVersionChanges as $path => $changes) {
  9552. if ($input->getOption('verbose')) {
  9553. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  9554. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  9555. if ($io->isVeryVerbose()) {
  9556. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  9557. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  9558. }
  9559. $io->write('<info>'.$path.'</info>:');
  9560. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  9561. } else {
  9562. $io->write($path);
  9563. }
  9564. }
  9565. }
  9566. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  9567. $io->writeError('Use --verbose (-v) to see a list of files');
  9568. }
  9569. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  9570. }
  9571. }
  9572. <?php declare(strict_types=1);
  9573. namespace Composer\Command;
  9574. use Composer\Repository\PlatformRepository;
  9575. use Composer\Repository\RootPackageRepository;
  9576. use Composer\Repository\InstalledRepository;
  9577. use Composer\Installer\SuggestedPackagesReporter;
  9578. use Composer\Console\Input\InputArgument;
  9579. use Symfony\Component\Console\Input\InputInterface;
  9580. use Composer\Console\Input\InputOption;
  9581. use Symfony\Component\Console\Output\OutputInterface;
  9582. class SuggestsCommand extends BaseCommand
  9583. {
  9584. use CompletionTrait;
  9585. protected function configure(): void
  9586. {
  9587. $this
  9588. ->setName('suggests')
  9589. ->setDescription('Shows package suggestions')
  9590. ->setDefinition([
  9591. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package (default)'),
  9592. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  9593. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show suggestions from all dependencies, including transitive ones'),
  9594. new InputOption('list', null, InputOption::VALUE_NONE, 'Show only list of suggested package names'),
  9595. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  9596. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.', null, $this->suggestInstalledPackage()),
  9597. ])
  9598. ->setHelp(
  9599. <<<EOT
  9600. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  9601. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  9602. EOT
  9603. )
  9604. ;
  9605. }
  9606. protected function execute(InputInterface $input, OutputInterface $output): int
  9607. {
  9608. $composer = $this->requireComposer();
  9609. $installedRepos = [
  9610. new RootPackageRepository(clone $composer->getPackage()),
  9611. ];
  9612. $locker = $composer->getLocker();
  9613. if ($locker->isLocked()) {
  9614. $installedRepos[] = new PlatformRepository([], $locker->getPlatformOverrides());
  9615. $installedRepos[] = $locker->getLockedRepository(!$input->getOption('no-dev'));
  9616. } else {
  9617. $installedRepos[] = new PlatformRepository([], $composer->getConfig()->get('platform'));
  9618. $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
  9619. }
  9620. $installedRepo = new InstalledRepository($installedRepos);
  9621. $reporter = new SuggestedPackagesReporter($this->getIO());
  9622. $filter = $input->getArgument('packages');
  9623. $packages = $installedRepo->getPackages();
  9624. $packages[] = $composer->getPackage();
  9625. foreach ($packages as $package) {
  9626. if (!empty($filter) && !in_array($package->getName(), $filter)) {
  9627. continue;
  9628. }
  9629. $reporter->addSuggestionsFromPackage($package);
  9630. }
  9631. $mode = SuggestedPackagesReporter::MODE_BY_PACKAGE;
  9632. if ($input->getOption('by-suggestion')) {
  9633. $mode = SuggestedPackagesReporter::MODE_BY_SUGGESTION;
  9634. }
  9635. if ($input->getOption('by-package')) {
  9636. $mode |= SuggestedPackagesReporter::MODE_BY_PACKAGE;
  9637. }
  9638. if ($input->getOption('list')) {
  9639. $mode = SuggestedPackagesReporter::MODE_LIST;
  9640. }
  9641. $reporter->output($mode, $installedRepo, empty($filter) && !$input->getOption('all') ? $composer->getPackage() : null);
  9642. return 0;
  9643. }
  9644. }
  9645. <?php declare(strict_types=1);
  9646. namespace Composer\Command;
  9647. use Composer\Composer;
  9648. use Composer\DependencyResolver\Request;
  9649. use Composer\Installer;
  9650. use Composer\IO\IOInterface;
  9651. use Composer\Package\Loader\RootPackageLoader;
  9652. use Composer\Pcre\Preg;
  9653. use Composer\Plugin\CommandEvent;
  9654. use Composer\Plugin\PluginEvents;
  9655. use Composer\Package\Version\VersionParser;
  9656. use Composer\Semver\Intervals;
  9657. use Composer\Util\HttpDownloader;
  9658. use Composer\Advisory\Auditor;
  9659. use Symfony\Component\Console\Helper\Table;
  9660. use Symfony\Component\Console\Input\InputInterface;
  9661. use Composer\Console\Input\InputOption;
  9662. use Composer\Console\Input\InputArgument;
  9663. use Symfony\Component\Console\Output\OutputInterface;
  9664. use Symfony\Component\Console\Question\Question;
  9665. class UpdateCommand extends BaseCommand
  9666. {
  9667. use CompletionTrait;
  9668. protected function configure()
  9669. {
  9670. $this
  9671. ->setName('update')
  9672. ->setAliases(['u', 'upgrade'])
  9673. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file')
  9674. ->setDefinition([
  9675. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.', null, $this->suggestInstalledPackage(false)),
  9676. new InputOption('with', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Temporary version constraint to add, e.g. foo/bar:1.0.0 or foo/bar=1.0.0'),
  9677. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  9678. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  9679. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  9680. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  9681. new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
  9682. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  9683. new InputOption('lock', null, InputOption::VALUE_NONE, 'Overwrites the lock file hash to suppress warning about the lock file being out of date without updating package versions. Package metadata like mirrors and URLs are updated if they changed.'),
  9684. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  9685. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  9686. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  9687. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  9688. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  9689. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  9690. new InputOption('with-dependencies', 'w', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, except those which are root requirements.'),
  9691. new InputOption('with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, including those which are root requirements.'),
  9692. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  9693. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  9694. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  9695. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  9696. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  9697. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  9698. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  9699. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies (can also be set via the COMPOSER_PREFER_STABLE=1 env var).'),
  9700. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies (can also be set via the COMPOSER_PREFER_LOWEST=1 env var).'),
  9701. new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During a partial update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'),
  9702. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  9703. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  9704. ])
  9705. ->setHelp(
  9706. <<<EOT
  9707. The <info>update</info> command reads the composer.json file from the
  9708. current directory, processes it, and updates, removes or installs all the
  9709. dependencies.
  9710. <info>php composer.phar update</info>
  9711. To limit the update operation to a few packages, you can list the package(s)
  9712. you want to update as such:
  9713. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  9714. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  9715. from a specific vendor:
  9716. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  9717. To run an update with more restrictive constraints you can use:
  9718. <info>php composer.phar update --with vendor/package:1.0.*</info>
  9719. To run a partial update with more restrictive constraints you can use the shorthand:
  9720. <info>php composer.phar update vendor/package:1.0.*</info>
  9721. To select packages names interactively with auto-completion use <info>-i</info>.
  9722. Read more at https://getcomposer.org/doc/03-cli.md#update-u-upgrade
  9723. EOT
  9724. )
  9725. ;
  9726. }
  9727. protected function execute(InputInterface $input, OutputInterface $output): int
  9728. {
  9729. $io = $this->getIO();
  9730. if ($input->getOption('dev')) {
  9731. $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
  9732. }
  9733. if ($input->getOption('no-suggest')) {
  9734. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  9735. }
  9736. $composer = $this->requireComposer();
  9737. if (!HttpDownloader::isCurlEnabled()) {
  9738. $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
  9739. }
  9740. $packages = $input->getArgument('packages');
  9741. $reqs = $this->formatRequirements($input->getOption('with'));
  9742. if (count($packages) > 0) {
  9743. $allowlistPackagesWithRequirements = array_filter($packages, static function ($pkg): bool {
  9744. return Preg::isMatch('{\S+[ =:]\S+}', $pkg);
  9745. });
  9746. foreach ($this->formatRequirements($allowlistPackagesWithRequirements) as $package => $constraint) {
  9747. $reqs[$package] = $constraint;
  9748. }
  9749. foreach ($allowlistPackagesWithRequirements as $package) {
  9750. $packageName = Preg::replace('{^([^ =:]+)[ =:].*$}', '$1', $package);
  9751. $index = array_search($package, $packages);
  9752. $packages[$index] = $packageName;
  9753. }
  9754. }
  9755. $rootPackage = $composer->getPackage();
  9756. $rootPackage->setReferences(RootPackageLoader::extractReferences($reqs, $rootPackage->getReferences()));
  9757. $rootPackage->setStabilityFlags(RootPackageLoader::extractStabilityFlags($reqs, $rootPackage->getMinimumStability(), $rootPackage->getStabilityFlags()));
  9758. $parser = new VersionParser;
  9759. $temporaryConstraints = [];
  9760. $rootRequirements = array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires());
  9761. foreach ($reqs as $package => $constraint) {
  9762. $package = strtolower($package);
  9763. $parsedConstraint = $parser->parseConstraints($constraint);
  9764. $temporaryConstraints[$package] = $parsedConstraint;
  9765. if (isset($rootRequirements[$package]) && !Intervals::haveIntersections($parsedConstraint, $rootRequirements[$package]->getConstraint())) {
  9766. $io->writeError('<error>The temporary constraint "'.$constraint.'" for "'.$package.'" must be a subset of the constraint in your composer.json ('.$rootRequirements[$package]->getPrettyConstraint().')</error>');
  9767. $io->write('<info>Run `composer require '.$package.'` or `composer require '.$package.':'.$constraint.'` instead to replace the constraint</info>');
  9768. return self::FAILURE;
  9769. }
  9770. }
  9771. if ($input->getOption('interactive')) {
  9772. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  9773. }
  9774. if ($input->getOption('root-reqs')) {
  9775. $requires = array_keys($rootPackage->getRequires());
  9776. if (!$input->getOption('no-dev')) {
  9777. $requires = array_merge($requires, array_keys($rootPackage->getDevRequires()));
  9778. }
  9779. if (!empty($packages)) {
  9780. $packages = array_intersect($packages, $requires);
  9781. } else {
  9782. $packages = $requires;
  9783. }
  9784. }
  9785. $filteredPackages = array_filter($packages, static function ($package): bool {
  9786. return !in_array($package, ['lock', 'nothing', 'mirrors'], true);
  9787. });
  9788. $updateMirrors = $input->getOption('lock') || count($filteredPackages) !== count($packages);
  9789. $packages = $filteredPackages;
  9790. if ($updateMirrors && !empty($packages)) {
  9791. $io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>');
  9792. return -1;
  9793. }
  9794. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  9795. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  9796. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  9797. $install = Installer::create($io, $composer);
  9798. $config = $composer->getConfig();
  9799. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  9800. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  9801. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  9802. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  9803. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  9804. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  9805. if ($input->getOption('with-all-dependencies')) {
  9806. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  9807. } elseif ($input->getOption('with-dependencies')) {
  9808. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  9809. }
  9810. $install
  9811. ->setDryRun($input->getOption('dry-run'))
  9812. ->setVerbose($input->getOption('verbose'))
  9813. ->setPreferSource($preferSource)
  9814. ->setPreferDist($preferDist)
  9815. ->setDevMode(!$input->getOption('no-dev'))
  9816. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  9817. ->setOptimizeAutoloader($optimize)
  9818. ->setClassMapAuthoritative($authoritative)
  9819. ->setApcuAutoloader($apcu, $apcuPrefix)
  9820. ->setUpdate(true)
  9821. ->setInstall(!$input->getOption('no-install'))
  9822. ->setUpdateMirrors($updateMirrors)
  9823. ->setUpdateAllowList($packages)
  9824. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  9825. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  9826. ->setPreferStable($input->getOption('prefer-stable'))
  9827. ->setPreferLowest($input->getOption('prefer-lowest'))
  9828. ->setTemporaryConstraints($temporaryConstraints)
  9829. ->setAudit(!$input->getOption('no-audit'))
  9830. ->setAuditFormat($this->getAuditFormat($input))
  9831. ->setMinimalUpdate($input->getOption('minimal-changes'))
  9832. ;
  9833. if ($input->getOption('no-plugins')) {
  9834. $install->disablePlugins();
  9835. }
  9836. return $install->run();
  9837. }
  9838. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages): array
  9839. {
  9840. if (!$input->isInteractive()) {
  9841. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  9842. }
  9843. $requires = array_merge(
  9844. $composer->getPackage()->getRequires(),
  9845. $composer->getPackage()->getDevRequires()
  9846. );
  9847. $autocompleterValues = [];
  9848. foreach ($requires as $require) {
  9849. $target = $require->getTarget();
  9850. $autocompleterValues[strtolower($target)] = $target;
  9851. }
  9852. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  9853. foreach ($installedPackages as $package) {
  9854. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  9855. }
  9856. $helper = $this->getHelper('question');
  9857. $question = new Question('<comment>Enter package name: </comment>', null);
  9858. $io->writeError('<info>Press enter without value to end submission</info>');
  9859. do {
  9860. $autocompleterValues = array_diff($autocompleterValues, $packages);
  9861. $question->setAutocompleterValues($autocompleterValues);
  9862. $addedPackage = $helper->ask($input, $output, $question);
  9863. if (!is_string($addedPackage) || empty($addedPackage)) {
  9864. break;
  9865. }
  9866. $addedPackage = strtolower($addedPackage);
  9867. if (!in_array($addedPackage, $packages)) {
  9868. $packages[] = $addedPackage;
  9869. }
  9870. } while (true);
  9871. $packages = array_filter($packages);
  9872. if (!$packages) {
  9873. throw new \InvalidArgumentException('You must enter minimum one package.');
  9874. }
  9875. $table = new Table($output);
  9876. $table->setHeaders(['Selected packages']);
  9877. foreach ($packages as $package) {
  9878. $table->addRow([$package]);
  9879. }
  9880. $table->render();
  9881. if ($io->askConfirmation(sprintf(
  9882. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  9883. 1 === count($packages) ? '' : 's'
  9884. ))) {
  9885. return $packages;
  9886. }
  9887. throw new \RuntimeException('Installation aborted.');
  9888. }
  9889. }
  9890. <?php declare(strict_types=1);
  9891. namespace Composer\Command;
  9892. use Composer\Factory;
  9893. use Composer\IO\IOInterface;
  9894. use Composer\Package\Loader\ValidatingArrayLoader;
  9895. use Composer\Plugin\CommandEvent;
  9896. use Composer\Plugin\PluginEvents;
  9897. use Composer\Repository\InstalledRepository;
  9898. use Composer\Repository\PlatformRepository;
  9899. use Composer\Util\ConfigValidator;
  9900. use Composer\Util\Filesystem;
  9901. use Symfony\Component\Console\Input\InputArgument;
  9902. use Symfony\Component\Console\Input\InputInterface;
  9903. use Symfony\Component\Console\Input\InputOption;
  9904. use Symfony\Component\Console\Output\OutputInterface;
  9905. class ValidateCommand extends BaseCommand
  9906. {
  9907. protected function configure(): void
  9908. {
  9909. $this
  9910. ->setName('validate')
  9911. ->setDescription('Validates a composer.json and composer.lock')
  9912. ->setDefinition([
  9913. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  9914. new InputOption('check-lock', null, InputOption::VALUE_NONE, 'Check if lock file is up to date (even when config.lock is false)'),
  9915. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  9916. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  9917. new InputOption('no-check-version', null, InputOption::VALUE_NONE, 'Do not report a warning if the version field is present'),
  9918. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  9919. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  9920. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  9921. ])
  9922. ->setHelp(
  9923. <<<EOT
  9924. The validate command validates a given composer.json and composer.lock
  9925. Exit codes in case of errors are:
  9926. 1 validation warning(s), only when --strict is given
  9927. 2 validation error(s)
  9928. 3 file unreadable or missing
  9929. Read more at https://getcomposer.org/doc/03-cli.md#validate
  9930. EOT
  9931. );
  9932. }
  9933. protected function execute(InputInterface $input, OutputInterface $output): int
  9934. {
  9935. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  9936. $io = $this->getIO();
  9937. if (!file_exists($file)) {
  9938. $io->writeError('<error>' . $file . ' not found.</error>');
  9939. return 3;
  9940. }
  9941. if (!Filesystem::isReadable($file)) {
  9942. $io->writeError('<error>' . $file . ' is not readable.</error>');
  9943. return 3;
  9944. }
  9945. $validator = new ConfigValidator($io);
  9946. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  9947. $checkPublish = !$input->getOption('no-check-publish');
  9948. $checkLock = !$input->getOption('no-check-lock');
  9949. $checkVersion = $input->getOption('no-check-version') ? 0 : ConfigValidator::CHECK_VERSION;
  9950. $isStrict = $input->getOption('strict');
  9951. [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);
  9952. $lockErrors = [];
  9953. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  9954. $checkLock = ($checkLock && $composer->getConfig()->get('lock')) || $input->getOption('check-lock');
  9955. $locker = $composer->getLocker();
  9956. if ($locker->isLocked() && !$locker->isFresh()) {
  9957. $lockErrors[] = '- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.';
  9958. }
  9959. if ($locker->isLocked()) {
  9960. $lockErrors = array_merge($lockErrors, $locker->getMissingRequirementInfo($composer->getPackage(), true));
  9961. }
  9962. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  9963. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  9964. if ($input->getOption('with-dependencies')) {
  9965. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  9966. foreach ($localRepo->getPackages() as $package) {
  9967. $path = $composer->getInstallationManager()->getInstallPath($package);
  9968. if (null === $path) {
  9969. continue;
  9970. }
  9971. $file = $path . '/composer.json';
  9972. if (is_dir($path) && file_exists($file)) {
  9973. [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);
  9974. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  9975. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  9976. $exitCode = max($depCode, $exitCode);
  9977. }
  9978. }
  9979. }
  9980. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  9981. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  9982. return max($eventCode, $exitCode);
  9983. }
  9984. private function outputResult(IOInterface $io, string $name, array &$errors, array &$warnings, bool $checkPublish = false, array $publishErrors = [], bool $checkLock = false, array $lockErrors = [], bool $printSchemaUrl = false): void
  9985. {
  9986. $doPrintSchemaUrl = false;
  9987. if ($errors) {
  9988. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  9989. } elseif ($publishErrors) {
  9990. $io->writeError('<info>' . $name . ' is valid for simple usage with Composer but has</info>');
  9991. $io->writeError('<info>strict errors that make it unable to be published as a package</info>');
  9992. $doPrintSchemaUrl = $printSchemaUrl;
  9993. } elseif ($warnings) {
  9994. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  9995. $doPrintSchemaUrl = $printSchemaUrl;
  9996. } elseif ($lockErrors) {
  9997. $io->write('<info>' . $name . ' is valid but your composer.lock has some '.($checkLock ? 'errors' : 'warnings').'</info>');
  9998. } else {
  9999. $io->write('<info>' . $name . ' is valid</info>');
  10000. }
  10001. if ($doPrintSchemaUrl) {
  10002. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  10003. }
  10004. if ($errors) {
  10005. $errors = array_map(static function ($err): string {
  10006. return '- ' . $err;
  10007. }, $errors);
  10008. array_unshift($errors, '# General errors');
  10009. }
  10010. if ($warnings) {
  10011. $warnings = array_map(static function ($err): string {
  10012. return '- ' . $err;
  10013. }, $warnings);
  10014. array_unshift($warnings, '# General warnings');
  10015. }
  10016. $extraWarnings = [];
  10017. if ($publishErrors) {
  10018. $publishErrors = array_map(static function ($err): string {
  10019. return '- ' . $err;
  10020. }, $publishErrors);
  10021. if ($checkPublish) {
  10022. array_unshift($publishErrors, '# Publish errors');
  10023. $errors = array_merge($errors, $publishErrors);
  10024. } else {
  10025. array_unshift($publishErrors, '# Publish warnings');
  10026. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  10027. }
  10028. }
  10029. if ($lockErrors) {
  10030. if ($checkLock) {
  10031. array_unshift($lockErrors, '# Lock file errors');
  10032. $errors = array_merge($errors, $lockErrors);
  10033. } else {
  10034. array_unshift($lockErrors, '# Lock file warnings');
  10035. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  10036. }
  10037. }
  10038. $messages = [
  10039. 'error' => $errors,
  10040. 'warning' => array_merge($warnings, $extraWarnings),
  10041. ];
  10042. foreach ($messages as $style => $msgs) {
  10043. foreach ($msgs as $msg) {
  10044. if (strpos($msg, '#') === 0) {
  10045. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  10046. } else {
  10047. $io->writeError($msg);
  10048. }
  10049. }
  10050. }
  10051. }
  10052. }
  10053. <?php declare(strict_types=1);
  10054. namespace Composer;
  10055. use Composer\Package\Locker;
  10056. use Composer\Pcre\Preg;
  10057. use Composer\Plugin\PluginManager;
  10058. use Composer\Downloader\DownloadManager;
  10059. use Composer\Autoload\AutoloadGenerator;
  10060. use Composer\Package\Archiver\ArchiveManager;
  10061. class Composer extends PartialComposer
  10062. {
  10063. public const VERSION = '2.7.1';
  10064. public const BRANCH_ALIAS_VERSION = '';
  10065. public const RELEASE_DATE = '2024-02-09 15:26:28';
  10066. public const SOURCE_VERSION = '';
  10067. public const RUNTIME_API_VERSION = '2.2.2';
  10068. public static function getVersion(): string
  10069. {
  10070. if (self::VERSION === '@package_version'.'@') {
  10071. return self::SOURCE_VERSION;
  10072. }
  10073. if (self::BRANCH_ALIAS_VERSION !== '' && Preg::isMatch('{^[a-f0-9]{40}$}', self::VERSION)) {
  10074. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  10075. }
  10076. return self::VERSION;
  10077. }
  10078. private $locker;
  10079. private $downloadManager;
  10080. private $pluginManager;
  10081. private $autoloadGenerator;
  10082. private $archiveManager;
  10083. public function setLocker(Locker $locker): void
  10084. {
  10085. $this->locker = $locker;
  10086. }
  10087. public function getLocker(): Locker
  10088. {
  10089. return $this->locker;
  10090. }
  10091. public function setDownloadManager(DownloadManager $manager): void
  10092. {
  10093. $this->downloadManager = $manager;
  10094. }
  10095. public function getDownloadManager(): DownloadManager
  10096. {
  10097. return $this->downloadManager;
  10098. }
  10099. public function setArchiveManager(ArchiveManager $manager): void
  10100. {
  10101. $this->archiveManager = $manager;
  10102. }
  10103. public function getArchiveManager(): ArchiveManager
  10104. {
  10105. return $this->archiveManager;
  10106. }
  10107. public function setPluginManager(PluginManager $manager): void
  10108. {
  10109. $this->pluginManager = $manager;
  10110. }
  10111. public function getPluginManager(): PluginManager
  10112. {
  10113. return $this->pluginManager;
  10114. }
  10115. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator): void
  10116. {
  10117. $this->autoloadGenerator = $autoloadGenerator;
  10118. }
  10119. public function getAutoloadGenerator(): AutoloadGenerator
  10120. {
  10121. return $this->autoloadGenerator;
  10122. }
  10123. }
  10124. <?php declare(strict_types=1);
  10125. namespace Composer;
  10126. use Composer\Advisory\Auditor;
  10127. use Composer\Config\ConfigSourceInterface;
  10128. use Composer\Downloader\TransportException;
  10129. use Composer\IO\IOInterface;
  10130. use Composer\Pcre\Preg;
  10131. use Composer\Util\Platform;
  10132. use Composer\Util\ProcessExecutor;
  10133. class Config
  10134. {
  10135. public const SOURCE_DEFAULT = 'default';
  10136. public const SOURCE_COMMAND = 'command';
  10137. public const SOURCE_UNKNOWN = 'unknown';
  10138. public const RELATIVE_PATHS = 1;
  10139. public static $defaultConfig = [
  10140. 'process-timeout' => 300,
  10141. 'use-include-path' => false,
  10142. 'allow-plugins' => [],
  10143. 'use-parent-dir' => 'prompt',
  10144. 'preferred-install' => 'dist',
  10145. 'audit' => ['ignore' => [], 'abandoned' => Auditor::ABANDONED_FAIL],
  10146. 'notify-on-install' => true,
  10147. 'github-protocols' => ['https', 'ssh', 'git'],
  10148. 'gitlab-protocol' => null,
  10149. 'vendor-dir' => 'vendor',
  10150. 'bin-dir' => '{$vendor-dir}/bin',
  10151. 'cache-dir' => '{$home}/cache',
  10152. 'data-dir' => '{$home}',
  10153. 'cache-files-dir' => '{$cache-dir}/files',
  10154. 'cache-repo-dir' => '{$cache-dir}/repo',
  10155. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  10156. 'cache-ttl' => 15552000,
  10157. 'cache-files-ttl' => null,
  10158. 'cache-files-maxsize' => '300MiB',
  10159. 'cache-read-only' => false,
  10160. 'bin-compat' => 'auto',
  10161. 'discard-changes' => false,
  10162. 'autoloader-suffix' => null,
  10163. 'sort-packages' => false,
  10164. 'optimize-autoloader' => false,
  10165. 'classmap-authoritative' => false,
  10166. 'apcu-autoloader' => false,
  10167. 'prepend-autoloader' => true,
  10168. 'github-domains' => ['github.com'],
  10169. 'bitbucket-expose-hostname' => true,
  10170. 'disable-tls' => false,
  10171. 'secure-http' => true,
  10172. 'secure-svn-domains' => [],
  10173. 'cafile' => null,
  10174. 'capath' => null,
  10175. 'github-expose-hostname' => true,
  10176. 'gitlab-domains' => ['gitlab.com'],
  10177. 'store-auths' => 'prompt',
  10178. 'platform' => [],
  10179. 'archive-format' => 'tar',
  10180. 'archive-dir' => '.',
  10181. 'htaccess-protect' => true,
  10182. 'use-github-api' => true,
  10183. 'lock' => true,
  10184. 'platform-check' => 'php-only',
  10185. 'bitbucket-oauth' => [],
  10186. 'github-oauth' => [],
  10187. 'gitlab-oauth' => [],
  10188. 'gitlab-token' => [],
  10189. 'http-basic' => [],
  10190. 'bearer' => [],
  10191. ];
  10192. public static $defaultRepositories = [
  10193. 'packagist.org' => [
  10194. 'type' => 'composer',
  10195. 'url' => 'https://repo.packagist.org',
  10196. ],
  10197. ];
  10198. private $config;
  10199. private $baseDir;
  10200. private $repositories;
  10201. private $configSource;
  10202. private $authConfigSource;
  10203. private $localAuthConfigSource = null;
  10204. private $useEnvironment;
  10205. private $warnedHosts = [];
  10206. private $sslVerifyWarnedHosts = [];
  10207. private $sourceOfConfigValue = [];
  10208. public function __construct(bool $useEnvironment = true, ?string $baseDir = null)
  10209. {
  10210. $this->config = static::$defaultConfig;
  10211. $this->repositories = static::$defaultRepositories;
  10212. $this->useEnvironment = (bool) $useEnvironment;
  10213. $this->baseDir = is_string($baseDir) && '' !== $baseDir ? $baseDir : null;
  10214. foreach ($this->config as $configKey => $configValue) {
  10215. $this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
  10216. }
  10217. foreach ($this->repositories as $configKey => $configValue) {
  10218. $this->setSourceOfConfigValue($configValue, 'repositories.' . $configKey, self::SOURCE_DEFAULT);
  10219. }
  10220. }
  10221. public function setConfigSource(ConfigSourceInterface $source): void
  10222. {
  10223. $this->configSource = $source;
  10224. }
  10225. public function getConfigSource(): ConfigSourceInterface
  10226. {
  10227. return $this->configSource;
  10228. }
  10229. public function setAuthConfigSource(ConfigSourceInterface $source): void
  10230. {
  10231. $this->authConfigSource = $source;
  10232. }
  10233. public function getAuthConfigSource(): ConfigSourceInterface
  10234. {
  10235. return $this->authConfigSource;
  10236. }
  10237. public function setLocalAuthConfigSource(ConfigSourceInterface $source): void
  10238. {
  10239. $this->localAuthConfigSource = $source;
  10240. }
  10241. public function getLocalAuthConfigSource(): ?ConfigSourceInterface
  10242. {
  10243. return $this->localAuthConfigSource;
  10244. }
  10245. public function merge(array $config, string $source = self::SOURCE_UNKNOWN): void
  10246. {
  10247. if (!empty($config['config']) && is_array($config['config'])) {
  10248. foreach ($config['config'] as $key => $val) {
  10249. if (in_array($key, ['bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer'], true) && isset($this->config[$key])) {
  10250. $this->config[$key] = array_merge($this->config[$key], $val);
  10251. $this->setSourceOfConfigValue($val, $key, $source);
  10252. } elseif (in_array($key, ['allow-plugins'], true) && isset($this->config[$key]) && is_array($this->config[$key]) && is_array($val)) {
  10253. $this->config[$key] = array_merge($val, $this->config[$key], $val);
  10254. $this->setSourceOfConfigValue($val, $key, $source);
  10255. } elseif (in_array($key, ['gitlab-domains', 'github-domains'], true) && isset($this->config[$key])) {
  10256. $this->config[$key] = array_unique(array_merge($this->config[$key], $val));
  10257. $this->setSourceOfConfigValue($val, $key, $source);
  10258. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  10259. if (is_array($val) || is_array($this->config[$key])) {
  10260. if (is_string($val)) {
  10261. $val = ['*' => $val];
  10262. }
  10263. if (is_string($this->config[$key])) {
  10264. $this->config[$key] = ['*' => $this->config[$key]];
  10265. $this->sourceOfConfigValue[$key . '*'] = $source;
  10266. }
  10267. $this->config[$key] = array_merge($this->config[$key], $val);
  10268. $this->setSourceOfConfigValue($val, $key, $source);
  10269. if (isset($this->config[$key]['*'])) {
  10270. $wildcard = $this->config[$key]['*'];
  10271. unset($this->config[$key]['*']);
  10272. $this->config[$key]['*'] = $wildcard;
  10273. }
  10274. } else {
  10275. $this->config[$key] = $val;
  10276. $this->setSourceOfConfigValue($val, $key, $source);
  10277. }
  10278. } elseif ('audit' === $key) {
  10279. $currentIgnores = $this->config['audit']['ignore'];
  10280. $this->config[$key] = array_merge($this->config['audit'], $val);
  10281. $this->setSourceOfConfigValue($val, $key, $source);
  10282. $this->config['audit']['ignore'] = array_merge($currentIgnores, $val['ignore'] ?? []);
  10283. } else {
  10284. $this->config[$key] = $val;
  10285. $this->setSourceOfConfigValue($val, $key, $source);
  10286. }
  10287. }
  10288. }
  10289. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  10290. $this->repositories = array_reverse($this->repositories, true);
  10291. $newRepos = array_reverse($config['repositories'], true);
  10292. foreach ($newRepos as $name => $repository) {
  10293. if (false === $repository) {
  10294. $this->disableRepoByName((string) $name);
  10295. continue;
  10296. }
  10297. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  10298. $this->disableRepoByName((string) key($repository));
  10299. continue;
  10300. }
  10301. if (isset($repository['type'], $repository['url']) && $repository['type'] === 'composer' && Preg::isMatch('{^https?://(?:[a-z0-9-.]+\.)?packagist.org(/|$)}', $repository['url'])) {
  10302. $this->disableRepoByName('packagist.org');
  10303. }
  10304. if (is_int($name)) {
  10305. $this->repositories[] = $repository;
  10306. $this->setSourceOfConfigValue($repository, 'repositories.' . array_search($repository, $this->repositories, true), $source);
  10307. } else {
  10308. if ($name === 'packagist') {
  10309. $this->repositories[$name . '.org'] = $repository;
  10310. $this->setSourceOfConfigValue($repository, 'repositories.' . $name . '.org', $source);
  10311. } else {
  10312. $this->repositories[$name] = $repository;
  10313. $this->setSourceOfConfigValue($repository, 'repositories.' . $name, $source);
  10314. }
  10315. }
  10316. }
  10317. $this->repositories = array_reverse($this->repositories, true);
  10318. }
  10319. }
  10320. public function getRepositories(): array
  10321. {
  10322. return $this->repositories;
  10323. }
  10324. public function get(string $key, int $flags = 0)
  10325. {
  10326. switch ($key) {
  10327. case 'vendor-dir':
  10328. case 'bin-dir':
  10329. case 'process-timeout':
  10330. case 'data-dir':
  10331. case 'cache-dir':
  10332. case 'cache-files-dir':
  10333. case 'cache-repo-dir':
  10334. case 'cache-vcs-dir':
  10335. case 'cafile':
  10336. case 'capath':
  10337. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  10338. $val = $this->getComposerEnv($env);
  10339. if ($val !== false) {
  10340. $this->setSourceOfConfigValue($val, $key, $env);
  10341. }
  10342. if ($key === 'process-timeout') {
  10343. return max(0, false !== $val ? (int) $val : $this->config[$key]);
  10344. }
  10345. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  10346. $val = Platform::expandPath($val);
  10347. if (substr($key, -4) !== '-dir') {
  10348. return $val;
  10349. }
  10350. return (($flags & self::RELATIVE_PATHS) === self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  10351. case 'cache-read-only':
  10352. case 'htaccess-protect':
  10353. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  10354. $val = $this->getComposerEnv($env);
  10355. if (false === $val) {
  10356. $val = $this->config[$key];
  10357. } else {
  10358. $this->setSourceOfConfigValue($val, $key, $env);
  10359. }
  10360. return $val !== 'false' && (bool) $val;
  10361. case 'disable-tls':
  10362. case 'secure-http':
  10363. case 'use-github-api':
  10364. case 'lock':
  10365. if ($key === 'secure-http' && $this->get('disable-tls') === true) {
  10366. return false;
  10367. }
  10368. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  10369. case 'cache-ttl':
  10370. return max(0, (int) $this->config[$key]);
  10371. case 'cache-files-maxsize':
  10372. if (!Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', (string) $this->config[$key], $matches)) {
  10373. throw new \RuntimeException(
  10374. "Could not parse the value of '$key': {$this->config[$key]}"
  10375. );
  10376. }
  10377. $size = (float) $matches[1];
  10378. if (isset($matches[2])) {
  10379. switch (strtolower($matches[2])) {
  10380. case 'g':
  10381. $size *= 1024;
  10382. case 'm':
  10383. $size *= 1024;
  10384. case 'k':
  10385. $size *= 1024;
  10386. break;
  10387. }
  10388. }
  10389. return max(0, (int) $size);
  10390. case 'cache-files-ttl':
  10391. if (isset($this->config[$key])) {
  10392. return max(0, (int) $this->config[$key]);
  10393. }
  10394. return $this->get('cache-ttl');
  10395. case 'home':
  10396. return rtrim($this->process(Platform::expandPath($this->config[$key]), $flags), '/\\');
  10397. case 'bin-compat':
  10398. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  10399. if (!in_array($value, ['auto', 'full', 'proxy', 'symlink'])) {
  10400. throw new \RuntimeException(
  10401. "Invalid value for 'bin-compat': {$value}. Expected auto, full or proxy"
  10402. );
  10403. }
  10404. if ($value === 'symlink') {
  10405. trigger_error('config.bin-compat "symlink" is deprecated since Composer 2.2, use auto, full (for Windows compatibility) or proxy instead.', E_USER_DEPRECATED);
  10406. }
  10407. return $value;
  10408. case 'discard-changes':
  10409. $env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES');
  10410. if ($env !== false) {
  10411. if (!in_array($env, ['stash', 'true', 'false', '1', '0'], true)) {
  10412. throw new \RuntimeException(
  10413. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  10414. );
  10415. }
  10416. if ('stash' === $env) {
  10417. return 'stash';
  10418. }
  10419. return $env !== 'false' && (bool) $env;
  10420. }
  10421. if (!in_array($this->config[$key], [true, false, 'stash'], true)) {
  10422. throw new \RuntimeException(
  10423. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  10424. );
  10425. }
  10426. return $this->config[$key];
  10427. case 'github-protocols':
  10428. $protos = $this->config['github-protocols'];
  10429. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  10430. unset($protos[$index]);
  10431. }
  10432. if (reset($protos) === 'http') {
  10433. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  10434. }
  10435. return $protos;
  10436. case 'autoloader-suffix':
  10437. if ($this->config[$key] === '') {
  10438. return null;
  10439. }
  10440. return $this->process($this->config[$key], $flags);
  10441. case 'audit':
  10442. $result = $this->config[$key];
  10443. $abandonedEnv = $this->getComposerEnv('COMPOSER_AUDIT_ABANDONED');
  10444. if (false !== $abandonedEnv) {
  10445. if (!in_array($abandonedEnv, $validChoices = [Auditor::ABANDONED_IGNORE, Auditor::ABANDONED_REPORT, Auditor::ABANDONED_FAIL], true)) {
  10446. throw new \RuntimeException(
  10447. "Invalid value for COMPOSER_AUDIT_ABANDONED: {$abandonedEnv}. Expected ".Auditor::ABANDONED_IGNORE.", ".Auditor::ABANDONED_REPORT." or ".Auditor::ABANDONED_FAIL
  10448. );
  10449. }
  10450. $result['abandoned'] = $abandonedEnv;
  10451. }
  10452. return $result;
  10453. default:
  10454. if (!isset($this->config[$key])) {
  10455. return null;
  10456. }
  10457. return $this->process($this->config[$key], $flags);
  10458. }
  10459. }
  10460. public function all(int $flags = 0): array
  10461. {
  10462. $all = [
  10463. 'repositories' => $this->getRepositories(),
  10464. ];
  10465. foreach (array_keys($this->config) as $key) {
  10466. $all['config'][$key] = $this->get($key, $flags);
  10467. }
  10468. return $all;
  10469. }
  10470. public function getSourceOfValue(string $key): string
  10471. {
  10472. $this->get($key);
  10473. return $this->sourceOfConfigValue[$key] ?? self::SOURCE_UNKNOWN;
  10474. }
  10475. private function setSourceOfConfigValue($configValue, string $path, string $source): void
  10476. {
  10477. $this->sourceOfConfigValue[$path] = $source;
  10478. if (is_array($configValue)) {
  10479. foreach ($configValue as $key => $value) {
  10480. $this->setSourceOfConfigValue($value, $path . '.' . $key, $source);
  10481. }
  10482. }
  10483. }
  10484. public function raw(): array
  10485. {
  10486. return [
  10487. 'repositories' => $this->getRepositories(),
  10488. 'config' => $this->config,
  10489. ];
  10490. }
  10491. public function has(string $key): bool
  10492. {
  10493. return array_key_exists($key, $this->config);
  10494. }
  10495. private function process($value, int $flags)
  10496. {
  10497. if (!is_string($value)) {
  10498. return $value;
  10499. }
  10500. return Preg::replaceCallback('#\{\$(.+)\}#', function ($match) use ($flags) {
  10501. assert(is_string($match[1]));
  10502. return $this->get($match[1], $flags);
  10503. }, $value);
  10504. }
  10505. private function realpath(string $path): string
  10506. {
  10507. if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://|\\\\\\\\)}i', $path)) {
  10508. return $path;
  10509. }
  10510. return $this->baseDir ? $this->baseDir . '/' . $path : $path;
  10511. }
  10512. private function getComposerEnv(string $var)
  10513. {
  10514. if ($this->useEnvironment) {
  10515. return Platform::getEnv($var);
  10516. }
  10517. return false;
  10518. }
  10519. private function disableRepoByName(string $name): void
  10520. {
  10521. if (isset($this->repositories[$name])) {
  10522. unset($this->repositories[$name]);
  10523. } elseif ($name === 'packagist') {
  10524. unset($this->repositories['packagist.org']);
  10525. }
  10526. }
  10527. public function prohibitUrlByConfig(string $url, ?IOInterface $io = null, array $repoOptions = []): void
  10528. {
  10529. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  10530. return;
  10531. }
  10532. $scheme = parse_url($url, PHP_URL_SCHEME);
  10533. $hostname = parse_url($url, PHP_URL_HOST);
  10534. if (in_array($scheme, ['http', 'git', 'ftp', 'svn'])) {
  10535. if ($this->get('secure-http')) {
  10536. if ($scheme === 'svn') {
  10537. if (in_array($hostname, $this->get('secure-svn-domains'), true)) {
  10538. return;
  10539. }
  10540. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-svn-domains for details.");
  10541. }
  10542. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  10543. }
  10544. if ($io !== null) {
  10545. if (is_string($hostname)) {
  10546. if (!isset($this->warnedHosts[$hostname])) {
  10547. $io->writeError("<warning>Warning: Accessing $hostname over $scheme which is an insecure protocol.</warning>");
  10548. }
  10549. $this->warnedHosts[$hostname] = true;
  10550. }
  10551. }
  10552. }
  10553. if ($io !== null && is_string($hostname) && !isset($this->sslVerifyWarnedHosts[$hostname])) {
  10554. $warning = null;
  10555. if (isset($repoOptions['ssl']['verify_peer']) && !(bool) $repoOptions['ssl']['verify_peer']) {
  10556. $warning = 'verify_peer';
  10557. }
  10558. if (isset($repoOptions['ssl']['verify_peer_name']) && !(bool) $repoOptions['ssl']['verify_peer_name']) {
  10559. $warning = $warning === null ? 'verify_peer_name' : $warning . ' and verify_peer_name';
  10560. }
  10561. if ($warning !== null) {
  10562. $io->writeError("<warning>Warning: Accessing $hostname with $warning disabled.</warning>");
  10563. $this->sslVerifyWarnedHosts[$hostname] = true;
  10564. }
  10565. }
  10566. }
  10567. public static function disableProcessTimeout(): void
  10568. {
  10569. ProcessExecutor::setTimeout(0);
  10570. }
  10571. }
  10572. <?php declare(strict_types=1);
  10573. namespace Composer\Config;
  10574. interface ConfigSourceInterface
  10575. {
  10576. public function addRepository(string $name, $config, bool $append = true): void;
  10577. public function removeRepository(string $name): void;
  10578. public function addConfigSetting(string $name, $value): void;
  10579. public function removeConfigSetting(string $name): void;
  10580. public function addProperty(string $name, $value): void;
  10581. public function removeProperty(string $name): void;
  10582. public function addLink(string $type, string $name, string $value): void;
  10583. public function removeLink(string $type, string $name): void;
  10584. public function getName(): string;
  10585. }
  10586. <?php declare(strict_types=1);
  10587. namespace Composer\Config;
  10588. use Composer\Json\JsonFile;
  10589. use Composer\Json\JsonManipulator;
  10590. use Composer\Json\JsonValidationException;
  10591. use Composer\Pcre\Preg;
  10592. use Composer\Util\Filesystem;
  10593. use Composer\Util\Silencer;
  10594. class JsonConfigSource implements ConfigSourceInterface
  10595. {
  10596. private $file;
  10597. private $authConfig;
  10598. public function __construct(JsonFile $file, bool $authConfig = false)
  10599. {
  10600. $this->file = $file;
  10601. $this->authConfig = $authConfig;
  10602. }
  10603. public function getName(): string
  10604. {
  10605. return $this->file->getPath();
  10606. }
  10607. public function addRepository(string $name, $config, bool $append = true): void
  10608. {
  10609. $this->manipulateJson('addRepository', static function (&$config, $repo, $repoConfig) use ($append): void {
  10610. if (isset($config['repositories'])) {
  10611. foreach ($config['repositories'] as $index => $val) {
  10612. if ($index === $repo) {
  10613. continue;
  10614. }
  10615. if (is_numeric($index) && ($val === ['packagist' => false] || $val === ['packagist.org' => false])) {
  10616. unset($config['repositories'][$index]);
  10617. $config['repositories']['packagist.org'] = false;
  10618. break;
  10619. }
  10620. }
  10621. }
  10622. if ($append) {
  10623. $config['repositories'][$repo] = $repoConfig;
  10624. } else {
  10625. $config['repositories'] = [$repo => $repoConfig] + $config['repositories'];
  10626. }
  10627. }, $name, $config, $append);
  10628. }
  10629. public function removeRepository(string $name): void
  10630. {
  10631. $this->manipulateJson('removeRepository', static function (&$config, $repo): void {
  10632. unset($config['repositories'][$repo]);
  10633. }, $name);
  10634. }
  10635. public function addConfigSetting(string $name, $value): void
  10636. {
  10637. $authConfig = $this->authConfig;
  10638. $this->manipulateJson('addConfigSetting', static function (&$config, $key, $val) use ($authConfig): void {
  10639. if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  10640. [$key, $host] = explode('.', $key, 2);
  10641. if ($authConfig) {
  10642. $config[$key][$host] = $val;
  10643. } else {
  10644. $config['config'][$key][$host] = $val;
  10645. }
  10646. } else {
  10647. $config['config'][$key] = $val;
  10648. }
  10649. }, $name, $value);
  10650. }
  10651. public function removeConfigSetting(string $name): void
  10652. {
  10653. $authConfig = $this->authConfig;
  10654. $this->manipulateJson('removeConfigSetting', static function (&$config, $key) use ($authConfig): void {
  10655. if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  10656. [$key, $host] = explode('.', $key, 2);
  10657. if ($authConfig) {
  10658. unset($config[$key][$host]);
  10659. } else {
  10660. unset($config['config'][$key][$host]);
  10661. }
  10662. } else {
  10663. unset($config['config'][$key]);
  10664. }
  10665. }, $name);
  10666. }
  10667. public function addProperty(string $name, $value): void
  10668. {
  10669. $this->manipulateJson('addProperty', static function (&$config, $key, $val): void {
  10670. if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
  10671. $bits = explode('.', $key);
  10672. $last = array_pop($bits);
  10673. $arr = &$config[reset($bits)];
  10674. foreach ($bits as $bit) {
  10675. if (!isset($arr[$bit])) {
  10676. $arr[$bit] = [];
  10677. }
  10678. $arr = &$arr[$bit];
  10679. }
  10680. $arr[$last] = $val;
  10681. } else {
  10682. $config[$key] = $val;
  10683. }
  10684. }, $name, $value);
  10685. }
  10686. public function removeProperty(string $name): void
  10687. {
  10688. $this->manipulateJson('removeProperty', static function (&$config, $key): void {
  10689. if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
  10690. $bits = explode('.', $key);
  10691. $last = array_pop($bits);
  10692. $arr = &$config[reset($bits)];
  10693. foreach ($bits as $bit) {
  10694. if (!isset($arr[$bit])) {
  10695. return;
  10696. }
  10697. $arr = &$arr[$bit];
  10698. }
  10699. unset($arr[$last]);
  10700. } else {
  10701. unset($config[$key]);
  10702. }
  10703. }, $name);
  10704. }
  10705. public function addLink(string $type, string $name, string $value): void
  10706. {
  10707. $this->manipulateJson('addLink', static function (&$config, $type, $name, $value): void {
  10708. $config[$type][$name] = $value;
  10709. }, $type, $name, $value);
  10710. }
  10711. public function removeLink(string $type, string $name): void
  10712. {
  10713. $this->manipulateJson('removeSubNode', static function (&$config, $type, $name): void {
  10714. unset($config[$type][$name]);
  10715. }, $type, $name);
  10716. $this->manipulateJson('removeMainKeyIfEmpty', static function (&$config, $type): void {
  10717. if (0 === count($config[$type])) {
  10718. unset($config[$type]);
  10719. }
  10720. }, $type);
  10721. }
  10722. private function manipulateJson(string $method, callable $fallback, ...$args): void
  10723. {
  10724. if ($this->file->exists()) {
  10725. if (!is_writable($this->file->getPath())) {
  10726. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  10727. }
  10728. if (!Filesystem::isReadable($this->file->getPath())) {
  10729. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  10730. }
  10731. $contents = file_get_contents($this->file->getPath());
  10732. } elseif ($this->authConfig) {
  10733. $contents = "{\n}\n";
  10734. } else {
  10735. $contents = "{\n \"config\": {\n }\n}\n";
  10736. }
  10737. $manipulator = new JsonManipulator($contents);
  10738. $newFile = !$this->file->exists();
  10739. if ($this->authConfig && $method === 'addConfigSetting') {
  10740. $method = 'addSubNode';
  10741. [$mainNode, $name] = explode('.', $args[0], 2);
  10742. $args = [$mainNode, $name, $args[1]];
  10743. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  10744. $method = 'removeSubNode';
  10745. [$mainNode, $name] = explode('.', $args[0], 2);
  10746. $args = [$mainNode, $name];
  10747. }
  10748. if (call_user_func_array([$manipulator, $method], $args)) {
  10749. file_put_contents($this->file->getPath(), $manipulator->getContents());
  10750. } else {
  10751. $config = $this->file->read();
  10752. $this->arrayUnshiftRef($args, $config);
  10753. $fallback(...$args);
  10754. foreach (['require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev', 'scripts', 'scripts-descriptions', 'scripts-aliases', 'support'] as $prop) {
  10755. if (isset($config[$prop]) && $config[$prop] === []) {
  10756. $config[$prop] = new \stdClass;
  10757. }
  10758. }
  10759. foreach (['psr-0', 'psr-4'] as $prop) {
  10760. if (isset($config['autoload'][$prop]) && $config['autoload'][$prop] === []) {
  10761. $config['autoload'][$prop] = new \stdClass;
  10762. }
  10763. if (isset($config['autoload-dev'][$prop]) && $config['autoload-dev'][$prop] === []) {
  10764. $config['autoload-dev'][$prop] = new \stdClass;
  10765. }
  10766. }
  10767. foreach (['platform', 'http-basic', 'bearer', 'gitlab-token', 'gitlab-oauth', 'github-oauth', 'preferred-install'] as $prop) {
  10768. if (isset($config['config'][$prop]) && $config['config'][$prop] === []) {
  10769. $config['config'][$prop] = new \stdClass;
  10770. }
  10771. }
  10772. $this->file->write($config);
  10773. }
  10774. try {
  10775. $this->file->validateSchema(JsonFile::LAX_SCHEMA);
  10776. } catch (JsonValidationException $e) {
  10777. file_put_contents($this->file->getPath(), $contents);
  10778. throw new \RuntimeException('Failed to update composer.json with a valid format, reverting to the original content. Please report an issue to us with details (command you run and a copy of your composer.json). '.PHP_EOL.implode(PHP_EOL, $e->getErrors()), 0, $e);
  10779. }
  10780. if ($newFile) {
  10781. Silencer::call('chmod', $this->file->getPath(), 0600);
  10782. }
  10783. }
  10784. private function arrayUnshiftRef(array &$array, &$value): int
  10785. {
  10786. $return = array_unshift($array, '');
  10787. $array[0] = &$value;
  10788. return $return;
  10789. }
  10790. }
  10791. <?php declare(strict_types=1);
  10792. namespace Composer\Console;
  10793. use Composer\IO\NullIO;
  10794. use Composer\Util\Filesystem;
  10795. use Composer\Util\Platform;
  10796. use Composer\Util\Silencer;
  10797. use LogicException;
  10798. use RuntimeException;
  10799. use Seld\Signal\SignalHandler;
  10800. use Symfony\Component\Console\Application as BaseApplication;
  10801. use Symfony\Component\Console\Exception\CommandNotFoundException;
  10802. use Symfony\Component\Console\Helper\HelperSet;
  10803. use Symfony\Component\Console\Helper\QuestionHelper;
  10804. use Symfony\Component\Console\Input\InputDefinition;
  10805. use Symfony\Component\Console\Input\InputInterface;
  10806. use Symfony\Component\Console\Input\InputOption;
  10807. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  10808. use Symfony\Component\Console\Output\OutputInterface;
  10809. use Seld\JsonLint\ParsingException;
  10810. use Composer\Command;
  10811. use Composer\Composer;
  10812. use Composer\Factory;
  10813. use Composer\IO\IOInterface;
  10814. use Composer\IO\ConsoleIO;
  10815. use Composer\Json\JsonValidationException;
  10816. use Composer\Util\ErrorHandler;
  10817. use Composer\Util\HttpDownloader;
  10818. use Composer\EventDispatcher\ScriptExecutionException;
  10819. use Composer\Exception\NoSslException;
  10820. use Composer\XdebugHandler\XdebugHandler;
  10821. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  10822. class Application extends BaseApplication
  10823. {
  10824. protected $composer;
  10825. protected $io;
  10826. private static $logo = ' ______
  10827. / ____/___ ____ ___ ____ ____ ________ _____
  10828. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  10829. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  10830. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  10831. /_/
  10832. ';
  10833. private $hasPluginCommands = false;
  10834. private $disablePluginsByDefault = false;
  10835. private $disableScriptsByDefault = false;
  10836. private $initialWorkingDirectory;
  10837. private $signalHandler;
  10838. public function __construct(string $name = 'Composer', string $version = '')
  10839. {
  10840. if (method_exists($this, 'setCatchErrors')) {
  10841. $this->setCatchErrors(true);
  10842. }
  10843. static $shutdownRegistered = false;
  10844. if ($version === '') {
  10845. $version = Composer::getVersion();
  10846. }
  10847. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  10848. ini_set('xdebug.show_exception_trace', '0');
  10849. ini_set('xdebug.scream', '0');
  10850. }
  10851. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  10852. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  10853. }
  10854. $this->io = new NullIO();
  10855. $this->signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) {
  10856. $this->io->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  10857. $handler->exitWithLastSignal();
  10858. });
  10859. if (!$shutdownRegistered) {
  10860. $shutdownRegistered = true;
  10861. register_shutdown_function(static function (): void {
  10862. $lastError = error_get_last();
  10863. if ($lastError && $lastError['message'] &&
  10864. (strpos($lastError['message'], 'Allowed memory') !== false ||
  10865. strpos($lastError['message'], 'exceeded memory') !== false )) {
  10866. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  10867. }
  10868. });
  10869. }
  10870. $this->initialWorkingDirectory = getcwd();
  10871. parent::__construct($name, $version);
  10872. }
  10873. public function __destruct()
  10874. {
  10875. $this->signalHandler->unregister();
  10876. }
  10877. public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
  10878. {
  10879. if (null === $output) {
  10880. $output = Factory::createOutput();
  10881. }
  10882. return parent::run($input, $output);
  10883. }
  10884. public function doRun(InputInterface $input, OutputInterface $output): int
  10885. {
  10886. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  10887. $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
  10888. $stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r');
  10889. if (Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') !== '1' && (Platform::getEnv('COMPOSER_NO_INTERACTION') || $stdin === false || !Platform::isTty($stdin))) {
  10890. $input->setInteractive(false);
  10891. }
  10892. $io = $this->io = new ConsoleIO($input, $output, new HelperSet([
  10893. new QuestionHelper(),
  10894. ]));
  10895. ErrorHandler::register($io);
  10896. if ($input->hasParameterOption('--no-cache')) {
  10897. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  10898. Platform::putEnv('COMPOSER_CACHE_DIR', Platform::isWindows() ? 'nul' : '/dev/null');
  10899. }
  10900. $newWorkDir = $this->getNewWorkingDir($input);
  10901. if (null !== $newWorkDir) {
  10902. $oldWorkingDir = Platform::getCwd(true);
  10903. chdir($newWorkDir);
  10904. $this->initialWorkingDirectory = $newWorkDir;
  10905. $cwd = Platform::getCwd(true);
  10906. $io->writeError('Changed CWD to ' . ($cwd !== '' ? $cwd : $newWorkDir), true, IOInterface::DEBUG);
  10907. }
  10908. $commandName = '';
  10909. if ($name = $this->getCommandName($input)) {
  10910. try {
  10911. $commandName = $this->find($name)->getName();
  10912. } catch (CommandNotFoundException $e) {
  10913. $commandName = false;
  10914. } catch (\InvalidArgumentException $e) {
  10915. }
  10916. }
  10917. if ($io->isInteractive() && null === $newWorkDir && !in_array($commandName, ['', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'], true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) {
  10918. $dir = dirname(Platform::getCwd(true));
  10919. $home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
  10920. while (dirname($dir) !== $dir && $dir !== $home) {
  10921. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  10922. if ($useParentDirIfNoJsonAvailable === true || $io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ')) {
  10923. if ($useParentDirIfNoJsonAvailable === true) {
  10924. $io->writeError('<info>No composer.json in current directory, changing working directory to '.$dir.'</info>');
  10925. } else {
  10926. $io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
  10927. }
  10928. $oldWorkingDir = Platform::getCwd(true);
  10929. chdir($dir);
  10930. }
  10931. break;
  10932. }
  10933. $dir = dirname($dir);
  10934. }
  10935. }
  10936. $needsSudoCheck = !Platform::isWindows()
  10937. && function_exists('exec')
  10938. && !Platform::getEnv('COMPOSER_ALLOW_SUPERUSER')
  10939. && (ini_get('open_basedir') || !file_exists('/.dockerenv'));
  10940. $isNonAllowedRoot = false;
  10941. if ($needsSudoCheck) {
  10942. $isNonAllowedRoot = $this->isRunningAsRoot();
  10943. if ($isNonAllowedRoot) {
  10944. if ($uid = (int) Platform::getEnv('SUDO_UID')) {
  10945. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  10946. }
  10947. }
  10948. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  10949. }
  10950. $mayNeedPluginCommand = false === $input->hasParameterOption(['--version', '-V'])
  10951. && (
  10952. false === $commandName
  10953. || in_array($commandName, ['', 'list', 'help'], true)
  10954. || ($commandName === '_complete' && !$isNonAllowedRoot)
  10955. );
  10956. if ($mayNeedPluginCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands) {
  10957. if ($isNonAllowedRoot) {
  10958. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  10959. if ($io->isInteractive() && $io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
  10960. $isNonAllowedRoot = false;
  10961. } else {
  10962. $io->writeError('<warning>Aborting as no plugin should be loaded if running as super user is not explicitly allowed</warning>');
  10963. return 1;
  10964. }
  10965. }
  10966. try {
  10967. foreach ($this->getPluginCommands() as $command) {
  10968. if ($this->has($command->getName())) {
  10969. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  10970. } else {
  10971. $this->add($command);
  10972. }
  10973. }
  10974. } catch (NoSslException $e) {
  10975. } catch (ParsingException $e) {
  10976. $details = $e->getDetails();
  10977. $file = realpath(Factory::getComposerFile());
  10978. $line = null;
  10979. if ($details && isset($details['line'])) {
  10980. $line = $details['line'];
  10981. }
  10982. $ghe = new GithubActionError($this->io);
  10983. $ghe->emit($e->getMessage(), $file, $line);
  10984. throw $e;
  10985. }
  10986. $this->hasPluginCommands = true;
  10987. }
  10988. if (!$this->disablePluginsByDefault && $isNonAllowedRoot && !$io->isInteractive()) {
  10989. $io->writeError('<error>Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.</error>');
  10990. $this->disablePluginsByDefault = true;
  10991. }
  10992. $isProxyCommand = false;
  10993. if ($name = $this->getCommandName($input)) {
  10994. try {
  10995. $command = $this->find($name);
  10996. $commandName = $command->getName();
  10997. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  10998. } catch (\InvalidArgumentException $e) {
  10999. }
  11000. }
  11001. if (!$isProxyCommand) {
  11002. $io->writeError(sprintf(
  11003. 'Running %s (%s) with %s on %s',
  11004. Composer::getVersion(),
  11005. Composer::RELEASE_DATE,
  11006. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  11007. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  11008. ), true, IOInterface::DEBUG);
  11009. if (PHP_VERSION_ID < 70205) {
  11010. $io->writeError('<warning>Composer supports PHP 7.2.5 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.'. Upgrading is strongly recommended but you can use Composer 2.2.x LTS as a fallback.</warning>');
  11011. }
  11012. if (XdebugHandler::isXdebugActive() && !Platform::getEnv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  11013. $io->writeError('<warning>Composer is operating slower than normal because you have Xdebug enabled. See https://getcomposer.org/xdebug</warning>');
  11014. }
  11015. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  11016. $io->writeError(sprintf('<warning>Warning: This development build of Composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  11017. }
  11018. if ($isNonAllowedRoot) {
  11019. if ($commandName !== 'self-update' && $commandName !== 'selfupdate' && $commandName !== '_complete') {
  11020. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  11021. if ($io->isInteractive()) {
  11022. if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
  11023. return 1;
  11024. }
  11025. }
  11026. }
  11027. }
  11028. Silencer::call(static function () use ($io): void {
  11029. $pid = function_exists('getmypid') ? getmypid() . '-' : '';
  11030. $tempfile = sys_get_temp_dir() . '/temp-' . $pid . md5(microtime());
  11031. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  11032. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  11033. }
  11034. });
  11035. $file = Factory::getComposerFile();
  11036. if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  11037. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  11038. foreach ($composer['scripts'] as $script => $dummy) {
  11039. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  11040. if ($this->has($script)) {
  11041. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  11042. } else {
  11043. $description = null;
  11044. if (isset($composer['scripts-descriptions'][$script])) {
  11045. $description = $composer['scripts-descriptions'][$script];
  11046. }
  11047. $aliases = $composer['scripts-aliases'][$script] ?? [];
  11048. $this->add(new Command\ScriptAliasCommand($script, $description, $aliases));
  11049. }
  11050. }
  11051. }
  11052. }
  11053. }
  11054. }
  11055. try {
  11056. if ($input->hasParameterOption('--profile')) {
  11057. $startTime = microtime(true);
  11058. $this->io->enableDebugging($startTime);
  11059. }
  11060. $result = parent::doRun($input, $output);
  11061. if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
  11062. Silencer::call('chdir', $oldWorkingDir);
  11063. }
  11064. if (isset($startTime)) {
  11065. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  11066. }
  11067. return $result;
  11068. } catch (ScriptExecutionException $e) {
  11069. if ($this->getDisablePluginsByDefault() && $this->isRunningAsRoot() && !$this->io->isInteractive()) {
  11070. $io->writeError('<error>Plugins have been disabled automatically as you are running as root, this may be the cause of the script failure.</error>', true, IOInterface::QUIET);
  11071. $io->writeError('<error>See also https://getcomposer.org/root</error>', true, IOInterface::QUIET);
  11072. }
  11073. return $e->getCode();
  11074. } catch (\Throwable $e) {
  11075. $ghe = new GithubActionError($this->io);
  11076. $ghe->emit($e->getMessage());
  11077. $this->hintCommonErrors($e, $output);
  11078. if (!method_exists($this, 'setCatchErrors') && !$e instanceof \Exception) {
  11079. if ($output instanceof ConsoleOutputInterface) {
  11080. $this->renderThrowable($e, $output->getErrorOutput());
  11081. } else {
  11082. $this->renderThrowable($e, $output);
  11083. }
  11084. return max(1, $e->getCode());
  11085. }
  11086. throw $e;
  11087. } finally {
  11088. restore_error_handler();
  11089. }
  11090. }
  11091. private function getNewWorkingDir(InputInterface $input): ?string
  11092. {
  11093. $workingDir = $input->getParameterOption(['--working-dir', '-d'], null, true);
  11094. if (null !== $workingDir && !is_dir($workingDir)) {
  11095. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  11096. }
  11097. return $workingDir;
  11098. }
  11099. private function hintCommonErrors(\Throwable $exception, OutputInterface $output): void
  11100. {
  11101. $io = $this->getIO();
  11102. if ((get_class($exception) === LogicException::class || $exception instanceof \Error) && $output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
  11103. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  11104. }
  11105. Silencer::suppress();
  11106. try {
  11107. $composer = $this->getComposer(false, true);
  11108. if (null !== $composer && function_exists('disk_free_space')) {
  11109. $config = $composer->getConfig();
  11110. $minSpaceFree = 100 * 1024 * 1024;
  11111. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  11112. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  11113. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  11114. ) {
  11115. $io->writeError('<error>The disk hosting '.$dir.' has less than 100MiB of free space, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  11116. }
  11117. }
  11118. } catch (\Exception $e) {
  11119. }
  11120. Silencer::restore();
  11121. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  11122. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  11123. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  11124. }
  11125. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  11126. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  11127. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  11128. }
  11129. if ($exception instanceof ProcessTimedOutException) {
  11130. $io->writeError('<error>The following exception is caused by a process timeout</error>', true, IOInterface::QUIET);
  11131. $io->writeError('<error>Check https://getcomposer.org/doc/06-config.md#process-timeout for details</error>', true, IOInterface::QUIET);
  11132. }
  11133. if ($this->getDisablePluginsByDefault() && $this->isRunningAsRoot() && !$this->io->isInteractive()) {
  11134. $io->writeError('<error>Plugins have been disabled automatically as you are running as root, this may be the cause of the following exception. See also https://getcomposer.org/root</error>', true, IOInterface::QUIET);
  11135. } elseif ($exception instanceof CommandNotFoundException && $this->getDisablePluginsByDefault()) {
  11136. $io->writeError('<error>Plugins have been disabled, which may be why some commands are missing, unless you made a typo</error>', true, IOInterface::QUIET);
  11137. }
  11138. $hints = HttpDownloader::getExceptionHints($exception);
  11139. if (null !== $hints && count($hints) > 0) {
  11140. foreach ($hints as $hint) {
  11141. $io->writeError($hint, true, IOInterface::QUIET);
  11142. }
  11143. }
  11144. }
  11145. public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
  11146. {
  11147. if (null === $disablePlugins) {
  11148. $disablePlugins = $this->disablePluginsByDefault;
  11149. }
  11150. if (null === $disableScripts) {
  11151. $disableScripts = $this->disableScriptsByDefault;
  11152. }
  11153. if (null === $this->composer) {
  11154. try {
  11155. $this->composer = Factory::create(Platform::isInputCompletionProcess() ? new NullIO() : $this->io, null, $disablePlugins, $disableScripts);
  11156. } catch (\InvalidArgumentException $e) {
  11157. if ($required) {
  11158. $this->io->writeError($e->getMessage());
  11159. if ($this->areExceptionsCaught()) {
  11160. exit(1);
  11161. }
  11162. throw $e;
  11163. }
  11164. } catch (JsonValidationException $e) {
  11165. if ($required) {
  11166. throw $e;
  11167. }
  11168. } catch (RuntimeException $e) {
  11169. if ($required) {
  11170. throw $e;
  11171. }
  11172. }
  11173. }
  11174. return $this->composer;
  11175. }
  11176. public function resetComposer(): void
  11177. {
  11178. $this->composer = null;
  11179. if (method_exists($this->getIO(), 'resetAuthentications')) {
  11180. $this->getIO()->resetAuthentications();
  11181. }
  11182. }
  11183. public function getIO(): IOInterface
  11184. {
  11185. return $this->io;
  11186. }
  11187. public function getHelp(): string
  11188. {
  11189. return self::$logo . parent::getHelp();
  11190. }
  11191. protected function getDefaultCommands(): array
  11192. {
  11193. $commands = array_merge(parent::getDefaultCommands(), [
  11194. new Command\AboutCommand(),
  11195. new Command\ConfigCommand(),
  11196. new Command\DependsCommand(),
  11197. new Command\ProhibitsCommand(),
  11198. new Command\InitCommand(),
  11199. new Command\InstallCommand(),
  11200. new Command\CreateProjectCommand(),
  11201. new Command\UpdateCommand(),
  11202. new Command\SearchCommand(),
  11203. new Command\ValidateCommand(),
  11204. new Command\AuditCommand(),
  11205. new Command\ShowCommand(),
  11206. new Command\SuggestsCommand(),
  11207. new Command\RequireCommand(),
  11208. new Command\DumpAutoloadCommand(),
  11209. new Command\StatusCommand(),
  11210. new Command\ArchiveCommand(),
  11211. new Command\DiagnoseCommand(),
  11212. new Command\RunScriptCommand(),
  11213. new Command\LicensesCommand(),
  11214. new Command\GlobalCommand(),
  11215. new Command\ClearCacheCommand(),
  11216. new Command\RemoveCommand(),
  11217. new Command\HomeCommand(),
  11218. new Command\ExecCommand(),
  11219. new Command\OutdatedCommand(),
  11220. new Command\CheckPlatformReqsCommand(),
  11221. new Command\FundCommand(),
  11222. new Command\ReinstallCommand(),
  11223. new Command\BumpCommand(),
  11224. ]);
  11225. if (strpos(__FILE__, 'phar:') === 0 || '1' === Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
  11226. $commands[] = new Command\SelfUpdateCommand();
  11227. }
  11228. return $commands;
  11229. }
  11230. public function getLongVersion(): string
  11231. {
  11232. $branchAliasString = '';
  11233. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  11234. $branchAliasString = sprintf(' (%s)', Composer::BRANCH_ALIAS_VERSION);
  11235. }
  11236. return sprintf(
  11237. '<info>%s</info> version <comment>%s%s</comment> %s',
  11238. $this->getName(),
  11239. $this->getVersion(),
  11240. $branchAliasString,
  11241. Composer::RELEASE_DATE
  11242. );
  11243. }
  11244. protected function getDefaultInputDefinition(): InputDefinition
  11245. {
  11246. $definition = parent::getDefaultInputDefinition();
  11247. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  11248. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  11249. $definition->addOption(new InputOption('--no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'));
  11250. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  11251. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  11252. return $definition;
  11253. }
  11254. private function getPluginCommands(): array
  11255. {
  11256. $commands = [];
  11257. $composer = $this->getComposer(false, false);
  11258. if (null === $composer) {
  11259. $composer = Factory::createGlobal($this->io, $this->disablePluginsByDefault, $this->disableScriptsByDefault);
  11260. }
  11261. if (null !== $composer) {
  11262. $pm = $composer->getPluginManager();
  11263. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', ['composer' => $composer, 'io' => $this->io]) as $capability) {
  11264. $newCommands = $capability->getCommands();
  11265. if (!is_array($newCommands)) {
  11266. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  11267. }
  11268. foreach ($newCommands as $command) {
  11269. if (!$command instanceof Command\BaseCommand) {
  11270. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  11271. }
  11272. }
  11273. $commands = array_merge($commands, $newCommands);
  11274. }
  11275. }
  11276. return $commands;
  11277. }
  11278. public function getInitialWorkingDirectory()
  11279. {
  11280. return $this->initialWorkingDirectory;
  11281. }
  11282. public function getDisablePluginsByDefault(): bool
  11283. {
  11284. return $this->disablePluginsByDefault;
  11285. }
  11286. public function getDisableScriptsByDefault(): bool
  11287. {
  11288. return $this->disableScriptsByDefault;
  11289. }
  11290. private function getUseParentDirConfigValue()
  11291. {
  11292. $config = Factory::createConfig($this->io);
  11293. return $config->get('use-parent-dir');
  11294. }
  11295. private function isRunningAsRoot(): bool
  11296. {
  11297. return function_exists('posix_getuid') && posix_getuid() === 0;
  11298. }
  11299. }
  11300. <?php declare(strict_types=1);
  11301. namespace Composer\Console;
  11302. use Composer\IO\IOInterface;
  11303. use Composer\Util\Platform;
  11304. final class GithubActionError
  11305. {
  11306. protected $io;
  11307. public function __construct(IOInterface $io)
  11308. {
  11309. $this->io = $io;
  11310. }
  11311. public function emit(string $message, ?string $file = null, ?int $line = null): void
  11312. {
  11313. if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
  11314. $message = $this->escapeData($message);
  11315. if ($file && $line) {
  11316. $file = $this->escapeProperty($file);
  11317. $this->io->write("::error file=". $file .",line=". $line ."::". $message);
  11318. } elseif ($file) {
  11319. $file = $this->escapeProperty($file);
  11320. $this->io->write("::error file=". $file ."::". $message);
  11321. } else {
  11322. $this->io->write("::error ::". $message);
  11323. }
  11324. }
  11325. }
  11326. private function escapeData(string $data): string
  11327. {
  11328. $data = str_replace("%", '%25', $data);
  11329. $data = str_replace("\r", '%0D', $data);
  11330. $data = str_replace("\n", '%0A', $data);
  11331. return $data;
  11332. }
  11333. private function escapeProperty(string $property): string
  11334. {
  11335. $property = str_replace("%", '%25', $property);
  11336. $property = str_replace("\r", '%0D', $property);
  11337. $property = str_replace("\n", '%0A', $property);
  11338. $property = str_replace(":", '%3A', $property);
  11339. $property = str_replace(",", '%2C', $property);
  11340. return $property;
  11341. }
  11342. }
  11343. <?php declare(strict_types=1);
  11344. namespace Composer\Console;
  11345. use Closure;
  11346. use Composer\Pcre\Preg;
  11347. use Symfony\Component\Console\Formatter\OutputFormatter;
  11348. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  11349. class HtmlOutputFormatter extends OutputFormatter
  11350. {
  11351. private static $availableForegroundColors = [
  11352. 30 => 'black',
  11353. 31 => 'red',
  11354. 32 => 'green',
  11355. 33 => 'yellow',
  11356. 34 => 'blue',
  11357. 35 => 'magenta',
  11358. 36 => 'cyan',
  11359. 37 => 'white',
  11360. ];
  11361. private static $availableBackgroundColors = [
  11362. 40 => 'black',
  11363. 41 => 'red',
  11364. 42 => 'green',
  11365. 43 => 'yellow',
  11366. 44 => 'blue',
  11367. 45 => 'magenta',
  11368. 46 => 'cyan',
  11369. 47 => 'white',
  11370. ];
  11371. private static $availableOptions = [
  11372. 1 => 'bold',
  11373. 4 => 'underscore',
  11374. ];
  11375. public function __construct(array $styles = [])
  11376. {
  11377. parent::__construct(true, $styles);
  11378. }
  11379. public function format(?string $message): ?string
  11380. {
  11381. $formatted = parent::format($message);
  11382. if ($formatted === null) {
  11383. return null;
  11384. }
  11385. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  11386. return Preg::replaceCallback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", Closure::fromCallable([$this, 'formatHtml']), $formatted);
  11387. }
  11388. private function formatHtml(array $matches): string
  11389. {
  11390. assert(is_string($matches[1]));
  11391. $out = '<span style="';
  11392. foreach (explode(';', $matches[1]) as $code) {
  11393. if (isset(self::$availableForegroundColors[(int) $code])) {
  11394. $out .= 'color:'.self::$availableForegroundColors[(int) $code].';';
  11395. } elseif (isset(self::$availableBackgroundColors[(int) $code])) {
  11396. $out .= 'background-color:'.self::$availableBackgroundColors[(int) $code].';';
  11397. } elseif (isset(self::$availableOptions[(int) $code])) {
  11398. switch (self::$availableOptions[(int) $code]) {
  11399. case 'bold':
  11400. $out .= 'font-weight:bold;';
  11401. break;
  11402. case 'underscore':
  11403. $out .= 'text-decoration:underline;';
  11404. break;
  11405. }
  11406. }
  11407. }
  11408. return $out.'">'.$matches[2].'</span>';
  11409. }
  11410. }
  11411. <?php declare(strict_types=1);
  11412. namespace Composer\Console\Input;
  11413. use Symfony\Component\Console\Completion\CompletionInput;
  11414. use Symfony\Component\Console\Completion\CompletionSuggestions;
  11415. use Symfony\Component\Console\Completion\Suggestion;
  11416. use Symfony\Component\Console\Exception\InvalidArgumentException;
  11417. use Symfony\Component\Console\Exception\LogicException;
  11418. use Symfony\Component\Console\Input\InputArgument as BaseInputArgument;
  11419. class InputArgument extends BaseInputArgument
  11420. {
  11421. private $suggestedValues;
  11422. public function __construct(string $name, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [])
  11423. {
  11424. parent::__construct($name, $mode, $description, $default);
  11425. $this->suggestedValues = $suggestedValues;
  11426. }
  11427. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  11428. {
  11429. $values = $this->suggestedValues;
  11430. if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) {
  11431. throw new LogicException(sprintf('Closure for option "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
  11432. }
  11433. if ([] !== $values) {
  11434. $suggestions->suggestValues($values);
  11435. }
  11436. }
  11437. }
  11438. <?php declare(strict_types=1);
  11439. namespace Composer\Console\Input;
  11440. use Symfony\Component\Console\Completion\CompletionInput;
  11441. use Symfony\Component\Console\Completion\CompletionSuggestions;
  11442. use Symfony\Component\Console\Completion\Suggestion;
  11443. use Symfony\Component\Console\Exception\InvalidArgumentException;
  11444. use Symfony\Component\Console\Exception\LogicException;
  11445. use Symfony\Component\Console\Input\InputOption as BaseInputOption;
  11446. class InputOption extends BaseInputOption
  11447. {
  11448. private $suggestedValues;
  11449. public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [])
  11450. {
  11451. parent::__construct($name, $shortcut, $mode, $description, $default);
  11452. $this->suggestedValues = $suggestedValues;
  11453. if ([] !== $suggestedValues && !$this->acceptValue()) {
  11454. throw new LogicException('Cannot set suggested values if the option does not accept a value.');
  11455. }
  11456. }
  11457. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  11458. {
  11459. $values = $this->suggestedValues;
  11460. if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) {
  11461. throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
  11462. }
  11463. if ([] !== $values) {
  11464. $suggestions->suggestValues($values);
  11465. }
  11466. }
  11467. }
  11468. <?php declare(strict_types=1);
  11469. namespace Composer\DependencyResolver;
  11470. class Decisions implements \Iterator, \Countable
  11471. {
  11472. public const DECISION_LITERAL = 0;
  11473. public const DECISION_REASON = 1;
  11474. protected $pool;
  11475. protected $decisionMap;
  11476. protected $decisionQueue = [];
  11477. public function __construct(Pool $pool)
  11478. {
  11479. $this->pool = $pool;
  11480. $this->decisionMap = [];
  11481. }
  11482. public function decide(int $literal, int $level, Rule $why): void
  11483. {
  11484. $this->addDecision($literal, $level);
  11485. $this->decisionQueue[] = [
  11486. self::DECISION_LITERAL => $literal,
  11487. self::DECISION_REASON => $why,
  11488. ];
  11489. }
  11490. public function satisfy(int $literal): bool
  11491. {
  11492. $packageId = abs($literal);
  11493. return (
  11494. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  11495. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  11496. );
  11497. }
  11498. public function conflict(int $literal): bool
  11499. {
  11500. $packageId = abs($literal);
  11501. return (
  11502. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  11503. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  11504. );
  11505. }
  11506. public function decided(int $literalOrPackageId): bool
  11507. {
  11508. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  11509. }
  11510. public function undecided(int $literalOrPackageId): bool
  11511. {
  11512. return empty($this->decisionMap[abs($literalOrPackageId)]);
  11513. }
  11514. public function decidedInstall(int $literalOrPackageId): bool
  11515. {
  11516. $packageId = abs($literalOrPackageId);
  11517. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  11518. }
  11519. public function decisionLevel(int $literalOrPackageId): int
  11520. {
  11521. $packageId = abs($literalOrPackageId);
  11522. if (isset($this->decisionMap[$packageId])) {
  11523. return abs($this->decisionMap[$packageId]);
  11524. }
  11525. return 0;
  11526. }
  11527. public function decisionRule(int $literalOrPackageId): ?Rule
  11528. {
  11529. $packageId = abs($literalOrPackageId);
  11530. foreach ($this->decisionQueue as $decision) {
  11531. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  11532. return $decision[self::DECISION_REASON];
  11533. }
  11534. }
  11535. return null;
  11536. }
  11537. public function atOffset(int $queueOffset): array
  11538. {
  11539. return $this->decisionQueue[$queueOffset];
  11540. }
  11541. public function validOffset(int $queueOffset): bool
  11542. {
  11543. return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
  11544. }
  11545. public function lastReason(): Rule
  11546. {
  11547. return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_REASON];
  11548. }
  11549. public function lastLiteral(): int
  11550. {
  11551. return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  11552. }
  11553. public function reset(): void
  11554. {
  11555. while ($decision = array_pop($this->decisionQueue)) {
  11556. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  11557. }
  11558. }
  11559. public function resetToOffset(int $offset): void
  11560. {
  11561. while (\count($this->decisionQueue) > $offset + 1) {
  11562. $decision = array_pop($this->decisionQueue);
  11563. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  11564. }
  11565. }
  11566. public function revertLast(): void
  11567. {
  11568. $this->decisionMap[abs($this->lastLiteral())] = 0;
  11569. array_pop($this->decisionQueue);
  11570. }
  11571. public function count(): int
  11572. {
  11573. return \count($this->decisionQueue);
  11574. }
  11575. public function rewind(): void
  11576. {
  11577. end($this->decisionQueue);
  11578. }
  11579. #[\ReturnTypeWillChange]
  11580. public function current()
  11581. {
  11582. return current($this->decisionQueue);
  11583. }
  11584. public function key(): ?int
  11585. {
  11586. return key($this->decisionQueue);
  11587. }
  11588. public function next(): void
  11589. {
  11590. prev($this->decisionQueue);
  11591. }
  11592. public function valid(): bool
  11593. {
  11594. return false !== current($this->decisionQueue);
  11595. }
  11596. public function isEmpty(): bool
  11597. {
  11598. return \count($this->decisionQueue) === 0;
  11599. }
  11600. protected function addDecision(int $literal, int $level): void
  11601. {
  11602. $packageId = abs($literal);
  11603. $previousDecision = $this->decisionMap[$packageId] ?? 0;
  11604. if ($previousDecision !== 0) {
  11605. $literalString = $this->pool->literalToPrettyString($literal, []);
  11606. $package = $this->pool->literalToPackage($literal);
  11607. throw new SolverBugException(
  11608. "Trying to decide $literalString on level $level, even though $package was previously decided as ".$previousDecision."."
  11609. );
  11610. }
  11611. if ($literal > 0) {
  11612. $this->decisionMap[$packageId] = $level;
  11613. } else {
  11614. $this->decisionMap[$packageId] = -$level;
  11615. }
  11616. }
  11617. public function toString(?Pool $pool = null): string
  11618. {
  11619. $decisionMap = $this->decisionMap;
  11620. ksort($decisionMap);
  11621. $str = '[';
  11622. foreach ($decisionMap as $packageId => $level) {
  11623. $str .= (($pool) ? $pool->literalToPackage($packageId) : $packageId).':'.$level.',';
  11624. }
  11625. $str .= ']';
  11626. return $str;
  11627. }
  11628. public function __toString(): string
  11629. {
  11630. return $this->toString();
  11631. }
  11632. }
  11633. <?php declare(strict_types=1);
  11634. namespace Composer\DependencyResolver;
  11635. use Composer\Package\AliasPackage;
  11636. use Composer\Package\BasePackage;
  11637. use Composer\Package\PackageInterface;
  11638. use Composer\Semver\CompilingMatcher;
  11639. use Composer\Semver\Constraint\Constraint;
  11640. class DefaultPolicy implements PolicyInterface
  11641. {
  11642. private $preferStable;
  11643. private $preferLowest;
  11644. private $preferredVersions;
  11645. private $preferredPackageResultCachePerPool;
  11646. private $sortingCachePerPool;
  11647. public function __construct(bool $preferStable = false, bool $preferLowest = false, ?array $preferredVersions = null)
  11648. {
  11649. $this->preferStable = $preferStable;
  11650. $this->preferLowest = $preferLowest;
  11651. $this->preferredVersions = $preferredVersions;
  11652. }
  11653. public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool
  11654. {
  11655. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  11656. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  11657. }
  11658. if (strpos($a->getVersion(), 'dev-') === 0 || strpos($b->getVersion(), 'dev-') === 0) {
  11659. $constraint = new Constraint($operator, $b->getVersion());
  11660. $version = new Constraint('==', $a->getVersion());
  11661. return $constraint->matchSpecific($version, true);
  11662. }
  11663. return CompilingMatcher::match(new Constraint($operator, $b->getVersion()), Constraint::OP_EQ, $a->getVersion());
  11664. }
  11665. public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array
  11666. {
  11667. sort($literals);
  11668. $resultCacheKey = implode(',', $literals).$requiredPackage;
  11669. $poolId = spl_object_id($pool);
  11670. if (isset($this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey])) {
  11671. return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey];
  11672. }
  11673. $packages = $this->groupLiteralsByName($pool, $literals);
  11674. foreach ($packages as &$nameLiterals) {
  11675. usort($nameLiterals, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
  11676. $cacheKey = 'i'.$a.'.'.$b.$requiredPackage;
  11677. if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
  11678. return $this->sortingCachePerPool[$poolId][$cacheKey];
  11679. }
  11680. return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  11681. });
  11682. }
  11683. foreach ($packages as &$sortedLiterals) {
  11684. $sortedLiterals = $this->pruneToBestVersion($pool, $sortedLiterals);
  11685. $sortedLiterals = $this->pruneRemoteAliases($pool, $sortedLiterals);
  11686. }
  11687. $selected = array_merge(...array_values($packages));
  11688. usort($selected, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
  11689. $cacheKey = $a.'.'.$b.$requiredPackage;
  11690. if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
  11691. return $this->sortingCachePerPool[$poolId][$cacheKey];
  11692. }
  11693. return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  11694. });
  11695. return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey] = $selected;
  11696. }
  11697. protected function groupLiteralsByName(Pool $pool, array $literals): array
  11698. {
  11699. $packages = [];
  11700. foreach ($literals as $literal) {
  11701. $packageName = $pool->literalToPackage($literal)->getName();
  11702. if (!isset($packages[$packageName])) {
  11703. $packages[$packageName] = [];
  11704. }
  11705. $packages[$packageName][] = $literal;
  11706. }
  11707. return $packages;
  11708. }
  11709. public function compareByPriority(Pool $pool, BasePackage $a, BasePackage $b, ?string $requiredPackage = null, bool $ignoreReplace = false): int
  11710. {
  11711. if ($a->getName() === $b->getName()) {
  11712. $aAliased = $a instanceof AliasPackage;
  11713. $bAliased = $b instanceof AliasPackage;
  11714. if ($aAliased && !$bAliased) {
  11715. return -1;
  11716. }
  11717. if (!$aAliased && $bAliased) {
  11718. return 1;
  11719. }
  11720. }
  11721. if (!$ignoreReplace) {
  11722. if ($this->replaces($a, $b)) {
  11723. return 1;
  11724. }
  11725. if ($this->replaces($b, $a)) {
  11726. return -1;
  11727. }
  11728. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  11729. $requiredVendor = substr($requiredPackage, 0, $pos);
  11730. $aIsSameVendor = strpos($a->getName(), $requiredVendor) === 0;
  11731. $bIsSameVendor = strpos($b->getName(), $requiredVendor) === 0;
  11732. if ($bIsSameVendor !== $aIsSameVendor) {
  11733. return $aIsSameVendor ? -1 : 1;
  11734. }
  11735. }
  11736. }
  11737. if ($a->id === $b->id) {
  11738. return 0;
  11739. }
  11740. return ($a->id < $b->id) ? -1 : 1;
  11741. }
  11742. protected function replaces(BasePackage $source, BasePackage $target): bool
  11743. {
  11744. foreach ($source->getReplaces() as $link) {
  11745. if ($link->getTarget() === $target->getName()
  11746. ) {
  11747. return true;
  11748. }
  11749. }
  11750. return false;
  11751. }
  11752. protected function pruneToBestVersion(Pool $pool, array $literals): array
  11753. {
  11754. if ($this->preferredVersions !== null) {
  11755. $name = $pool->literalToPackage($literals[0])->getName();
  11756. if (isset($this->preferredVersions[$name])) {
  11757. $preferredVersion = $this->preferredVersions[$name];
  11758. $bestLiterals = [];
  11759. foreach ($literals as $literal) {
  11760. if ($pool->literalToPackage($literal)->getVersion() === $preferredVersion) {
  11761. $bestLiterals[] = $literal;
  11762. }
  11763. }
  11764. if (\count($bestLiterals) > 0) {
  11765. return $bestLiterals;
  11766. }
  11767. }
  11768. }
  11769. $operator = $this->preferLowest ? '<' : '>';
  11770. $bestLiterals = [$literals[0]];
  11771. $bestPackage = $pool->literalToPackage($literals[0]);
  11772. foreach ($literals as $i => $literal) {
  11773. if (0 === $i) {
  11774. continue;
  11775. }
  11776. $package = $pool->literalToPackage($literal);
  11777. if ($this->versionCompare($package, $bestPackage, $operator)) {
  11778. $bestPackage = $package;
  11779. $bestLiterals = [$literal];
  11780. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  11781. $bestLiterals[] = $literal;
  11782. }
  11783. }
  11784. return $bestLiterals;
  11785. }
  11786. protected function pruneRemoteAliases(Pool $pool, array $literals): array
  11787. {
  11788. $hasLocalAlias = false;
  11789. foreach ($literals as $literal) {
  11790. $package = $pool->literalToPackage($literal);
  11791. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  11792. $hasLocalAlias = true;
  11793. break;
  11794. }
  11795. }
  11796. if (!$hasLocalAlias) {
  11797. return $literals;
  11798. }
  11799. $selected = [];
  11800. foreach ($literals as $literal) {
  11801. $package = $pool->literalToPackage($literal);
  11802. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  11803. $selected[] = $literal;
  11804. }
  11805. }
  11806. return $selected;
  11807. }
  11808. }
  11809. <?php declare(strict_types=1);
  11810. namespace Composer\DependencyResolver;
  11811. class GenericRule extends Rule
  11812. {
  11813. protected $literals;
  11814. public function __construct(array $literals, $reason, $reasonData)
  11815. {
  11816. parent::__construct($reason, $reasonData);
  11817. sort($literals);
  11818. $this->literals = $literals;
  11819. }
  11820. public function getLiterals(): array
  11821. {
  11822. return $this->literals;
  11823. }
  11824. public function getHash()
  11825. {
  11826. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  11827. return $data['hash'];
  11828. }
  11829. public function equals(Rule $rule): bool
  11830. {
  11831. return $this->literals === $rule->getLiterals();
  11832. }
  11833. public function isAssertion(): bool
  11834. {
  11835. return 1 === \count($this->literals);
  11836. }
  11837. public function __toString(): string
  11838. {
  11839. $result = $this->isDisabled() ? 'disabled(' : '(';
  11840. foreach ($this->literals as $i => $literal) {
  11841. if ($i !== 0) {
  11842. $result .= '|';
  11843. }
  11844. $result .= $literal;
  11845. }
  11846. $result .= ')';
  11847. return $result;
  11848. }
  11849. }
  11850. <?php declare(strict_types=1);
  11851. namespace Composer\DependencyResolver;
  11852. use Composer\Repository\InstalledRepositoryInterface;
  11853. use Composer\Repository\RepositoryInterface;
  11854. class LocalRepoTransaction extends Transaction
  11855. {
  11856. public function __construct(RepositoryInterface $lockedRepository, InstalledRepositoryInterface $localRepository)
  11857. {
  11858. parent::__construct(
  11859. $localRepository->getPackages(),
  11860. $lockedRepository->getPackages()
  11861. );
  11862. }
  11863. }
  11864. <?php declare(strict_types=1);
  11865. namespace Composer\DependencyResolver;
  11866. use Composer\Package\AliasPackage;
  11867. use Composer\Package\BasePackage;
  11868. use Composer\Package\Package;
  11869. use Composer\Pcre\Preg;
  11870. class LockTransaction extends Transaction
  11871. {
  11872. protected $presentMap;
  11873. protected $unlockableMap;
  11874. protected $resultPackages;
  11875. public function __construct(Pool $pool, array $presentMap, array $unlockableMap, Decisions $decisions)
  11876. {
  11877. $this->presentMap = $presentMap;
  11878. $this->unlockableMap = $unlockableMap;
  11879. $this->setResultPackages($pool, $decisions);
  11880. parent::__construct($this->presentMap, $this->resultPackages['all']);
  11881. }
  11882. public function setResultPackages(Pool $pool, Decisions $decisions): void
  11883. {
  11884. $this->resultPackages = ['all' => [], 'non-dev' => [], 'dev' => []];
  11885. foreach ($decisions as $i => $decision) {
  11886. $literal = $decision[Decisions::DECISION_LITERAL];
  11887. if ($literal > 0) {
  11888. $package = $pool->literalToPackage($literal);
  11889. $this->resultPackages['all'][] = $package;
  11890. if (!isset($this->unlockableMap[$package->id])) {
  11891. $this->resultPackages['non-dev'][] = $package;
  11892. }
  11893. }
  11894. }
  11895. }
  11896. public function setNonDevPackages(LockTransaction $extractionResult): void
  11897. {
  11898. $packages = $extractionResult->getNewLockPackages(false);
  11899. $this->resultPackages['dev'] = $this->resultPackages['non-dev'];
  11900. $this->resultPackages['non-dev'] = [];
  11901. foreach ($packages as $package) {
  11902. foreach ($this->resultPackages['dev'] as $i => $resultPackage) {
  11903. if ($package->getName() === $resultPackage->getName()) {
  11904. $this->resultPackages['non-dev'][] = $resultPackage;
  11905. unset($this->resultPackages['dev'][$i]);
  11906. }
  11907. }
  11908. }
  11909. }
  11910. public function getNewLockPackages(bool $devMode, bool $updateMirrors = false): array
  11911. {
  11912. $packages = [];
  11913. foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
  11914. if (!$package instanceof AliasPackage) {
  11915. if ($updateMirrors && !isset($this->presentMap[spl_object_hash($package)])) {
  11916. foreach ($this->presentMap as $presentPackage) {
  11917. if ($package->getName() === $presentPackage->getName() && $package->getVersion() === $presentPackage->getVersion()) {
  11918. if ($presentPackage->getSourceReference() && $presentPackage->getSourceType() === $package->getSourceType()) {
  11919. $package->setSourceDistReferences($presentPackage->getSourceReference());
  11920. if ($package->getDistUrl() !== null && !Preg::isMatch('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  11921. $package->setDistUrl($presentPackage->getDistUrl());
  11922. }
  11923. $package->setDistType($presentPackage->getDistType());
  11924. if ($package instanceof Package) {
  11925. $package->setDistSha1Checksum($presentPackage->getDistSha1Checksum());
  11926. }
  11927. }
  11928. if ($presentPackage->getReleaseDate() !== null && $package instanceof Package) {
  11929. $package->setReleaseDate($presentPackage->getReleaseDate());
  11930. }
  11931. }
  11932. }
  11933. }
  11934. $packages[] = $package;
  11935. }
  11936. }
  11937. return $packages;
  11938. }
  11939. public function getAliases(array $aliases): array
  11940. {
  11941. $usedAliases = [];
  11942. foreach ($this->resultPackages['all'] as $package) {
  11943. if ($package instanceof AliasPackage) {
  11944. foreach ($aliases as $index => $alias) {
  11945. if ($alias['package'] === $package->getName()) {
  11946. $usedAliases[] = $alias;
  11947. unset($aliases[$index]);
  11948. }
  11949. }
  11950. }
  11951. }
  11952. usort($usedAliases, static function ($a, $b): int {
  11953. return strcmp($a['package'], $b['package']);
  11954. });
  11955. return $usedAliases;
  11956. }
  11957. }
  11958. <?php declare(strict_types=1);
  11959. namespace Composer\DependencyResolver;
  11960. class MultiConflictRule extends Rule
  11961. {
  11962. protected $literals;
  11963. public function __construct(array $literals, $reason, $reasonData)
  11964. {
  11965. parent::__construct($reason, $reasonData);
  11966. if (\count($literals) < 3) {
  11967. throw new \RuntimeException("multi conflict rule requires at least 3 literals");
  11968. }
  11969. sort($literals);
  11970. $this->literals = $literals;
  11971. }
  11972. public function getLiterals(): array
  11973. {
  11974. return $this->literals;
  11975. }
  11976. public function getHash()
  11977. {
  11978. $data = unpack('ihash', md5('c:'.implode(',', $this->literals), true));
  11979. return $data['hash'];
  11980. }
  11981. public function equals(Rule $rule): bool
  11982. {
  11983. if ($rule instanceof MultiConflictRule) {
  11984. return $this->literals === $rule->getLiterals();
  11985. }
  11986. return false;
  11987. }
  11988. public function isAssertion(): bool
  11989. {
  11990. return false;
  11991. }
  11992. public function disable(): void
  11993. {
  11994. throw new \RuntimeException("Disabling multi conflict rules is not possible. Please contact composer at https://github.com/composer/composer to let us debug what lead to this situation.");
  11995. }
  11996. public function __toString(): string
  11997. {
  11998. $result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
  11999. foreach ($this->literals as $i => $literal) {
  12000. if ($i !== 0) {
  12001. $result .= '|';
  12002. }
  12003. $result .= $literal;
  12004. }
  12005. $result .= '))';
  12006. return $result;
  12007. }
  12008. }
  12009. <?php declare(strict_types=1);
  12010. namespace Composer\DependencyResolver\Operation;
  12011. use Composer\Package\PackageInterface;
  12012. class InstallOperation extends SolverOperation implements OperationInterface
  12013. {
  12014. protected const TYPE = 'install';
  12015. protected $package;
  12016. public function __construct(PackageInterface $package)
  12017. {
  12018. $this->package = $package;
  12019. }
  12020. public function getPackage(): PackageInterface
  12021. {
  12022. return $this->package;
  12023. }
  12024. public function show($lock): string
  12025. {
  12026. return self::format($this->package, $lock);
  12027. }
  12028. public static function format(PackageInterface $package, bool $lock = false): string
  12029. {
  12030. return ($lock ? 'Locking ' : 'Installing ').'<info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
  12031. }
  12032. }
  12033. <?php declare(strict_types=1);
  12034. namespace Composer\DependencyResolver\Operation;
  12035. use Composer\Package\AliasPackage;
  12036. class MarkAliasInstalledOperation extends SolverOperation implements OperationInterface
  12037. {
  12038. protected const TYPE = 'markAliasInstalled';
  12039. protected $package;
  12040. public function __construct(AliasPackage $package)
  12041. {
  12042. $this->package = $package;
  12043. }
  12044. public function getPackage(): AliasPackage
  12045. {
  12046. return $this->package;
  12047. }
  12048. public function show($lock): string
  12049. {
  12050. return 'Marking <info>'.$this->package->getPrettyName().'</info> (<comment>'.$this->package->getFullPrettyVersion().'</comment>) as installed, alias of <info>'.$this->package->getAliasOf()->getPrettyName().'</info> (<comment>'.$this->package->getAliasOf()->getFullPrettyVersion().'</comment>)';
  12051. }
  12052. }
  12053. <?php declare(strict_types=1);
  12054. namespace Composer\DependencyResolver\Operation;
  12055. use Composer\Package\AliasPackage;
  12056. class MarkAliasUninstalledOperation extends SolverOperation implements OperationInterface
  12057. {
  12058. protected const TYPE = 'markAliasUninstalled';
  12059. protected $package;
  12060. public function __construct(AliasPackage $package)
  12061. {
  12062. $this->package = $package;
  12063. }
  12064. public function getPackage(): AliasPackage
  12065. {
  12066. return $this->package;
  12067. }
  12068. public function show($lock): string
  12069. {
  12070. return 'Marking <info>'.$this->package->getPrettyName().'</info> (<comment>'.$this->package->getFullPrettyVersion().'</comment>) as uninstalled, alias of <info>'.$this->package->getAliasOf()->getPrettyName().'</info> (<comment>'.$this->package->getAliasOf()->getFullPrettyVersion().'</comment>)';
  12071. }
  12072. }
  12073. <?php declare(strict_types=1);
  12074. namespace Composer\DependencyResolver\Operation;
  12075. interface OperationInterface
  12076. {
  12077. public function getOperationType();
  12078. public function show(bool $lock);
  12079. public function __toString();
  12080. }
  12081. <?php declare(strict_types=1);
  12082. namespace Composer\DependencyResolver\Operation;
  12083. abstract class SolverOperation implements OperationInterface
  12084. {
  12085. protected const TYPE = '';
  12086. public function getOperationType(): string
  12087. {
  12088. return static::TYPE;
  12089. }
  12090. public function __toString()
  12091. {
  12092. return $this->show(false);
  12093. }
  12094. }
  12095. <?php declare(strict_types=1);
  12096. namespace Composer\DependencyResolver\Operation;
  12097. use Composer\Package\PackageInterface;
  12098. class UninstallOperation extends SolverOperation implements OperationInterface
  12099. {
  12100. protected const TYPE = 'uninstall';
  12101. protected $package;
  12102. public function __construct(PackageInterface $package)
  12103. {
  12104. $this->package = $package;
  12105. }
  12106. public function getPackage(): PackageInterface
  12107. {
  12108. return $this->package;
  12109. }
  12110. public function show($lock): string
  12111. {
  12112. return self::format($this->package, $lock);
  12113. }
  12114. public static function format(PackageInterface $package, bool $lock = false): string
  12115. {
  12116. return 'Removing <info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
  12117. }
  12118. }
  12119. <?php declare(strict_types=1);
  12120. namespace Composer\DependencyResolver\Operation;
  12121. use Composer\Package\PackageInterface;
  12122. use Composer\Package\Version\VersionParser;
  12123. class UpdateOperation extends SolverOperation implements OperationInterface
  12124. {
  12125. protected const TYPE = 'update';
  12126. protected $initialPackage;
  12127. protected $targetPackage;
  12128. public function __construct(PackageInterface $initial, PackageInterface $target)
  12129. {
  12130. $this->initialPackage = $initial;
  12131. $this->targetPackage = $target;
  12132. }
  12133. public function getInitialPackage(): PackageInterface
  12134. {
  12135. return $this->initialPackage;
  12136. }
  12137. public function getTargetPackage(): PackageInterface
  12138. {
  12139. return $this->targetPackage;
  12140. }
  12141. public function show($lock): string
  12142. {
  12143. return self::format($this->initialPackage, $this->targetPackage, $lock);
  12144. }
  12145. public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, bool $lock = false): string
  12146. {
  12147. $fromVersion = $initialPackage->getFullPrettyVersion();
  12148. $toVersion = $targetPackage->getFullPrettyVersion();
  12149. if ($fromVersion === $toVersion && $initialPackage->getSourceReference() !== $targetPackage->getSourceReference()) {
  12150. $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
  12151. $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
  12152. } elseif ($fromVersion === $toVersion && $initialPackage->getDistReference() !== $targetPackage->getDistReference()) {
  12153. $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
  12154. $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
  12155. }
  12156. $actionName = VersionParser::isUpgrade($initialPackage->getVersion(), $targetPackage->getVersion()) ? 'Upgrading' : 'Downgrading';
  12157. return $actionName.' <info>'.$initialPackage->getPrettyName().'</info> (<comment>'.$fromVersion.'</comment> => <comment>'.$toVersion.'</comment>)';
  12158. }
  12159. }
  12160. <?php declare(strict_types=1);
  12161. namespace Composer\DependencyResolver;
  12162. use Composer\Package\PackageInterface;
  12163. use Composer\Semver\Constraint\Constraint;
  12164. interface PolicyInterface
  12165. {
  12166. public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool;
  12167. public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array;
  12168. }
  12169. <?php declare(strict_types=1);
  12170. namespace Composer\DependencyResolver;
  12171. use Composer\Package\BasePackage;
  12172. use Composer\Package\Version\VersionParser;
  12173. use Composer\Semver\CompilingMatcher;
  12174. use Composer\Semver\Constraint\ConstraintInterface;
  12175. use Composer\Semver\Constraint\Constraint;
  12176. class Pool implements \Countable
  12177. {
  12178. protected $packages = [];
  12179. protected $packageByName = [];
  12180. protected $versionParser;
  12181. protected $providerCache = [];
  12182. protected $unacceptableFixedOrLockedPackages;
  12183. protected $removedVersions = [];
  12184. protected $removedVersionsByPackage = [];
  12185. public function __construct(array $packages = [], array $unacceptableFixedOrLockedPackages = [], array $removedVersions = [], array $removedVersionsByPackage = [])
  12186. {
  12187. $this->versionParser = new VersionParser;
  12188. $this->setPackages($packages);
  12189. $this->unacceptableFixedOrLockedPackages = $unacceptableFixedOrLockedPackages;
  12190. $this->removedVersions = $removedVersions;
  12191. $this->removedVersionsByPackage = $removedVersionsByPackage;
  12192. }
  12193. public function getRemovedVersions(string $name, ConstraintInterface $constraint): array
  12194. {
  12195. if (!isset($this->removedVersions[$name])) {
  12196. return [];
  12197. }
  12198. $result = [];
  12199. foreach ($this->removedVersions[$name] as $version => $prettyVersion) {
  12200. if ($constraint->matches(new Constraint('==', $version))) {
  12201. $result[$version] = $prettyVersion;
  12202. }
  12203. }
  12204. return $result;
  12205. }
  12206. public function getRemovedVersionsByPackage(string $objectHash): array
  12207. {
  12208. if (!isset($this->removedVersionsByPackage[$objectHash])) {
  12209. return [];
  12210. }
  12211. return $this->removedVersionsByPackage[$objectHash];
  12212. }
  12213. private function setPackages(array $packages): void
  12214. {
  12215. $id = 1;
  12216. foreach ($packages as $package) {
  12217. $this->packages[] = $package;
  12218. $package->id = $id++;
  12219. foreach ($package->getNames() as $provided) {
  12220. $this->packageByName[$provided][] = $package;
  12221. }
  12222. }
  12223. }
  12224. public function getPackages(): array
  12225. {
  12226. return $this->packages;
  12227. }
  12228. public function packageById(int $id): BasePackage
  12229. {
  12230. return $this->packages[$id - 1];
  12231. }
  12232. public function count(): int
  12233. {
  12234. return \count($this->packages);
  12235. }
  12236. public function whatProvides(string $name, ?ConstraintInterface $constraint = null): array
  12237. {
  12238. $key = (string) $constraint;
  12239. if (isset($this->providerCache[$name][$key])) {
  12240. return $this->providerCache[$name][$key];
  12241. }
  12242. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint);
  12243. }
  12244. private function computeWhatProvides(string $name, ?ConstraintInterface $constraint = null): array
  12245. {
  12246. if (!isset($this->packageByName[$name])) {
  12247. return [];
  12248. }
  12249. $matches = [];
  12250. foreach ($this->packageByName[$name] as $candidate) {
  12251. if ($this->match($candidate, $name, $constraint)) {
  12252. $matches[] = $candidate;
  12253. }
  12254. }
  12255. return $matches;
  12256. }
  12257. public function literalToPackage(int $literal): BasePackage
  12258. {
  12259. $packageId = abs($literal);
  12260. return $this->packageById($packageId);
  12261. }
  12262. public function literalToPrettyString(int $literal, array $installedMap): string
  12263. {
  12264. $package = $this->literalToPackage($literal);
  12265. if (isset($installedMap[$package->id])) {
  12266. $prefix = ($literal > 0 ? 'keep' : 'remove');
  12267. } else {
  12268. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  12269. }
  12270. return $prefix.' '.$package->getPrettyString();
  12271. }
  12272. public function match(BasePackage $candidate, string $name, ?ConstraintInterface $constraint = null): bool
  12273. {
  12274. $candidateName = $candidate->getName();
  12275. $candidateVersion = $candidate->getVersion();
  12276. if ($candidateName === $name) {
  12277. return $constraint === null || CompilingMatcher::match($constraint, Constraint::OP_EQ, $candidateVersion);
  12278. }
  12279. $provides = $candidate->getProvides();
  12280. $replaces = $candidate->getReplaces();
  12281. if (isset($replaces[0]) || isset($provides[0])) {
  12282. foreach ($provides as $link) {
  12283. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  12284. return true;
  12285. }
  12286. }
  12287. foreach ($replaces as $link) {
  12288. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  12289. return true;
  12290. }
  12291. }
  12292. return false;
  12293. }
  12294. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  12295. return true;
  12296. }
  12297. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  12298. return true;
  12299. }
  12300. return false;
  12301. }
  12302. public function isUnacceptableFixedOrLockedPackage(BasePackage $package): bool
  12303. {
  12304. return \in_array($package, $this->unacceptableFixedOrLockedPackages, true);
  12305. }
  12306. public function getUnacceptableFixedOrLockedPackages(): array
  12307. {
  12308. return $this->unacceptableFixedOrLockedPackages;
  12309. }
  12310. public function __toString(): string
  12311. {
  12312. $str = "Pool:\n";
  12313. foreach ($this->packages as $package) {
  12314. $str .= '- '.str_pad((string) $package->id, 6, ' ', STR_PAD_LEFT).': '.$package->getName()."\n";
  12315. }
  12316. return $str;
  12317. }
  12318. }
  12319. <?php declare(strict_types=1);
  12320. namespace Composer\DependencyResolver;
  12321. use Composer\EventDispatcher\EventDispatcher;
  12322. use Composer\IO\IOInterface;
  12323. use Composer\Package\AliasPackage;
  12324. use Composer\Package\BasePackage;
  12325. use Composer\Package\CompleteAliasPackage;
  12326. use Composer\Package\CompletePackage;
  12327. use Composer\Package\PackageInterface;
  12328. use Composer\Package\Version\StabilityFilter;
  12329. use Composer\Pcre\Preg;
  12330. use Composer\Plugin\PluginEvents;
  12331. use Composer\Plugin\PrePoolCreateEvent;
  12332. use Composer\Repository\PlatformRepository;
  12333. use Composer\Repository\RepositoryInterface;
  12334. use Composer\Repository\RootPackageRepository;
  12335. use Composer\Semver\CompilingMatcher;
  12336. use Composer\Semver\Constraint\Constraint;
  12337. use Composer\Semver\Constraint\ConstraintInterface;
  12338. use Composer\Semver\Constraint\MatchAllConstraint;
  12339. use Composer\Semver\Constraint\MultiConstraint;
  12340. use Composer\Semver\Intervals;
  12341. class PoolBuilder
  12342. {
  12343. private $acceptableStabilities;
  12344. private $stabilityFlags;
  12345. private $rootAliases;
  12346. private $rootReferences;
  12347. private $temporaryConstraints;
  12348. private $eventDispatcher;
  12349. private $poolOptimizer;
  12350. private $io;
  12351. private $aliasMap = [];
  12352. private $packagesToLoad = [];
  12353. private $loadedPackages = [];
  12354. private $loadedPerRepo = [];
  12355. private $packages = [];
  12356. private $unacceptableFixedOrLockedPackages = [];
  12357. private $updateAllowList = [];
  12358. private $skippedLoad = [];
  12359. private $restrictedPackagesList = null;
  12360. private $pathRepoUnlocked = [];
  12361. private $maxExtendedReqs = [];
  12362. private $updateAllowWarned = [];
  12363. private $indexCounter = 0;
  12364. public function __construct(array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null, array $temporaryConstraints = [])
  12365. {
  12366. $this->acceptableStabilities = $acceptableStabilities;
  12367. $this->stabilityFlags = $stabilityFlags;
  12368. $this->rootAliases = $rootAliases;
  12369. $this->rootReferences = $rootReferences;
  12370. $this->eventDispatcher = $eventDispatcher;
  12371. $this->poolOptimizer = $poolOptimizer;
  12372. $this->io = $io;
  12373. $this->temporaryConstraints = $temporaryConstraints;
  12374. }
  12375. public function buildPool(array $repositories, Request $request): Pool
  12376. {
  12377. $this->restrictedPackagesList = $request->getRestrictedPackages() !== null ? array_flip($request->getRestrictedPackages()) : null;
  12378. if ($request->getUpdateAllowList()) {
  12379. $this->updateAllowList = $request->getUpdateAllowList();
  12380. $this->warnAboutNonMatchingUpdateAllowList($request);
  12381. foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) {
  12382. if (!$this->isUpdateAllowed($lockedPackage)) {
  12383. $this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage;
  12384. foreach ($lockedPackage->getReplaces() as $link) {
  12385. $this->skippedLoad[$link->getTarget()][] = $lockedPackage;
  12386. }
  12387. if ($lockedPackage->getDistType() === 'path') {
  12388. $transportOptions = $lockedPackage->getTransportOptions();
  12389. if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
  12390. $this->pathRepoUnlocked[$lockedPackage->getName()] = true;
  12391. continue;
  12392. }
  12393. }
  12394. $request->lockPackage($lockedPackage);
  12395. }
  12396. }
  12397. }
  12398. foreach ($request->getFixedOrLockedPackages() as $package) {
  12399. $this->loadedPackages[$package->getName()] = new MatchAllConstraint();
  12400. foreach ($package->getReplaces() as $link) {
  12401. $this->loadedPackages[$link->getTarget()] = new MatchAllConstraint();
  12402. }
  12403. if (
  12404. $package->getRepository() instanceof RootPackageRepository
  12405. || $package->getRepository() instanceof PlatformRepository
  12406. || StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $package->getNames(), $package->getStability())
  12407. ) {
  12408. $this->loadPackage($request, $repositories, $package, false);
  12409. } else {
  12410. $this->unacceptableFixedOrLockedPackages[] = $package;
  12411. }
  12412. }
  12413. foreach ($request->getRequires() as $packageName => $constraint) {
  12414. if (isset($this->loadedPackages[$packageName])) {
  12415. continue;
  12416. }
  12417. $this->packagesToLoad[$packageName] = $constraint;
  12418. $this->maxExtendedReqs[$packageName] = true;
  12419. }
  12420. foreach ($this->packagesToLoad as $name => $constraint) {
  12421. if (isset($this->loadedPackages[$name])) {
  12422. unset($this->packagesToLoad[$name]);
  12423. }
  12424. }
  12425. while (!empty($this->packagesToLoad)) {
  12426. $this->loadPackagesMarkedForLoading($request, $repositories);
  12427. }
  12428. if (\count($this->temporaryConstraints) > 0) {
  12429. foreach ($this->packages as $i => $package) {
  12430. if (!isset($this->temporaryConstraints[$package->getName()]) || $package instanceof AliasPackage) {
  12431. continue;
  12432. }
  12433. $constraint = $this->temporaryConstraints[$package->getName()];
  12434. $packageAndAliases = [$i => $package];
  12435. if (isset($this->aliasMap[spl_object_hash($package)])) {
  12436. $packageAndAliases += $this->aliasMap[spl_object_hash($package)];
  12437. }
  12438. $found = false;
  12439. foreach ($packageAndAliases as $packageOrAlias) {
  12440. if (CompilingMatcher::match($constraint, Constraint::OP_EQ, $packageOrAlias->getVersion())) {
  12441. $found = true;
  12442. }
  12443. }
  12444. if (!$found) {
  12445. foreach ($packageAndAliases as $index => $packageOrAlias) {
  12446. unset($this->packages[$index]);
  12447. }
  12448. }
  12449. }
  12450. }
  12451. if ($this->eventDispatcher) {
  12452. $prePoolCreateEvent = new PrePoolCreateEvent(
  12453. PluginEvents::PRE_POOL_CREATE,
  12454. $repositories,
  12455. $request,
  12456. $this->acceptableStabilities,
  12457. $this->stabilityFlags,
  12458. $this->rootAliases,
  12459. $this->rootReferences,
  12460. $this->packages,
  12461. $this->unacceptableFixedOrLockedPackages
  12462. );
  12463. $this->eventDispatcher->dispatch($prePoolCreateEvent->getName(), $prePoolCreateEvent);
  12464. $this->packages = $prePoolCreateEvent->getPackages();
  12465. $this->unacceptableFixedOrLockedPackages = $prePoolCreateEvent->getUnacceptableFixedPackages();
  12466. }
  12467. $pool = new Pool($this->packages, $this->unacceptableFixedOrLockedPackages);
  12468. $this->aliasMap = [];
  12469. $this->packagesToLoad = [];
  12470. $this->loadedPackages = [];
  12471. $this->loadedPerRepo = [];
  12472. $this->packages = [];
  12473. $this->unacceptableFixedOrLockedPackages = [];
  12474. $this->maxExtendedReqs = [];
  12475. $this->skippedLoad = [];
  12476. $this->indexCounter = 0;
  12477. $this->io->debug('Built pool.');
  12478. $pool = $this->runOptimizer($request, $pool);
  12479. Intervals::clear();
  12480. return $pool;
  12481. }
  12482. private function markPackageNameForLoading(Request $request, string $name, ConstraintInterface $constraint): void
  12483. {
  12484. if (PlatformRepository::isPlatformPackage($name)) {
  12485. return;
  12486. }
  12487. if (isset($this->maxExtendedReqs[$name])) {
  12488. return;
  12489. }
  12490. $rootRequires = $request->getRequires();
  12491. if (isset($rootRequires[$name]) && !Intervals::isSubsetOf($constraint, $rootRequires[$name])) {
  12492. $constraint = $rootRequires[$name];
  12493. }
  12494. if (!isset($this->loadedPackages[$name])) {
  12495. if (isset($this->packagesToLoad[$name])) {
  12496. if (Intervals::isSubsetOf($constraint, $this->packagesToLoad[$name])) {
  12497. return;
  12498. }
  12499. $constraint = Intervals::compactConstraint(MultiConstraint::create([$this->packagesToLoad[$name], $constraint], false));
  12500. }
  12501. $this->packagesToLoad[$name] = $constraint;
  12502. return;
  12503. }
  12504. if (Intervals::isSubsetOf($constraint, $this->loadedPackages[$name])) {
  12505. return;
  12506. }
  12507. $this->packagesToLoad[$name] = Intervals::compactConstraint(MultiConstraint::create([$this->loadedPackages[$name], $constraint], false));
  12508. unset($this->loadedPackages[$name]);
  12509. }
  12510. private function loadPackagesMarkedForLoading(Request $request, array $repositories): void
  12511. {
  12512. foreach ($this->packagesToLoad as $name => $constraint) {
  12513. if ($this->restrictedPackagesList !== null && !isset($this->restrictedPackagesList[$name])) {
  12514. unset($this->packagesToLoad[$name]);
  12515. continue;
  12516. }
  12517. $this->loadedPackages[$name] = $constraint;
  12518. }
  12519. $packageBatch = $this->packagesToLoad;
  12520. $this->packagesToLoad = [];
  12521. foreach ($repositories as $repoIndex => $repository) {
  12522. if (empty($packageBatch)) {
  12523. break;
  12524. }
  12525. if ($repository instanceof PlatformRepository || $repository === $request->getLockedRepository()) {
  12526. continue;
  12527. }
  12528. $result = $repository->loadPackages($packageBatch, $this->acceptableStabilities, $this->stabilityFlags, $this->loadedPerRepo[$repoIndex] ?? []);
  12529. foreach ($result['namesFound'] as $name) {
  12530. unset($packageBatch[$name]);
  12531. }
  12532. foreach ($result['packages'] as $package) {
  12533. $this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()] = $package;
  12534. $this->loadPackage($request, $repositories, $package, !isset($this->pathRepoUnlocked[$package->getName()]));
  12535. }
  12536. }
  12537. }
  12538. private function loadPackage(Request $request, array $repositories, BasePackage $package, bool $propagateUpdate): void
  12539. {
  12540. $index = $this->indexCounter++;
  12541. $this->packages[$index] = $package;
  12542. if ($package instanceof AliasPackage) {
  12543. $this->aliasMap[spl_object_hash($package->getAliasOf())][$index] = $package;
  12544. }
  12545. $name = $package->getName();
  12546. if (isset($this->rootReferences[$name])) {
  12547. if (!$request->isLockedPackage($package) && !$request->isFixedPackage($package)) {
  12548. $package->setSourceDistReferences($this->rootReferences[$name]);
  12549. }
  12550. }
  12551. if (($propagateUpdate || isset($this->pathRepoUnlocked[$package->getName()])) && isset($this->rootAliases[$name][$package->getVersion()])) {
  12552. $alias = $this->rootAliases[$name][$package->getVersion()];
  12553. if ($package instanceof AliasPackage) {
  12554. $basePackage = $package->getAliasOf();
  12555. } else {
  12556. $basePackage = $package;
  12557. }
  12558. if ($basePackage instanceof CompletePackage) {
  12559. $aliasPackage = new CompleteAliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
  12560. } else {
  12561. $aliasPackage = new AliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
  12562. }
  12563. $aliasPackage->setRootPackageAlias(true);
  12564. $newIndex = $this->indexCounter++;
  12565. $this->packages[$newIndex] = $aliasPackage;
  12566. $this->aliasMap[spl_object_hash($aliasPackage->getAliasOf())][$newIndex] = $aliasPackage;
  12567. }
  12568. foreach ($package->getRequires() as $link) {
  12569. $require = $link->getTarget();
  12570. $linkConstraint = $link->getConstraint();
  12571. if (isset($this->skippedLoad[$require])) {
  12572. if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
  12573. $skippedRootRequires = $this->getSkippedRootRequires($request, $require);
  12574. if ($request->getUpdateAllowTransitiveRootDependencies() || !$skippedRootRequires) {
  12575. $this->unlockPackage($request, $repositories, $require);
  12576. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  12577. } else {
  12578. foreach ($skippedRootRequires as $rootRequire) {
  12579. if (!isset($this->updateAllowWarned[$rootRequire])) {
  12580. $this->updateAllowWarned[$rootRequire] = true;
  12581. $this->io->writeError('<warning>Dependency '.$rootRequire.' is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>');
  12582. }
  12583. }
  12584. }
  12585. } elseif (isset($this->pathRepoUnlocked[$require]) && !isset($this->loadedPackages[$require])) {
  12586. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  12587. }
  12588. } else {
  12589. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  12590. }
  12591. }
  12592. if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
  12593. foreach ($package->getReplaces() as $link) {
  12594. $replace = $link->getTarget();
  12595. if (isset($this->loadedPackages[$replace], $this->skippedLoad[$replace])) {
  12596. $skippedRootRequires = $this->getSkippedRootRequires($request, $replace);
  12597. if ($request->getUpdateAllowTransitiveRootDependencies() || !$skippedRootRequires) {
  12598. $this->unlockPackage($request, $repositories, $replace);
  12599. $this->markPackageNameForLoadingIfRequired($request, $replace);
  12600. } else {
  12601. foreach ($skippedRootRequires as $rootRequire) {
  12602. if (!isset($this->updateAllowWarned[$rootRequire])) {
  12603. $this->updateAllowWarned[$rootRequire] = true;
  12604. $this->io->writeError('<warning>Dependency '.$rootRequire.' is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>');
  12605. }
  12606. }
  12607. }
  12608. }
  12609. }
  12610. }
  12611. }
  12612. private function isRootRequire(Request $request, string $name): bool
  12613. {
  12614. $rootRequires = $request->getRequires();
  12615. return isset($rootRequires[$name]);
  12616. }
  12617. private function getSkippedRootRequires(Request $request, string $name): array
  12618. {
  12619. if (!isset($this->skippedLoad[$name])) {
  12620. return [];
  12621. }
  12622. $rootRequires = $request->getRequires();
  12623. $matches = [];
  12624. if (isset($rootRequires[$name])) {
  12625. return array_map(static function (PackageInterface $package) use ($name): string {
  12626. if ($name !== $package->getName()) {
  12627. return $package->getName() .' (via replace of '.$name.')';
  12628. }
  12629. return $package->getName();
  12630. }, $this->skippedLoad[$name]);
  12631. }
  12632. foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
  12633. if (isset($rootRequires[$packageOrReplacer->getName()])) {
  12634. $matches[] = $packageOrReplacer->getName();
  12635. }
  12636. foreach ($packageOrReplacer->getReplaces() as $link) {
  12637. if (isset($rootRequires[$link->getTarget()])) {
  12638. if ($name !== $packageOrReplacer->getName()) {
  12639. $matches[] = $packageOrReplacer->getName() .' (via replace of '.$name.')';
  12640. } else {
  12641. $matches[] = $packageOrReplacer->getName();
  12642. }
  12643. break;
  12644. }
  12645. }
  12646. }
  12647. return $matches;
  12648. }
  12649. private function isUpdateAllowed(BasePackage $package): bool
  12650. {
  12651. foreach ($this->updateAllowList as $pattern) {
  12652. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  12653. if (Preg::isMatch($patternRegexp, $package->getName())) {
  12654. return true;
  12655. }
  12656. }
  12657. return false;
  12658. }
  12659. private function warnAboutNonMatchingUpdateAllowList(Request $request): void
  12660. {
  12661. foreach ($this->updateAllowList as $pattern) {
  12662. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  12663. foreach ($request->getLockedRepository()->getPackages() as $package) {
  12664. if (Preg::isMatch($patternRegexp, $package->getName())) {
  12665. continue 2;
  12666. }
  12667. }
  12668. foreach ($request->getRequires() as $packageName => $constraint) {
  12669. if (Preg::isMatch($patternRegexp, $packageName)) {
  12670. continue 2;
  12671. }
  12672. }
  12673. if (strpos($pattern, '*') !== false) {
  12674. $this->io->writeError('<warning>Pattern "' . $pattern . '" listed for update does not match any locked packages.</warning>');
  12675. } else {
  12676. $this->io->writeError('<warning>Package "' . $pattern . '" listed for update is not locked.</warning>');
  12677. }
  12678. }
  12679. }
  12680. private function unlockPackage(Request $request, array $repositories, string $name): void
  12681. {
  12682. foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
  12683. if ($packageOrReplacer->getName() !== $name && isset($this->skippedLoad[$packageOrReplacer->getName()])) {
  12684. $replacerName = $packageOrReplacer->getName();
  12685. if ($request->getUpdateAllowTransitiveRootDependencies() || (!$this->isRootRequire($request, $name) && !$this->isRootRequire($request, $replacerName))) {
  12686. $this->unlockPackage($request, $repositories, $replacerName);
  12687. if ($this->isRootRequire($request, $replacerName)) {
  12688. $this->markPackageNameForLoading($request, $replacerName, new MatchAllConstraint);
  12689. } else {
  12690. foreach ($this->packages as $loadedPackage) {
  12691. $requires = $loadedPackage->getRequires();
  12692. if (isset($requires[$replacerName])) {
  12693. $this->markPackageNameForLoading($request, $replacerName, $requires[$replacerName]->getConstraint());
  12694. }
  12695. }
  12696. }
  12697. }
  12698. }
  12699. }
  12700. if (isset($this->pathRepoUnlocked[$name])) {
  12701. foreach ($this->packages as $index => $package) {
  12702. if ($package->getName() === $name) {
  12703. $this->removeLoadedPackage($request, $repositories, $package, $index);
  12704. }
  12705. }
  12706. }
  12707. unset($this->skippedLoad[$name], $this->loadedPackages[$name], $this->maxExtendedReqs[$name], $this->pathRepoUnlocked[$name]);
  12708. foreach ($request->getLockedPackages() as $lockedPackage) {
  12709. if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) {
  12710. if (false !== $index = array_search($lockedPackage, $this->packages, true)) {
  12711. $request->unlockPackage($lockedPackage);
  12712. $this->removeLoadedPackage($request, $repositories, $lockedPackage, $index);
  12713. foreach ($request->getFixedOrLockedPackages() as $fixedOrLockedPackage) {
  12714. if ($fixedOrLockedPackage === $lockedPackage) {
  12715. continue;
  12716. }
  12717. if (isset($this->skippedLoad[$fixedOrLockedPackage->getName()])) {
  12718. $requires = $fixedOrLockedPackage->getRequires();
  12719. if (isset($requires[$lockedPackage->getName()])) {
  12720. $this->markPackageNameForLoading($request, $lockedPackage->getName(), $requires[$lockedPackage->getName()]->getConstraint());
  12721. }
  12722. foreach ($lockedPackage->getReplaces() as $replace) {
  12723. if (isset($requires[$replace->getTarget()], $this->skippedLoad[$replace->getTarget()])) {
  12724. $this->unlockPackage($request, $repositories, $replace->getTarget());
  12725. $this->markPackageNameForLoading($request, $replace->getTarget(), $replace->getConstraint());
  12726. }
  12727. }
  12728. }
  12729. }
  12730. }
  12731. }
  12732. }
  12733. }
  12734. private function markPackageNameForLoadingIfRequired(Request $request, string $name): void
  12735. {
  12736. if ($this->isRootRequire($request, $name)) {
  12737. $this->markPackageNameForLoading($request, $name, $request->getRequires()[$name]);
  12738. }
  12739. foreach ($this->packages as $package) {
  12740. foreach ($package->getRequires() as $link) {
  12741. if ($name === $link->getTarget()) {
  12742. $this->markPackageNameForLoading($request, $link->getTarget(), $link->getConstraint());
  12743. }
  12744. }
  12745. }
  12746. }
  12747. private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, int $index): void
  12748. {
  12749. $repoIndex = array_search($package->getRepository(), $repositories, true);
  12750. unset($this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()]);
  12751. unset($this->packages[$index]);
  12752. if (isset($this->aliasMap[spl_object_hash($package)])) {
  12753. foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) {
  12754. unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]);
  12755. unset($this->packages[$aliasIndex]);
  12756. }
  12757. unset($this->aliasMap[spl_object_hash($package)]);
  12758. }
  12759. }
  12760. private function runOptimizer(Request $request, Pool $pool): Pool
  12761. {
  12762. if (null === $this->poolOptimizer) {
  12763. return $pool;
  12764. }
  12765. $this->io->debug('Running pool optimizer.');
  12766. $before = microtime(true);
  12767. $total = \count($pool->getPackages());
  12768. $pool = $this->poolOptimizer->optimize($request, $pool);
  12769. $filtered = $total - \count($pool->getPackages());
  12770. if (0 === $filtered) {
  12771. return $pool;
  12772. }
  12773. $this->io->write(sprintf('Pool optimizer completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERY_VERBOSE);
  12774. $this->io->write(sprintf(
  12775. '<info>Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.</info>',
  12776. number_format($total),
  12777. number_format($filtered),
  12778. round(100 / $total * $filtered)
  12779. ), true, IOInterface::VERY_VERBOSE);
  12780. return $pool;
  12781. }
  12782. }
  12783. <?php declare(strict_types=1);
  12784. namespace Composer\DependencyResolver;
  12785. use Composer\Package\AliasPackage;
  12786. use Composer\Package\BasePackage;
  12787. use Composer\Package\Version\VersionParser;
  12788. use Composer\Semver\CompilingMatcher;
  12789. use Composer\Semver\Constraint\ConstraintInterface;
  12790. use Composer\Semver\Constraint\Constraint;
  12791. use Composer\Semver\Constraint\MultiConstraint;
  12792. use Composer\Semver\Intervals;
  12793. class PoolOptimizer
  12794. {
  12795. private $policy;
  12796. private $irremovablePackages = [];
  12797. private $requireConstraintsPerPackage = [];
  12798. private $conflictConstraintsPerPackage = [];
  12799. private $packagesToRemove = [];
  12800. private $aliasesPerPackage = [];
  12801. private $removedVersionsByPackage = [];
  12802. public function __construct(PolicyInterface $policy)
  12803. {
  12804. $this->policy = $policy;
  12805. }
  12806. public function optimize(Request $request, Pool $pool): Pool
  12807. {
  12808. $this->prepare($request, $pool);
  12809. $this->optimizeByIdenticalDependencies($request, $pool);
  12810. $this->optimizeImpossiblePackagesAway($request, $pool);
  12811. $optimizedPool = $this->applyRemovalsToPool($pool);
  12812. $this->irremovablePackages = [];
  12813. $this->requireConstraintsPerPackage = [];
  12814. $this->conflictConstraintsPerPackage = [];
  12815. $this->packagesToRemove = [];
  12816. $this->aliasesPerPackage = [];
  12817. $this->removedVersionsByPackage = [];
  12818. return $optimizedPool;
  12819. }
  12820. private function prepare(Request $request, Pool $pool): void
  12821. {
  12822. $irremovablePackageConstraintGroups = [];
  12823. foreach ($request->getFixedOrLockedPackages() as $package) {
  12824. $irremovablePackageConstraintGroups[$package->getName()][] = new Constraint('==', $package->getVersion());
  12825. }
  12826. foreach ($request->getRequires() as $require => $constraint) {
  12827. $this->extractRequireConstraintsPerPackage($require, $constraint);
  12828. }
  12829. foreach ($pool->getPackages() as $package) {
  12830. foreach ($package->getRequires() as $link) {
  12831. $this->extractRequireConstraintsPerPackage($link->getTarget(), $link->getConstraint());
  12832. }
  12833. foreach ($package->getConflicts() as $link) {
  12834. $this->extractConflictConstraintsPerPackage($link->getTarget(), $link->getConstraint());
  12835. }
  12836. if ($package instanceof AliasPackage) {
  12837. $this->aliasesPerPackage[$package->getAliasOf()->id][] = $package;
  12838. }
  12839. }
  12840. $irremovablePackageConstraints = [];
  12841. foreach ($irremovablePackageConstraintGroups as $packageName => $constraints) {
  12842. $irremovablePackageConstraints[$packageName] = 1 === \count($constraints) ? $constraints[0] : new MultiConstraint($constraints, false);
  12843. }
  12844. unset($irremovablePackageConstraintGroups);
  12845. foreach ($pool->getPackages() as $package) {
  12846. if (!isset($irremovablePackageConstraints[$package->getName()])) {
  12847. continue;
  12848. }
  12849. if (CompilingMatcher::match($irremovablePackageConstraints[$package->getName()], Constraint::OP_EQ, $package->getVersion())) {
  12850. $this->markPackageIrremovable($package);
  12851. }
  12852. }
  12853. }
  12854. private function markPackageIrremovable(BasePackage $package): void
  12855. {
  12856. $this->irremovablePackages[$package->id] = true;
  12857. if ($package instanceof AliasPackage) {
  12858. $this->markPackageIrremovable($package->getAliasOf());
  12859. }
  12860. if (isset($this->aliasesPerPackage[$package->id])) {
  12861. foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
  12862. $this->irremovablePackages[$aliasPackage->id] = true;
  12863. }
  12864. }
  12865. }
  12866. private function applyRemovalsToPool(Pool $pool): Pool
  12867. {
  12868. $packages = [];
  12869. $removedVersions = [];
  12870. foreach ($pool->getPackages() as $package) {
  12871. if (!isset($this->packagesToRemove[$package->id])) {
  12872. $packages[] = $package;
  12873. } else {
  12874. $removedVersions[$package->getName()][$package->getVersion()] = $package->getPrettyVersion();
  12875. }
  12876. }
  12877. $optimizedPool = new Pool($packages, $pool->getUnacceptableFixedOrLockedPackages(), $removedVersions, $this->removedVersionsByPackage);
  12878. return $optimizedPool;
  12879. }
  12880. private function optimizeByIdenticalDependencies(Request $request, Pool $pool): void
  12881. {
  12882. $identicalDefinitionsPerPackage = [];
  12883. $packageIdenticalDefinitionLookup = [];
  12884. foreach ($pool->getPackages() as $package) {
  12885. if (isset($this->irremovablePackages[$package->id])) {
  12886. continue;
  12887. }
  12888. $this->markPackageForRemoval($package->id);
  12889. $dependencyHash = $this->calculateDependencyHash($package);
  12890. foreach ($package->getNames(false) as $packageName) {
  12891. if (!isset($this->requireConstraintsPerPackage[$packageName])) {
  12892. continue;
  12893. }
  12894. foreach ($this->requireConstraintsPerPackage[$packageName] as $requireConstraint) {
  12895. $groupHashParts = [];
  12896. if (CompilingMatcher::match($requireConstraint, Constraint::OP_EQ, $package->getVersion())) {
  12897. $groupHashParts[] = 'require:' . (string) $requireConstraint;
  12898. }
  12899. if ($package->getReplaces()) {
  12900. foreach ($package->getReplaces() as $link) {
  12901. if (CompilingMatcher::match($link->getConstraint(), Constraint::OP_EQ, $package->getVersion())) {
  12902. $groupHashParts[] = 'require:' . (string) $link->getConstraint();
  12903. }
  12904. }
  12905. }
  12906. if (isset($this->conflictConstraintsPerPackage[$packageName])) {
  12907. foreach ($this->conflictConstraintsPerPackage[$packageName] as $conflictConstraint) {
  12908. if (CompilingMatcher::match($conflictConstraint, Constraint::OP_EQ, $package->getVersion())) {
  12909. $groupHashParts[] = 'conflict:' . (string) $conflictConstraint;
  12910. }
  12911. }
  12912. }
  12913. if (!$groupHashParts) {
  12914. continue;
  12915. }
  12916. $groupHash = implode('', $groupHashParts);
  12917. $identicalDefinitionsPerPackage[$packageName][$groupHash][$dependencyHash][] = $package;
  12918. $packageIdenticalDefinitionLookup[$package->id][$packageName] = ['groupHash' => $groupHash, 'dependencyHash' => $dependencyHash];
  12919. }
  12920. }
  12921. }
  12922. foreach ($identicalDefinitionsPerPackage as $constraintGroups) {
  12923. foreach ($constraintGroups as $constraintGroup) {
  12924. foreach ($constraintGroup as $packages) {
  12925. if (1 === \count($packages)) {
  12926. $this->keepPackage($packages[0], $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  12927. continue;
  12928. }
  12929. $literals = [];
  12930. foreach ($packages as $package) {
  12931. $literals[] = $package->id;
  12932. }
  12933. foreach ($this->policy->selectPreferredPackages($pool, $literals) as $preferredLiteral) {
  12934. $this->keepPackage($pool->literalToPackage($preferredLiteral), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  12935. }
  12936. }
  12937. }
  12938. }
  12939. }
  12940. private function calculateDependencyHash(BasePackage $package): string
  12941. {
  12942. $hash = '';
  12943. $hashRelevantLinks = [
  12944. 'requires' => $package->getRequires(),
  12945. 'conflicts' => $package->getConflicts(),
  12946. 'replaces' => $package->getReplaces(),
  12947. 'provides' => $package->getProvides(),
  12948. ];
  12949. foreach ($hashRelevantLinks as $key => $links) {
  12950. if (0 === \count($links)) {
  12951. continue;
  12952. }
  12953. $hash .= $key . ':';
  12954. $subhash = [];
  12955. foreach ($links as $link) {
  12956. $subhash[$link->getTarget()] = (string) $link->getConstraint();
  12957. }
  12958. ksort($subhash);
  12959. foreach ($subhash as $target => $constraint) {
  12960. $hash .= $target . '@' . $constraint;
  12961. }
  12962. }
  12963. return $hash;
  12964. }
  12965. private function markPackageForRemoval(int $id): void
  12966. {
  12967. if (isset($this->irremovablePackages[$id])) {
  12968. throw new \LogicException('Attempted removing a package which was previously marked irremovable');
  12969. }
  12970. $this->packagesToRemove[$id] = true;
  12971. }
  12972. private function keepPackage(BasePackage $package, array $identicalDefinitionsPerPackage, array $packageIdenticalDefinitionLookup): void
  12973. {
  12974. if (!isset($this->packagesToRemove[$package->id])) {
  12975. return;
  12976. }
  12977. unset($this->packagesToRemove[$package->id]);
  12978. if ($package instanceof AliasPackage) {
  12979. $this->keepPackage($package->getAliasOf(), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  12980. }
  12981. foreach ($package->getNames(false) as $name) {
  12982. if (isset($packageIdenticalDefinitionLookup[$package->id][$name])) {
  12983. $packageGroupPointers = $packageIdenticalDefinitionLookup[$package->id][$name];
  12984. $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
  12985. foreach ($packageGroup as $pkg) {
  12986. if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  12987. $pkg = $pkg->getAliasOf();
  12988. }
  12989. $this->removedVersionsByPackage[spl_object_hash($package)][$pkg->getVersion()] = $pkg->getPrettyVersion();
  12990. }
  12991. }
  12992. }
  12993. if (isset($this->aliasesPerPackage[$package->id])) {
  12994. foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
  12995. unset($this->packagesToRemove[$aliasPackage->id]);
  12996. foreach ($aliasPackage->getNames(false) as $name) {
  12997. if (isset($packageIdenticalDefinitionLookup[$aliasPackage->id][$name])) {
  12998. $packageGroupPointers = $packageIdenticalDefinitionLookup[$aliasPackage->id][$name];
  12999. $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
  13000. foreach ($packageGroup as $pkg) {
  13001. if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  13002. $pkg = $pkg->getAliasOf();
  13003. }
  13004. $this->removedVersionsByPackage[spl_object_hash($aliasPackage)][$pkg->getVersion()] = $pkg->getPrettyVersion();
  13005. }
  13006. }
  13007. }
  13008. }
  13009. }
  13010. }
  13011. private function optimizeImpossiblePackagesAway(Request $request, Pool $pool): void
  13012. {
  13013. if (count($request->getLockedPackages()) === 0) {
  13014. return;
  13015. }
  13016. $packageIndex = [];
  13017. foreach ($pool->getPackages() as $package) {
  13018. $id = $package->id;
  13019. if (isset($this->irremovablePackages[$id])) {
  13020. continue;
  13021. }
  13022. if (isset($this->aliasesPerPackage[$id]) || $package instanceof AliasPackage) {
  13023. continue;
  13024. }
  13025. if ($request->isFixedPackage($package) || $request->isLockedPackage($package)) {
  13026. continue;
  13027. }
  13028. $packageIndex[$package->getName()][$package->id] = $package;
  13029. }
  13030. foreach ($request->getLockedPackages() as $package) {
  13031. $isUnusedPackage = true;
  13032. foreach ($package->getNames(false) as $packageName) {
  13033. if (isset($this->requireConstraintsPerPackage[$packageName])) {
  13034. $isUnusedPackage = false;
  13035. break;
  13036. }
  13037. }
  13038. if ($isUnusedPackage) {
  13039. continue;
  13040. }
  13041. foreach ($package->getRequires() as $link) {
  13042. $require = $link->getTarget();
  13043. if (!isset($packageIndex[$require])) {
  13044. continue;
  13045. }
  13046. $linkConstraint = $link->getConstraint();
  13047. foreach ($packageIndex[$require] as $id => $requiredPkg) {
  13048. if (false === CompilingMatcher::match($linkConstraint, Constraint::OP_EQ, $requiredPkg->getVersion())) {
  13049. $this->markPackageForRemoval($id);
  13050. unset($packageIndex[$require][$id]);
  13051. }
  13052. }
  13053. }
  13054. }
  13055. }
  13056. private function extractRequireConstraintsPerPackage(string $package, ConstraintInterface $constraint)
  13057. {
  13058. foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
  13059. $this->requireConstraintsPerPackage[$package][(string) $expanded] = $expanded;
  13060. }
  13061. }
  13062. private function extractConflictConstraintsPerPackage(string $package, ConstraintInterface $constraint)
  13063. {
  13064. foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
  13065. $this->conflictConstraintsPerPackage[$package][(string) $expanded] = $expanded;
  13066. }
  13067. }
  13068. private function expandDisjunctiveMultiConstraints(ConstraintInterface $constraint)
  13069. {
  13070. $constraint = Intervals::compactConstraint($constraint);
  13071. if ($constraint instanceof MultiConstraint && $constraint->isDisjunctive()) {
  13072. return $constraint->getConstraints();
  13073. }
  13074. return [$constraint];
  13075. }
  13076. }
  13077. <?php declare(strict_types=1);
  13078. namespace Composer\DependencyResolver;
  13079. use Composer\Package\CompletePackageInterface;
  13080. use Composer\Package\AliasPackage;
  13081. use Composer\Package\BasePackage;
  13082. use Composer\Package\Link;
  13083. use Composer\Package\PackageInterface;
  13084. use Composer\Package\RootPackageInterface;
  13085. use Composer\Pcre\Preg;
  13086. use Composer\Repository\RepositorySet;
  13087. use Composer\Repository\LockArrayRepository;
  13088. use Composer\Semver\Constraint\Constraint;
  13089. use Composer\Semver\Constraint\ConstraintInterface;
  13090. use Composer\Package\Version\VersionParser;
  13091. use Composer\Repository\PlatformRepository;
  13092. class Problem
  13093. {
  13094. protected $reasonSeen;
  13095. protected $reasons = [];
  13096. protected $section = 0;
  13097. public function addRule(Rule $rule): void
  13098. {
  13099. $this->addReason(spl_object_hash($rule), $rule);
  13100. }
  13101. public function getReasons(): array
  13102. {
  13103. return $this->reasons;
  13104. }
  13105. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
  13106. {
  13107. $reasons = array_merge(...array_reverse($this->reasons));
  13108. if (count($reasons) === 1) {
  13109. reset($reasons);
  13110. $rule = current($reasons);
  13111. if ($rule->getReason() !== Rule::RULE_ROOT_REQUIRE) {
  13112. throw new \LogicException("Single reason problems must contain a root require rule.");
  13113. }
  13114. $reasonData = $rule->getReasonData();
  13115. $packageName = $reasonData['packageName'];
  13116. $constraint = $reasonData['constraint'];
  13117. $packages = $pool->whatProvides($packageName, $constraint);
  13118. if (count($packages) === 0) {
  13119. return "\n ".implode(self::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $packageName, $constraint));
  13120. }
  13121. }
  13122. return self::formatDeduplicatedRules($reasons, ' ', $repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
  13123. }
  13124. public static function formatDeduplicatedRules(array $rules, string $indent, RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
  13125. {
  13126. $messages = [];
  13127. $templates = [];
  13128. $parser = new VersionParser;
  13129. $deduplicatableRuleTypes = [Rule::RULE_PACKAGE_REQUIRES, Rule::RULE_PACKAGE_CONFLICT];
  13130. foreach ($rules as $rule) {
  13131. $message = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
  13132. if (in_array($rule->getReason(), $deduplicatableRuleTypes, true) && Preg::isMatchStrictGroups('{^(?P<package>\S+) (?P<version>\S+) (?P<type>requires|conflicts)}', $message, $m)) {
  13133. $message = str_replace('%', '%%', $message);
  13134. $template = Preg::replace('{^\S+ \S+ }', '%s%s ', $message);
  13135. $messages[] = $template;
  13136. $templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
  13137. $sourcePackage = $rule->getSourcePackage($pool);
  13138. foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($sourcePackage)) as $version => $prettyVersion) {
  13139. $templates[$template][$m[1]][$version] = $prettyVersion;
  13140. }
  13141. } elseif ($message !== '') {
  13142. $messages[] = $message;
  13143. }
  13144. }
  13145. $result = [];
  13146. foreach (array_unique($messages) as $message) {
  13147. if (isset($templates[$message])) {
  13148. foreach ($templates[$message] as $package => $versions) {
  13149. uksort($versions, 'version_compare');
  13150. if (!$isVerbose) {
  13151. $versions = self::condenseVersionList($versions, 1);
  13152. }
  13153. if (count($versions) > 1) {
  13154. $message = Preg::replace('{^(%s%s (?:require|conflict))s}', '$1', $message);
  13155. $result[] = sprintf($message, $package, '['.implode(', ', $versions).']');
  13156. } else {
  13157. $result[] = sprintf($message, $package, ' '.reset($versions));
  13158. }
  13159. }
  13160. } else {
  13161. $result[] = $message;
  13162. }
  13163. }
  13164. return "\n$indent- ".implode("\n$indent- ", $result);
  13165. }
  13166. public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
  13167. {
  13168. foreach ($this->reasons as $sectionRules) {
  13169. foreach ($sectionRules as $rule) {
  13170. if ($rule->isCausedByLock($repositorySet, $request, $pool)) {
  13171. return true;
  13172. }
  13173. }
  13174. }
  13175. return false;
  13176. }
  13177. protected function addReason(string $id, Rule $reason): void
  13178. {
  13179. if (!isset($this->reasonSeen[$id])) {
  13180. $this->reasonSeen[$id] = true;
  13181. $this->reasons[$this->section][] = $reason;
  13182. }
  13183. }
  13184. public function nextSection(): void
  13185. {
  13186. $this->section++;
  13187. }
  13188. public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, string $packageName, ?ConstraintInterface $constraint = null): array
  13189. {
  13190. if (PlatformRepository::isPlatformPackage($packageName)) {
  13191. if (0 === stripos($packageName, 'php') || $packageName === 'hhvm') {
  13192. $version = self::getPlatformPackageVersion($pool, $packageName, phpversion());
  13193. $msg = "- Root composer.json requires ".$packageName.self::constraintToText($constraint).' but ';
  13194. if (defined('HHVM_VERSION') || ($packageName === 'hhvm' && count($pool->whatProvides($packageName)) > 0)) {
  13195. return [$msg, 'your HHVM version does not satisfy that requirement.'];
  13196. }
  13197. if ($packageName === 'hhvm') {
  13198. return [$msg, 'HHVM was not detected on this machine, make sure it is in your PATH.'];
  13199. }
  13200. if (null === $version) {
  13201. return [$msg, 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".'];
  13202. }
  13203. return [$msg, 'your '.$packageName.' version ('. $version .') does not satisfy that requirement.'];
  13204. }
  13205. if (0 === stripos($packageName, 'ext-')) {
  13206. if (false !== strpos($packageName, ' ')) {
  13207. return ['- ', "PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.'];
  13208. }
  13209. $ext = substr($packageName, 4);
  13210. $msg = "- Root composer.json requires PHP extension ".$packageName.self::constraintToText($constraint).' but ';
  13211. $version = self::getPlatformPackageVersion($pool, $packageName, phpversion($ext) ?: '0');
  13212. if (null === $version) {
  13213. if (extension_loaded($ext)) {
  13214. return [
  13215. $msg,
  13216. 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".',
  13217. ];
  13218. }
  13219. return [$msg, 'it is missing from your system. Install or enable PHP\'s '.$ext.' extension.'];
  13220. }
  13221. return [$msg, 'it has the wrong version installed ('.$version.').'];
  13222. }
  13223. if (0 === stripos($packageName, 'lib-')) {
  13224. if (strtolower($packageName) === 'lib-icu') {
  13225. $error = extension_loaded('intl') ? 'it has the wrong version installed, try upgrading the intl extension.' : 'it is missing from your system, make sure the intl extension is loaded.';
  13226. return ["- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', $error];
  13227. }
  13228. return ["- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', 'it has the wrong version installed or is missing from your system, make sure to load the extension providing it.'];
  13229. }
  13230. }
  13231. $lockedPackage = null;
  13232. foreach ($request->getLockedPackages() as $package) {
  13233. if ($package->getName() === $packageName) {
  13234. $lockedPackage = $package;
  13235. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  13236. return ["- ", $package->getPrettyName().' is fixed to '.$package->getPrettyVersion().' (lock file version) by a partial update but that version is rejected by your minimum-stability. Make sure you list it as an argument for the update command.'];
  13237. }
  13238. break;
  13239. }
  13240. }
  13241. if ($packages = $repositorySet->findPackages($packageName, $constraint)) {
  13242. $rootReqs = $repositorySet->getRootRequires();
  13243. if (isset($rootReqs[$packageName])) {
  13244. $filtered = array_filter($packages, static function ($p) use ($rootReqs, $packageName): bool {
  13245. return $rootReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
  13246. });
  13247. if (0 === count($filtered)) {
  13248. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your root composer.json require ('.$rootReqs[$packageName]->getPrettyString().').'];
  13249. }
  13250. }
  13251. $tempReqs = $repositorySet->getTemporaryConstraints();
  13252. if (isset($tempReqs[$packageName])) {
  13253. $filtered = array_filter($packages, static function ($p) use ($tempReqs, $packageName): bool {
  13254. return $tempReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
  13255. });
  13256. if (0 === count($filtered)) {
  13257. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your temporary update constraint ('.$packageName.':'.$tempReqs[$packageName]->getPrettyString().').'];
  13258. }
  13259. }
  13260. if ($lockedPackage) {
  13261. $fixedConstraint = new Constraint('==', $lockedPackage->getVersion());
  13262. $filtered = array_filter($packages, static function ($p) use ($fixedConstraint): bool {
  13263. return $fixedConstraint->matches(new Constraint('==', $p->getVersion()));
  13264. });
  13265. if (0 === count($filtered)) {
  13266. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but the package is fixed to '.$lockedPackage->getPrettyVersion().' (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.'];
  13267. }
  13268. }
  13269. $nonLockedPackages = array_filter($packages, static function ($p): bool {
  13270. return !$p->getRepository() instanceof LockArrayRepository;
  13271. });
  13272. if (!$nonLockedPackages) {
  13273. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.'];
  13274. }
  13275. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but these were not loaded, likely because '.(self::hasMultipleNames($packages) ? 'they conflict' : 'it conflicts').' with another require.'];
  13276. }
  13277. if ($packages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
  13278. if ($allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES)) {
  13279. return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'minimum-stability', $constraint);
  13280. }
  13281. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your minimum-stability.'];
  13282. }
  13283. if ($packages = $repositorySet->findPackages($packageName, null, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
  13284. if ($allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES)) {
  13285. return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'constraint', $constraint);
  13286. }
  13287. $suffix = '';
  13288. if ($constraint instanceof Constraint && $constraint->getVersion() === 'dev-master') {
  13289. foreach ($packages as $candidate) {
  13290. if (in_array($candidate->getVersion(), ['dev-default', 'dev-main'], true)) {
  13291. $suffix = ' Perhaps dev-master was renamed to '.$candidate->getPrettyVersion().'?';
  13292. break;
  13293. }
  13294. }
  13295. }
  13296. $allReposPackages = $packages;
  13297. $topPackage = reset($allReposPackages);
  13298. if ($topPackage instanceof RootPackageInterface) {
  13299. $suffix = ' See https://getcomposer.org/dep-on-root for details and assistance.';
  13300. }
  13301. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match the constraint.' . $suffix];
  13302. }
  13303. if (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  13304. $illegalChars = Preg::replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  13305. return ["- Root composer.json requires $packageName, it ", 'could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.'];
  13306. }
  13307. if ($providers = $repositorySet->getProviders($packageName)) {
  13308. $maxProviders = 20;
  13309. $providersStr = implode(array_map(static function ($p): string {
  13310. $description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
  13311. return ' - '.$p['name'].$description."\n";
  13312. }, count($providers) > $maxProviders + 1 ? array_slice($providers, 0, $maxProviders) : $providers));
  13313. if (count($providers) > $maxProviders + 1) {
  13314. $providersStr .= ' ... and '.(count($providers) - $maxProviders).' more.'."\n";
  13315. }
  13316. return ["- Root composer.json requires $packageName".self::constraintToText($constraint).", it ", "could not be found in any version, but the following packages provide it:\n".$providersStr." Consider requiring one of these to satisfy the $packageName requirement."];
  13317. }
  13318. return ["- Root composer.json requires $packageName, it ", "could not be found in any version, there may be a typo in the package name."];
  13319. }
  13320. public static function getPackageList(array $packages, bool $isVerbose, ?Pool $pool = null, ?ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
  13321. {
  13322. $prepared = [];
  13323. $hasDefaultBranch = [];
  13324. foreach ($packages as $package) {
  13325. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  13326. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion().($package instanceof AliasPackage ? ' (alias of '.$package->getAliasOf()->getPrettyVersion().')' : '');
  13327. if ($pool && $constraint) {
  13328. foreach ($pool->getRemovedVersions($package->getName(), $constraint) as $version => $prettyVersion) {
  13329. $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
  13330. }
  13331. }
  13332. if ($pool && $useRemovedVersionGroup) {
  13333. foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($package)) as $version => $prettyVersion) {
  13334. $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
  13335. }
  13336. }
  13337. if ($package->isDefaultBranch()) {
  13338. $hasDefaultBranch[$package->getName()] = true;
  13339. }
  13340. }
  13341. $preparedStrings = [];
  13342. foreach ($prepared as $name => $package) {
  13343. if (isset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS], $hasDefaultBranch[$name])) {
  13344. unset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS]);
  13345. }
  13346. uksort($package['versions'], 'version_compare');
  13347. if (!$isVerbose) {
  13348. $package['versions'] = self::condenseVersionList($package['versions'], 4);
  13349. }
  13350. $preparedStrings[] = $package['name'].'['.implode(', ', $package['versions']).']';
  13351. }
  13352. return implode(', ', $preparedStrings);
  13353. }
  13354. private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version): ?string
  13355. {
  13356. $available = $pool->whatProvides($packageName);
  13357. if (count($available)) {
  13358. $selected = null;
  13359. foreach ($available as $pkg) {
  13360. if ($pkg->getRepository() instanceof PlatformRepository) {
  13361. $selected = $pkg;
  13362. break;
  13363. }
  13364. }
  13365. if ($selected === null) {
  13366. $selected = reset($available);
  13367. }
  13368. if ($selected->getName() !== $packageName) {
  13369. foreach (array_merge(array_values($selected->getProvides()), array_values($selected->getReplaces())) as $link) {
  13370. if ($link->getTarget() === $packageName) {
  13371. return $link->getPrettyConstraint().' '.substr($link->getDescription(), 0, -1).'d by '.$selected->getPrettyString();
  13372. }
  13373. }
  13374. }
  13375. $version = $selected->getPrettyVersion();
  13376. $extra = $selected->getExtra();
  13377. if ($selected instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  13378. $version .= '; ' . str_replace('Package ', '', $selected->getDescription());
  13379. }
  13380. } else {
  13381. return null;
  13382. }
  13383. return $version;
  13384. }
  13385. private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array
  13386. {
  13387. if (count($versions) <= $max) {
  13388. return array_values($versions);
  13389. }
  13390. $filtered = [];
  13391. $byMajor = [];
  13392. foreach ($versions as $version => $pretty) {
  13393. if (0 === stripos((string) $version, 'dev-')) {
  13394. $byMajor['dev'][] = $pretty;
  13395. } else {
  13396. $byMajor[Preg::replace('{^(\d+)\..*}', '$1', (string) $version)][] = $pretty;
  13397. }
  13398. }
  13399. foreach ($byMajor as $majorVersion => $versionsForMajor) {
  13400. $maxVersions = $majorVersion === 'dev' ? $maxDev : $max;
  13401. if (count($versionsForMajor) > $maxVersions) {
  13402. $filtered[] = $versionsForMajor[0];
  13403. $filtered[] = '...';
  13404. $filtered[] = $versionsForMajor[count($versionsForMajor) - 1];
  13405. } else {
  13406. $filtered = array_merge($filtered, $versionsForMajor);
  13407. }
  13408. }
  13409. return $filtered;
  13410. }
  13411. private static function hasMultipleNames(array $packages): bool
  13412. {
  13413. $name = null;
  13414. foreach ($packages as $package) {
  13415. if ($name === null || $name === $package->getName()) {
  13416. $name = $package->getName();
  13417. } else {
  13418. return true;
  13419. }
  13420. }
  13421. return false;
  13422. }
  13423. private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose, string $packageName, array $higherRepoPackages, array $allReposPackages, string $reason, ?ConstraintInterface $constraint = null): array
  13424. {
  13425. $nextRepoPackages = [];
  13426. $nextRepo = null;
  13427. foreach ($allReposPackages as $package) {
  13428. if ($nextRepo === null || $nextRepo === $package->getRepository()) {
  13429. $nextRepoPackages[] = $package;
  13430. $nextRepo = $package->getRepository();
  13431. } else {
  13432. break;
  13433. }
  13434. }
  13435. if ($higherRepoPackages) {
  13436. $topPackage = reset($higherRepoPackages);
  13437. if ($topPackage instanceof RootPackageInterface) {
  13438. return [
  13439. "- Root composer.json requires $packageName".self::constraintToText($constraint).', it is ',
  13440. 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.$topPackage->getPrettyName().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.',
  13441. ];
  13442. }
  13443. }
  13444. if ($nextRepo instanceof LockArrayRepository) {
  13445. $singular = count($higherRepoPackages) === 1;
  13446. $suggestion = 'Make sure you either fix the '.$reason.' or avoid updating this package to keep the one present in the lock file ('.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).').';
  13447. if ($nextRepoPackages[0]->getDistType() === 'path') {
  13448. $transportOptions = $nextRepoPackages[0]->getTransportOptions();
  13449. if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
  13450. $suggestion = 'Make sure you fix the '.$reason.' as packages installed from symlinked path repos are updated even in partial updates and the one from the lock file can thus not be used.';
  13451. }
  13452. }
  13453. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ',
  13454. 'found ' . self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. '.$suggestion,
  13455. ];
  13456. }
  13457. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages from the higher priority repository do not match your '.$reason.' and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'];
  13458. }
  13459. protected static function constraintToText(?ConstraintInterface $constraint = null): string
  13460. {
  13461. if ($constraint instanceof Constraint && $constraint->getOperator() === Constraint::STR_OP_EQ && !str_starts_with($constraint->getVersion(), 'dev-')) {
  13462. if (!Preg::isMatch('{^\d+(?:\.\d+)*$}', $constraint->getPrettyString())) {
  13463. return ' '.$constraint->getPrettyString() .' (exact version match)';
  13464. }
  13465. $versions = [$constraint->getPrettyString()];
  13466. for ($i = 3 - substr_count($versions[0], '.'); $i > 0; $i--) {
  13467. $versions[] = end($versions) . '.0';
  13468. }
  13469. return ' ' . $constraint->getPrettyString() . ' (exact version match: ' . (count($versions) > 1 ? implode(', ', array_slice($versions, 0, -1)) . ' or ' . end($versions) : $versions[0]) . ')';
  13470. }
  13471. return $constraint ? ' '.$constraint->getPrettyString() : '';
  13472. }
  13473. }
  13474. <?php declare(strict_types=1);
  13475. namespace Composer\DependencyResolver;
  13476. use Composer\Package\BasePackage;
  13477. use Composer\Package\PackageInterface;
  13478. use Composer\Repository\LockArrayRepository;
  13479. use Composer\Semver\Constraint\ConstraintInterface;
  13480. use Composer\Semver\Constraint\MatchAllConstraint;
  13481. class Request
  13482. {
  13483. public const UPDATE_ONLY_LISTED = 0;
  13484. public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE = 1;
  13485. public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS = 2;
  13486. protected $lockedRepository;
  13487. protected $requires = [];
  13488. protected $fixedPackages = [];
  13489. protected $lockedPackages = [];
  13490. protected $fixedLockedPackages = [];
  13491. protected $updateAllowList = [];
  13492. protected $updateAllowTransitiveDependencies = false;
  13493. private $restrictedPackages = null;
  13494. public function __construct(?LockArrayRepository $lockedRepository = null)
  13495. {
  13496. $this->lockedRepository = $lockedRepository;
  13497. }
  13498. public function requireName(string $packageName, ?ConstraintInterface $constraint = null): void
  13499. {
  13500. $packageName = strtolower($packageName);
  13501. if ($constraint === null) {
  13502. $constraint = new MatchAllConstraint();
  13503. }
  13504. if (isset($this->requires[$packageName])) {
  13505. throw new \LogicException('Overwriting requires seems like a bug ('.$packageName.' '.$this->requires[$packageName]->getPrettyString().' => '.$constraint->getPrettyString().', check why it is happening, might be a root alias');
  13506. }
  13507. $this->requires[$packageName] = $constraint;
  13508. }
  13509. public function fixPackage(BasePackage $package): void
  13510. {
  13511. $this->fixedPackages[spl_object_hash($package)] = $package;
  13512. }
  13513. public function lockPackage(BasePackage $package): void
  13514. {
  13515. $this->lockedPackages[spl_object_hash($package)] = $package;
  13516. }
  13517. public function fixLockedPackage(BasePackage $package): void
  13518. {
  13519. $this->fixedPackages[spl_object_hash($package)] = $package;
  13520. $this->fixedLockedPackages[spl_object_hash($package)] = $package;
  13521. }
  13522. public function unlockPackage(BasePackage $package): void
  13523. {
  13524. unset($this->lockedPackages[spl_object_hash($package)]);
  13525. }
  13526. public function setUpdateAllowList(array $updateAllowList, $updateAllowTransitiveDependencies): void
  13527. {
  13528. $this->updateAllowList = $updateAllowList;
  13529. $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
  13530. }
  13531. public function getUpdateAllowList(): array
  13532. {
  13533. return $this->updateAllowList;
  13534. }
  13535. public function getUpdateAllowTransitiveDependencies(): bool
  13536. {
  13537. return $this->updateAllowTransitiveDependencies !== self::UPDATE_ONLY_LISTED;
  13538. }
  13539. public function getUpdateAllowTransitiveRootDependencies(): bool
  13540. {
  13541. return $this->updateAllowTransitiveDependencies === self::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  13542. }
  13543. public function getRequires(): array
  13544. {
  13545. return $this->requires;
  13546. }
  13547. public function getFixedPackages(): array
  13548. {
  13549. return $this->fixedPackages;
  13550. }
  13551. public function isFixedPackage(BasePackage $package): bool
  13552. {
  13553. return isset($this->fixedPackages[spl_object_hash($package)]);
  13554. }
  13555. public function getLockedPackages(): array
  13556. {
  13557. return $this->lockedPackages;
  13558. }
  13559. public function isLockedPackage(PackageInterface $package): bool
  13560. {
  13561. return isset($this->lockedPackages[spl_object_hash($package)]) || isset($this->fixedLockedPackages[spl_object_hash($package)]);
  13562. }
  13563. public function getFixedOrLockedPackages(): array
  13564. {
  13565. return array_merge($this->fixedPackages, $this->lockedPackages);
  13566. }
  13567. public function getPresentMap(bool $packageIds = false): array
  13568. {
  13569. $presentMap = [];
  13570. if ($this->lockedRepository) {
  13571. foreach ($this->lockedRepository->getPackages() as $package) {
  13572. $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
  13573. }
  13574. }
  13575. foreach ($this->fixedPackages as $package) {
  13576. $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
  13577. }
  13578. return $presentMap;
  13579. }
  13580. public function getFixedPackagesMap(): array
  13581. {
  13582. $fixedPackagesMap = [];
  13583. foreach ($this->fixedPackages as $package) {
  13584. $fixedPackagesMap[$package->getId()] = $package;
  13585. }
  13586. return $fixedPackagesMap;
  13587. }
  13588. public function getLockedRepository(): ?LockArrayRepository
  13589. {
  13590. return $this->lockedRepository;
  13591. }
  13592. public function restrictPackages(array $names): void
  13593. {
  13594. $this->restrictedPackages = $names;
  13595. }
  13596. public function getRestrictedPackages(): ?array
  13597. {
  13598. return $this->restrictedPackages;
  13599. }
  13600. }
  13601. <?php declare(strict_types=1);
  13602. namespace Composer\DependencyResolver;
  13603. use Composer\Package\AliasPackage;
  13604. use Composer\Package\BasePackage;
  13605. use Composer\Package\Link;
  13606. use Composer\Repository\PlatformRepository;
  13607. use Composer\Repository\RepositorySet;
  13608. use Composer\Package\Version\VersionParser;
  13609. use Composer\Semver\Constraint\Constraint;
  13610. use Composer\Semver\Constraint\ConstraintInterface;
  13611. abstract class Rule
  13612. {
  13613. public const RULE_ROOT_REQUIRE = 2;
  13614. public const RULE_FIXED = 3;
  13615. public const RULE_PACKAGE_CONFLICT = 6;
  13616. public const RULE_PACKAGE_REQUIRES = 7;
  13617. public const RULE_PACKAGE_SAME_NAME = 10;
  13618. public const RULE_LEARNED = 12;
  13619. public const RULE_PACKAGE_ALIAS = 13;
  13620. public const RULE_PACKAGE_INVERSE_ALIAS = 14;
  13621. private const BITFIELD_TYPE = 0;
  13622. private const BITFIELD_REASON = 8;
  13623. private const BITFIELD_DISABLED = 16;
  13624. protected $bitfield;
  13625. protected $request;
  13626. protected $reasonData;
  13627. public function __construct($reason, $reasonData)
  13628. {
  13629. $this->reasonData = $reasonData;
  13630. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  13631. ($reason << self::BITFIELD_REASON) |
  13632. (255 << self::BITFIELD_TYPE);
  13633. }
  13634. abstract public function getLiterals(): array;
  13635. abstract public function getHash();
  13636. abstract public function __toString(): string;
  13637. abstract public function equals(Rule $rule): bool;
  13638. public function getReason(): int
  13639. {
  13640. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  13641. }
  13642. public function getReasonData()
  13643. {
  13644. return $this->reasonData;
  13645. }
  13646. public function getRequiredPackage(): ?string
  13647. {
  13648. switch ($this->getReason()) {
  13649. case self::RULE_ROOT_REQUIRE:
  13650. return $this->getReasonData()['packageName'];
  13651. case self::RULE_FIXED:
  13652. return $this->getReasonData()['package']->getName();
  13653. case self::RULE_PACKAGE_REQUIRES:
  13654. return $this->getReasonData()->getTarget();
  13655. }
  13656. return null;
  13657. }
  13658. public function setType($type): void
  13659. {
  13660. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  13661. }
  13662. public function getType(): int
  13663. {
  13664. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  13665. }
  13666. public function disable(): void
  13667. {
  13668. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  13669. }
  13670. public function enable(): void
  13671. {
  13672. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  13673. }
  13674. public function isDisabled(): bool
  13675. {
  13676. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  13677. }
  13678. public function isEnabled(): bool
  13679. {
  13680. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  13681. }
  13682. abstract public function isAssertion(): bool;
  13683. public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
  13684. {
  13685. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  13686. if (PlatformRepository::isPlatformPackage($this->getReasonData()->getTarget())) {
  13687. return false;
  13688. }
  13689. if ($request->getLockedRepository()) {
  13690. foreach ($request->getLockedRepository()->getPackages() as $package) {
  13691. if ($package->getName() === $this->getReasonData()->getTarget()) {
  13692. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  13693. return true;
  13694. }
  13695. if (!$this->getReasonData()->getConstraint()->matches(new Constraint('=', $package->getVersion()))) {
  13696. return true;
  13697. }
  13698. if (!$request->isLockedPackage($package)) {
  13699. return true;
  13700. }
  13701. break;
  13702. }
  13703. }
  13704. }
  13705. }
  13706. if ($this->getReason() === self::RULE_ROOT_REQUIRE) {
  13707. if (PlatformRepository::isPlatformPackage($this->getReasonData()['packageName'])) {
  13708. return false;
  13709. }
  13710. if ($request->getLockedRepository()) {
  13711. foreach ($request->getLockedRepository()->getPackages() as $package) {
  13712. if ($package->getName() === $this->getReasonData()['packageName']) {
  13713. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  13714. return true;
  13715. }
  13716. if (!$this->getReasonData()['constraint']->matches(new Constraint('=', $package->getVersion()))) {
  13717. return true;
  13718. }
  13719. break;
  13720. }
  13721. }
  13722. }
  13723. }
  13724. return false;
  13725. }
  13726. public function getSourcePackage(Pool $pool): BasePackage
  13727. {
  13728. $literals = $this->getLiterals();
  13729. switch ($this->getReason()) {
  13730. case self::RULE_PACKAGE_CONFLICT:
  13731. $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  13732. $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  13733. $reasonData = $this->getReasonData();
  13734. if ($reasonData->getSource() === $package1->getName()) {
  13735. [$package2, $package1] = [$package1, $package2];
  13736. }
  13737. return $package2;
  13738. case self::RULE_PACKAGE_REQUIRES:
  13739. $sourceLiteral = array_shift($literals);
  13740. $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
  13741. return $sourcePackage;
  13742. default:
  13743. throw new \LogicException('Not implemented');
  13744. }
  13745. }
  13746. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
  13747. {
  13748. $literals = $this->getLiterals();
  13749. switch ($this->getReason()) {
  13750. case self::RULE_ROOT_REQUIRE:
  13751. $reasonData = $this->getReasonData();
  13752. $packageName = $reasonData['packageName'];
  13753. $constraint = $reasonData['constraint'];
  13754. $packages = $pool->whatProvides($packageName, $constraint);
  13755. if (!$packages) {
  13756. return 'No package found to satisfy root composer.json require '.$packageName.' '.$constraint->getPrettyString();
  13757. }
  13758. $packagesNonAlias = array_values(array_filter($packages, static function ($p): bool {
  13759. return !($p instanceof AliasPackage);
  13760. }));
  13761. if (count($packagesNonAlias) === 1) {
  13762. $package = $packagesNonAlias[0];
  13763. if ($request->isLockedPackage($package)) {
  13764. return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion()." and an update of this package was not requested.";
  13765. }
  13766. }
  13767. return 'Root composer.json requires '.$packageName.' '.$constraint->getPrettyString().' -> satisfiable by '.$this->formatPackagesUnique($pool, $packages, $isVerbose, $constraint).'.';
  13768. case self::RULE_FIXED:
  13769. $package = $this->deduplicateDefaultBranchAlias($this->getReasonData()['package']);
  13770. if ($request->isLockedPackage($package)) {
  13771. return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion().' and an update of this package was not requested.';
  13772. }
  13773. return $package->getPrettyName().' is present at version '.$package->getPrettyVersion() . ' and cannot be modified by Composer';
  13774. case self::RULE_PACKAGE_CONFLICT:
  13775. $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  13776. $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  13777. $conflictTarget = $package1->getPrettyString();
  13778. $reasonData = $this->getReasonData();
  13779. if ($reasonData->getSource() === $package1->getName()) {
  13780. [$package2, $package1] = [$package1, $package2];
  13781. $conflictTarget = $package1->getPrettyName().' '.$reasonData->getPrettyConstraint();
  13782. }
  13783. if ($reasonData->getTarget() !== $package1->getName()) {
  13784. $provideType = null;
  13785. $provided = null;
  13786. foreach ($package1->getProvides() as $provide) {
  13787. if ($provide->getTarget() === $reasonData->getTarget()) {
  13788. $provideType = 'provides';
  13789. $provided = $provide->getPrettyConstraint();
  13790. break;
  13791. }
  13792. }
  13793. foreach ($package1->getReplaces() as $replace) {
  13794. if ($replace->getTarget() === $reasonData->getTarget()) {
  13795. $provideType = 'replaces';
  13796. $provided = $replace->getPrettyConstraint();
  13797. break;
  13798. }
  13799. }
  13800. if (null !== $provideType) {
  13801. $conflictTarget = $reasonData->getTarget().' '.$reasonData->getPrettyConstraint().' ('.$package1->getPrettyString().' '.$provideType.' '.$reasonData->getTarget().' '.$provided.')';
  13802. }
  13803. }
  13804. return $package2->getPrettyString().' conflicts with '.$conflictTarget.'.';
  13805. case self::RULE_PACKAGE_REQUIRES:
  13806. $sourceLiteral = array_shift($literals);
  13807. $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
  13808. $reasonData = $this->getReasonData();
  13809. $requires = [];
  13810. foreach ($literals as $literal) {
  13811. $requires[] = $pool->literalToPackage($literal);
  13812. }
  13813. $text = $reasonData->getPrettyString($sourcePackage);
  13814. if ($requires) {
  13815. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires, $isVerbose, $reasonData->getConstraint()) . '.';
  13816. } else {
  13817. $targetName = $reasonData->getTarget();
  13818. $reason = Problem::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $targetName, $reasonData->getConstraint());
  13819. return $text . ' -> ' . $reason[1];
  13820. }
  13821. return $text;
  13822. case self::RULE_PACKAGE_SAME_NAME:
  13823. $packageNames = [];
  13824. foreach ($literals as $literal) {
  13825. $package = $pool->literalToPackage($literal);
  13826. $packageNames[$package->getName()] = true;
  13827. }
  13828. $replacedName = $this->getReasonData();
  13829. if (count($packageNames) > 1) {
  13830. $reason = null;
  13831. if (!isset($packageNames[$replacedName])) {
  13832. $reason = 'They '.(count($literals) === 2 ? 'both' : 'all').' replace '.$replacedName.' and thus cannot coexist.';
  13833. } else {
  13834. $replacerNames = $packageNames;
  13835. unset($replacerNames[$replacedName]);
  13836. $replacerNames = array_keys($replacerNames);
  13837. if (count($replacerNames) === 1) {
  13838. $reason = $replacerNames[0] . ' replaces ';
  13839. } else {
  13840. $reason = '['.implode(', ', $replacerNames).'] replace ';
  13841. }
  13842. $reason .= $replacedName.' and thus cannot coexist with it.';
  13843. }
  13844. $installedPackages = [];
  13845. $removablePackages = [];
  13846. foreach ($literals as $literal) {
  13847. if (isset($installedMap[abs($literal)])) {
  13848. $installedPackages[] = $pool->literalToPackage($literal);
  13849. } else {
  13850. $removablePackages[] = $pool->literalToPackage($literal);
  13851. }
  13852. }
  13853. if ($installedPackages && $removablePackages) {
  13854. return $this->formatPackagesUnique($pool, $removablePackages, $isVerbose, null, true).' cannot be installed as that would require removing '.$this->formatPackagesUnique($pool, $installedPackages, $isVerbose, null, true).'. '.$reason;
  13855. }
  13856. return 'Only one of these can be installed: '.$this->formatPackagesUnique($pool, $literals, $isVerbose, null, true).'. '.$reason;
  13857. }
  13858. return 'You can only install one version of a package, so only one of these can be installed: ' . $this->formatPackagesUnique($pool, $literals, $isVerbose, null, true) . '.';
  13859. case self::RULE_LEARNED:
  13860. $learnedString = ' (conflict analysis result)';
  13861. if (count($literals) === 1) {
  13862. $ruleText = $pool->literalToPrettyString($literals[0], $installedMap);
  13863. } else {
  13864. $groups = [];
  13865. foreach ($literals as $literal) {
  13866. $package = $pool->literalToPackage($literal);
  13867. if (isset($installedMap[$package->id])) {
  13868. $group = $literal > 0 ? 'keep' : 'remove';
  13869. } else {
  13870. $group = $literal > 0 ? 'install' : 'don\'t install';
  13871. }
  13872. $groups[$group][] = $this->deduplicateDefaultBranchAlias($package);
  13873. }
  13874. $ruleTexts = [];
  13875. foreach ($groups as $group => $packages) {
  13876. $ruleTexts[] = $group . (count($packages) > 1 ? ' one of' : '').' ' . $this->formatPackagesUnique($pool, $packages, $isVerbose);
  13877. }
  13878. $ruleText = implode(' | ', $ruleTexts);
  13879. }
  13880. return 'Conclusion: '.$ruleText.$learnedString;
  13881. case self::RULE_PACKAGE_ALIAS:
  13882. $aliasPackage = $pool->literalToPackage($literals[0]);
  13883. if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  13884. return '';
  13885. }
  13886. $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  13887. return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and thus requires it to be installed too.';
  13888. case self::RULE_PACKAGE_INVERSE_ALIAS:
  13889. $aliasPackage = $pool->literalToPackage($literals[1]);
  13890. if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  13891. return '';
  13892. }
  13893. $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  13894. return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and must be installed with it.';
  13895. default:
  13896. $ruleText = '';
  13897. foreach ($literals as $i => $literal) {
  13898. if ($i !== 0) {
  13899. $ruleText .= '|';
  13900. }
  13901. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  13902. }
  13903. return '('.$ruleText.')';
  13904. }
  13905. }
  13906. protected function formatPackagesUnique(Pool $pool, array $packages, bool $isVerbose, ?ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
  13907. {
  13908. foreach ($packages as $index => $package) {
  13909. if (!\is_object($package)) {
  13910. $packages[$index] = $pool->literalToPackage($package);
  13911. }
  13912. }
  13913. return Problem::getPackageList($packages, $isVerbose, $pool, $constraint, $useRemovedVersionGroup);
  13914. }
  13915. private function deduplicateDefaultBranchAlias(BasePackage $package): BasePackage
  13916. {
  13917. if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  13918. $package = $package->getAliasOf();
  13919. }
  13920. return $package;
  13921. }
  13922. }
  13923. <?php declare(strict_types=1);
  13924. namespace Composer\DependencyResolver;
  13925. class Rule2Literals extends Rule
  13926. {
  13927. protected $literal1;
  13928. protected $literal2;
  13929. public function __construct(int $literal1, int $literal2, $reason, $reasonData)
  13930. {
  13931. parent::__construct($reason, $reasonData);
  13932. if ($literal1 < $literal2) {
  13933. $this->literal1 = $literal1;
  13934. $this->literal2 = $literal2;
  13935. } else {
  13936. $this->literal1 = $literal2;
  13937. $this->literal2 = $literal1;
  13938. }
  13939. }
  13940. public function getLiterals(): array
  13941. {
  13942. return [$this->literal1, $this->literal2];
  13943. }
  13944. public function getHash()
  13945. {
  13946. return $this->literal1.','.$this->literal2;
  13947. }
  13948. public function equals(Rule $rule): bool
  13949. {
  13950. if ($rule instanceof self) {
  13951. if ($this->literal1 !== $rule->literal1) {
  13952. return false;
  13953. }
  13954. if ($this->literal2 !== $rule->literal2) {
  13955. return false;
  13956. }
  13957. return true;
  13958. }
  13959. $literals = $rule->getLiterals();
  13960. if (2 !== \count($literals)) {
  13961. return false;
  13962. }
  13963. if ($this->literal1 !== $literals[0]) {
  13964. return false;
  13965. }
  13966. if ($this->literal2 !== $literals[1]) {
  13967. return false;
  13968. }
  13969. return true;
  13970. }
  13971. public function isAssertion(): bool
  13972. {
  13973. return false;
  13974. }
  13975. public function __toString(): string
  13976. {
  13977. $result = $this->isDisabled() ? 'disabled(' : '(';
  13978. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  13979. return $result;
  13980. }
  13981. }
  13982. <?php declare(strict_types=1);
  13983. namespace Composer\DependencyResolver;
  13984. use Composer\Repository\RepositorySet;
  13985. class RuleSet implements \IteratorAggregate, \Countable
  13986. {
  13987. public const TYPE_PACKAGE = 0;
  13988. public const TYPE_REQUEST = 1;
  13989. public const TYPE_LEARNED = 4;
  13990. public $ruleById = [];
  13991. const TYPES = [
  13992. self::TYPE_PACKAGE => 'PACKAGE',
  13993. self::TYPE_REQUEST => 'REQUEST',
  13994. self::TYPE_LEARNED => 'LEARNED',
  13995. ];
  13996. protected $rules;
  13997. protected $nextRuleId = 0;
  13998. protected $rulesByHash = [];
  13999. public function __construct()
  14000. {
  14001. foreach ($this->getTypes() as $type) {
  14002. $this->rules[$type] = [];
  14003. }
  14004. }
  14005. public function add(Rule $rule, $type): void
  14006. {
  14007. if (!isset(self::TYPES[$type])) {
  14008. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  14009. }
  14010. $hash = $rule->getHash();
  14011. if (isset($this->rulesByHash[$hash])) {
  14012. $potentialDuplicates = $this->rulesByHash[$hash];
  14013. if (\is_array($potentialDuplicates)) {
  14014. foreach ($potentialDuplicates as $potentialDuplicate) {
  14015. if ($rule->equals($potentialDuplicate)) {
  14016. return;
  14017. }
  14018. }
  14019. } else {
  14020. if ($rule->equals($potentialDuplicates)) {
  14021. return;
  14022. }
  14023. }
  14024. }
  14025. if (!isset($this->rules[$type])) {
  14026. $this->rules[$type] = [];
  14027. }
  14028. $this->rules[$type][] = $rule;
  14029. $this->ruleById[$this->nextRuleId] = $rule;
  14030. $rule->setType($type);
  14031. $this->nextRuleId++;
  14032. if (!isset($this->rulesByHash[$hash])) {
  14033. $this->rulesByHash[$hash] = $rule;
  14034. } elseif (\is_array($this->rulesByHash[$hash])) {
  14035. $this->rulesByHash[$hash][] = $rule;
  14036. } else {
  14037. $originalRule = $this->rulesByHash[$hash];
  14038. $this->rulesByHash[$hash] = [$originalRule, $rule];
  14039. }
  14040. }
  14041. public function count(): int
  14042. {
  14043. return $this->nextRuleId;
  14044. }
  14045. public function ruleById(int $id): Rule
  14046. {
  14047. return $this->ruleById[$id];
  14048. }
  14049. public function getRules(): array
  14050. {
  14051. return $this->rules;
  14052. }
  14053. public function getIterator(): RuleSetIterator
  14054. {
  14055. return new RuleSetIterator($this->getRules());
  14056. }
  14057. public function getIteratorFor($types): RuleSetIterator
  14058. {
  14059. if (!\is_array($types)) {
  14060. $types = [$types];
  14061. }
  14062. $allRules = $this->getRules();
  14063. $rules = [];
  14064. foreach ($types as $type) {
  14065. $rules[$type] = $allRules[$type];
  14066. }
  14067. return new RuleSetIterator($rules);
  14068. }
  14069. public function getIteratorWithout($types): RuleSetIterator
  14070. {
  14071. if (!\is_array($types)) {
  14072. $types = [$types];
  14073. }
  14074. $rules = $this->getRules();
  14075. foreach ($types as $type) {
  14076. unset($rules[$type]);
  14077. }
  14078. return new RuleSetIterator($rules);
  14079. }
  14080. public function getTypes(): array
  14081. {
  14082. $types = self::TYPES;
  14083. return array_keys($types);
  14084. }
  14085. public function getPrettyString(?RepositorySet $repositorySet = null, ?Request $request = null, ?Pool $pool = null, bool $isVerbose = false): string
  14086. {
  14087. $string = "\n";
  14088. foreach ($this->rules as $type => $rules) {
  14089. $string .= str_pad(self::TYPES[$type], 8, ' ') . ": ";
  14090. foreach ($rules as $rule) {
  14091. $string .= ($repositorySet && $request && $pool ? $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose) : $rule)."\n";
  14092. }
  14093. $string .= "\n\n";
  14094. }
  14095. return $string;
  14096. }
  14097. public function __toString(): string
  14098. {
  14099. return $this->getPrettyString();
  14100. }
  14101. }
  14102. <?php declare(strict_types=1);
  14103. namespace Composer\DependencyResolver;
  14104. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  14105. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  14106. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  14107. use Composer\Package\BasePackage;
  14108. use Composer\Package\AliasPackage;
  14109. class RuleSetGenerator
  14110. {
  14111. protected $policy;
  14112. protected $pool;
  14113. protected $rules;
  14114. protected $addedMap = [];
  14115. protected $addedPackagesByNames = [];
  14116. public function __construct(PolicyInterface $policy, Pool $pool)
  14117. {
  14118. $this->policy = $policy;
  14119. $this->pool = $pool;
  14120. $this->rules = new RuleSet;
  14121. }
  14122. protected function createRequireRule(BasePackage $package, array $providers, $reason, $reasonData = null): ?Rule
  14123. {
  14124. $literals = [-$package->id];
  14125. foreach ($providers as $provider) {
  14126. if ($provider === $package) {
  14127. return null;
  14128. }
  14129. $literals[] = $provider->id;
  14130. }
  14131. return new GenericRule($literals, $reason, $reasonData);
  14132. }
  14133. protected function createInstallOneOfRule(array $packages, $reason, $reasonData): Rule
  14134. {
  14135. $literals = [];
  14136. foreach ($packages as $package) {
  14137. $literals[] = $package->id;
  14138. }
  14139. return new GenericRule($literals, $reason, $reasonData);
  14140. }
  14141. protected function createRule2Literals(BasePackage $issuer, BasePackage $provider, $reason, $reasonData = null): ?Rule
  14142. {
  14143. if ($issuer === $provider) {
  14144. return null;
  14145. }
  14146. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  14147. }
  14148. protected function createMultiConflictRule(array $packages, $reason, $reasonData): Rule
  14149. {
  14150. $literals = [];
  14151. foreach ($packages as $package) {
  14152. $literals[] = -$package->id;
  14153. }
  14154. if (\count($literals) === 2) {
  14155. return new Rule2Literals($literals[0], $literals[1], $reason, $reasonData);
  14156. }
  14157. return new MultiConflictRule($literals, $reason, $reasonData);
  14158. }
  14159. private function addRule($type, ?Rule $newRule = null): void
  14160. {
  14161. if (!$newRule) {
  14162. return;
  14163. }
  14164. $this->rules->add($newRule, $type);
  14165. }
  14166. protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter): void
  14167. {
  14168. $workQueue = new \SplQueue;
  14169. $workQueue->enqueue($package);
  14170. while (!$workQueue->isEmpty()) {
  14171. $package = $workQueue->dequeue();
  14172. if (isset($this->addedMap[$package->id])) {
  14173. continue;
  14174. }
  14175. $this->addedMap[$package->id] = $package;
  14176. if (!$package instanceof AliasPackage) {
  14177. foreach ($package->getNames(false) as $name) {
  14178. $this->addedPackagesByNames[$name][] = $package;
  14179. }
  14180. } else {
  14181. $workQueue->enqueue($package->getAliasOf());
  14182. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, [$package->getAliasOf()], Rule::RULE_PACKAGE_ALIAS, $package));
  14183. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package->getAliasOf(), [$package], Rule::RULE_PACKAGE_INVERSE_ALIAS, $package->getAliasOf()));
  14184. if (!$package->hasSelfVersionRequires()) {
  14185. continue;
  14186. }
  14187. }
  14188. foreach ($package->getRequires() as $link) {
  14189. $constraint = $link->getConstraint();
  14190. if ($platformRequirementFilter->isIgnored($link->getTarget())) {
  14191. continue;
  14192. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14193. $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint);
  14194. }
  14195. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $constraint);
  14196. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  14197. foreach ($possibleRequires as $require) {
  14198. $workQueue->enqueue($require);
  14199. }
  14200. }
  14201. }
  14202. }
  14203. protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter): void
  14204. {
  14205. foreach ($this->addedMap as $package) {
  14206. foreach ($package->getConflicts() as $link) {
  14207. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  14208. continue;
  14209. }
  14210. $constraint = $link->getConstraint();
  14211. if ($platformRequirementFilter->isIgnored($link->getTarget())) {
  14212. continue;
  14213. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14214. $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint, false);
  14215. }
  14216. $conflicts = $this->pool->whatProvides($link->getTarget(), $constraint);
  14217. foreach ($conflicts as $conflict) {
  14218. if (!$conflict instanceof AliasPackage || $conflict->getName() === $link->getTarget()) {
  14219. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  14220. }
  14221. }
  14222. }
  14223. }
  14224. foreach ($this->addedPackagesByNames as $name => $packages) {
  14225. if (\count($packages) > 1) {
  14226. $reason = Rule::RULE_PACKAGE_SAME_NAME;
  14227. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createMultiConflictRule($packages, $reason, $name));
  14228. }
  14229. }
  14230. }
  14231. protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
  14232. {
  14233. foreach ($request->getFixedPackages() as $package) {
  14234. if ($package->id === -1) {
  14235. if ($this->pool->isUnacceptableFixedOrLockedPackage($package)) {
  14236. continue;
  14237. }
  14238. throw new \LogicException("Fixed package ".$package->getPrettyString()." was not added to solver pool.");
  14239. }
  14240. $this->addRulesForPackage($package, $platformRequirementFilter);
  14241. $rule = $this->createInstallOneOfRule([$package], Rule::RULE_FIXED, [
  14242. 'package' => $package,
  14243. ]);
  14244. $this->addRule(RuleSet::TYPE_REQUEST, $rule);
  14245. }
  14246. foreach ($request->getRequires() as $packageName => $constraint) {
  14247. if ($platformRequirementFilter->isIgnored($packageName)) {
  14248. continue;
  14249. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14250. $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
  14251. }
  14252. $packages = $this->pool->whatProvides($packageName, $constraint);
  14253. if ($packages) {
  14254. foreach ($packages as $package) {
  14255. $this->addRulesForPackage($package, $platformRequirementFilter);
  14256. }
  14257. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_ROOT_REQUIRE, [
  14258. 'packageName' => $packageName,
  14259. 'constraint' => $constraint,
  14260. ]);
  14261. $this->addRule(RuleSet::TYPE_REQUEST, $rule);
  14262. }
  14263. }
  14264. }
  14265. protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter): void
  14266. {
  14267. foreach ($this->pool->getPackages() as $package) {
  14268. if (!isset($this->addedMap[$package->id]) &&
  14269. $package instanceof AliasPackage &&
  14270. ($package->isRootPackageAlias() || isset($this->addedMap[$package->getAliasOf()->id]))
  14271. ) {
  14272. $this->addRulesForPackage($package, $platformRequirementFilter);
  14273. }
  14274. }
  14275. }
  14276. public function getRulesFor(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null): RuleSet
  14277. {
  14278. $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
  14279. $this->addRulesForRequest($request, $platformRequirementFilter);
  14280. $this->addRulesForRootAliases($platformRequirementFilter);
  14281. $this->addConflictRules($platformRequirementFilter);
  14282. $this->addedMap = $this->addedPackagesByNames = [];
  14283. $rules = $this->rules;
  14284. $this->rules = new RuleSet;
  14285. return $rules;
  14286. }
  14287. }
  14288. <?php declare(strict_types=1);
  14289. namespace Composer\DependencyResolver;
  14290. class RuleSetIterator implements \Iterator
  14291. {
  14292. protected $rules;
  14293. protected $types;
  14294. protected $currentOffset;
  14295. protected $currentType;
  14296. protected $currentTypeOffset;
  14297. public function __construct(array $rules)
  14298. {
  14299. $this->rules = $rules;
  14300. $this->types = array_keys($rules);
  14301. sort($this->types);
  14302. $this->rewind();
  14303. }
  14304. public function current(): Rule
  14305. {
  14306. return $this->rules[$this->currentType][$this->currentOffset];
  14307. }
  14308. public function key(): int
  14309. {
  14310. return $this->currentType;
  14311. }
  14312. public function next(): void
  14313. {
  14314. $this->currentOffset++;
  14315. if (!isset($this->rules[$this->currentType])) {
  14316. return;
  14317. }
  14318. if ($this->currentOffset >= \count($this->rules[$this->currentType])) {
  14319. $this->currentOffset = 0;
  14320. do {
  14321. $this->currentTypeOffset++;
  14322. if (!isset($this->types[$this->currentTypeOffset])) {
  14323. $this->currentType = -1;
  14324. break;
  14325. }
  14326. $this->currentType = $this->types[$this->currentTypeOffset];
  14327. } while (0 === \count($this->rules[$this->currentType]));
  14328. }
  14329. }
  14330. public function rewind(): void
  14331. {
  14332. $this->currentOffset = 0;
  14333. $this->currentTypeOffset = -1;
  14334. $this->currentType = -1;
  14335. do {
  14336. $this->currentTypeOffset++;
  14337. if (!isset($this->types[$this->currentTypeOffset])) {
  14338. $this->currentType = -1;
  14339. break;
  14340. }
  14341. $this->currentType = $this->types[$this->currentTypeOffset];
  14342. } while (0 === \count($this->rules[$this->currentType]));
  14343. }
  14344. public function valid(): bool
  14345. {
  14346. return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);
  14347. }
  14348. }
  14349. <?php declare(strict_types=1);
  14350. namespace Composer\DependencyResolver;
  14351. class RuleWatchChain extends \SplDoublyLinkedList
  14352. {
  14353. public function seek(int $offset): void
  14354. {
  14355. $this->rewind();
  14356. for ($i = 0; $i < $offset; $i++, $this->next());
  14357. }
  14358. public function remove(): void
  14359. {
  14360. $offset = $this->key();
  14361. $this->offsetUnset($offset);
  14362. $this->seek($offset);
  14363. }
  14364. }
  14365. <?php declare(strict_types=1);
  14366. namespace Composer\DependencyResolver;
  14367. class RuleWatchGraph
  14368. {
  14369. protected $watchChains = [];
  14370. public function insert(RuleWatchNode $node): void
  14371. {
  14372. if ($node->getRule()->isAssertion()) {
  14373. return;
  14374. }
  14375. if (!$node->getRule() instanceof MultiConflictRule) {
  14376. foreach ([$node->watch1, $node->watch2] as $literal) {
  14377. if (!isset($this->watchChains[$literal])) {
  14378. $this->watchChains[$literal] = new RuleWatchChain;
  14379. }
  14380. $this->watchChains[$literal]->unshift($node);
  14381. }
  14382. } else {
  14383. foreach ($node->getRule()->getLiterals() as $literal) {
  14384. if (!isset($this->watchChains[$literal])) {
  14385. $this->watchChains[$literal] = new RuleWatchChain;
  14386. }
  14387. $this->watchChains[$literal]->unshift($node);
  14388. }
  14389. }
  14390. }
  14391. public function propagateLiteral(int $decidedLiteral, int $level, Decisions $decisions): ?Rule
  14392. {
  14393. $literal = -$decidedLiteral;
  14394. if (!isset($this->watchChains[$literal])) {
  14395. return null;
  14396. }
  14397. $chain = $this->watchChains[$literal];
  14398. $chain->rewind();
  14399. while ($chain->valid()) {
  14400. $node = $chain->current();
  14401. if (!$node->getRule() instanceof MultiConflictRule) {
  14402. $otherWatch = $node->getOtherWatch($literal);
  14403. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  14404. $ruleLiterals = $node->getRule()->getLiterals();
  14405. $alternativeLiterals = array_filter($ruleLiterals, static function ($ruleLiteral) use ($literal, $otherWatch, $decisions): bool {
  14406. return $literal !== $ruleLiteral &&
  14407. $otherWatch !== $ruleLiteral &&
  14408. !$decisions->conflict($ruleLiteral);
  14409. });
  14410. if (\count($alternativeLiterals) > 0) {
  14411. reset($alternativeLiterals);
  14412. $this->moveWatch($literal, current($alternativeLiterals), $node);
  14413. continue;
  14414. }
  14415. if ($decisions->conflict($otherWatch)) {
  14416. return $node->getRule();
  14417. }
  14418. $decisions->decide($otherWatch, $level, $node->getRule());
  14419. }
  14420. } else {
  14421. foreach ($node->getRule()->getLiterals() as $otherLiteral) {
  14422. if ($literal !== $otherLiteral && !$decisions->satisfy($otherLiteral)) {
  14423. if ($decisions->conflict($otherLiteral)) {
  14424. return $node->getRule();
  14425. }
  14426. $decisions->decide($otherLiteral, $level, $node->getRule());
  14427. }
  14428. }
  14429. }
  14430. $chain->next();
  14431. }
  14432. return null;
  14433. }
  14434. protected function moveWatch(int $fromLiteral, int $toLiteral, RuleWatchNode $node): void
  14435. {
  14436. if (!isset($this->watchChains[$toLiteral])) {
  14437. $this->watchChains[$toLiteral] = new RuleWatchChain;
  14438. }
  14439. $node->moveWatch($fromLiteral, $toLiteral);
  14440. $this->watchChains[$fromLiteral]->remove();
  14441. $this->watchChains[$toLiteral]->unshift($node);
  14442. }
  14443. }
  14444. <?php declare(strict_types=1);
  14445. namespace Composer\DependencyResolver;
  14446. class RuleWatchNode
  14447. {
  14448. public $watch1;
  14449. public $watch2;
  14450. protected $rule;
  14451. public function __construct(Rule $rule)
  14452. {
  14453. $this->rule = $rule;
  14454. $literals = $rule->getLiterals();
  14455. $literalCount = \count($literals);
  14456. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  14457. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  14458. }
  14459. public function watch2OnHighest(Decisions $decisions): void
  14460. {
  14461. $literals = $this->rule->getLiterals();
  14462. if (\count($literals) < 3 || $this->rule instanceof MultiConflictRule) {
  14463. return;
  14464. }
  14465. $watchLevel = 0;
  14466. foreach ($literals as $literal) {
  14467. $level = $decisions->decisionLevel($literal);
  14468. if ($level > $watchLevel) {
  14469. $this->watch2 = $literal;
  14470. $watchLevel = $level;
  14471. }
  14472. }
  14473. }
  14474. public function getRule(): Rule
  14475. {
  14476. return $this->rule;
  14477. }
  14478. public function getOtherWatch(int $literal): int
  14479. {
  14480. if ($this->watch1 === $literal) {
  14481. return $this->watch2;
  14482. }
  14483. return $this->watch1;
  14484. }
  14485. public function moveWatch(int $from, int $to): void
  14486. {
  14487. if ($this->watch1 === $from) {
  14488. $this->watch1 = $to;
  14489. } else {
  14490. $this->watch2 = $to;
  14491. }
  14492. }
  14493. }
  14494. <?php declare(strict_types=1);
  14495. namespace Composer\DependencyResolver;
  14496. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  14497. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  14498. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  14499. use Composer\IO\IOInterface;
  14500. use Composer\Package\BasePackage;
  14501. class Solver
  14502. {
  14503. private const BRANCH_LITERALS = 0;
  14504. private const BRANCH_LEVEL = 1;
  14505. protected $policy;
  14506. protected $pool;
  14507. protected $rules;
  14508. protected $watchGraph;
  14509. protected $decisions;
  14510. protected $fixedMap;
  14511. protected $propagateIndex;
  14512. protected $branches = [];
  14513. protected $problems = [];
  14514. protected $learnedPool = [];
  14515. protected $learnedWhy = [];
  14516. public $testFlagLearnedPositiveLiteral = false;
  14517. protected $io;
  14518. public function __construct(PolicyInterface $policy, Pool $pool, IOInterface $io)
  14519. {
  14520. $this->io = $io;
  14521. $this->policy = $policy;
  14522. $this->pool = $pool;
  14523. }
  14524. public function getRuleSetSize(): int
  14525. {
  14526. return \count($this->rules);
  14527. }
  14528. public function getPool(): Pool
  14529. {
  14530. return $this->pool;
  14531. }
  14532. private function makeAssertionRuleDecisions(): void
  14533. {
  14534. $decisionStart = \count($this->decisions) - 1;
  14535. $rulesCount = \count($this->rules);
  14536. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  14537. $rule = $this->rules->ruleById[$ruleIndex];
  14538. if (!$rule->isAssertion() || $rule->isDisabled()) {
  14539. continue;
  14540. }
  14541. $literals = $rule->getLiterals();
  14542. $literal = $literals[0];
  14543. if (!$this->decisions->decided($literal)) {
  14544. $this->decisions->decide($literal, 1, $rule);
  14545. continue;
  14546. }
  14547. if ($this->decisions->satisfy($literal)) {
  14548. continue;
  14549. }
  14550. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  14551. $rule->disable();
  14552. continue;
  14553. }
  14554. $conflict = $this->decisions->decisionRule($literal);
  14555. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  14556. $problem = new Problem();
  14557. $problem->addRule($rule);
  14558. $problem->addRule($conflict);
  14559. $rule->disable();
  14560. $this->problems[] = $problem;
  14561. continue;
  14562. }
  14563. $problem = new Problem();
  14564. $problem->addRule($rule);
  14565. $problem->addRule($conflict);
  14566. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_REQUEST) as $assertRule) {
  14567. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  14568. continue;
  14569. }
  14570. $assertRuleLiterals = $assertRule->getLiterals();
  14571. $assertRuleLiteral = $assertRuleLiterals[0];
  14572. if (abs($literal) !== abs($assertRuleLiteral)) {
  14573. continue;
  14574. }
  14575. $problem->addRule($assertRule);
  14576. $assertRule->disable();
  14577. }
  14578. $this->problems[] = $problem;
  14579. $this->decisions->resetToOffset($decisionStart);
  14580. $ruleIndex = -1;
  14581. }
  14582. }
  14583. protected function setupFixedMap(Request $request): void
  14584. {
  14585. $this->fixedMap = [];
  14586. foreach ($request->getFixedPackages() as $package) {
  14587. $this->fixedMap[$package->id] = $package;
  14588. }
  14589. }
  14590. protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
  14591. {
  14592. foreach ($request->getRequires() as $packageName => $constraint) {
  14593. if ($platformRequirementFilter->isIgnored($packageName)) {
  14594. continue;
  14595. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14596. $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
  14597. }
  14598. if (!$this->pool->whatProvides($packageName, $constraint)) {
  14599. $problem = new Problem();
  14600. $problem->addRule(new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => $packageName, 'constraint' => $constraint]));
  14601. $this->problems[] = $problem;
  14602. }
  14603. }
  14604. }
  14605. public function solve(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null): LockTransaction
  14606. {
  14607. $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
  14608. $this->setupFixedMap($request);
  14609. $this->io->writeError('Generating rules', true, IOInterface::DEBUG);
  14610. $ruleSetGenerator = new RuleSetGenerator($this->policy, $this->pool);
  14611. $this->rules = $ruleSetGenerator->getRulesFor($request, $platformRequirementFilter);
  14612. unset($ruleSetGenerator);
  14613. $this->checkForRootRequireProblems($request, $platformRequirementFilter);
  14614. $this->decisions = new Decisions($this->pool);
  14615. $this->watchGraph = new RuleWatchGraph;
  14616. foreach ($this->rules as $rule) {
  14617. $this->watchGraph->insert(new RuleWatchNode($rule));
  14618. }
  14619. $this->makeAssertionRuleDecisions();
  14620. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  14621. $before = microtime(true);
  14622. $this->runSat();
  14623. $this->io->writeError('', true, IOInterface::DEBUG);
  14624. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  14625. if ($this->problems) {
  14626. throw new SolverProblemsException($this->problems, $this->learnedPool);
  14627. }
  14628. return new LockTransaction($this->pool, $request->getPresentMap(), $request->getFixedPackagesMap(), $this->decisions);
  14629. }
  14630. protected function propagate(int $level): ?Rule
  14631. {
  14632. while ($this->decisions->validOffset($this->propagateIndex)) {
  14633. $decision = $this->decisions->atOffset($this->propagateIndex);
  14634. $conflict = $this->watchGraph->propagateLiteral(
  14635. $decision[Decisions::DECISION_LITERAL],
  14636. $level,
  14637. $this->decisions
  14638. );
  14639. $this->propagateIndex++;
  14640. if ($conflict) {
  14641. return $conflict;
  14642. }
  14643. }
  14644. return null;
  14645. }
  14646. private function revert(int $level): void
  14647. {
  14648. while (!$this->decisions->isEmpty()) {
  14649. $literal = $this->decisions->lastLiteral();
  14650. if ($this->decisions->undecided($literal)) {
  14651. break;
  14652. }
  14653. $decisionLevel = $this->decisions->decisionLevel($literal);
  14654. if ($decisionLevel <= $level) {
  14655. break;
  14656. }
  14657. $this->decisions->revertLast();
  14658. $this->propagateIndex = \count($this->decisions);
  14659. }
  14660. while (!empty($this->branches) && $this->branches[\count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  14661. array_pop($this->branches);
  14662. }
  14663. }
  14664. private function setPropagateLearn(int $level, $literal, Rule $rule): int
  14665. {
  14666. $level++;
  14667. $this->decisions->decide($literal, $level, $rule);
  14668. while (true) {
  14669. $rule = $this->propagate($level);
  14670. if (null === $rule) {
  14671. break;
  14672. }
  14673. if ($level === 1) {
  14674. return $this->analyzeUnsolvable($rule);
  14675. }
  14676. [$learnLiteral, $newLevel, $newRule, $why] = $this->analyze($level, $rule);
  14677. if ($newLevel <= 0 || $newLevel >= $level) {
  14678. throw new SolverBugException(
  14679. "Trying to revert to invalid level ".$newLevel." from level ".$level."."
  14680. );
  14681. }
  14682. $level = $newLevel;
  14683. $this->revert($level);
  14684. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  14685. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  14686. $ruleNode = new RuleWatchNode($newRule);
  14687. $ruleNode->watch2OnHighest($this->decisions);
  14688. $this->watchGraph->insert($ruleNode);
  14689. $this->decisions->decide($learnLiteral, $level, $newRule);
  14690. }
  14691. return $level;
  14692. }
  14693. private function selectAndInstall(int $level, array $decisionQueue, Rule $rule): int
  14694. {
  14695. $literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
  14696. $selectedLiteral = array_shift($literals);
  14697. if (\count($literals)) {
  14698. $this->branches[] = [$literals, $level];
  14699. }
  14700. return $this->setPropagateLearn($level, $selectedLiteral, $rule);
  14701. }
  14702. protected function analyze(int $level, Rule $rule): array
  14703. {
  14704. $analyzedRule = $rule;
  14705. $ruleLevel = 1;
  14706. $num = 0;
  14707. $l1num = 0;
  14708. $seen = [];
  14709. $learnedLiterals = [null];
  14710. $decisionId = \count($this->decisions);
  14711. $this->learnedPool[] = [];
  14712. while (true) {
  14713. $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
  14714. foreach ($rule->getLiterals() as $literal) {
  14715. if ($rule instanceof MultiConflictRule && !$this->decisions->decided($literal)) {
  14716. continue;
  14717. }
  14718. if ($this->decisions->satisfy($literal)) {
  14719. continue;
  14720. }
  14721. if (isset($seen[abs($literal)])) {
  14722. continue;
  14723. }
  14724. $seen[abs($literal)] = true;
  14725. $l = $this->decisions->decisionLevel($literal);
  14726. if (1 === $l) {
  14727. $l1num++;
  14728. } elseif ($level === $l) {
  14729. $num++;
  14730. } else {
  14731. $learnedLiterals[] = $literal;
  14732. if ($l > $ruleLevel) {
  14733. $ruleLevel = $l;
  14734. }
  14735. }
  14736. }
  14737. unset($literal);
  14738. $l1retry = true;
  14739. while ($l1retry) {
  14740. $l1retry = false;
  14741. if (0 === $num && 0 === --$l1num) {
  14742. break 2;
  14743. }
  14744. while (true) {
  14745. if ($decisionId <= 0) {
  14746. throw new SolverBugException(
  14747. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  14748. );
  14749. }
  14750. $decisionId--;
  14751. $decision = $this->decisions->atOffset($decisionId);
  14752. $literal = $decision[Decisions::DECISION_LITERAL];
  14753. if (isset($seen[abs($literal)])) {
  14754. break;
  14755. }
  14756. }
  14757. unset($seen[abs($literal)]);
  14758. if (0 !== $num && 0 === --$num) {
  14759. if ($literal < 0) {
  14760. $this->testFlagLearnedPositiveLiteral = true;
  14761. }
  14762. $learnedLiterals[0] = -$literal;
  14763. if (!$l1num) {
  14764. break 2;
  14765. }
  14766. foreach ($learnedLiterals as $i => $learnedLiteral) {
  14767. if ($i !== 0) {
  14768. unset($seen[abs($learnedLiteral)]);
  14769. }
  14770. }
  14771. $l1num++;
  14772. $l1retry = true;
  14773. } else {
  14774. $decision = $this->decisions->atOffset($decisionId);
  14775. $rule = $decision[Decisions::DECISION_REASON];
  14776. if ($rule instanceof MultiConflictRule) {
  14777. foreach ($rule->getLiterals() as $literal) {
  14778. if (!isset($seen[abs($literal)]) && $this->decisions->satisfy(-$literal)) {
  14779. $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
  14780. $l = $this->decisions->decisionLevel($literal);
  14781. if (1 === $l) {
  14782. $l1num++;
  14783. } elseif ($level === $l) {
  14784. $num++;
  14785. } else {
  14786. $learnedLiterals[] = $literal;
  14787. if ($l > $ruleLevel) {
  14788. $ruleLevel = $l;
  14789. }
  14790. }
  14791. $seen[abs($literal)] = true;
  14792. break;
  14793. }
  14794. }
  14795. $l1retry = true;
  14796. }
  14797. }
  14798. }
  14799. $decision = $this->decisions->atOffset($decisionId);
  14800. $rule = $decision[Decisions::DECISION_REASON];
  14801. }
  14802. $why = \count($this->learnedPool) - 1;
  14803. if (null === $learnedLiterals[0]) {
  14804. throw new SolverBugException(
  14805. "Did not find a learnable literal in analyzed rule $analyzedRule."
  14806. );
  14807. }
  14808. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  14809. return [$learnedLiterals[0], $ruleLevel, $newRule, $why];
  14810. }
  14811. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen): void
  14812. {
  14813. $why = spl_object_hash($conflictRule);
  14814. $ruleSeen[$why] = true;
  14815. if ($conflictRule->getType() === RuleSet::TYPE_LEARNED) {
  14816. $learnedWhy = $this->learnedWhy[$why];
  14817. $problemRules = $this->learnedPool[$learnedWhy];
  14818. foreach ($problemRules as $problemRule) {
  14819. if (!isset($ruleSeen[spl_object_hash($problemRule)])) {
  14820. $this->analyzeUnsolvableRule($problem, $problemRule, $ruleSeen);
  14821. }
  14822. }
  14823. return;
  14824. }
  14825. if ($conflictRule->getType() === RuleSet::TYPE_PACKAGE) {
  14826. return;
  14827. }
  14828. $problem->nextSection();
  14829. $problem->addRule($conflictRule);
  14830. }
  14831. private function analyzeUnsolvable(Rule $conflictRule): int
  14832. {
  14833. $problem = new Problem();
  14834. $problem->addRule($conflictRule);
  14835. $ruleSeen = [];
  14836. $this->analyzeUnsolvableRule($problem, $conflictRule, $ruleSeen);
  14837. $this->problems[] = $problem;
  14838. $seen = [];
  14839. $literals = $conflictRule->getLiterals();
  14840. foreach ($literals as $literal) {
  14841. if ($this->decisions->satisfy($literal)) {
  14842. continue;
  14843. }
  14844. $seen[abs($literal)] = true;
  14845. }
  14846. foreach ($this->decisions as $decision) {
  14847. $literal = $decision[Decisions::DECISION_LITERAL];
  14848. if (!isset($seen[abs($literal)])) {
  14849. continue;
  14850. }
  14851. $why = $decision[Decisions::DECISION_REASON];
  14852. $problem->addRule($why);
  14853. $this->analyzeUnsolvableRule($problem, $why, $ruleSeen);
  14854. $literals = $why->getLiterals();
  14855. foreach ($literals as $literal) {
  14856. if ($this->decisions->satisfy($literal)) {
  14857. continue;
  14858. }
  14859. $seen[abs($literal)] = true;
  14860. }
  14861. }
  14862. return 0;
  14863. }
  14864. private function runSat(): void
  14865. {
  14866. $this->propagateIndex = 0;
  14867. $level = 1;
  14868. $systemLevel = $level + 1;
  14869. while (true) {
  14870. if (1 === $level) {
  14871. $conflictRule = $this->propagate($level);
  14872. if (null !== $conflictRule) {
  14873. if ($this->analyzeUnsolvable($conflictRule)) {
  14874. continue;
  14875. }
  14876. return;
  14877. }
  14878. }
  14879. if ($level < $systemLevel) {
  14880. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_REQUEST);
  14881. foreach ($iterator as $rule) {
  14882. if ($rule->isEnabled()) {
  14883. $decisionQueue = [];
  14884. $noneSatisfied = true;
  14885. foreach ($rule->getLiterals() as $literal) {
  14886. if ($this->decisions->satisfy($literal)) {
  14887. $noneSatisfied = false;
  14888. break;
  14889. }
  14890. if ($literal > 0 && $this->decisions->undecided($literal)) {
  14891. $decisionQueue[] = $literal;
  14892. }
  14893. }
  14894. if ($noneSatisfied && \count($decisionQueue)) {
  14895. $prunedQueue = [];
  14896. foreach ($decisionQueue as $literal) {
  14897. if (isset($this->fixedMap[abs($literal)])) {
  14898. $prunedQueue[] = $literal;
  14899. }
  14900. }
  14901. if (!empty($prunedQueue)) {
  14902. $decisionQueue = $prunedQueue;
  14903. }
  14904. }
  14905. if ($noneSatisfied && \count($decisionQueue)) {
  14906. $oLevel = $level;
  14907. $level = $this->selectAndInstall($level, $decisionQueue, $rule);
  14908. if (0 === $level) {
  14909. return;
  14910. }
  14911. if ($level <= $oLevel) {
  14912. break;
  14913. }
  14914. }
  14915. }
  14916. }
  14917. $systemLevel = $level + 1;
  14918. $iterator->next();
  14919. if ($iterator->valid()) {
  14920. continue;
  14921. }
  14922. }
  14923. if ($level < $systemLevel) {
  14924. $systemLevel = $level;
  14925. }
  14926. $rulesCount = \count($this->rules);
  14927. $pass = 1;
  14928. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  14929. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  14930. if ($i === $rulesCount) {
  14931. if (1 === $pass) {
  14932. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  14933. } else {
  14934. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  14935. }
  14936. $i = 0;
  14937. $pass++;
  14938. }
  14939. $rule = $this->rules->ruleById[$i];
  14940. $literals = $rule->getLiterals();
  14941. if ($rule->isDisabled()) {
  14942. continue;
  14943. }
  14944. $decisionQueue = [];
  14945. foreach ($literals as $literal) {
  14946. if ($literal <= 0) {
  14947. if (!$this->decisions->decidedInstall($literal)) {
  14948. continue 2;
  14949. }
  14950. } else {
  14951. if ($this->decisions->decidedInstall($literal)) {
  14952. continue 2;
  14953. }
  14954. if ($this->decisions->undecided($literal)) {
  14955. $decisionQueue[] = $literal;
  14956. }
  14957. }
  14958. }
  14959. if (\count($decisionQueue) < 2) {
  14960. continue;
  14961. }
  14962. $level = $this->selectAndInstall($level, $decisionQueue, $rule);
  14963. if (0 === $level) {
  14964. return;
  14965. }
  14966. $rulesCount = \count($this->rules);
  14967. $n = -1;
  14968. }
  14969. if ($level < $systemLevel) {
  14970. continue;
  14971. }
  14972. if (\count($this->branches)) {
  14973. $lastLiteral = null;
  14974. $lastLevel = null;
  14975. $lastBranchIndex = 0;
  14976. $lastBranchOffset = 0;
  14977. for ($i = \count($this->branches) - 1; $i >= 0; $i--) {
  14978. [$literals, $l] = $this->branches[$i];
  14979. foreach ($literals as $offset => $literal) {
  14980. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  14981. $lastLiteral = $literal;
  14982. $lastBranchIndex = $i;
  14983. $lastBranchOffset = $offset;
  14984. $lastLevel = $l;
  14985. }
  14986. }
  14987. }
  14988. if ($lastLiteral) {
  14989. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  14990. $level = $lastLevel;
  14991. $this->revert($level);
  14992. $why = $this->decisions->lastReason();
  14993. $level = $this->setPropagateLearn($level, $lastLiteral, $why);
  14994. if ($level === 0) {
  14995. return;
  14996. }
  14997. continue;
  14998. }
  14999. }
  15000. break;
  15001. }
  15002. }
  15003. }
  15004. <?php declare(strict_types=1);
  15005. namespace Composer\DependencyResolver;
  15006. class SolverBugException extends \RuntimeException
  15007. {
  15008. public function __construct(string $message)
  15009. {
  15010. parent::__construct(
  15011. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  15012. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  15013. );
  15014. }
  15015. }
  15016. <?php declare(strict_types=1);
  15017. namespace Composer\DependencyResolver;
  15018. use Composer\Util\IniHelper;
  15019. use Composer\Repository\RepositorySet;
  15020. class SolverProblemsException extends \RuntimeException
  15021. {
  15022. public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
  15023. protected $problems;
  15024. protected $learnedPool;
  15025. public function __construct(array $problems, array $learnedPool)
  15026. {
  15027. $this->problems = $problems;
  15028. $this->learnedPool = $learnedPool;
  15029. parent::__construct('Failed resolving dependencies with '.count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED);
  15030. }
  15031. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, bool $isDevExtraction = false): string
  15032. {
  15033. $installedMap = $request->getPresentMap(true);
  15034. $missingExtensions = [];
  15035. $isCausedByLock = false;
  15036. $problems = [];
  15037. foreach ($this->problems as $problem) {
  15038. $problems[] = $problem->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $this->learnedPool)."\n";
  15039. $missingExtensions = array_merge($missingExtensions, $this->getExtensionProblems($problem->getReasons()));
  15040. $isCausedByLock = $isCausedByLock || $problem->isCausedByLock($repositorySet, $request, $pool);
  15041. }
  15042. $i = 1;
  15043. $text = "\n";
  15044. foreach (array_unique($problems) as $problem) {
  15045. $text .= " Problem ".($i++).$problem;
  15046. }
  15047. $hints = [];
  15048. if (!$isDevExtraction && (strpos($text, 'could not be found') || strpos($text, 'no matching package found'))) {
  15049. $hints[] = "Potential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  15050. }
  15051. if (!empty($missingExtensions)) {
  15052. $hints[] = $this->createExtensionHint($missingExtensions);
  15053. }
  15054. if ($isCausedByLock && !$isDevExtraction && !$request->getUpdateAllowTransitiveRootDependencies()) {
  15055. $hints[] = "Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.";
  15056. }
  15057. if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match') && strpos($text, '- ocramius/package-versions')) {
  15058. $hints[] = "<warning>ocramius/package-versions only provides support for Composer 2 in 1.8+, which requires PHP 7.4.</warning>\nIf you can not upgrade PHP you can require <info>composer/package-versions-deprecated</info> to resolve this with PHP 7.0+.";
  15059. }
  15060. if (!class_exists('PHPUnit\Framework\TestCase', false)) {
  15061. if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match')) {
  15062. $hints[] = "You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.";
  15063. }
  15064. }
  15065. if ($hints) {
  15066. $text .= "\n" . implode("\n\n", $hints);
  15067. }
  15068. return $text;
  15069. }
  15070. public function getProblems(): array
  15071. {
  15072. return $this->problems;
  15073. }
  15074. private function createExtensionHint(array $missingExtensions): string
  15075. {
  15076. $paths = IniHelper::getAll();
  15077. if ('' === $paths[0]) {
  15078. if (count($paths) === 1) {
  15079. return '';
  15080. }
  15081. array_shift($paths);
  15082. }
  15083. $ignoreExtensionsArguments = implode(" ", array_map(static function ($extension) {
  15084. return "--ignore-platform-req=$extension";
  15085. }, array_unique($missingExtensions)));
  15086. $text = "To enable extensions, verify that they are enabled in your .ini files:\n - ";
  15087. $text .= implode("\n - ", $paths);
  15088. $text .= "\nYou can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.";
  15089. $text .= "\nAlternatively, you can run Composer with `$ignoreExtensionsArguments` to temporarily ignore these required extensions.";
  15090. return $text;
  15091. }
  15092. private function getExtensionProblems(array $reasonSets): array
  15093. {
  15094. $missingExtensions = [];
  15095. foreach ($reasonSets as $reasonSet) {
  15096. foreach ($reasonSet as $rule) {
  15097. $required = $rule->getRequiredPackage();
  15098. if (null !== $required && 0 === strpos($required, 'ext-')) {
  15099. $missingExtensions[$required] = 1;
  15100. }
  15101. }
  15102. }
  15103. return array_keys($missingExtensions);
  15104. }
  15105. }
  15106. <?php declare(strict_types=1);
  15107. namespace Composer\DependencyResolver;
  15108. use Composer\Package\AliasPackage;
  15109. use Composer\Package\Link;
  15110. use Composer\Package\PackageInterface;
  15111. use Composer\Repository\PlatformRepository;
  15112. use Composer\DependencyResolver\Operation\OperationInterface;
  15113. class Transaction
  15114. {
  15115. protected $operations;
  15116. protected $presentPackages;
  15117. protected $resultPackageMap;
  15118. protected $resultPackagesByName = [];
  15119. public function __construct(array $presentPackages, array $resultPackages)
  15120. {
  15121. $this->presentPackages = $presentPackages;
  15122. $this->setResultPackageMaps($resultPackages);
  15123. $this->operations = $this->calculateOperations();
  15124. }
  15125. public function getOperations(): array
  15126. {
  15127. return $this->operations;
  15128. }
  15129. private function setResultPackageMaps(array $resultPackages): void
  15130. {
  15131. $packageSort = static function (PackageInterface $a, PackageInterface $b): int {
  15132. if ($a->getName() === $b->getName()) {
  15133. if ($a instanceof AliasPackage !== $b instanceof AliasPackage) {
  15134. return $a instanceof AliasPackage ? -1 : 1;
  15135. }
  15136. return strcmp($b->getVersion(), $a->getVersion());
  15137. }
  15138. return strcmp($b->getName(), $a->getName());
  15139. };
  15140. $this->resultPackageMap = [];
  15141. foreach ($resultPackages as $package) {
  15142. $this->resultPackageMap[spl_object_hash($package)] = $package;
  15143. foreach ($package->getNames() as $name) {
  15144. $this->resultPackagesByName[$name][] = $package;
  15145. }
  15146. }
  15147. uasort($this->resultPackageMap, $packageSort);
  15148. foreach ($this->resultPackagesByName as $name => $packages) {
  15149. uasort($this->resultPackagesByName[$name], $packageSort);
  15150. }
  15151. }
  15152. protected function calculateOperations(): array
  15153. {
  15154. $operations = [];
  15155. $presentPackageMap = [];
  15156. $removeMap = [];
  15157. $presentAliasMap = [];
  15158. $removeAliasMap = [];
  15159. foreach ($this->presentPackages as $package) {
  15160. if ($package instanceof AliasPackage) {
  15161. $presentAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
  15162. $removeAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
  15163. } else {
  15164. $presentPackageMap[$package->getName()] = $package;
  15165. $removeMap[$package->getName()] = $package;
  15166. }
  15167. }
  15168. $stack = $this->getRootPackages();
  15169. $visited = [];
  15170. $processed = [];
  15171. while (!empty($stack)) {
  15172. $package = array_pop($stack);
  15173. if (isset($processed[spl_object_hash($package)])) {
  15174. continue;
  15175. }
  15176. if (!isset($visited[spl_object_hash($package)])) {
  15177. $visited[spl_object_hash($package)] = true;
  15178. $stack[] = $package;
  15179. if ($package instanceof AliasPackage) {
  15180. $stack[] = $package->getAliasOf();
  15181. } else {
  15182. foreach ($package->getRequires() as $link) {
  15183. $possibleRequires = $this->getProvidersInResult($link);
  15184. foreach ($possibleRequires as $require) {
  15185. $stack[] = $require;
  15186. }
  15187. }
  15188. }
  15189. } elseif (!isset($processed[spl_object_hash($package)])) {
  15190. $processed[spl_object_hash($package)] = true;
  15191. if ($package instanceof AliasPackage) {
  15192. $aliasKey = $package->getName().'::'.$package->getVersion();
  15193. if (isset($presentAliasMap[$aliasKey])) {
  15194. unset($removeAliasMap[$aliasKey]);
  15195. } else {
  15196. $operations[] = new Operation\MarkAliasInstalledOperation($package);
  15197. }
  15198. } else {
  15199. if (isset($presentPackageMap[$package->getName()])) {
  15200. $source = $presentPackageMap[$package->getName()];
  15201. if ($package->getVersion() !== $presentPackageMap[$package->getName()]->getVersion() ||
  15202. $package->getDistReference() !== $presentPackageMap[$package->getName()]->getDistReference() ||
  15203. $package->getSourceReference() !== $presentPackageMap[$package->getName()]->getSourceReference()
  15204. ) {
  15205. $operations[] = new Operation\UpdateOperation($source, $package);
  15206. }
  15207. unset($removeMap[$package->getName()]);
  15208. } else {
  15209. $operations[] = new Operation\InstallOperation($package);
  15210. unset($removeMap[$package->getName()]);
  15211. }
  15212. }
  15213. }
  15214. }
  15215. foreach ($removeMap as $name => $package) {
  15216. array_unshift($operations, new Operation\UninstallOperation($package));
  15217. }
  15218. foreach ($removeAliasMap as $nameVersion => $package) {
  15219. $operations[] = new Operation\MarkAliasUninstalledOperation($package);
  15220. }
  15221. $operations = $this->movePluginsToFront($operations);
  15222. $operations = $this->moveUninstallsToFront($operations);
  15223. return $this->operations = $operations;
  15224. }
  15225. protected function getRootPackages(): array
  15226. {
  15227. $roots = $this->resultPackageMap;
  15228. foreach ($this->resultPackageMap as $packageHash => $package) {
  15229. if (!isset($roots[$packageHash])) {
  15230. continue;
  15231. }
  15232. foreach ($package->getRequires() as $link) {
  15233. $possibleRequires = $this->getProvidersInResult($link);
  15234. foreach ($possibleRequires as $require) {
  15235. if ($require !== $package) {
  15236. unset($roots[spl_object_hash($require)]);
  15237. }
  15238. }
  15239. }
  15240. }
  15241. return $roots;
  15242. }
  15243. protected function getProvidersInResult(Link $link): array
  15244. {
  15245. if (!isset($this->resultPackagesByName[$link->getTarget()])) {
  15246. return [];
  15247. }
  15248. return $this->resultPackagesByName[$link->getTarget()];
  15249. }
  15250. private function movePluginsToFront(array $operations): array
  15251. {
  15252. $dlModifyingPluginsNoDeps = [];
  15253. $dlModifyingPluginsWithDeps = [];
  15254. $dlModifyingPluginRequires = [];
  15255. $pluginsNoDeps = [];
  15256. $pluginsWithDeps = [];
  15257. $pluginRequires = [];
  15258. foreach (array_reverse($operations, true) as $idx => $op) {
  15259. if ($op instanceof Operation\InstallOperation) {
  15260. $package = $op->getPackage();
  15261. } elseif ($op instanceof Operation\UpdateOperation) {
  15262. $package = $op->getTargetPackage();
  15263. } else {
  15264. continue;
  15265. }
  15266. $isDownloadsModifyingPlugin = $package->getType() === 'composer-plugin' && ($extra = $package->getExtra()) && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true;
  15267. if ($isDownloadsModifyingPlugin || count(array_intersect($package->getNames(), $dlModifyingPluginRequires))) {
  15268. $requires = array_filter(array_keys($package->getRequires()), static function ($req): bool {
  15269. return !PlatformRepository::isPlatformPackage($req);
  15270. });
  15271. if ($isDownloadsModifyingPlugin && !count($requires)) {
  15272. array_unshift($dlModifyingPluginsNoDeps, $op);
  15273. } else {
  15274. $dlModifyingPluginRequires = array_merge($dlModifyingPluginRequires, $requires);
  15275. array_unshift($dlModifyingPluginsWithDeps, $op);
  15276. }
  15277. unset($operations[$idx]);
  15278. continue;
  15279. }
  15280. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  15281. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  15282. $requires = array_filter(array_keys($package->getRequires()), static function ($req): bool {
  15283. return !PlatformRepository::isPlatformPackage($req);
  15284. });
  15285. if ($isPlugin && !count($requires)) {
  15286. array_unshift($pluginsNoDeps, $op);
  15287. } else {
  15288. $pluginRequires = array_merge($pluginRequires, $requires);
  15289. array_unshift($pluginsWithDeps, $op);
  15290. }
  15291. unset($operations[$idx]);
  15292. }
  15293. }
  15294. return array_merge($dlModifyingPluginsNoDeps, $dlModifyingPluginsWithDeps, $pluginsNoDeps, $pluginsWithDeps, $operations);
  15295. }
  15296. private function moveUninstallsToFront(array $operations): array
  15297. {
  15298. $uninstOps = [];
  15299. foreach ($operations as $idx => $op) {
  15300. if ($op instanceof Operation\UninstallOperation || $op instanceof Operation\MarkAliasUninstalledOperation) {
  15301. $uninstOps[] = $op;
  15302. unset($operations[$idx]);
  15303. }
  15304. }
  15305. return array_merge($uninstOps, $operations);
  15306. }
  15307. }
  15308. <?php declare(strict_types=1);
  15309. namespace Composer\Downloader;
  15310. use Composer\Package\PackageInterface;
  15311. use Composer\Util\Platform;
  15312. use Symfony\Component\Finder\Finder;
  15313. use React\Promise\PromiseInterface;
  15314. use Composer\DependencyResolver\Operation\InstallOperation;
  15315. abstract class ArchiveDownloader extends FileDownloader
  15316. {
  15317. protected $cleanupExecuted = [];
  15318. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  15319. {
  15320. unset($this->cleanupExecuted[$package->getName()]);
  15321. return parent::prepare($type, $package, $path, $prevPackage);
  15322. }
  15323. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  15324. {
  15325. $this->cleanupExecuted[$package->getName()] = true;
  15326. return parent::cleanup($type, $package, $path, $prevPackage);
  15327. }
  15328. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  15329. {
  15330. if ($output) {
  15331. $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
  15332. }
  15333. $vendorDir = $this->config->get('vendor-dir');
  15334. if (false === strpos($this->filesystem->normalizePath($vendorDir), $this->filesystem->normalizePath($path.DIRECTORY_SEPARATOR))) {
  15335. $this->filesystem->emptyDirectory($path);
  15336. }
  15337. do {
  15338. $temporaryDir = $vendorDir.'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  15339. } while (is_dir($temporaryDir));
  15340. $this->addCleanupPath($package, $temporaryDir);
  15341. if (!is_dir($path) || realpath($path) !== Platform::getCwd()) {
  15342. $this->addCleanupPath($package, $path);
  15343. }
  15344. $this->filesystem->ensureDirectoryExists($temporaryDir);
  15345. $fileName = $this->getFileName($package, $path);
  15346. $filesystem = $this->filesystem;
  15347. $cleanup = function () use ($path, $filesystem, $temporaryDir, $package) {
  15348. $this->clearLastCacheWrite($package);
  15349. $filesystem->removeDirectory($temporaryDir);
  15350. if (is_dir($path) && realpath($path) !== Platform::getCwd()) {
  15351. $filesystem->removeDirectory($path);
  15352. }
  15353. $this->removeCleanupPath($package, $temporaryDir);
  15354. $realpath = realpath($path);
  15355. if ($realpath !== false) {
  15356. $this->removeCleanupPath($package, $realpath);
  15357. }
  15358. };
  15359. try {
  15360. $promise = $this->extract($package, $fileName, $temporaryDir);
  15361. } catch (\Exception $e) {
  15362. $cleanup();
  15363. throw $e;
  15364. }
  15365. return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
  15366. if (file_exists($fileName)) {
  15367. $filesystem->unlink($fileName);
  15368. }
  15369. $getFolderContent = static function ($dir): array {
  15370. $finder = Finder::create()
  15371. ->ignoreVCS(false)
  15372. ->ignoreDotFiles(false)
  15373. ->notName('.DS_Store')
  15374. ->depth(0)
  15375. ->in($dir);
  15376. return iterator_to_array($finder);
  15377. };
  15378. $renameRecursively = null;
  15379. $renameRecursively = static function ($from, $to) use ($filesystem, $getFolderContent, $package, &$renameRecursively) {
  15380. $contentDir = $getFolderContent($from);
  15381. foreach ($contentDir as $file) {
  15382. $file = (string) $file;
  15383. if (is_dir($to . '/' . basename($file))) {
  15384. if (!is_dir($file)) {
  15385. throw new \RuntimeException('Installing '.$package.' would lead to overwriting the '.$to.'/'.basename($file).' directory with a file from the package, invalid operation.');
  15386. }
  15387. $renameRecursively($file, $to . '/' . basename($file));
  15388. } else {
  15389. $filesystem->rename($file, $to . '/' . basename($file));
  15390. }
  15391. }
  15392. };
  15393. $renameAsOne = false;
  15394. if (!file_exists($path)) {
  15395. $renameAsOne = true;
  15396. } elseif ($filesystem->isDirEmpty($path)) {
  15397. try {
  15398. if ($filesystem->removeDirectoryPhp($path)) {
  15399. $renameAsOne = true;
  15400. }
  15401. } catch (\RuntimeException $e) {
  15402. }
  15403. }
  15404. $contentDir = $getFolderContent($temporaryDir);
  15405. $singleDirAtTopLevel = 1 === count($contentDir) && is_dir((string) reset($contentDir));
  15406. if ($renameAsOne) {
  15407. if ($singleDirAtTopLevel) {
  15408. $extractedDir = (string) reset($contentDir);
  15409. } else {
  15410. $extractedDir = $temporaryDir;
  15411. }
  15412. $filesystem->rename($extractedDir, $path);
  15413. } else {
  15414. $from = $temporaryDir;
  15415. if ($singleDirAtTopLevel) {
  15416. $from = (string) reset($contentDir);
  15417. }
  15418. $renameRecursively($from, $path);
  15419. }
  15420. $promise = $filesystem->removeDirectoryAsync($temporaryDir);
  15421. return $promise->then(function () use ($package, $path, $temporaryDir) {
  15422. $this->removeCleanupPath($package, $temporaryDir);
  15423. $this->removeCleanupPath($package, $path);
  15424. });
  15425. }, static function ($e) use ($cleanup) {
  15426. $cleanup();
  15427. throw $e;
  15428. });
  15429. }
  15430. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  15431. {
  15432. return ': Extracting archive';
  15433. }
  15434. abstract protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface;
  15435. }
  15436. <?php declare(strict_types=1);
  15437. namespace Composer\Downloader;
  15438. use Composer\Package\PackageInterface;
  15439. interface ChangeReportInterface
  15440. {
  15441. public function getLocalChanges(PackageInterface $package, string $path): ?string;
  15442. }
  15443. <?php declare(strict_types=1);
  15444. namespace Composer\Downloader;
  15445. use Composer\Package\PackageInterface;
  15446. use Composer\IO\IOInterface;
  15447. use Composer\Pcre\Preg;
  15448. use Composer\Util\Filesystem;
  15449. use Composer\Exception\IrrecoverableDownloadException;
  15450. use React\Promise\PromiseInterface;
  15451. class DownloadManager
  15452. {
  15453. private $io;
  15454. private $preferDist = false;
  15455. private $preferSource;
  15456. private $packagePreferences = [];
  15457. private $filesystem;
  15458. private $downloaders = [];
  15459. public function __construct(IOInterface $io, bool $preferSource = false, ?Filesystem $filesystem = null)
  15460. {
  15461. $this->io = $io;
  15462. $this->preferSource = $preferSource;
  15463. $this->filesystem = $filesystem ?: new Filesystem();
  15464. }
  15465. public function setPreferSource(bool $preferSource): self
  15466. {
  15467. $this->preferSource = $preferSource;
  15468. return $this;
  15469. }
  15470. public function setPreferDist(bool $preferDist): self
  15471. {
  15472. $this->preferDist = $preferDist;
  15473. return $this;
  15474. }
  15475. public function setPreferences(array $preferences): self
  15476. {
  15477. $this->packagePreferences = $preferences;
  15478. return $this;
  15479. }
  15480. public function setDownloader(string $type, DownloaderInterface $downloader): self
  15481. {
  15482. $type = strtolower($type);
  15483. $this->downloaders[$type] = $downloader;
  15484. return $this;
  15485. }
  15486. public function getDownloader(string $type): DownloaderInterface
  15487. {
  15488. $type = strtolower($type);
  15489. if (!isset($this->downloaders[$type])) {
  15490. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  15491. }
  15492. return $this->downloaders[$type];
  15493. }
  15494. public function getDownloaderForPackage(PackageInterface $package): ?DownloaderInterface
  15495. {
  15496. $installationSource = $package->getInstallationSource();
  15497. if ('metapackage' === $package->getType()) {
  15498. return null;
  15499. }
  15500. if ('dist' === $installationSource) {
  15501. $downloader = $this->getDownloader($package->getDistType());
  15502. } elseif ('source' === $installationSource) {
  15503. $downloader = $this->getDownloader($package->getSourceType());
  15504. } else {
  15505. throw new \InvalidArgumentException(
  15506. 'Package '.$package.' does not have an installation source set'
  15507. );
  15508. }
  15509. if ($installationSource !== $downloader->getInstallationSource()) {
  15510. throw new \LogicException(sprintf(
  15511. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  15512. get_class($downloader),
  15513. $downloader->getInstallationSource(),
  15514. $installationSource,
  15515. $package
  15516. ));
  15517. }
  15518. return $downloader;
  15519. }
  15520. public function getDownloaderType(DownloaderInterface $downloader): string
  15521. {
  15522. return array_search($downloader, $this->downloaders);
  15523. }
  15524. public function download(PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
  15525. {
  15526. $targetDir = $this->normalizeTargetDir($targetDir);
  15527. $this->filesystem->ensureDirectoryExists(dirname($targetDir));
  15528. $sources = $this->getAvailableSources($package, $prevPackage);
  15529. $io = $this->io;
  15530. $download = function ($retry = false) use (&$sources, $io, $package, $targetDir, &$download, $prevPackage) {
  15531. $source = array_shift($sources);
  15532. if ($retry) {
  15533. $io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  15534. }
  15535. $package->setInstallationSource($source);
  15536. $downloader = $this->getDownloaderForPackage($package);
  15537. if (!$downloader) {
  15538. return \React\Promise\resolve(null);
  15539. }
  15540. $handleError = static function ($e) use ($sources, $source, $package, $io, $download) {
  15541. if ($e instanceof \RuntimeException && !$e instanceof IrrecoverableDownloadException) {
  15542. if (!$sources) {
  15543. throw $e;
  15544. }
  15545. $io->writeError(
  15546. ' <warning>Failed to download '.
  15547. $package->getPrettyName().
  15548. ' from ' . $source . ': '.
  15549. $e->getMessage().'</warning>'
  15550. );
  15551. return $download(true);
  15552. }
  15553. throw $e;
  15554. };
  15555. try {
  15556. $result = $downloader->download($package, $targetDir, $prevPackage);
  15557. } catch (\Exception $e) {
  15558. return $handleError($e);
  15559. }
  15560. $res = $result->then(static function ($res) {
  15561. return $res;
  15562. }, $handleError);
  15563. return $res;
  15564. };
  15565. return $download();
  15566. }
  15567. public function prepare(string $type, PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
  15568. {
  15569. $targetDir = $this->normalizeTargetDir($targetDir);
  15570. $downloader = $this->getDownloaderForPackage($package);
  15571. if ($downloader) {
  15572. return $downloader->prepare($type, $package, $targetDir, $prevPackage);
  15573. }
  15574. return \React\Promise\resolve(null);
  15575. }
  15576. public function install(PackageInterface $package, string $targetDir): PromiseInterface
  15577. {
  15578. $targetDir = $this->normalizeTargetDir($targetDir);
  15579. $downloader = $this->getDownloaderForPackage($package);
  15580. if ($downloader) {
  15581. return $downloader->install($package, $targetDir);
  15582. }
  15583. return \React\Promise\resolve(null);
  15584. }
  15585. public function update(PackageInterface $initial, PackageInterface $target, string $targetDir): PromiseInterface
  15586. {
  15587. $targetDir = $this->normalizeTargetDir($targetDir);
  15588. $downloader = $this->getDownloaderForPackage($target);
  15589. $initialDownloader = $this->getDownloaderForPackage($initial);
  15590. if (!$initialDownloader && !$downloader) {
  15591. return \React\Promise\resolve(null);
  15592. }
  15593. if (!$downloader) {
  15594. return $initialDownloader->remove($initial, $targetDir);
  15595. }
  15596. $initialType = $this->getDownloaderType($initialDownloader);
  15597. $targetType = $this->getDownloaderType($downloader);
  15598. if ($initialType === $targetType) {
  15599. try {
  15600. return $downloader->update($initial, $target, $targetDir);
  15601. } catch (\RuntimeException $e) {
  15602. if (!$this->io->isInteractive()) {
  15603. throw $e;
  15604. }
  15605. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  15606. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ')) {
  15607. throw $e;
  15608. }
  15609. }
  15610. }
  15611. $promise = $initialDownloader->remove($initial, $targetDir);
  15612. return $promise->then(function ($res) use ($target, $targetDir): PromiseInterface {
  15613. return $this->install($target, $targetDir);
  15614. });
  15615. }
  15616. public function remove(PackageInterface $package, string $targetDir): PromiseInterface
  15617. {
  15618. $targetDir = $this->normalizeTargetDir($targetDir);
  15619. $downloader = $this->getDownloaderForPackage($package);
  15620. if ($downloader) {
  15621. return $downloader->remove($package, $targetDir);
  15622. }
  15623. return \React\Promise\resolve(null);
  15624. }
  15625. public function cleanup(string $type, PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
  15626. {
  15627. $targetDir = $this->normalizeTargetDir($targetDir);
  15628. $downloader = $this->getDownloaderForPackage($package);
  15629. if ($downloader) {
  15630. return $downloader->cleanup($type, $package, $targetDir, $prevPackage);
  15631. }
  15632. return \React\Promise\resolve(null);
  15633. }
  15634. protected function resolvePackageInstallPreference(PackageInterface $package): string
  15635. {
  15636. foreach ($this->packagePreferences as $pattern => $preference) {
  15637. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  15638. if (Preg::isMatch($pattern, $package->getName())) {
  15639. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  15640. return 'dist';
  15641. }
  15642. return 'source';
  15643. }
  15644. }
  15645. return $package->isDev() ? 'source' : 'dist';
  15646. }
  15647. private function getAvailableSources(PackageInterface $package, ?PackageInterface $prevPackage = null): array
  15648. {
  15649. $sourceType = $package->getSourceType();
  15650. $distType = $package->getDistType();
  15651. $sources = [];
  15652. if ($sourceType) {
  15653. $sources[] = 'source';
  15654. }
  15655. if ($distType) {
  15656. $sources[] = 'dist';
  15657. }
  15658. if (empty($sources)) {
  15659. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  15660. }
  15661. if (
  15662. $prevPackage
  15663. && in_array($prevPackage->getInstallationSource(), $sources, true)
  15664. && !(!$prevPackage->isDev() && $prevPackage->getInstallationSource() === 'dist' && $package->isDev())
  15665. ) {
  15666. $prevSource = $prevPackage->getInstallationSource();
  15667. usort($sources, static function ($a, $b) use ($prevSource): int {
  15668. return $a === $prevSource ? -1 : 1;
  15669. });
  15670. return $sources;
  15671. }
  15672. if (!$this->preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  15673. $sources = array_reverse($sources);
  15674. }
  15675. return $sources;
  15676. }
  15677. private function normalizeTargetDir(string $dir): string
  15678. {
  15679. if ($dir === '\\' || $dir === '/') {
  15680. return $dir;
  15681. }
  15682. return rtrim($dir, '\\/');
  15683. }
  15684. }
  15685. <?php declare(strict_types=1);
  15686. namespace Composer\Downloader;
  15687. use Composer\Package\PackageInterface;
  15688. use React\Promise\PromiseInterface;
  15689. interface DownloaderInterface
  15690. {
  15691. public function getInstallationSource(): string;
  15692. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
  15693. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
  15694. public function install(PackageInterface $package, string $path): PromiseInterface;
  15695. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface;
  15696. public function remove(PackageInterface $package, string $path): PromiseInterface;
  15697. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
  15698. }
  15699. <?php declare(strict_types=1);
  15700. namespace Composer\Downloader;
  15701. use Composer\Package\PackageInterface;
  15702. interface DvcsDownloaderInterface
  15703. {
  15704. public function getUnpushedChanges(PackageInterface $package, string $path): ?string;
  15705. }
  15706. <?php declare(strict_types=1);
  15707. namespace Composer\Downloader;
  15708. use Composer\Config;
  15709. use Composer\Cache;
  15710. use Composer\IO\IOInterface;
  15711. use Composer\IO\NullIO;
  15712. use Composer\Exception\IrrecoverableDownloadException;
  15713. use Composer\Package\Comparer\Comparer;
  15714. use Composer\DependencyResolver\Operation\UpdateOperation;
  15715. use Composer\DependencyResolver\Operation\InstallOperation;
  15716. use Composer\DependencyResolver\Operation\UninstallOperation;
  15717. use Composer\Package\PackageInterface;
  15718. use Composer\Plugin\PluginEvents;
  15719. use Composer\Plugin\PostFileDownloadEvent;
  15720. use Composer\Plugin\PreFileDownloadEvent;
  15721. use Composer\EventDispatcher\EventDispatcher;
  15722. use Composer\Util\Filesystem;
  15723. use Composer\Util\Platform;
  15724. use Composer\Util\Silencer;
  15725. use Composer\Util\HttpDownloader;
  15726. use Composer\Util\Url as UrlUtil;
  15727. use Composer\Util\ProcessExecutor;
  15728. use React\Promise\PromiseInterface;
  15729. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  15730. {
  15731. protected $io;
  15732. protected $config;
  15733. protected $httpDownloader;
  15734. protected $filesystem;
  15735. protected $cache;
  15736. protected $eventDispatcher;
  15737. protected $process;
  15738. public static $downloadMetadata = [];
  15739. public static $responseHeaders = [];
  15740. private $lastCacheWrites = [];
  15741. private $additionalCleanupPaths = [];
  15742. public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null, ?Cache $cache = null, ?Filesystem $filesystem = null, ?ProcessExecutor $process = null)
  15743. {
  15744. $this->io = $io;
  15745. $this->config = $config;
  15746. $this->eventDispatcher = $eventDispatcher;
  15747. $this->httpDownloader = $httpDownloader;
  15748. $this->cache = $cache;
  15749. $this->process = $process ?? new ProcessExecutor($io);
  15750. $this->filesystem = $filesystem ?: new Filesystem($this->process);
  15751. if ($this->cache && $this->cache->gcIsNecessary()) {
  15752. $this->io->writeError('Running cache garbage collection', true, IOInterface::VERY_VERBOSE);
  15753. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  15754. }
  15755. }
  15756. public function getInstallationSource(): string
  15757. {
  15758. return 'dist';
  15759. }
  15760. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  15761. {
  15762. if (!$package->getDistUrl()) {
  15763. throw new \InvalidArgumentException('The given package is missing url information');
  15764. }
  15765. $cacheKeyGenerator = static function (PackageInterface $package, $key): string {
  15766. $cacheKey = sha1($key);
  15767. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  15768. };
  15769. $retries = 3;
  15770. $distUrls = $package->getDistUrls();
  15771. $urls = [];
  15772. foreach ($distUrls as $index => $url) {
  15773. $processedUrl = $this->processUrl($package, $url);
  15774. $urls[$index] = [
  15775. 'base' => $url,
  15776. 'processed' => $processedUrl,
  15777. 'cacheKey' => $cacheKeyGenerator($package, $processedUrl),
  15778. ];
  15779. }
  15780. assert(count($urls) > 0);
  15781. $fileName = $this->getFileName($package, $path);
  15782. $this->filesystem->ensureDirectoryExists($path);
  15783. $this->filesystem->ensureDirectoryExists(dirname($fileName));
  15784. $io = $this->io;
  15785. $cache = $this->cache;
  15786. $httpDownloader = $this->httpDownloader;
  15787. $eventDispatcher = $this->eventDispatcher;
  15788. $filesystem = $this->filesystem;
  15789. $accept = null;
  15790. $reject = null;
  15791. $download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) {
  15792. $url = reset($urls);
  15793. $index = key($urls);
  15794. if ($eventDispatcher) {
  15795. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed'], 'package', $package);
  15796. $eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  15797. if ($preFileDownloadEvent->getCustomCacheKey() !== null) {
  15798. $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getCustomCacheKey());
  15799. } elseif ($preFileDownloadEvent->getProcessedUrl() !== $url['processed']) {
  15800. $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getProcessedUrl());
  15801. }
  15802. $url['processed'] = $preFileDownloadEvent->getProcessedUrl();
  15803. }
  15804. $urls[$index] = $url;
  15805. $checksum = $package->getDistSha1Checksum();
  15806. $cacheKey = $url['cacheKey'];
  15807. if ($cache && (!$checksum || $checksum === $cache->sha1($cacheKey)) && $cache->copyTo($cacheKey, $fileName)) {
  15808. if ($output) {
  15809. $io->writeError(" - Loading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) from cache", true, IOInterface::VERY_VERBOSE);
  15810. }
  15811. if (!$cache->isReadOnly()) {
  15812. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  15813. }
  15814. $result = \React\Promise\resolve($fileName);
  15815. } else {
  15816. if ($output) {
  15817. $io->writeError(" - Downloading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15818. }
  15819. $result = $httpDownloader->addCopy($url['processed'], $fileName, $package->getTransportOptions())
  15820. ->then($accept, $reject);
  15821. }
  15822. return $result->then(static function ($result) use ($fileName, $checksum, $url, $package, $eventDispatcher): string {
  15823. if (null === $result) {
  15824. return $fileName;
  15825. }
  15826. if (!file_exists($fileName)) {
  15827. throw new \UnexpectedValueException($url['base'].' could not be saved to '.$fileName.', make sure the'
  15828. .' directory is writable and you have internet connectivity');
  15829. }
  15830. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  15831. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url['base'].')');
  15832. }
  15833. if ($eventDispatcher) {
  15834. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, $fileName, $checksum, $url['processed'], 'package', $package);
  15835. $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  15836. }
  15837. return $fileName;
  15838. });
  15839. };
  15840. $accept = function ($response) use ($cache, $package, $fileName, &$urls): string {
  15841. $url = reset($urls);
  15842. $cacheKey = $url['cacheKey'];
  15843. FileDownloader::$downloadMetadata[$package->getName()] = @filesize($fileName) ?: $response->getHeader('Content-Length') ?: '?';
  15844. if (Platform::getEnv('GITHUB_ACTIONS') !== false && Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') === false) {
  15845. FileDownloader::$responseHeaders[$package->getName()] = $response->getHeaders();
  15846. }
  15847. if ($cache && !$cache->isReadOnly()) {
  15848. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  15849. $cache->copyFrom($cacheKey, $fileName);
  15850. }
  15851. $response->collect();
  15852. return $fileName;
  15853. };
  15854. $reject = function ($e) use ($io, &$urls, $download, $fileName, $package, &$retries, $filesystem) {
  15855. if (file_exists($fileName)) {
  15856. $filesystem->unlink($fileName);
  15857. }
  15858. $this->clearLastCacheWrite($package);
  15859. if ($e instanceof IrrecoverableDownloadException) {
  15860. throw $e;
  15861. }
  15862. if ($e instanceof MaxFileSizeExceededException) {
  15863. throw $e;
  15864. }
  15865. if ($e instanceof TransportException) {
  15866. if ((0 !== $e->getCode() && !in_array($e->getCode(), [500, 502, 503, 504])) || !$retries) {
  15867. $retries = 0;
  15868. }
  15869. }
  15870. if ($e instanceof TransportException && $e->getStatusCode() === 499) {
  15871. $retries = 0;
  15872. $urls = [];
  15873. }
  15874. if ($retries) {
  15875. usleep(500000);
  15876. $retries--;
  15877. return $download();
  15878. }
  15879. array_shift($urls);
  15880. if ($urls) {
  15881. if ($io->isDebug()) {
  15882. $io->writeError(' Failed downloading '.$package->getName().': ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  15883. $io->writeError(' Trying the next URL for '.$package->getName());
  15884. } else {
  15885. $io->writeError(' Failed downloading '.$package->getName().', trying the next URL ('.$e->getCode().': '.$e->getMessage().')');
  15886. }
  15887. $retries = 3;
  15888. usleep(100000);
  15889. return $download();
  15890. }
  15891. throw $e;
  15892. };
  15893. return $download();
  15894. }
  15895. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  15896. {
  15897. return \React\Promise\resolve(null);
  15898. }
  15899. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  15900. {
  15901. $fileName = $this->getFileName($package, $path);
  15902. if (file_exists($fileName)) {
  15903. $this->filesystem->unlink($fileName);
  15904. }
  15905. $dirsToCleanUp = [
  15906. $path,
  15907. $this->config->get('vendor-dir').'/'.explode('/', $package->getPrettyName())[0],
  15908. $this->config->get('vendor-dir').'/composer/',
  15909. $this->config->get('vendor-dir'),
  15910. ];
  15911. if (isset($this->additionalCleanupPaths[$package->getName()])) {
  15912. foreach ($this->additionalCleanupPaths[$package->getName()] as $path) {
  15913. $this->filesystem->remove($path);
  15914. }
  15915. }
  15916. foreach ($dirsToCleanUp as $dir) {
  15917. if (is_dir($dir) && $this->filesystem->isDirEmpty($dir) && realpath($dir) !== Platform::getCwd()) {
  15918. $this->filesystem->removeDirectoryPhp($dir);
  15919. }
  15920. }
  15921. return \React\Promise\resolve(null);
  15922. }
  15923. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  15924. {
  15925. if ($output) {
  15926. $this->io->writeError(" - " . InstallOperation::format($package));
  15927. }
  15928. $this->filesystem->emptyDirectory($path);
  15929. $this->filesystem->ensureDirectoryExists($path);
  15930. $this->filesystem->rename($this->getFileName($package, $path), $path . '/' . $this->getDistPath($package, PATHINFO_BASENAME));
  15931. if ($package->getBinaries()) {
  15932. foreach ($package->getBinaries() as $bin) {
  15933. if (file_exists($path . '/' . $bin) && !is_executable($path . '/' . $bin)) {
  15934. Silencer::call('chmod', $path . '/' . $bin, 0777 & ~umask());
  15935. }
  15936. }
  15937. }
  15938. return \React\Promise\resolve(null);
  15939. }
  15940. protected function getDistPath(PackageInterface $package, int $component): string
  15941. {
  15942. return pathinfo((string) parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), $component);
  15943. }
  15944. protected function clearLastCacheWrite(PackageInterface $package): void
  15945. {
  15946. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  15947. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  15948. unset($this->lastCacheWrites[$package->getName()]);
  15949. }
  15950. }
  15951. protected function addCleanupPath(PackageInterface $package, string $path): void
  15952. {
  15953. $this->additionalCleanupPaths[$package->getName()][] = $path;
  15954. }
  15955. protected function removeCleanupPath(PackageInterface $package, string $path): void
  15956. {
  15957. if (isset($this->additionalCleanupPaths[$package->getName()])) {
  15958. $idx = array_search($path, $this->additionalCleanupPaths[$package->getName()]);
  15959. if (false !== $idx) {
  15960. unset($this->additionalCleanupPaths[$package->getName()][$idx]);
  15961. }
  15962. }
  15963. }
  15964. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
  15965. {
  15966. $this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
  15967. $promise = $this->remove($initial, $path, false);
  15968. return $promise->then(function () use ($target, $path): PromiseInterface {
  15969. return $this->install($target, $path, false);
  15970. });
  15971. }
  15972. public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  15973. {
  15974. if ($output) {
  15975. $this->io->writeError(" - " . UninstallOperation::format($package));
  15976. }
  15977. $promise = $this->filesystem->removeDirectoryAsync($path);
  15978. return $promise->then(static function ($result) use ($path): void {
  15979. if (!$result) {
  15980. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  15981. }
  15982. });
  15983. }
  15984. protected function getFileName(PackageInterface $package, string $path): string
  15985. {
  15986. $extension = $this->getDistPath($package, PATHINFO_EXTENSION);
  15987. if ($extension === '') {
  15988. $extension = $package->getDistType();
  15989. }
  15990. return rtrim($this->config->get('vendor-dir') . '/composer/tmp-' . md5($package . spl_object_hash($package)) . '.' . $extension, '.');
  15991. }
  15992. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  15993. {
  15994. return '';
  15995. }
  15996. protected function processUrl(PackageInterface $package, string $url): string
  15997. {
  15998. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  15999. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  16000. }
  16001. if ($package->getDistReference()) {
  16002. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  16003. }
  16004. return $url;
  16005. }
  16006. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16007. {
  16008. $prevIO = $this->io;
  16009. $this->io = new NullIO;
  16010. $this->io->loadConfiguration($this->config);
  16011. $e = null;
  16012. $output = '';
  16013. $targetDir = Filesystem::trimTrailingSlash($path);
  16014. try {
  16015. if (is_dir($targetDir.'_compare')) {
  16016. $this->filesystem->removeDirectory($targetDir.'_compare');
  16017. }
  16018. $this->download($package, $targetDir.'_compare', null, false);
  16019. $this->httpDownloader->wait();
  16020. $this->install($package, $targetDir.'_compare', false);
  16021. $this->process->wait();
  16022. $comparer = new Comparer();
  16023. $comparer->setSource($targetDir.'_compare');
  16024. $comparer->setUpdate($targetDir);
  16025. $comparer->doCompare();
  16026. $output = $comparer->getChangedAsString(true);
  16027. $this->filesystem->removeDirectory($targetDir.'_compare');
  16028. } catch (\Exception $e) {
  16029. }
  16030. $this->io = $prevIO;
  16031. if ($e) {
  16032. throw $e;
  16033. }
  16034. $output = trim($output);
  16035. return strlen($output) > 0 ? $output : null;
  16036. }
  16037. }
  16038. <?php declare(strict_types=1);
  16039. namespace Composer\Downloader;
  16040. class FilesystemException extends \Exception
  16041. {
  16042. public function __construct(string $message = '', int $code = 0, ?\Exception $previous = null)
  16043. {
  16044. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  16045. }
  16046. }
  16047. <?php declare(strict_types=1);
  16048. namespace Composer\Downloader;
  16049. use React\Promise\PromiseInterface;
  16050. use Composer\Package\PackageInterface;
  16051. use Composer\Pcre\Preg;
  16052. use Composer\Util\ProcessExecutor;
  16053. class FossilDownloader extends VcsDownloader
  16054. {
  16055. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  16056. {
  16057. return \React\Promise\resolve(null);
  16058. }
  16059. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  16060. {
  16061. $this->config->prohibitUrlByConfig($url, $this->io);
  16062. $url = ProcessExecutor::escape($url);
  16063. $ref = ProcessExecutor::escape($package->getSourceReference());
  16064. $repoFile = $path . '.fossil';
  16065. $this->io->writeError("Cloning ".$package->getSourceReference());
  16066. $command = sprintf('fossil clone -- %s %s', $url, ProcessExecutor::escape($repoFile));
  16067. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  16068. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16069. }
  16070. $command = sprintf('fossil open --nested -- %s', ProcessExecutor::escape($repoFile));
  16071. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  16072. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16073. }
  16074. $command = sprintf('fossil update -- %s', $ref);
  16075. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  16076. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16077. }
  16078. return \React\Promise\resolve(null);
  16079. }
  16080. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  16081. {
  16082. $this->config->prohibitUrlByConfig($url, $this->io);
  16083. $ref = ProcessExecutor::escape($target->getSourceReference());
  16084. $this->io->writeError(" Updating to ".$target->getSourceReference());
  16085. if (!$this->hasMetadataRepository($path)) {
  16086. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  16087. }
  16088. $command = sprintf('fossil pull && fossil up %s', $ref);
  16089. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  16090. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16091. }
  16092. return \React\Promise\resolve(null);
  16093. }
  16094. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16095. {
  16096. if (!$this->hasMetadataRepository($path)) {
  16097. return null;
  16098. }
  16099. $this->process->execute('fossil changes', $output, realpath($path));
  16100. $output = trim($output);
  16101. return strlen($output) > 0 ? $output : null;
  16102. }
  16103. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  16104. {
  16105. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  16106. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  16107. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16108. }
  16109. $log = '';
  16110. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  16111. foreach ($this->process->splitLines($output) as $line) {
  16112. if (Preg::isMatch($match, $line)) {
  16113. break;
  16114. }
  16115. $log .= $line;
  16116. }
  16117. return $log;
  16118. }
  16119. protected function hasMetadataRepository(string $path): bool
  16120. {
  16121. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  16122. }
  16123. }
  16124. <?php declare(strict_types=1);
  16125. namespace Composer\Downloader;
  16126. use Composer\Config;
  16127. use Composer\IO\IOInterface;
  16128. use Composer\Package\PackageInterface;
  16129. use Composer\Pcre\Preg;
  16130. use Composer\Util\Filesystem;
  16131. use Composer\Util\Git as GitUtil;
  16132. use Composer\Util\Url;
  16133. use Composer\Util\Platform;
  16134. use Composer\Util\ProcessExecutor;
  16135. use Composer\Cache;
  16136. use React\Promise\PromiseInterface;
  16137. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  16138. {
  16139. private $hasStashedChanges = [];
  16140. private $hasDiscardedChanges = [];
  16141. private $gitUtil;
  16142. private $cachedPackages = [];
  16143. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?Filesystem $fs = null)
  16144. {
  16145. parent::__construct($io, $config, $process, $fs);
  16146. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  16147. }
  16148. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  16149. {
  16150. if (Filesystem::isLocalPath($url)) {
  16151. return \React\Promise\resolve(null);
  16152. }
  16153. GitUtil::cleanEnv();
  16154. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
  16155. $gitVersion = GitUtil::getVersion($this->process);
  16156. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  16157. $this->io->writeError(" - Syncing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) into cache");
  16158. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  16159. $ref = $package->getSourceReference();
  16160. if ($this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref, $package->getPrettyVersion()) && is_dir($cachePath)) {
  16161. $this->cachedPackages[$package->getId()][$ref] = true;
  16162. }
  16163. } elseif (null === $gitVersion) {
  16164. throw new \RuntimeException('git was not found in your PATH, skipping source download');
  16165. }
  16166. return \React\Promise\resolve(null);
  16167. }
  16168. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  16169. {
  16170. GitUtil::cleanEnv();
  16171. $path = $this->normalizePath($path);
  16172. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
  16173. $ref = $package->getSourceReference();
  16174. $flag = Platform::isWindows() ? '/D ' : '';
  16175. if (!empty($this->cachedPackages[$package->getId()][$ref])) {
  16176. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  16177. $cloneFlags = '--dissociate --reference %cachePath% ';
  16178. $transportOptions = $package->getTransportOptions();
  16179. if (isset($transportOptions['git']['single_use_clone']) && $transportOptions['git']['single_use_clone']) {
  16180. $cloneFlags = '';
  16181. }
  16182. $command =
  16183. 'git clone --no-checkout %cachePath% %path% ' . $cloneFlags
  16184. . '&& cd '.$flag.'%path% '
  16185. . '&& git remote set-url origin -- %sanitizedUrl% && git remote add composer -- %sanitizedUrl%';
  16186. } else {
  16187. $msg = "Cloning ".$this->getShortHash($ref);
  16188. $command = 'git clone --no-checkout -- %url% %path% && cd '.$flag.'%path% && git remote add composer -- %url% && git fetch composer && git remote set-url origin -- %sanitizedUrl% && git remote set-url composer -- %sanitizedUrl%';
  16189. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  16190. throw new \RuntimeException('The required git reference for '.$package->getName().' is not in cache and network is disabled, aborting');
  16191. }
  16192. }
  16193. $this->io->writeError($msg);
  16194. $commandCallable = static function (string $url) use ($path, $command, $cachePath): string {
  16195. return str_replace(
  16196. ['%url%', '%path%', '%cachePath%', '%sanitizedUrl%'],
  16197. [
  16198. ProcessExecutor::escape($url),
  16199. ProcessExecutor::escape($path),
  16200. ProcessExecutor::escape($cachePath),
  16201. ProcessExecutor::escape(Preg::replace('{://([^@]+?):(.+?)@}', '://', $url)),
  16202. ],
  16203. $command
  16204. );
  16205. };
  16206. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  16207. $sourceUrl = $package->getSourceUrl();
  16208. if ($url !== $sourceUrl && $sourceUrl !== null) {
  16209. $this->updateOriginUrl($path, $sourceUrl);
  16210. } else {
  16211. $this->setPushUrl($path, $url);
  16212. }
  16213. if ($newRef = $this->updateToCommit($package, $path, (string) $ref, $package->getPrettyVersion())) {
  16214. if ($package->getDistReference() === $package->getSourceReference()) {
  16215. $package->setDistReference($newRef);
  16216. }
  16217. $package->setSourceReference($newRef);
  16218. }
  16219. return \React\Promise\resolve(null);
  16220. }
  16221. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  16222. {
  16223. GitUtil::cleanEnv();
  16224. $path = $this->normalizePath($path);
  16225. if (!$this->hasMetadataRepository($path)) {
  16226. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  16227. }
  16228. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
  16229. $ref = $target->getSourceReference();
  16230. if (!empty($this->cachedPackages[$target->getId()][$ref])) {
  16231. $msg = "Checking out ".$this->getShortHash($ref).' from cache';
  16232. $command = '(git rev-parse --quiet --verify %ref% || (git remote set-url composer -- %cachePath% && git fetch composer && git fetch --tags composer)) && git remote set-url composer -- %sanitizedUrl%';
  16233. } else {
  16234. $msg = "Checking out ".$this->getShortHash($ref);
  16235. $command = '(git remote set-url composer -- %url% && git rev-parse --quiet --verify %ref% || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- %sanitizedUrl%';
  16236. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  16237. throw new \RuntimeException('The required git reference for '.$target->getName().' is not in cache and network is disabled, aborting');
  16238. }
  16239. }
  16240. $this->io->writeError($msg);
  16241. $commandCallable = static function ($url) use ($ref, $command, $cachePath): string {
  16242. return str_replace(
  16243. ['%url%', '%ref%', '%cachePath%', '%sanitizedUrl%'],
  16244. [
  16245. ProcessExecutor::escape($url),
  16246. ProcessExecutor::escape($ref.'^{commit}'),
  16247. ProcessExecutor::escape($cachePath),
  16248. ProcessExecutor::escape(Preg::replace('{://([^@]+?):(.+?)@}', '://', $url)),
  16249. ],
  16250. $command
  16251. );
  16252. };
  16253. $this->gitUtil->runCommand($commandCallable, $url, $path);
  16254. if ($newRef = $this->updateToCommit($target, $path, (string) $ref, $target->getPrettyVersion())) {
  16255. if ($target->getDistReference() === $target->getSourceReference()) {
  16256. $target->setDistReference($newRef);
  16257. }
  16258. $target->setSourceReference($newRef);
  16259. }
  16260. $updateOriginUrl = false;
  16261. if (
  16262. 0 === $this->process->execute('git remote -v', $output, $path)
  16263. && Preg::isMatch('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  16264. && Preg::isMatch('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  16265. ) {
  16266. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  16267. $updateOriginUrl = true;
  16268. }
  16269. }
  16270. if ($updateOriginUrl && $target->getSourceUrl() !== null) {
  16271. $this->updateOriginUrl($path, $target->getSourceUrl());
  16272. }
  16273. return \React\Promise\resolve(null);
  16274. }
  16275. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16276. {
  16277. GitUtil::cleanEnv();
  16278. if (!$this->hasMetadataRepository($path)) {
  16279. return null;
  16280. }
  16281. $command = 'git status --porcelain --untracked-files=no';
  16282. if (0 !== $this->process->execute($command, $output, $path)) {
  16283. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16284. }
  16285. $output = trim($output);
  16286. return strlen($output) > 0 ? $output : null;
  16287. }
  16288. public function getUnpushedChanges(PackageInterface $package, string $path): ?string
  16289. {
  16290. GitUtil::cleanEnv();
  16291. $path = $this->normalizePath($path);
  16292. if (!$this->hasMetadataRepository($path)) {
  16293. return null;
  16294. }
  16295. $command = 'git show-ref --head -d';
  16296. if (0 !== $this->process->execute($command, $output, $path)) {
  16297. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16298. }
  16299. $refs = trim($output);
  16300. if (!Preg::isMatchStrictGroups('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  16301. return null;
  16302. }
  16303. $headRef = $match[1];
  16304. if (!Preg::isMatchAllStrictGroups('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  16305. return null;
  16306. }
  16307. $candidateBranches = $matches[1];
  16308. $branch = $candidateBranches[0];
  16309. $unpushedChanges = null;
  16310. $branchNotFoundError = false;
  16311. for ($i = 0; $i <= 1; $i++) {
  16312. $remoteBranches = [];
  16313. foreach ($candidateBranches as $candidate) {
  16314. if (Preg::isMatchAllStrictGroups('{^[a-f0-9]+ refs/remotes/((?:[^/]+)/'.preg_quote($candidate).')$}mi', $refs, $matches)) {
  16315. foreach ($matches[1] as $match) {
  16316. $branch = $candidate;
  16317. $remoteBranches[] = $match;
  16318. }
  16319. break;
  16320. }
  16321. }
  16322. if (count($remoteBranches) === 0) {
  16323. $unpushedChanges = 'Branch ' . $branch . ' could not be found on any remote and appears to be unpushed';
  16324. $branchNotFoundError = true;
  16325. } else {
  16326. if ($branchNotFoundError) {
  16327. $unpushedChanges = null;
  16328. }
  16329. foreach ($remoteBranches as $remoteBranch) {
  16330. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  16331. if (0 !== $this->process->execute($command, $output, $path)) {
  16332. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16333. }
  16334. $output = trim($output);
  16335. if ($unpushedChanges === null || strlen($output) < strlen($unpushedChanges)) {
  16336. $unpushedChanges = $output;
  16337. }
  16338. }
  16339. }
  16340. if ($unpushedChanges && $i === 0) {
  16341. $this->process->execute('git fetch --all', $output, $path);
  16342. $command = 'git show-ref --head -d';
  16343. if (0 !== $this->process->execute($command, $output, $path)) {
  16344. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16345. }
  16346. $refs = trim($output);
  16347. }
  16348. if (!$unpushedChanges) {
  16349. break;
  16350. }
  16351. }
  16352. return $unpushedChanges;
  16353. }
  16354. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  16355. {
  16356. GitUtil::cleanEnv();
  16357. $path = $this->normalizePath($path);
  16358. $unpushed = $this->getUnpushedChanges($package, $path);
  16359. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  16360. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  16361. }
  16362. if (null === ($changes = $this->getLocalChanges($package, $path))) {
  16363. return \React\Promise\resolve(null);
  16364. }
  16365. if (!$this->io->isInteractive()) {
  16366. $discardChanges = $this->config->get('discard-changes');
  16367. if (true === $discardChanges) {
  16368. return $this->discardChanges($path);
  16369. }
  16370. if ('stash' === $discardChanges) {
  16371. if (!$update) {
  16372. return parent::cleanChanges($package, $path, $update);
  16373. }
  16374. return $this->stashChanges($path);
  16375. }
  16376. return parent::cleanChanges($package, $path, $update);
  16377. }
  16378. $changes = array_map(static function ($elem): string {
  16379. return ' '.$elem;
  16380. }, Preg::split('{\s*\r?\n\s*}', $changes));
  16381. $this->io->writeError(' <error>'.$package->getPrettyName().' has modified files:</error>');
  16382. $this->io->writeError(array_slice($changes, 0, 10));
  16383. if (count($changes) > 10) {
  16384. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  16385. }
  16386. while (true) {
  16387. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  16388. case 'y':
  16389. $this->discardChanges($path);
  16390. break 2;
  16391. case 's':
  16392. if (!$update) {
  16393. goto help;
  16394. }
  16395. $this->stashChanges($path);
  16396. break 2;
  16397. case 'n':
  16398. throw new \RuntimeException('Update aborted');
  16399. case 'v':
  16400. $this->io->writeError($changes);
  16401. break;
  16402. case 'd':
  16403. $this->viewDiff($path);
  16404. break;
  16405. case '?':
  16406. default:
  16407. help :
  16408. $this->io->writeError([
  16409. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  16410. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  16411. ' v - view modified files',
  16412. ' d - view local modifications (diff)',
  16413. ]);
  16414. if ($update) {
  16415. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  16416. }
  16417. $this->io->writeError(' ? - print help');
  16418. break;
  16419. }
  16420. }
  16421. return \React\Promise\resolve(null);
  16422. }
  16423. protected function reapplyChanges(string $path): void
  16424. {
  16425. $path = $this->normalizePath($path);
  16426. if (!empty($this->hasStashedChanges[$path])) {
  16427. unset($this->hasStashedChanges[$path]);
  16428. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  16429. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  16430. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  16431. }
  16432. }
  16433. unset($this->hasDiscardedChanges[$path]);
  16434. }
  16435. protected function updateToCommit(PackageInterface $package, string $path, string $reference, string $prettyVersion): ?string
  16436. {
  16437. $force = !empty($this->hasDiscardedChanges[$path]) || !empty($this->hasStashedChanges[$path]) ? '-f ' : '';
  16438. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  16439. $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
  16440. $branches = null;
  16441. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  16442. $branches = $output;
  16443. }
  16444. $gitRef = $reference;
  16445. if (!Preg::isMatch('{^[a-f0-9]{40}$}', $reference)
  16446. && null !== $branches
  16447. && Preg::isMatch('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  16448. ) {
  16449. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  16450. if (0 === $this->process->execute($command, $output, $path)) {
  16451. return null;
  16452. }
  16453. }
  16454. if (Preg::isMatch('{^[a-f0-9]{40}$}', $reference)) {
  16455. if (null !== $branches && !Preg::isMatch('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && Preg::isMatch('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  16456. $branch = 'v' . $branch;
  16457. }
  16458. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  16459. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  16460. $resetCommand = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  16461. if (0 === $this->process->execute("($command || $fallbackCommand) && $resetCommand", $output, $path)) {
  16462. return null;
  16463. }
  16464. }
  16465. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  16466. if (0 === $this->process->execute($command, $output, $path)) {
  16467. return null;
  16468. }
  16469. $exceptionExtra = '';
  16470. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  16471. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  16472. $exceptionExtra = "\nIt looks like the commit hash is not available in the repository, maybe ".($package->isDev() ? 'the commit was removed from the branch' : 'the tag was recreated').'? Run "composer update '.$package->getPrettyName().'" to resolve this.';
  16473. }
  16474. throw new \RuntimeException(Url::sanitize('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput() . $exceptionExtra));
  16475. }
  16476. protected function updateOriginUrl(string $path, string $url): void
  16477. {
  16478. $this->process->execute(sprintf('git remote set-url origin -- %s', ProcessExecutor::escape($url)), $output, $path);
  16479. $this->setPushUrl($path, $url);
  16480. }
  16481. protected function setPushUrl(string $path, string $url): void
  16482. {
  16483. if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  16484. $protocols = $this->config->get('github-protocols');
  16485. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  16486. if (!in_array('ssh', $protocols, true)) {
  16487. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  16488. }
  16489. $cmd = sprintf('git remote set-url --push origin -- %s', ProcessExecutor::escape($pushUrl));
  16490. $this->process->execute($cmd, $ignoredOutput, $path);
  16491. }
  16492. }
  16493. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  16494. {
  16495. $path = $this->normalizePath($path);
  16496. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  16497. if (0 !== $this->process->execute($command, $output, $path)) {
  16498. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16499. }
  16500. return $output;
  16501. }
  16502. protected function discardChanges(string $path): PromiseInterface
  16503. {
  16504. $path = $this->normalizePath($path);
  16505. if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
  16506. throw new \RuntimeException("Could not reset changes\n\n:".$output);
  16507. }
  16508. $this->hasDiscardedChanges[$path] = true;
  16509. return \React\Promise\resolve(null);
  16510. }
  16511. protected function stashChanges(string $path): PromiseInterface
  16512. {
  16513. $path = $this->normalizePath($path);
  16514. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  16515. throw new \RuntimeException("Could not stash changes\n\n:".$output);
  16516. }
  16517. $this->hasStashedChanges[$path] = true;
  16518. return \React\Promise\resolve(null);
  16519. }
  16520. protected function viewDiff(string $path): void
  16521. {
  16522. $path = $this->normalizePath($path);
  16523. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  16524. throw new \RuntimeException("Could not view diff\n\n:".$output);
  16525. }
  16526. $this->io->writeError($output);
  16527. }
  16528. protected function normalizePath(string $path): string
  16529. {
  16530. if (Platform::isWindows() && strlen($path) > 0) {
  16531. $basePath = $path;
  16532. $removed = [];
  16533. while (!is_dir($basePath) && $basePath !== '\\') {
  16534. array_unshift($removed, basename($basePath));
  16535. $basePath = dirname($basePath);
  16536. }
  16537. if ($basePath === '\\') {
  16538. return $path;
  16539. }
  16540. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  16541. }
  16542. return $path;
  16543. }
  16544. protected function hasMetadataRepository(string $path): bool
  16545. {
  16546. $path = $this->normalizePath($path);
  16547. return is_dir($path.'/.git');
  16548. }
  16549. protected function getShortHash(string $reference): string
  16550. {
  16551. if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
  16552. return substr($reference, 0, 10);
  16553. }
  16554. return $reference;
  16555. }
  16556. }
  16557. <?php declare(strict_types=1);
  16558. namespace Composer\Downloader;
  16559. use React\Promise\PromiseInterface;
  16560. use Composer\Package\PackageInterface;
  16561. use Composer\Util\Platform;
  16562. use Composer\Util\ProcessExecutor;
  16563. class GzipDownloader extends ArchiveDownloader
  16564. {
  16565. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  16566. {
  16567. $filename = pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_FILENAME);
  16568. $targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
  16569. if (!Platform::isWindows()) {
  16570. $command = 'gzip -cd -- ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  16571. if (0 === $this->process->execute($command, $ignoredOutput)) {
  16572. return \React\Promise\resolve(null);
  16573. }
  16574. if (extension_loaded('zlib')) {
  16575. $this->extractUsingExt($file, $targetFilepath);
  16576. return \React\Promise\resolve(null);
  16577. }
  16578. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  16579. throw new \RuntimeException($processError);
  16580. }
  16581. $this->extractUsingExt($file, $targetFilepath);
  16582. return \React\Promise\resolve(null);
  16583. }
  16584. private function extractUsingExt(string $file, string $targetFilepath): void
  16585. {
  16586. $archiveFile = gzopen($file, 'rb');
  16587. $targetFile = fopen($targetFilepath, 'wb');
  16588. while ($string = gzread($archiveFile, 4096)) {
  16589. fwrite($targetFile, $string, Platform::strlen($string));
  16590. }
  16591. gzclose($archiveFile);
  16592. fclose($targetFile);
  16593. }
  16594. }
  16595. <?php declare(strict_types=1);
  16596. namespace Composer\Downloader;
  16597. use React\Promise\PromiseInterface;
  16598. use Composer\Package\PackageInterface;
  16599. use Composer\Util\ProcessExecutor;
  16600. use Composer\Util\Hg as HgUtils;
  16601. class HgDownloader extends VcsDownloader
  16602. {
  16603. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  16604. {
  16605. if (null === HgUtils::getVersion($this->process)) {
  16606. throw new \RuntimeException('hg was not found in your PATH, skipping source download');
  16607. }
  16608. return \React\Promise\resolve(null);
  16609. }
  16610. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  16611. {
  16612. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  16613. $cloneCommand = static function (string $url) use ($path): string {
  16614. return sprintf('hg clone -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  16615. };
  16616. $hgUtils->runCommand($cloneCommand, $url, $path);
  16617. $ref = ProcessExecutor::escape($package->getSourceReference());
  16618. $command = sprintf('hg up -- %s', $ref);
  16619. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  16620. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16621. }
  16622. return \React\Promise\resolve(null);
  16623. }
  16624. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  16625. {
  16626. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  16627. $ref = $target->getSourceReference();
  16628. $this->io->writeError(" Updating to ".$target->getSourceReference());
  16629. if (!$this->hasMetadataRepository($path)) {
  16630. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  16631. }
  16632. $command = static function ($url) use ($ref): string {
  16633. return sprintf('hg pull -- %s && hg up -- %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  16634. };
  16635. $hgUtils->runCommand($command, $url, $path);
  16636. return \React\Promise\resolve(null);
  16637. }
  16638. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16639. {
  16640. if (!is_dir($path.'/.hg')) {
  16641. return null;
  16642. }
  16643. $this->process->execute('hg st', $output, realpath($path));
  16644. $output = trim($output);
  16645. return strlen($output) > 0 ? $output : null;
  16646. }
  16647. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  16648. {
  16649. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  16650. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  16651. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  16652. }
  16653. return $output;
  16654. }
  16655. protected function hasMetadataRepository(string $path): bool
  16656. {
  16657. return is_dir($path . '/.hg');
  16658. }
  16659. }
  16660. <?php declare(strict_types=1);
  16661. namespace Composer\Downloader;
  16662. class MaxFileSizeExceededException extends TransportException
  16663. {
  16664. }
  16665. <?php declare(strict_types=1);
  16666. namespace Composer\Downloader;
  16667. use React\Promise\PromiseInterface;
  16668. use Composer\Package\Archiver\ArchivableFilesFinder;
  16669. use Composer\Package\Dumper\ArrayDumper;
  16670. use Composer\Package\PackageInterface;
  16671. use Composer\Package\Version\VersionGuesser;
  16672. use Composer\Package\Version\VersionParser;
  16673. use Composer\Util\Platform;
  16674. use Composer\Util\Filesystem;
  16675. use Symfony\Component\Filesystem\Exception\IOException;
  16676. use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
  16677. use Composer\DependencyResolver\Operation\InstallOperation;
  16678. use Composer\DependencyResolver\Operation\UninstallOperation;
  16679. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  16680. {
  16681. private const STRATEGY_SYMLINK = 10;
  16682. private const STRATEGY_MIRROR = 20;
  16683. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  16684. {
  16685. $path = Filesystem::trimTrailingSlash($path);
  16686. $url = $package->getDistUrl();
  16687. $realUrl = realpath($url);
  16688. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  16689. throw new \RuntimeException(sprintf(
  16690. 'Source path "%s" is not found for package %s',
  16691. $url,
  16692. $package->getName()
  16693. ));
  16694. }
  16695. if (realpath($path) === $realUrl) {
  16696. return \React\Promise\resolve(null);
  16697. }
  16698. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  16699. throw new \RuntimeException(sprintf(
  16700. 'Package %s cannot install to "%s" inside its source at "%s"',
  16701. $package->getName(),
  16702. realpath($path),
  16703. $realUrl
  16704. ));
  16705. }
  16706. return \React\Promise\resolve(null);
  16707. }
  16708. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  16709. {
  16710. $path = Filesystem::trimTrailingSlash($path);
  16711. $url = $package->getDistUrl();
  16712. $realUrl = realpath($url);
  16713. if (realpath($path) === $realUrl) {
  16714. if ($output) {
  16715. $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
  16716. }
  16717. return \React\Promise\resolve(null);
  16718. }
  16719. $transportOptions = $package->getTransportOptions() + ['relative' => true];
  16720. [$currentStrategy, $allowedStrategies] = $this->computeAllowedStrategies($transportOptions);
  16721. $symfonyFilesystem = new SymfonyFilesystem();
  16722. $this->filesystem->removeDirectory($path);
  16723. if ($output) {
  16724. $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
  16725. }
  16726. $isFallback = false;
  16727. if (self::STRATEGY_SYMLINK === $currentStrategy) {
  16728. try {
  16729. if (Platform::isWindows()) {
  16730. if ($output) {
  16731. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  16732. }
  16733. $this->filesystem->junction($realUrl, $path);
  16734. } else {
  16735. $absolutePath = $path;
  16736. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  16737. $absolutePath = Platform::getCwd() . DIRECTORY_SEPARATOR . $path;
  16738. }
  16739. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  16740. $path = rtrim($path, "/");
  16741. if ($output) {
  16742. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  16743. }
  16744. if ($transportOptions['relative']) {
  16745. $symfonyFilesystem->symlink($shortestPath.'/', $path);
  16746. } else {
  16747. $symfonyFilesystem->symlink($realUrl.'/', $path);
  16748. }
  16749. }
  16750. } catch (IOException $e) {
  16751. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  16752. if ($output) {
  16753. $this->io->writeError('');
  16754. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  16755. }
  16756. $currentStrategy = self::STRATEGY_MIRROR;
  16757. $isFallback = true;
  16758. } else {
  16759. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  16760. }
  16761. }
  16762. }
  16763. if (self::STRATEGY_MIRROR === $currentStrategy) {
  16764. $realUrl = $this->filesystem->normalizePath($realUrl);
  16765. if ($output) {
  16766. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  16767. }
  16768. $iterator = new ArchivableFilesFinder($realUrl, []);
  16769. $symfonyFilesystem->mirror($realUrl, $path, $iterator);
  16770. }
  16771. if ($output) {
  16772. $this->io->writeError('');
  16773. }
  16774. return \React\Promise\resolve(null);
  16775. }
  16776. public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  16777. {
  16778. $path = Filesystem::trimTrailingSlash($path);
  16779. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  16780. if ($output) {
  16781. $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
  16782. }
  16783. if (!$this->filesystem->removeJunction($path)) {
  16784. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  16785. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  16786. }
  16787. return \React\Promise\resolve(null);
  16788. }
  16789. $fs = new Filesystem;
  16790. $absPath = $fs->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path;
  16791. $absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : Platform::getCwd() . '/' . $package->getDistUrl();
  16792. if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
  16793. if ($output) {
  16794. $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
  16795. }
  16796. return \React\Promise\resolve(null);
  16797. }
  16798. return parent::remove($package, $path, $output);
  16799. }
  16800. public function getVcsReference(PackageInterface $package, string $path): ?string
  16801. {
  16802. $path = Filesystem::trimTrailingSlash($path);
  16803. $parser = new VersionParser;
  16804. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  16805. $dumper = new ArrayDumper;
  16806. $packageConfig = $dumper->dump($package);
  16807. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  16808. return $packageVersion['commit'];
  16809. }
  16810. return null;
  16811. }
  16812. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  16813. {
  16814. $realUrl = realpath($package->getDistUrl());
  16815. if (realpath($path) === $realUrl) {
  16816. return ': Source already present';
  16817. }
  16818. [$currentStrategy] = $this->computeAllowedStrategies($package->getTransportOptions());
  16819. if ($currentStrategy === self::STRATEGY_SYMLINK) {
  16820. if (Platform::isWindows()) {
  16821. return ': Junctioning from '.$package->getDistUrl();
  16822. }
  16823. return ': Symlinking from '.$package->getDistUrl();
  16824. }
  16825. return ': Mirroring from '.$package->getDistUrl();
  16826. }
  16827. private function computeAllowedStrategies(array $transportOptions): array
  16828. {
  16829. $currentStrategy = self::STRATEGY_SYMLINK;
  16830. $allowedStrategies = [self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR];
  16831. $mirrorPathRepos = Platform::getEnv('COMPOSER_MIRROR_PATH_REPOS');
  16832. if ($mirrorPathRepos) {
  16833. $currentStrategy = self::STRATEGY_MIRROR;
  16834. }
  16835. $symlinkOption = $transportOptions['symlink'] ?? null;
  16836. if (true === $symlinkOption) {
  16837. $currentStrategy = self::STRATEGY_SYMLINK;
  16838. $allowedStrategies = [self::STRATEGY_SYMLINK];
  16839. } elseif (false === $symlinkOption) {
  16840. $currentStrategy = self::STRATEGY_MIRROR;
  16841. $allowedStrategies = [self::STRATEGY_MIRROR];
  16842. }
  16843. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  16844. if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  16845. throw new \RuntimeException('You are on an old Windows / old PHP combo which does not allow Composer to use junctions/symlinks and this path repository has symlink:true in its options so copying is not allowed');
  16846. }
  16847. $currentStrategy = self::STRATEGY_MIRROR;
  16848. $allowedStrategies = [self::STRATEGY_MIRROR];
  16849. }
  16850. if (!Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !function_exists('symlink')) {
  16851. if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  16852. throw new \RuntimeException('Your PHP has the symlink() function disabled which does not allow Composer to use symlinks and this path repository has symlink:true in its options so copying is not allowed');
  16853. }
  16854. $currentStrategy = self::STRATEGY_MIRROR;
  16855. $allowedStrategies = [self::STRATEGY_MIRROR];
  16856. }
  16857. return [$currentStrategy, $allowedStrategies];
  16858. }
  16859. private function safeJunctions(): bool
  16860. {
  16861. return function_exists('proc_open') &&
  16862. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  16863. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  16864. }
  16865. }
  16866. <?php declare(strict_types=1);
  16867. namespace Composer\Downloader;
  16868. use React\Promise\PromiseInterface;
  16869. use Composer\Package\PackageInterface;
  16870. use Composer\Repository\VcsRepository;
  16871. use Composer\Util\Perforce;
  16872. class PerforceDownloader extends VcsDownloader
  16873. {
  16874. protected $perforce;
  16875. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  16876. {
  16877. return \React\Promise\resolve(null);
  16878. }
  16879. public function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  16880. {
  16881. $ref = $package->getSourceReference();
  16882. $label = $this->getLabelFromSourceReference((string) $ref);
  16883. $this->io->writeError('Cloning ' . $ref);
  16884. $this->initPerforce($package, $path, $url);
  16885. $this->perforce->setStream($ref);
  16886. $this->perforce->p4Login();
  16887. $this->perforce->writeP4ClientSpec();
  16888. $this->perforce->connectClient();
  16889. $this->perforce->syncCodeBase($label);
  16890. $this->perforce->cleanupClientSpec();
  16891. return \React\Promise\resolve(null);
  16892. }
  16893. private function getLabelFromSourceReference(string $ref): ?string
  16894. {
  16895. $pos = strpos($ref, '@');
  16896. if (false !== $pos) {
  16897. return substr($ref, $pos + 1);
  16898. }
  16899. return null;
  16900. }
  16901. public function initPerforce(PackageInterface $package, string $path, string $url): void
  16902. {
  16903. if (!empty($this->perforce)) {
  16904. $this->perforce->initializePath($path);
  16905. return;
  16906. }
  16907. $repository = $package->getRepository();
  16908. $repoConfig = null;
  16909. if ($repository instanceof VcsRepository) {
  16910. $repoConfig = $this->getRepoConfig($repository);
  16911. }
  16912. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  16913. }
  16914. private function getRepoConfig(VcsRepository $repository): array
  16915. {
  16916. return $repository->getRepoConfig();
  16917. }
  16918. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  16919. {
  16920. return $this->doInstall($target, $path, $url);
  16921. }
  16922. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16923. {
  16924. $this->io->writeError('Perforce driver does not check for local changes before overriding');
  16925. return null;
  16926. }
  16927. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  16928. {
  16929. return $this->perforce->getCommitLogs($fromReference, $toReference);
  16930. }
  16931. public function setPerforce(Perforce $perforce): void
  16932. {
  16933. $this->perforce = $perforce;
  16934. }
  16935. protected function hasMetadataRepository(string $path): bool
  16936. {
  16937. return true;
  16938. }
  16939. }
  16940. <?php declare(strict_types=1);
  16941. namespace Composer\Downloader;
  16942. use React\Promise\PromiseInterface;
  16943. use Composer\Package\PackageInterface;
  16944. class PharDownloader extends ArchiveDownloader
  16945. {
  16946. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  16947. {
  16948. $archive = new \Phar($file);
  16949. $archive->extractTo($path, null, true);
  16950. return \React\Promise\resolve(null);
  16951. }
  16952. }
  16953. <?php declare(strict_types=1);
  16954. namespace Composer\Downloader;
  16955. use React\Promise\PromiseInterface;
  16956. use Composer\Util\IniHelper;
  16957. use Composer\Util\Platform;
  16958. use Composer\Util\ProcessExecutor;
  16959. use Composer\Package\PackageInterface;
  16960. use RarArchive;
  16961. class RarDownloader extends ArchiveDownloader
  16962. {
  16963. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  16964. {
  16965. $processError = null;
  16966. if (!Platform::isWindows()) {
  16967. $command = 'unrar x -- ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  16968. if (0 === $this->process->execute($command, $ignoredOutput)) {
  16969. return \React\Promise\resolve(null);
  16970. }
  16971. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  16972. }
  16973. if (!class_exists('RarArchive')) {
  16974. $iniMessage = IniHelper::getMessage();
  16975. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  16976. . $iniMessage . "\n" . $processError;
  16977. if (!Platform::isWindows()) {
  16978. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  16979. }
  16980. throw new \RuntimeException($error);
  16981. }
  16982. $rarArchive = RarArchive::open($file);
  16983. if (false === $rarArchive) {
  16984. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  16985. }
  16986. $entries = $rarArchive->getEntries();
  16987. if (false === $entries) {
  16988. throw new \RuntimeException('Could not retrieve RAR archive entries');
  16989. }
  16990. foreach ($entries as $entry) {
  16991. if (false === $entry->extract($path)) {
  16992. throw new \RuntimeException('Could not extract entry');
  16993. }
  16994. }
  16995. $rarArchive->close();
  16996. return \React\Promise\resolve(null);
  16997. }
  16998. }
  16999. <?php declare(strict_types=1);
  17000. namespace Composer\Downloader;
  17001. use Composer\Package\PackageInterface;
  17002. use Composer\Pcre\Preg;
  17003. use Composer\Util\Svn as SvnUtil;
  17004. use Composer\Repository\VcsRepository;
  17005. use Composer\Util\ProcessExecutor;
  17006. use React\Promise\PromiseInterface;
  17007. class SvnDownloader extends VcsDownloader
  17008. {
  17009. protected $cacheCredentials = true;
  17010. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  17011. {
  17012. SvnUtil::cleanEnv();
  17013. $util = new SvnUtil($url, $this->io, $this->config, $this->process);
  17014. if (null === $util->binaryVersion()) {
  17015. throw new \RuntimeException('svn was not found in your PATH, skipping source download');
  17016. }
  17017. return \React\Promise\resolve(null);
  17018. }
  17019. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  17020. {
  17021. SvnUtil::cleanEnv();
  17022. $ref = $package->getSourceReference();
  17023. $repo = $package->getRepository();
  17024. if ($repo instanceof VcsRepository) {
  17025. $repoConfig = $repo->getRepoConfig();
  17026. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  17027. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  17028. }
  17029. }
  17030. $this->io->writeError(" Checking out ".$package->getSourceReference());
  17031. $this->execute($package, $url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  17032. return \React\Promise\resolve(null);
  17033. }
  17034. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  17035. {
  17036. SvnUtil::cleanEnv();
  17037. $ref = $target->getSourceReference();
  17038. if (!$this->hasMetadataRepository($path)) {
  17039. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  17040. }
  17041. $util = new SvnUtil($url, $this->io, $this->config, $this->process);
  17042. $flags = "";
  17043. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  17044. $flags .= ' --ignore-ancestry';
  17045. }
  17046. $this->io->writeError(" Checking out " . $ref);
  17047. $this->execute($target, $url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  17048. return \React\Promise\resolve(null);
  17049. }
  17050. public function getLocalChanges(PackageInterface $package, string $path): ?string
  17051. {
  17052. if (!$this->hasMetadataRepository($path)) {
  17053. return null;
  17054. }
  17055. $this->process->execute('svn status --ignore-externals', $output, $path);
  17056. return Preg::isMatch('{^ *[^X ] +}m', $output) ? $output : null;
  17057. }
  17058. protected function execute(PackageInterface $package, string $baseUrl, string $command, string $url, ?string $cwd = null, ?string $path = null): string
  17059. {
  17060. $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
  17061. $util->setCacheCredentials($this->cacheCredentials);
  17062. try {
  17063. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  17064. } catch (\RuntimeException $e) {
  17065. throw new \RuntimeException(
  17066. $package->getPrettyName().' could not be downloaded, '.$e->getMessage()
  17067. );
  17068. }
  17069. }
  17070. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  17071. {
  17072. if (null === ($changes = $this->getLocalChanges($package, $path))) {
  17073. return \React\Promise\resolve(null);
  17074. }
  17075. if (!$this->io->isInteractive()) {
  17076. if (true === $this->config->get('discard-changes')) {
  17077. return $this->discardChanges($path);
  17078. }
  17079. return parent::cleanChanges($package, $path, $update);
  17080. }
  17081. $changes = array_map(static function ($elem): string {
  17082. return ' '.$elem;
  17083. }, Preg::split('{\s*\r?\n\s*}', $changes));
  17084. $countChanges = count($changes);
  17085. $this->io->writeError(sprintf(' <error>'.$package->getPrettyName().' has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  17086. $this->io->writeError(array_slice($changes, 0, 10));
  17087. if ($countChanges > 10) {
  17088. $remainingChanges = $countChanges - 10;
  17089. $this->io->writeError(
  17090. sprintf(
  17091. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  17092. $remainingChanges === 1 ? '' : 's'
  17093. )
  17094. );
  17095. }
  17096. while (true) {
  17097. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  17098. case 'y':
  17099. $this->discardChanges($path);
  17100. break 2;
  17101. case 'n':
  17102. throw new \RuntimeException('Update aborted');
  17103. case 'v':
  17104. $this->io->writeError($changes);
  17105. break;
  17106. case '?':
  17107. default:
  17108. $this->io->writeError([
  17109. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  17110. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  17111. ' v - view modified files',
  17112. ' ? - print help',
  17113. ]);
  17114. break;
  17115. }
  17116. }
  17117. return \React\Promise\resolve(null);
  17118. }
  17119. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  17120. {
  17121. if (Preg::isMatch('{@(\d+)$}', $fromReference) && Preg::isMatch('{@(\d+)$}', $toReference)) {
  17122. $command = sprintf('svn info --non-interactive --xml -- %s', ProcessExecutor::escape($path));
  17123. if (0 !== $this->process->execute($command, $output, $path)) {
  17124. throw new \RuntimeException(
  17125. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  17126. );
  17127. }
  17128. $urlPattern = '#<url>(.*)</url>#';
  17129. if (Preg::isMatchStrictGroups($urlPattern, $output, $matches)) {
  17130. $baseUrl = $matches[1];
  17131. } else {
  17132. throw new \RuntimeException(
  17133. 'Unable to determine svn url for path '. $path
  17134. );
  17135. }
  17136. $fromRevision = Preg::replace('{.*@(\d+)$}', '$1', $fromReference);
  17137. $toRevision = Preg::replace('{.*@(\d+)$}', '$1', $toReference);
  17138. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  17139. $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
  17140. $util->setCacheCredentials($this->cacheCredentials);
  17141. try {
  17142. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  17143. } catch (\RuntimeException $e) {
  17144. throw new \RuntimeException(
  17145. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  17146. );
  17147. }
  17148. }
  17149. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  17150. }
  17151. protected function discardChanges(string $path): PromiseInterface
  17152. {
  17153. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  17154. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  17155. }
  17156. return \React\Promise\resolve(null);
  17157. }
  17158. protected function hasMetadataRepository(string $path): bool
  17159. {
  17160. return is_dir($path.'/.svn');
  17161. }
  17162. }
  17163. <?php declare(strict_types=1);
  17164. namespace Composer\Downloader;
  17165. use Composer\Package\PackageInterface;
  17166. use React\Promise\PromiseInterface;
  17167. class TarDownloader extends ArchiveDownloader
  17168. {
  17169. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17170. {
  17171. $archive = new \PharData($file);
  17172. $archive->extractTo($path, null, true);
  17173. return \React\Promise\resolve(null);
  17174. }
  17175. }
  17176. <?php declare(strict_types=1);
  17177. namespace Composer\Downloader;
  17178. class TransportException extends \RuntimeException
  17179. {
  17180. protected $headers;
  17181. protected $response;
  17182. protected $statusCode;
  17183. protected $responseInfo = [];
  17184. public function setHeaders(array $headers): void
  17185. {
  17186. $this->headers = $headers;
  17187. }
  17188. public function getHeaders(): ?array
  17189. {
  17190. return $this->headers;
  17191. }
  17192. public function setResponse(?string $response): void
  17193. {
  17194. $this->response = $response;
  17195. }
  17196. public function getResponse(): ?string
  17197. {
  17198. return $this->response;
  17199. }
  17200. public function setStatusCode($statusCode): void
  17201. {
  17202. $this->statusCode = $statusCode;
  17203. }
  17204. public function getStatusCode(): ?int
  17205. {
  17206. return $this->statusCode;
  17207. }
  17208. public function getResponseInfo(): array
  17209. {
  17210. return $this->responseInfo;
  17211. }
  17212. public function setResponseInfo(array $responseInfo): void
  17213. {
  17214. $this->responseInfo = $responseInfo;
  17215. }
  17216. }
  17217. <?php declare(strict_types=1);
  17218. namespace Composer\Downloader;
  17219. use Composer\Package\PackageInterface;
  17220. interface VcsCapableDownloaderInterface
  17221. {
  17222. public function getVcsReference(PackageInterface $package, string $path): ?string;
  17223. }
  17224. <?php declare(strict_types=1);
  17225. namespace Composer\Downloader;
  17226. use Composer\Config;
  17227. use Composer\Package\Dumper\ArrayDumper;
  17228. use Composer\Package\PackageInterface;
  17229. use Composer\Package\Version\VersionGuesser;
  17230. use Composer\Package\Version\VersionParser;
  17231. use Composer\Util\ProcessExecutor;
  17232. use Composer\IO\IOInterface;
  17233. use Composer\Util\Filesystem;
  17234. use React\Promise\PromiseInterface;
  17235. use Composer\DependencyResolver\Operation\UpdateOperation;
  17236. use Composer\DependencyResolver\Operation\InstallOperation;
  17237. use Composer\DependencyResolver\Operation\UninstallOperation;
  17238. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  17239. {
  17240. protected $io;
  17241. protected $config;
  17242. protected $process;
  17243. protected $filesystem;
  17244. protected $hasCleanedChanges = [];
  17245. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?Filesystem $fs = null)
  17246. {
  17247. $this->io = $io;
  17248. $this->config = $config;
  17249. $this->process = $process ?? new ProcessExecutor($io);
  17250. $this->filesystem = $fs ?? new Filesystem($this->process);
  17251. }
  17252. public function getInstallationSource(): string
  17253. {
  17254. return 'source';
  17255. }
  17256. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  17257. {
  17258. if (!$package->getSourceReference()) {
  17259. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  17260. }
  17261. $urls = $this->prepareUrls($package->getSourceUrls());
  17262. while ($url = array_shift($urls)) {
  17263. try {
  17264. return $this->doDownload($package, $path, $url, $prevPackage);
  17265. } catch (\Exception $e) {
  17266. if ($e instanceof \PHPUnit\Framework\Exception) {
  17267. throw $e;
  17268. }
  17269. if ($this->io->isDebug()) {
  17270. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  17271. } elseif (count($urls)) {
  17272. $this->io->writeError(' Failed, trying the next URL');
  17273. }
  17274. if (!count($urls)) {
  17275. throw $e;
  17276. }
  17277. }
  17278. }
  17279. return \React\Promise\resolve(null);
  17280. }
  17281. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  17282. {
  17283. if ($type === 'update') {
  17284. $this->cleanChanges($prevPackage, $path, true);
  17285. $this->hasCleanedChanges[$prevPackage->getUniqueName()] = true;
  17286. } elseif ($type === 'install') {
  17287. $this->filesystem->emptyDirectory($path);
  17288. } elseif ($type === 'uninstall') {
  17289. $this->cleanChanges($package, $path, false);
  17290. }
  17291. return \React\Promise\resolve(null);
  17292. }
  17293. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  17294. {
  17295. if ($type === 'update' && isset($this->hasCleanedChanges[$prevPackage->getUniqueName()])) {
  17296. $this->reapplyChanges($path);
  17297. unset($this->hasCleanedChanges[$prevPackage->getUniqueName()]);
  17298. }
  17299. return \React\Promise\resolve(null);
  17300. }
  17301. public function install(PackageInterface $package, string $path): PromiseInterface
  17302. {
  17303. if (!$package->getSourceReference()) {
  17304. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  17305. }
  17306. $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
  17307. $urls = $this->prepareUrls($package->getSourceUrls());
  17308. while ($url = array_shift($urls)) {
  17309. try {
  17310. $this->doInstall($package, $path, $url);
  17311. break;
  17312. } catch (\Exception $e) {
  17313. if ($e instanceof \PHPUnit\Framework\Exception) {
  17314. throw $e;
  17315. }
  17316. if ($this->io->isDebug()) {
  17317. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  17318. } elseif (count($urls)) {
  17319. $this->io->writeError(' Failed, trying the next URL');
  17320. }
  17321. if (!count($urls)) {
  17322. throw $e;
  17323. }
  17324. }
  17325. }
  17326. return \React\Promise\resolve(null);
  17327. }
  17328. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
  17329. {
  17330. if (!$target->getSourceReference()) {
  17331. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  17332. }
  17333. $this->io->writeError(" - " . UpdateOperation::format($initial, $target).': ', false);
  17334. $urls = $this->prepareUrls($target->getSourceUrls());
  17335. $exception = null;
  17336. while ($url = array_shift($urls)) {
  17337. try {
  17338. $this->doUpdate($initial, $target, $path, $url);
  17339. $exception = null;
  17340. break;
  17341. } catch (\Exception $exception) {
  17342. if ($exception instanceof \PHPUnit\Framework\Exception) {
  17343. throw $exception;
  17344. }
  17345. if ($this->io->isDebug()) {
  17346. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  17347. } elseif (count($urls)) {
  17348. $this->io->writeError(' Failed, trying the next URL');
  17349. }
  17350. }
  17351. }
  17352. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  17353. $message = 'Pulling in changes:';
  17354. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  17355. if ('' === trim($logs)) {
  17356. $message = 'Rolling back changes:';
  17357. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  17358. }
  17359. if ('' !== trim($logs)) {
  17360. $logs = implode("\n", array_map(static function ($line): string {
  17361. return ' ' . $line;
  17362. }, explode("\n", $logs)));
  17363. $logs = str_replace('<', '\<', $logs);
  17364. $this->io->writeError(' '.$message);
  17365. $this->io->writeError($logs);
  17366. }
  17367. }
  17368. if (!$urls && $exception) {
  17369. throw $exception;
  17370. }
  17371. return \React\Promise\resolve(null);
  17372. }
  17373. public function remove(PackageInterface $package, string $path): PromiseInterface
  17374. {
  17375. $this->io->writeError(" - " . UninstallOperation::format($package));
  17376. $promise = $this->filesystem->removeDirectoryAsync($path);
  17377. return $promise->then(static function (bool $result) use ($path) {
  17378. if (!$result) {
  17379. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  17380. }
  17381. });
  17382. }
  17383. public function getVcsReference(PackageInterface $package, string $path): ?string
  17384. {
  17385. $parser = new VersionParser;
  17386. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  17387. $dumper = new ArrayDumper;
  17388. $packageConfig = $dumper->dump($package);
  17389. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  17390. return $packageVersion['commit'];
  17391. }
  17392. return null;
  17393. }
  17394. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  17395. {
  17396. if (null !== $this->getLocalChanges($package, $path)) {
  17397. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  17398. }
  17399. return \React\Promise\resolve(null);
  17400. }
  17401. protected function reapplyChanges(string $path): void
  17402. {
  17403. }
  17404. abstract protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface;
  17405. abstract protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface;
  17406. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface;
  17407. abstract protected function getCommitLogs(string $fromReference, string $toReference, string $path): string;
  17408. abstract protected function hasMetadataRepository(string $path): bool;
  17409. private function prepareUrls(array $urls): array
  17410. {
  17411. foreach ($urls as $index => $url) {
  17412. if (Filesystem::isLocalPath($url)) {
  17413. $fileProtocol = 'file://';
  17414. $isFileProtocol = false;
  17415. if (0 === strpos($url, $fileProtocol)) {
  17416. $url = substr($url, strlen($fileProtocol));
  17417. $isFileProtocol = true;
  17418. }
  17419. if (false !== strpos($url, '%')) {
  17420. $url = rawurldecode($url);
  17421. }
  17422. $urls[$index] = realpath($url);
  17423. if ($isFileProtocol) {
  17424. $urls[$index] = $fileProtocol . $urls[$index];
  17425. }
  17426. }
  17427. }
  17428. return $urls;
  17429. }
  17430. }
  17431. <?php declare(strict_types=1);
  17432. namespace Composer\Downloader;
  17433. use React\Promise\PromiseInterface;
  17434. use Composer\Package\PackageInterface;
  17435. use Composer\Util\ProcessExecutor;
  17436. class XzDownloader extends ArchiveDownloader
  17437. {
  17438. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17439. {
  17440. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  17441. if (0 === $this->process->execute($command, $ignoredOutput)) {
  17442. return \React\Promise\resolve(null);
  17443. }
  17444. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  17445. throw new \RuntimeException($processError);
  17446. }
  17447. }
  17448. <?php declare(strict_types=1);
  17449. namespace Composer\Downloader;
  17450. use Composer\Package\PackageInterface;
  17451. use Composer\Pcre\Preg;
  17452. use Composer\Util\IniHelper;
  17453. use Composer\Util\Platform;
  17454. use Composer\Util\ProcessExecutor;
  17455. use Symfony\Component\Process\ExecutableFinder;
  17456. use Symfony\Component\Process\Process;
  17457. use React\Promise\PromiseInterface;
  17458. use ZipArchive;
  17459. class ZipDownloader extends ArchiveDownloader
  17460. {
  17461. private static $unzipCommands;
  17462. private static $hasZipArchive;
  17463. private static $isWindows;
  17464. private $zipArchiveObject;
  17465. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  17466. {
  17467. if (null === self::$unzipCommands) {
  17468. self::$unzipCommands = [];
  17469. $finder = new ExecutableFinder;
  17470. if (Platform::isWindows() && ($cmd = $finder->find('7z', null, ['C:\Program Files\7-Zip']))) {
  17471. self::$unzipCommands[] = ['7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'];
  17472. }
  17473. if ($cmd = $finder->find('unzip')) {
  17474. self::$unzipCommands[] = ['unzip', ProcessExecutor::escape($cmd).' -qq %s -d %s'];
  17475. }
  17476. if (!Platform::isWindows() && ($cmd = $finder->find('7z'))) {
  17477. self::$unzipCommands[] = ['7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'];
  17478. }
  17479. if (!Platform::isWindows() && ($cmd = $finder->find('7zz'))) {
  17480. self::$unzipCommands[] = ['7zz', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'];
  17481. }
  17482. }
  17483. $procOpenMissing = false;
  17484. if (!function_exists('proc_open')) {
  17485. self::$unzipCommands = [];
  17486. $procOpenMissing = true;
  17487. }
  17488. if (null === self::$hasZipArchive) {
  17489. self::$hasZipArchive = class_exists('ZipArchive');
  17490. }
  17491. if (!self::$hasZipArchive && !self::$unzipCommands) {
  17492. $iniMessage = IniHelper::getMessage();
  17493. if ($procOpenMissing) {
  17494. $error = "The zip extension is missing and unzip/7z commands cannot be called as proc_open is disabled, skipping.\n" . $iniMessage;
  17495. } else {
  17496. $error = "The zip extension and unzip/7z commands are both missing, skipping.\n" . $iniMessage;
  17497. }
  17498. throw new \RuntimeException($error);
  17499. }
  17500. if (null === self::$isWindows) {
  17501. self::$isWindows = Platform::isWindows();
  17502. if (!self::$isWindows && !self::$unzipCommands) {
  17503. if ($procOpenMissing) {
  17504. $this->io->writeError("<warning>proc_open is disabled so 'unzip' and '7z' commands cannot be used, zip files are being unpacked using the PHP zip extension.</warning>");
  17505. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  17506. $this->io->writeError("<warning>Enabling proc_open and installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
  17507. } else {
  17508. $this->io->writeError("<warning>As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  17509. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  17510. $this->io->writeError("<warning>Installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
  17511. }
  17512. }
  17513. }
  17514. return parent::download($package, $path, $prevPackage, $output);
  17515. }
  17516. private function extractWithSystemUnzip(PackageInterface $package, string $file, string $path): PromiseInterface
  17517. {
  17518. static $warned7ZipLinux = false;
  17519. $isLastChance = !self::$hasZipArchive;
  17520. if (!self::$unzipCommands) {
  17521. return $this->extractWithZipArchive($package, $file, $path);
  17522. }
  17523. $commandSpec = reset(self::$unzipCommands);
  17524. $command = sprintf($commandSpec[1], ProcessExecutor::escape($file), ProcessExecutor::escape($path));
  17525. if (Platform::isWindows()) {
  17526. $command = sprintf($commandSpec[1], ProcessExecutor::escape(strtr($file, '/', '\\')), ProcessExecutor::escape(strtr($path, '/', '\\')));
  17527. }
  17528. $executable = $commandSpec[0];
  17529. if (!$warned7ZipLinux && !Platform::isWindows() && in_array($executable, ['7z', '7zz'], true)) {
  17530. $warned7ZipLinux = true;
  17531. if (0 === $this->process->execute($executable, $output)) {
  17532. if (Preg::isMatchStrictGroups('{^\s*7-Zip(?: \[64\])? ([0-9.]+)}', $output, $match) && version_compare($match[1], '21.01', '<')) {
  17533. $this->io->writeError(' <warning>Unzipping using '.$executable.' '.$match[1].' may result in incorrect file permissions. Install '.$executable.' 21.01+ or unzip to ensure you get correct permissions.</warning>');
  17534. }
  17535. }
  17536. }
  17537. $io = $this->io;
  17538. $tryFallback = function (\Throwable $processError) use ($isLastChance, $io, $file, $path, $package, $executable): \React\Promise\PromiseInterface {
  17539. if ($isLastChance) {
  17540. throw $processError;
  17541. }
  17542. if (!is_file($file)) {
  17543. $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
  17544. $io->writeError(' <warning>This most likely is due to a custom installer plugin not handling the returned Promise from the downloader</warning>');
  17545. $io->writeError(' <warning>See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix</warning>');
  17546. } else {
  17547. $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
  17548. $io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  17549. $io->writeError(' Unzip with '.$executable.' command failed, falling back to ZipArchive class');
  17550. if (Platform::getEnv('GITHUB_ACTIONS') !== false && Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') === false) {
  17551. $io->writeError(' <warning>Additional debug info, please report to https://github.com/composer/composer/issues/11148 if you see this:</warning>');
  17552. $io->writeError('File size: '.@filesize($file));
  17553. $io->writeError('File SHA1: '.hash_file('sha1', $file));
  17554. $io->writeError('First 100 bytes (hex): '.bin2hex(substr((string) file_get_contents($file), 0, 100)));
  17555. $io->writeError('Last 100 bytes (hex): '.bin2hex(substr((string) file_get_contents($file), -100)));
  17556. if (strlen((string) $package->getDistUrl()) > 0) {
  17557. $io->writeError('Origin URL: '.$this->processUrl($package, (string) $package->getDistUrl()));
  17558. $io->writeError('Response Headers: '.json_encode(FileDownloader::$responseHeaders[$package->getName()] ?? []));
  17559. }
  17560. }
  17561. }
  17562. return $this->extractWithZipArchive($package, $file, $path);
  17563. };
  17564. try {
  17565. $promise = $this->process->executeAsync($command);
  17566. return $promise->then(function (Process $process) use ($tryFallback, $command, $package, $file) {
  17567. if (!$process->isSuccessful()) {
  17568. if (isset($this->cleanupExecuted[$package->getName()])) {
  17569. throw new \RuntimeException('Failed to extract '.$package->getName().' as the installation was aborted by another package operation.');
  17570. }
  17571. $output = $process->getErrorOutput();
  17572. $output = str_replace(', '.$file.'.zip or '.$file.'.ZIP', '', $output);
  17573. return $tryFallback(new \RuntimeException('Failed to extract '.$package->getName().': ('.$process->getExitCode().') '.$command."\n\n".$output));
  17574. }
  17575. });
  17576. } catch (\Throwable $e) {
  17577. return $tryFallback($e);
  17578. }
  17579. }
  17580. private function extractWithZipArchive(PackageInterface $package, string $file, string $path): PromiseInterface
  17581. {
  17582. $processError = null;
  17583. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  17584. try {
  17585. if (!file_exists($file) || ($filesize = filesize($file)) === false || $filesize === 0) {
  17586. $retval = -1;
  17587. } else {
  17588. $retval = $zipArchive->open($file);
  17589. }
  17590. if (true === $retval) {
  17591. $extractResult = $zipArchive->extractTo($path);
  17592. if (true === $extractResult) {
  17593. $zipArchive->close();
  17594. return \React\Promise\resolve(null);
  17595. }
  17596. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  17597. } else {
  17598. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  17599. }
  17600. } catch (\ErrorException $e) {
  17601. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  17602. } catch (\Throwable $e) {
  17603. $processError = $e;
  17604. }
  17605. throw $processError;
  17606. }
  17607. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17608. {
  17609. return $this->extractWithSystemUnzip($package, $file, $path);
  17610. }
  17611. protected function getErrorMessage(int $retval, string $file): string
  17612. {
  17613. switch ($retval) {
  17614. case ZipArchive::ER_EXISTS:
  17615. return sprintf("File '%s' already exists.", $file);
  17616. case ZipArchive::ER_INCONS:
  17617. return sprintf("Zip archive '%s' is inconsistent.", $file);
  17618. case ZipArchive::ER_INVAL:
  17619. return sprintf("Invalid argument (%s)", $file);
  17620. case ZipArchive::ER_MEMORY:
  17621. return sprintf("Malloc failure (%s)", $file);
  17622. case ZipArchive::ER_NOENT:
  17623. return sprintf("No such zip file: '%s'", $file);
  17624. case ZipArchive::ER_NOZIP:
  17625. return sprintf("'%s' is not a zip archive.", $file);
  17626. case ZipArchive::ER_OPEN:
  17627. return sprintf("Can't open zip file: %s", $file);
  17628. case ZipArchive::ER_READ:
  17629. return sprintf("Zip read error (%s)", $file);
  17630. case ZipArchive::ER_SEEK:
  17631. return sprintf("Zip seek error (%s)", $file);
  17632. case -1:
  17633. return sprintf("'%s' is a corrupted zip archive (0 bytes), try again.", $file);
  17634. default:
  17635. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  17636. }
  17637. }
  17638. }
  17639. <?php declare(strict_types=1);
  17640. namespace Composer\EventDispatcher;
  17641. class Event
  17642. {
  17643. protected $name;
  17644. protected $args;
  17645. protected $flags;
  17646. private $propagationStopped = false;
  17647. public function __construct(string $name, array $args = [], array $flags = [])
  17648. {
  17649. $this->name = $name;
  17650. $this->args = $args;
  17651. $this->flags = $flags;
  17652. }
  17653. public function getName(): string
  17654. {
  17655. return $this->name;
  17656. }
  17657. public function getArguments(): array
  17658. {
  17659. return $this->args;
  17660. }
  17661. public function getFlags(): array
  17662. {
  17663. return $this->flags;
  17664. }
  17665. public function isPropagationStopped(): bool
  17666. {
  17667. return $this->propagationStopped;
  17668. }
  17669. public function stopPropagation(): void
  17670. {
  17671. $this->propagationStopped = true;
  17672. }
  17673. }
  17674. <?php declare(strict_types=1);
  17675. namespace Composer\EventDispatcher;
  17676. use Composer\DependencyResolver\Transaction;
  17677. use Composer\Installer\InstallerEvent;
  17678. use Composer\IO\BufferIO;
  17679. use Composer\IO\ConsoleIO;
  17680. use Composer\IO\IOInterface;
  17681. use Composer\Composer;
  17682. use Composer\PartialComposer;
  17683. use Composer\Pcre\Preg;
  17684. use Composer\Plugin\CommandEvent;
  17685. use Composer\Plugin\PreCommandRunEvent;
  17686. use Composer\Util\Platform;
  17687. use Composer\DependencyResolver\Operation\OperationInterface;
  17688. use Composer\Repository\RepositoryInterface;
  17689. use Composer\Script;
  17690. use Composer\Installer\PackageEvent;
  17691. use Composer\Installer\BinaryInstaller;
  17692. use Composer\Util\ProcessExecutor;
  17693. use Composer\Script\Event as ScriptEvent;
  17694. use Composer\Autoload\ClassLoader;
  17695. use Symfony\Component\Console\Application;
  17696. use Symfony\Component\Console\Command\Command;
  17697. use Symfony\Component\Console\Input\StringInput;
  17698. use Symfony\Component\Console\Output\ConsoleOutput;
  17699. use Symfony\Component\Process\PhpExecutableFinder;
  17700. use Symfony\Component\Process\ExecutableFinder;
  17701. class EventDispatcher
  17702. {
  17703. protected $composer;
  17704. protected $io;
  17705. protected $loader;
  17706. protected $process;
  17707. protected $listeners = [];
  17708. protected $runScripts = true;
  17709. private $eventStack;
  17710. public function __construct(PartialComposer $composer, IOInterface $io, ?ProcessExecutor $process = null)
  17711. {
  17712. $this->composer = $composer;
  17713. $this->io = $io;
  17714. $this->process = $process ?? new ProcessExecutor($io);
  17715. $this->eventStack = [];
  17716. }
  17717. public function setRunScripts(bool $runScripts = true): self
  17718. {
  17719. $this->runScripts = (bool) $runScripts;
  17720. return $this;
  17721. }
  17722. public function dispatch(?string $eventName, ?Event $event = null): int
  17723. {
  17724. if (null === $event) {
  17725. if (null === $eventName) {
  17726. throw new \InvalidArgumentException('If no $event is passed in to '.__METHOD__.' you have to pass in an $eventName, got null.');
  17727. }
  17728. $event = new Event($eventName);
  17729. }
  17730. return $this->doDispatch($event);
  17731. }
  17732. public function dispatchScript(string $eventName, bool $devMode = false, array $additionalArgs = [], array $flags = []): int
  17733. {
  17734. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  17735. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  17736. }
  17737. public function dispatchPackageEvent(string $eventName, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation): int
  17738. {
  17739. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  17740. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $localRepo, $operations, $operation));
  17741. }
  17742. public function dispatchInstallerEvent(string $eventName, bool $devMode, bool $executeOperations, Transaction $transaction): int
  17743. {
  17744. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  17745. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $executeOperations, $transaction));
  17746. }
  17747. protected function doDispatch(Event $event)
  17748. {
  17749. if (Platform::getEnv('COMPOSER_DEBUG_EVENTS')) {
  17750. $details = null;
  17751. if ($event instanceof PackageEvent) {
  17752. $details = (string) $event->getOperation();
  17753. } elseif ($event instanceof CommandEvent) {
  17754. $details = $event->getCommandName();
  17755. } elseif ($event instanceof PreCommandRunEvent) {
  17756. $details = $event->getCommand();
  17757. }
  17758. $this->io->writeError('Dispatching <info>'.$event->getName().'</info>'.($details ? ' ('.$details.')' : '').' event');
  17759. }
  17760. $listeners = $this->getListeners($event);
  17761. $this->pushEvent($event);
  17762. try {
  17763. $returnMax = 0;
  17764. foreach ($listeners as $callable) {
  17765. $return = 0;
  17766. $this->ensureBinDirIsInPath();
  17767. $formattedEventNameWithArgs = $event->getName() . ($event->getArguments() !== [] ? ' (' . implode(', ', $event->getArguments()) . ')' : '');
  17768. if (!is_string($callable)) {
  17769. if (!is_callable($callable)) {
  17770. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  17771. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  17772. }
  17773. if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {
  17774. $this->io->writeError(sprintf('> %s: %s', $formattedEventNameWithArgs, (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);
  17775. }
  17776. $return = false === $callable($event) ? 1 : 0;
  17777. } elseif ($this->isComposerScript($callable)) {
  17778. $this->io->writeError(sprintf('> %s: %s', $formattedEventNameWithArgs, $callable), true, IOInterface::VERBOSE);
  17779. $script = explode(' ', substr($callable, 1));
  17780. $scriptName = $script[0];
  17781. unset($script[0]);
  17782. $args = array_merge($script, $event->getArguments());
  17783. $flags = $event->getFlags();
  17784. if (isset($flags['script-alias-input'])) {
  17785. $argsString = implode(' ', array_map(static function ($arg) { return ProcessExecutor::escape($arg); }, $script));
  17786. $flags['script-alias-input'] = $argsString . ' ' . $flags['script-alias-input'];
  17787. unset($argsString);
  17788. }
  17789. if (strpos($callable, '@composer ') === 0) {
  17790. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . ' ' . implode(' ', $args);
  17791. if (0 !== ($exitCode = $this->executeTty($exec))) {
  17792. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  17793. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  17794. }
  17795. } else {
  17796. if (!$this->getListeners(new Event($scriptName))) {
  17797. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  17798. }
  17799. try {
  17800. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  17801. $scriptEvent->setOriginatingEvent($event);
  17802. $return = $this->dispatch($scriptName, $scriptEvent);
  17803. } catch (ScriptExecutionException $e) {
  17804. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  17805. throw $e;
  17806. }
  17807. }
  17808. } elseif ($this->isPhpScript($callable)) {
  17809. $className = substr($callable, 0, strpos($callable, '::'));
  17810. $methodName = substr($callable, strpos($callable, '::') + 2);
  17811. if (!class_exists($className)) {
  17812. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  17813. continue;
  17814. }
  17815. if (!is_callable($callable)) {
  17816. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  17817. continue;
  17818. }
  17819. try {
  17820. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  17821. } catch (\Exception $e) {
  17822. $message = "Script %s handling the %s event terminated with an exception";
  17823. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  17824. throw $e;
  17825. }
  17826. } elseif ($this->isCommandClass($callable)) {
  17827. $className = $callable;
  17828. if (!class_exists($className)) {
  17829. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  17830. continue;
  17831. }
  17832. if (!is_a($className, Command::class, true)) {
  17833. $this->io->writeError('<warning>Class '.$className.' does not extend '.Command::class.', can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  17834. continue;
  17835. }
  17836. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($event->getName())))) {
  17837. $this->io->writeError('<warning>You cannot bind '.$event->getName().' to a Command class, use a non-reserved name</warning>', true, IOInterface::QUIET);
  17838. continue;
  17839. }
  17840. $app = new Application();
  17841. $app->setCatchExceptions(false);
  17842. if (method_exists($app, 'setCatchErrors')) {
  17843. $app->setCatchErrors(false);
  17844. }
  17845. $app->setAutoExit(false);
  17846. $cmd = new $className($event->getName());
  17847. $app->add($cmd);
  17848. $app->setDefaultCommand((string) $cmd->getName(), true);
  17849. try {
  17850. $args = implode(' ', array_map(static function ($arg) { return ProcessExecutor::escape($arg); }, $event->getArguments()));
  17851. if ($this->io instanceof ConsoleIO) {
  17852. $reflProp = new \ReflectionProperty($this->io, 'output');
  17853. if (PHP_VERSION_ID < 80100) {
  17854. $reflProp->setAccessible(true);
  17855. }
  17856. $output = $reflProp->getValue($this->io);
  17857. } else {
  17858. $output = new ConsoleOutput();
  17859. }
  17860. $return = $app->run(new StringInput($event->getFlags()['script-alias-input'] ?? $args), $output);
  17861. } catch (\Exception $e) {
  17862. $message = "Script %s handling the %s event terminated with an exception";
  17863. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  17864. throw $e;
  17865. }
  17866. } else {
  17867. $args = implode(' ', array_map(['Composer\Util\ProcessExecutor', 'escape'], $event->getArguments()));
  17868. if (strpos($callable, '@putenv ') === 0) {
  17869. $exec = $callable;
  17870. } else {
  17871. $exec = $callable . ($args === '' ? '' : ' '.$args);
  17872. }
  17873. if ($this->io->isVerbose()) {
  17874. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  17875. } elseif ($event->getName() !== '__exec_command') {
  17876. $this->io->writeError(sprintf('> %s', $exec));
  17877. }
  17878. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  17879. if ($possibleLocalBinaries) {
  17880. foreach ($possibleLocalBinaries as $localExec) {
  17881. if (Preg::isMatch('{\b'.preg_quote($callable).'$}', $localExec)) {
  17882. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  17883. $exec = Preg::replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  17884. break;
  17885. }
  17886. }
  17887. }
  17888. if (strpos($exec, '@putenv ') === 0) {
  17889. if (false === strpos($exec, '=')) {
  17890. Platform::clearEnv(substr($exec, 8));
  17891. } else {
  17892. [$var, $value] = explode('=', substr($exec, 8), 2);
  17893. Platform::putEnv($var, $value);
  17894. }
  17895. continue;
  17896. }
  17897. if (strpos($exec, '@php ') === 0) {
  17898. $pathAndArgs = substr($exec, 5);
  17899. if (Platform::isWindows()) {
  17900. $pathAndArgs = Preg::replaceCallback('{^\S+}', static function ($path) {
  17901. return str_replace('/', '\\', (string) $path[0]);
  17902. }, $pathAndArgs);
  17903. }
  17904. $matched = Preg::isMatchStrictGroups('{^[^\'"\s/\\\\]+}', $pathAndArgs, $match);
  17905. if ($matched && !file_exists($match[0])) {
  17906. $finder = new ExecutableFinder;
  17907. if ($pathToExec = $finder->find($match[0])) {
  17908. if (Platform::isWindows()) {
  17909. $execWithoutExt = Preg::replace('{\.(exe|bat|cmd|com)$}i', '', $pathToExec);
  17910. if (file_exists($execWithoutExt)) {
  17911. $pathToExec = $execWithoutExt;
  17912. }
  17913. unset($execWithoutExt);
  17914. }
  17915. $pathAndArgs = $pathToExec . substr($pathAndArgs, strlen($match[0]));
  17916. }
  17917. }
  17918. $exec = $this->getPhpExecCommand() . ' ' . $pathAndArgs;
  17919. } else {
  17920. $finder = new PhpExecutableFinder();
  17921. $phpPath = $finder->find(false);
  17922. if ($phpPath) {
  17923. Platform::putEnv('PHP_BINARY', $phpPath);
  17924. }
  17925. if (Platform::isWindows()) {
  17926. $exec = Preg::replaceCallback('{^\S+}', static function ($path) {
  17927. assert(is_string($path[0]));
  17928. return str_replace('/', '\\', $path[0]);
  17929. }, $exec);
  17930. }
  17931. }
  17932. if (strpos($exec, 'composer ') === 0) {
  17933. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . substr($exec, 8);
  17934. }
  17935. if (0 !== ($exitCode = $this->executeTty($exec))) {
  17936. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  17937. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  17938. }
  17939. }
  17940. $returnMax = max($returnMax, $return);
  17941. if ($event->isPropagationStopped()) {
  17942. break;
  17943. }
  17944. }
  17945. } finally {
  17946. $this->popEvent();
  17947. }
  17948. return $returnMax;
  17949. }
  17950. protected function executeTty(string $exec): int
  17951. {
  17952. if ($this->io->isInteractive()) {
  17953. return $this->process->executeTty($exec);
  17954. }
  17955. return $this->process->execute($exec);
  17956. }
  17957. protected function getPhpExecCommand(): string
  17958. {
  17959. $finder = new PhpExecutableFinder();
  17960. $phpPath = $finder->find(false);
  17961. if (!$phpPath) {
  17962. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  17963. }
  17964. $phpArgs = $finder->findArguments();
  17965. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  17966. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  17967. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  17968. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  17969. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  17970. }
  17971. protected function executeEventPhpScript(string $className, string $methodName, Event $event)
  17972. {
  17973. if ($this->io->isVerbose()) {
  17974. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  17975. } else {
  17976. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  17977. }
  17978. return $className::$methodName($event);
  17979. }
  17980. public function addListener(string $eventName, $listener, int $priority = 0): void
  17981. {
  17982. $this->listeners[$eventName][$priority][] = $listener;
  17983. }
  17984. public function removeListener($listener): void
  17985. {
  17986. foreach ($this->listeners as $eventName => $priorities) {
  17987. foreach ($priorities as $priority => $listeners) {
  17988. foreach ($listeners as $index => $candidate) {
  17989. if ($listener === $candidate || (is_array($candidate) && is_object($listener) && $candidate[0] === $listener)) {
  17990. unset($this->listeners[$eventName][$priority][$index]);
  17991. }
  17992. }
  17993. }
  17994. }
  17995. }
  17996. public function addSubscriber(EventSubscriberInterface $subscriber): void
  17997. {
  17998. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  17999. if (is_string($params)) {
  18000. $this->addListener($eventName, [$subscriber, $params]);
  18001. } elseif (is_string($params[0])) {
  18002. $this->addListener($eventName, [$subscriber, $params[0]], $params[1] ?? 0);
  18003. } else {
  18004. foreach ($params as $listener) {
  18005. $this->addListener($eventName, [$subscriber, $listener[0]], $listener[1] ?? 0);
  18006. }
  18007. }
  18008. }
  18009. }
  18010. protected function getListeners(Event $event): array
  18011. {
  18012. $scriptListeners = $this->runScripts ? $this->getScriptListeners($event) : [];
  18013. if (!isset($this->listeners[$event->getName()][0])) {
  18014. $this->listeners[$event->getName()][0] = [];
  18015. }
  18016. krsort($this->listeners[$event->getName()]);
  18017. $listeners = $this->listeners;
  18018. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  18019. return array_merge(...$listeners[$event->getName()]);
  18020. }
  18021. public function hasEventListeners(Event $event): bool
  18022. {
  18023. $listeners = $this->getListeners($event);
  18024. return count($listeners) > 0;
  18025. }
  18026. protected function getScriptListeners(Event $event): array
  18027. {
  18028. $package = $this->composer->getPackage();
  18029. $scripts = $package->getScripts();
  18030. if (empty($scripts[$event->getName()])) {
  18031. return [];
  18032. }
  18033. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  18034. if ($this->loader) {
  18035. $this->loader->unregister();
  18036. }
  18037. $generator = $this->composer->getAutoloadGenerator();
  18038. if ($event instanceof ScriptEvent) {
  18039. $generator->setDevMode($event->isDevMode());
  18040. }
  18041. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  18042. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  18043. $map = $generator->parseAutoloads($packageMap, $package);
  18044. $this->loader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
  18045. $this->loader->register(false);
  18046. return $scripts[$event->getName()];
  18047. }
  18048. protected function isPhpScript(string $callable): bool
  18049. {
  18050. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  18051. }
  18052. protected function isCommandClass(string $callable): bool
  18053. {
  18054. return str_contains($callable, '\\') && !str_contains($callable, ' ') && str_ends_with($callable, 'Command');
  18055. }
  18056. protected function isComposerScript(string $callable): bool
  18057. {
  18058. return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
  18059. }
  18060. protected function pushEvent(Event $event): int
  18061. {
  18062. $eventName = $event->getName();
  18063. if (in_array($eventName, $this->eventStack)) {
  18064. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  18065. }
  18066. return array_push($this->eventStack, $eventName);
  18067. }
  18068. protected function popEvent(): ?string
  18069. {
  18070. return array_pop($this->eventStack);
  18071. }
  18072. private function ensureBinDirIsInPath(): void
  18073. {
  18074. $pathEnv = 'PATH';
  18075. if (!isset($_SERVER[$pathEnv]) && isset($_SERVER['Path'])) {
  18076. $pathEnv = 'Path';
  18077. }
  18078. $binDir = $this->composer->getConfig()->get('bin-dir');
  18079. if (is_dir($binDir)) {
  18080. $binDir = realpath($binDir);
  18081. $pathValue = (string) Platform::getEnv($pathEnv);
  18082. if (!Preg::isMatch('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $pathValue)) {
  18083. Platform::putEnv($pathEnv, $binDir.PATH_SEPARATOR.$pathValue);
  18084. }
  18085. }
  18086. }
  18087. }
  18088. <?php declare(strict_types=1);
  18089. namespace Composer\EventDispatcher;
  18090. interface EventSubscriberInterface
  18091. {
  18092. public static function getSubscribedEvents();
  18093. }
  18094. <?php declare(strict_types=1);
  18095. namespace Composer\EventDispatcher;
  18096. class ScriptExecutionException extends \RuntimeException
  18097. {
  18098. }
  18099. <?php declare(strict_types=1);
  18100. namespace Composer\Exception;
  18101. class IrrecoverableDownloadException extends \RuntimeException
  18102. {
  18103. }
  18104. <?php declare(strict_types=1);
  18105. namespace Composer\Exception;
  18106. class NoSslException extends \RuntimeException
  18107. {
  18108. }
  18109. <?php declare(strict_types=1);
  18110. namespace Composer;
  18111. use Composer\Config\JsonConfigSource;
  18112. use Composer\Json\JsonFile;
  18113. use Composer\IO\IOInterface;
  18114. use Composer\Package\Archiver;
  18115. use Composer\Package\Version\VersionGuesser;
  18116. use Composer\Package\RootPackageInterface;
  18117. use Composer\Repository\FilesystemRepository;
  18118. use Composer\Repository\RepositoryManager;
  18119. use Composer\Repository\RepositoryFactory;
  18120. use Composer\Util\Filesystem;
  18121. use Composer\Util\Platform;
  18122. use Composer\Util\ProcessExecutor;
  18123. use Composer\Util\HttpDownloader;
  18124. use Composer\Util\Loop;
  18125. use Composer\Util\Silencer;
  18126. use Composer\Plugin\PluginEvents;
  18127. use Composer\EventDispatcher\Event;
  18128. use Phar;
  18129. use Symfony\Component\Console\Formatter\OutputFormatter;
  18130. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  18131. use Symfony\Component\Console\Output\ConsoleOutput;
  18132. use Composer\EventDispatcher\EventDispatcher;
  18133. use Composer\Autoload\AutoloadGenerator;
  18134. use Composer\Package\Version\VersionParser;
  18135. use Composer\Downloader\TransportException;
  18136. use Composer\Json\JsonValidationException;
  18137. use Composer\Repository\InstalledRepositoryInterface;
  18138. use UnexpectedValueException;
  18139. use ZipArchive;
  18140. class Factory
  18141. {
  18142. protected static function getHomeDir(): string
  18143. {
  18144. $home = Platform::getEnv('COMPOSER_HOME');
  18145. if ($home) {
  18146. return $home;
  18147. }
  18148. if (Platform::isWindows()) {
  18149. if (!Platform::getEnv('APPDATA')) {
  18150. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  18151. }
  18152. return rtrim(strtr(Platform::getEnv('APPDATA'), '\\', '/'), '/') . '/Composer';
  18153. }
  18154. $userDir = self::getUserDir();
  18155. $dirs = [];
  18156. if (self::useXdg()) {
  18157. $xdgConfig = Platform::getEnv('XDG_CONFIG_HOME');
  18158. if (!$xdgConfig) {
  18159. $xdgConfig = $userDir . '/.config';
  18160. }
  18161. $dirs[] = $xdgConfig . '/composer';
  18162. }
  18163. $dirs[] = $userDir . '/.composer';
  18164. foreach ($dirs as $dir) {
  18165. if (Silencer::call('is_dir', $dir)) {
  18166. return $dir;
  18167. }
  18168. }
  18169. return $dirs[0];
  18170. }
  18171. protected static function getCacheDir(string $home): string
  18172. {
  18173. $cacheDir = Platform::getEnv('COMPOSER_CACHE_DIR');
  18174. if ($cacheDir) {
  18175. return $cacheDir;
  18176. }
  18177. $homeEnv = Platform::getEnv('COMPOSER_HOME');
  18178. if ($homeEnv) {
  18179. return $homeEnv . '/cache';
  18180. }
  18181. if (Platform::isWindows()) {
  18182. if ($cacheDir = Platform::getEnv('LOCALAPPDATA')) {
  18183. $cacheDir .= '/Composer';
  18184. } else {
  18185. $cacheDir = $home . '/cache';
  18186. }
  18187. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  18188. }
  18189. $userDir = self::getUserDir();
  18190. if (PHP_OS === 'Darwin') {
  18191. if (is_dir($home . '/cache') && !is_dir($userDir . '/Library/Caches/composer')) {
  18192. Silencer::call('rename', $home . '/cache', $userDir . '/Library/Caches/composer');
  18193. }
  18194. return $userDir . '/Library/Caches/composer';
  18195. }
  18196. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  18197. return $home . '/cache';
  18198. }
  18199. if (self::useXdg()) {
  18200. $xdgCache = Platform::getEnv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  18201. return $xdgCache . '/composer';
  18202. }
  18203. return $home . '/cache';
  18204. }
  18205. protected static function getDataDir(string $home): string
  18206. {
  18207. $homeEnv = Platform::getEnv('COMPOSER_HOME');
  18208. if ($homeEnv) {
  18209. return $homeEnv;
  18210. }
  18211. if (Platform::isWindows()) {
  18212. return strtr($home, '\\', '/');
  18213. }
  18214. $userDir = self::getUserDir();
  18215. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  18216. $xdgData = Platform::getEnv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  18217. return $xdgData . '/composer';
  18218. }
  18219. return $home;
  18220. }
  18221. public static function createConfig(?IOInterface $io = null, ?string $cwd = null): Config
  18222. {
  18223. $cwd = $cwd ?? Platform::getCwd(true);
  18224. $config = new Config(true, $cwd);
  18225. $home = self::getHomeDir();
  18226. $config->merge([
  18227. 'config' => [
  18228. 'home' => $home,
  18229. 'cache-dir' => self::getCacheDir($home),
  18230. 'data-dir' => self::getDataDir($home),
  18231. ],
  18232. ], Config::SOURCE_DEFAULT);
  18233. $file = new JsonFile($config->get('home').'/config.json');
  18234. if ($file->exists()) {
  18235. if ($io instanceof IOInterface) {
  18236. $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
  18237. }
  18238. self::validateJsonSchema($io, $file);
  18239. $config->merge($file->read(), $file->getPath());
  18240. }
  18241. $config->setConfigSource(new JsonConfigSource($file));
  18242. $htaccessProtect = $config->get('htaccess-protect');
  18243. if ($htaccessProtect) {
  18244. $dirs = [$config->get('home'), $config->get('cache-dir'), $config->get('data-dir')];
  18245. foreach ($dirs as $dir) {
  18246. if (!file_exists($dir . '/.htaccess')) {
  18247. if (!is_dir($dir)) {
  18248. Silencer::call('mkdir', $dir, 0777, true);
  18249. }
  18250. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  18251. }
  18252. }
  18253. }
  18254. $file = new JsonFile($config->get('home').'/auth.json');
  18255. if ($file->exists()) {
  18256. if ($io instanceof IOInterface) {
  18257. $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
  18258. }
  18259. self::validateJsonSchema($io, $file, JsonFile::AUTH_SCHEMA);
  18260. $config->merge(['config' => $file->read()], $file->getPath());
  18261. }
  18262. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  18263. if ($composerAuthEnv = Platform::getEnv('COMPOSER_AUTH')) {
  18264. $authData = json_decode($composerAuthEnv);
  18265. if (null === $authData) {
  18266. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  18267. } else {
  18268. if ($io instanceof IOInterface) {
  18269. $io->writeError('Loading auth config from COMPOSER_AUTH', true, IOInterface::DEBUG);
  18270. }
  18271. self::validateJsonSchema($io, $authData, JsonFile::AUTH_SCHEMA, 'COMPOSER_AUTH');
  18272. $authData = json_decode($composerAuthEnv, true);
  18273. if (null !== $authData) {
  18274. $config->merge(['config' => $authData], 'COMPOSER_AUTH');
  18275. }
  18276. }
  18277. }
  18278. return $config;
  18279. }
  18280. public static function getComposerFile(): string
  18281. {
  18282. return trim((string) Platform::getEnv('COMPOSER')) ?: './composer.json';
  18283. }
  18284. public static function getLockFile(string $composerFile): string
  18285. {
  18286. return "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  18287. ? substr($composerFile, 0, -4).'lock'
  18288. : $composerFile . '.lock';
  18289. }
  18290. public static function createAdditionalStyles(): array
  18291. {
  18292. return [
  18293. 'highlight' => new OutputFormatterStyle('red'),
  18294. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  18295. ];
  18296. }
  18297. public static function createOutput(): ConsoleOutput
  18298. {
  18299. $styles = self::createAdditionalStyles();
  18300. $formatter = new OutputFormatter(false, $styles);
  18301. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  18302. }
  18303. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
  18304. {
  18305. if (is_string($localConfig) && is_file($localConfig) && null === $cwd) {
  18306. $cwd = dirname($localConfig);
  18307. }
  18308. $cwd = $cwd ?? Platform::getCwd(true);
  18309. if (null === $localConfig) {
  18310. $localConfig = static::getComposerFile();
  18311. }
  18312. $localConfigSource = Config::SOURCE_UNKNOWN;
  18313. if (is_string($localConfig)) {
  18314. $composerFile = $localConfig;
  18315. $file = new JsonFile($localConfig, null, $io);
  18316. if (!$file->exists()) {
  18317. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  18318. $message = 'Composer could not find a composer.json file in '.$cwd;
  18319. } else {
  18320. $message = 'Composer could not find the config file: '.$localConfig;
  18321. }
  18322. $instructions = $fullLoad ? 'To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage' : '';
  18323. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  18324. }
  18325. if (!Platform::isInputCompletionProcess()) {
  18326. try {
  18327. $file->validateSchema(JsonFile::LAX_SCHEMA);
  18328. } catch (JsonValidationException $e) {
  18329. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  18330. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  18331. throw new JsonValidationException($message);
  18332. }
  18333. }
  18334. $localConfig = $file->read();
  18335. $localConfigSource = $file->getPath();
  18336. }
  18337. $config = static::createConfig($io, $cwd);
  18338. $config->merge($localConfig, $localConfigSource);
  18339. if (isset($composerFile)) {
  18340. $io->writeError('Loading config file ' . $composerFile .' ('.realpath($composerFile).')', true, IOInterface::DEBUG);
  18341. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  18342. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  18343. if ($localAuthFile->exists()) {
  18344. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  18345. self::validateJsonSchema($io, $localAuthFile, JsonFile::AUTH_SCHEMA);
  18346. $config->merge(['config' => $localAuthFile->read()], $localAuthFile->getPath());
  18347. $config->setLocalAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  18348. }
  18349. }
  18350. $vendorDir = $config->get('vendor-dir');
  18351. $composer = $fullLoad ? new Composer() : new PartialComposer();
  18352. $composer->setConfig($config);
  18353. if ($fullLoad) {
  18354. $io->loadConfiguration($config);
  18355. if (false === $disablePlugins && false === $disableScripts && !class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/installed.php')) {
  18356. if (class_exists('Composer\InstalledVersions')) {
  18357. FilesystemRepository::safelyLoadInstalledVersions($installedVersionsPath);
  18358. }
  18359. }
  18360. }
  18361. $httpDownloader = self::createHttpDownloader($io, $config);
  18362. $process = new ProcessExecutor($io);
  18363. $loop = new Loop($httpDownloader, $process);
  18364. $composer->setLoop($loop);
  18365. $dispatcher = new EventDispatcher($composer, $io, $process);
  18366. $dispatcher->setRunScripts(!$disableScripts);
  18367. $composer->setEventDispatcher($dispatcher);
  18368. $rm = RepositoryFactory::manager($io, $config, $httpDownloader, $dispatcher, $process);
  18369. $composer->setRepositoryManager($rm);
  18370. if (!$fullLoad && !isset($localConfig['version'])) {
  18371. $localConfig['version'] = '1.0.0';
  18372. }
  18373. $parser = new VersionParser;
  18374. $guesser = new VersionGuesser($config, $process, $parser);
  18375. $loader = $this->loadRootPackage($rm, $config, $parser, $guesser, $io);
  18376. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  18377. $composer->setPackage($package);
  18378. $this->addLocalRepository($io, $rm, $vendorDir, $package, $process);
  18379. $im = $this->createInstallationManager($loop, $io, $dispatcher);
  18380. $composer->setInstallationManager($im);
  18381. if ($composer instanceof Composer) {
  18382. $dm = $this->createDownloadManager($io, $config, $httpDownloader, $process, $dispatcher);
  18383. $composer->setDownloadManager($dm);
  18384. $generator = new AutoloadGenerator($dispatcher, $io);
  18385. $composer->setAutoloadGenerator($generator);
  18386. $am = $this->createArchiveManager($config, $dm, $loop);
  18387. $composer->setArchiveManager($am);
  18388. }
  18389. $this->createDefaultInstallers($im, $composer, $io, $process);
  18390. if ($composer instanceof Composer && isset($composerFile)) {
  18391. $lockFile = self::getLockFile($composerFile);
  18392. if (!$config->get('lock') && file_exists($lockFile)) {
  18393. $io->writeError('<warning>'.$lockFile.' is present but ignored as the "lock" config option is disabled.</warning>');
  18394. }
  18395. $locker = new Package\Locker($io, new JsonFile($config->get('lock') ? $lockFile : Platform::getDevNull(), null, $io), $im, file_get_contents($composerFile), $process);
  18396. $composer->setLocker($locker);
  18397. } elseif ($composer instanceof Composer) {
  18398. $locker = new Package\Locker($io, new JsonFile(Platform::getDevNull(), null, $io), $im, JsonFile::encode($localConfig), $process);
  18399. $composer->setLocker($locker);
  18400. }
  18401. if ($composer instanceof Composer) {
  18402. $globalComposer = null;
  18403. if (realpath($config->get('home')) !== $cwd) {
  18404. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins, $disableScripts);
  18405. }
  18406. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  18407. $composer->setPluginManager($pm);
  18408. if (realpath($config->get('home')) === $cwd) {
  18409. $pm->setRunningInGlobalDir(true);
  18410. }
  18411. $pm->loadInstalledPlugins();
  18412. }
  18413. if ($fullLoad) {
  18414. $initEvent = new Event(PluginEvents::INIT);
  18415. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  18416. $this->purgePackages($rm->getLocalRepository(), $im);
  18417. }
  18418. return $composer;
  18419. }
  18420. public static function createGlobal(IOInterface $io, bool $disablePlugins = false, bool $disableScripts = false): ?Composer
  18421. {
  18422. $factory = new static();
  18423. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
  18424. }
  18425. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, string $vendorDir, RootPackageInterface $rootPackage, ?ProcessExecutor $process = null): void
  18426. {
  18427. $fs = null;
  18428. if ($process) {
  18429. $fs = new Filesystem($process);
  18430. }
  18431. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io), true, $rootPackage, $fs));
  18432. }
  18433. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, bool $disableScripts, bool $fullLoad = false): ?PartialComposer
  18434. {
  18435. $disablePlugins = $disablePlugins === 'global' || $disablePlugins === true;
  18436. $composer = null;
  18437. try {
  18438. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad, $disableScripts);
  18439. } catch (\Exception $e) {
  18440. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  18441. }
  18442. return $composer;
  18443. }
  18444. public function createDownloadManager(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process, ?EventDispatcher $eventDispatcher = null): Downloader\DownloadManager
  18445. {
  18446. $cache = null;
  18447. if ($config->get('cache-files-ttl') > 0) {
  18448. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  18449. $cache->setReadOnly($config->get('cache-read-only'));
  18450. }
  18451. $fs = new Filesystem($process);
  18452. $dm = new Downloader\DownloadManager($io, false, $fs);
  18453. switch ($preferred = $config->get('preferred-install')) {
  18454. case 'dist':
  18455. $dm->setPreferDist(true);
  18456. break;
  18457. case 'source':
  18458. $dm->setPreferSource(true);
  18459. break;
  18460. case 'auto':
  18461. default:
  18462. break;
  18463. }
  18464. if (is_array($preferred)) {
  18465. $dm->setPreferences($preferred);
  18466. }
  18467. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $process, $fs));
  18468. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $process, $fs));
  18469. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $process, $fs));
  18470. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $process, $fs));
  18471. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config, $process, $fs));
  18472. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18473. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18474. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18475. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18476. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18477. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18478. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18479. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  18480. return $dm;
  18481. }
  18482. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm, Loop $loop)
  18483. {
  18484. $am = new Archiver\ArchiveManager($dm, $loop);
  18485. if (class_exists(ZipArchive::class)) {
  18486. $am->addArchiver(new Archiver\ZipArchiver);
  18487. }
  18488. if (class_exists(Phar::class)) {
  18489. $am->addArchiver(new Archiver\PharArchiver);
  18490. }
  18491. return $am;
  18492. }
  18493. protected function createPluginManager(IOInterface $io, Composer $composer, ?PartialComposer $globalComposer = null, $disablePlugins = false): Plugin\PluginManager
  18494. {
  18495. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  18496. }
  18497. public function createInstallationManager(Loop $loop, IOInterface $io, ?EventDispatcher $eventDispatcher = null): Installer\InstallationManager
  18498. {
  18499. return new Installer\InstallationManager($loop, $io, $eventDispatcher);
  18500. }
  18501. protected function createDefaultInstallers(Installer\InstallationManager $im, PartialComposer $composer, IOInterface $io, ?ProcessExecutor $process = null): void
  18502. {
  18503. $fs = new Filesystem($process);
  18504. $binaryInstaller = new Installer\BinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $fs, rtrim($composer->getConfig()->get('vendor-dir'), '/'));
  18505. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null, $fs, $binaryInstaller));
  18506. $im->addInstaller(new Installer\PluginInstaller($io, $composer, $fs, $binaryInstaller));
  18507. $im->addInstaller(new Installer\MetapackageInstaller($io));
  18508. }
  18509. protected function purgePackages(InstalledRepositoryInterface $repo, Installer\InstallationManager $im): void
  18510. {
  18511. foreach ($repo->getPackages() as $package) {
  18512. if (!$im->isPackageInstalled($repo, $package)) {
  18513. $repo->removePackage($package);
  18514. }
  18515. }
  18516. }
  18517. protected function loadRootPackage(RepositoryManager $rm, Config $config, VersionParser $parser, VersionGuesser $guesser, IOInterface $io): Package\Loader\RootPackageLoader
  18518. {
  18519. return new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  18520. }
  18521. public static function create(IOInterface $io, $config = null, $disablePlugins = false, bool $disableScripts = false): Composer
  18522. {
  18523. $factory = new static();
  18524. if ($config !== null && $config !== self::getComposerFile() && $disablePlugins === false) {
  18525. $disablePlugins = 'local';
  18526. }
  18527. return $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
  18528. }
  18529. public static function createHttpDownloader(IOInterface $io, Config $config, array $options = []): HttpDownloader
  18530. {
  18531. static $warned = false;
  18532. $disableTls = false;
  18533. if (isset($_SERVER['argv']) && in_array('disable-tls', $_SERVER['argv']) && (in_array('conf', $_SERVER['argv']) || in_array('config', $_SERVER['argv']))) {
  18534. $warned = true;
  18535. $disableTls = !extension_loaded('openssl');
  18536. } elseif ($config->get('disable-tls') === true) {
  18537. if (!$warned) {
  18538. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  18539. }
  18540. $warned = true;
  18541. $disableTls = true;
  18542. } elseif (!extension_loaded('openssl')) {
  18543. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  18544. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  18545. }
  18546. $httpDownloaderOptions = [];
  18547. if ($disableTls === false) {
  18548. if ('' !== $config->get('cafile')) {
  18549. $httpDownloaderOptions['ssl']['cafile'] = $config->get('cafile');
  18550. }
  18551. if ('' !== $config->get('capath')) {
  18552. $httpDownloaderOptions['ssl']['capath'] = $config->get('capath');
  18553. }
  18554. $httpDownloaderOptions = array_replace_recursive($httpDownloaderOptions, $options);
  18555. }
  18556. try {
  18557. $httpDownloader = new HttpDownloader($io, $config, $httpDownloaderOptions, $disableTls);
  18558. } catch (TransportException $e) {
  18559. if (false !== strpos($e->getMessage(), 'cafile')) {
  18560. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  18561. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  18562. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  18563. }
  18564. throw $e;
  18565. }
  18566. return $httpDownloader;
  18567. }
  18568. private static function useXdg(): bool
  18569. {
  18570. foreach (array_keys($_SERVER) as $key) {
  18571. if (strpos($key, 'XDG_') === 0) {
  18572. return true;
  18573. }
  18574. }
  18575. if (Silencer::call('is_dir', '/etc/xdg')) {
  18576. return true;
  18577. }
  18578. return false;
  18579. }
  18580. private static function getUserDir(): string
  18581. {
  18582. $home = Platform::getEnv('HOME');
  18583. if (!$home) {
  18584. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  18585. }
  18586. return rtrim(strtr($home, '\\', '/'), '/');
  18587. }
  18588. private static function validateJsonSchema(?IOInterface $io, $fileOrData, int $schema = JsonFile::LAX_SCHEMA, ?string $source = null): void
  18589. {
  18590. if (Platform::isInputCompletionProcess()) {
  18591. return;
  18592. }
  18593. try {
  18594. if ($fileOrData instanceof JsonFile) {
  18595. $fileOrData->validateSchema($schema);
  18596. } else {
  18597. if (null === $source) {
  18598. throw new \InvalidArgumentException('$source is required to be provided if $fileOrData is arbitrary data');
  18599. }
  18600. JsonFile::validateJsonSchema($source, $fileOrData, $schema);
  18601. }
  18602. } catch (JsonValidationException $e) {
  18603. $msg = $e->getMessage().', this may result in errors and should be resolved:'.PHP_EOL.' - '.implode(PHP_EOL.' - ', $e->getErrors());
  18604. if ($io instanceof IOInterface) {
  18605. $io->writeError('<warning>'.$msg.'</>');
  18606. } else {
  18607. throw new UnexpectedValueException($msg);
  18608. }
  18609. }
  18610. }
  18611. }
  18612. <?php declare(strict_types=1);
  18613. namespace Composer\Filter\PlatformRequirementFilter;
  18614. use Composer\Repository\PlatformRepository;
  18615. final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFilterInterface
  18616. {
  18617. public function isIgnored(string $req): bool
  18618. {
  18619. return PlatformRepository::isPlatformPackage($req);
  18620. }
  18621. public function isUpperBoundIgnored(string $req): bool
  18622. {
  18623. return $this->isIgnored($req);
  18624. }
  18625. }
  18626. <?php declare(strict_types=1);
  18627. namespace Composer\Filter\PlatformRequirementFilter;
  18628. use Composer\Package\BasePackage;
  18629. use Composer\Pcre\Preg;
  18630. use Composer\Repository\PlatformRepository;
  18631. use Composer\Semver\Constraint\Constraint;
  18632. use Composer\Semver\Constraint\ConstraintInterface;
  18633. use Composer\Semver\Constraint\MatchAllConstraint;
  18634. use Composer\Semver\Constraint\MultiConstraint;
  18635. use Composer\Semver\Interval;
  18636. use Composer\Semver\Intervals;
  18637. final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface
  18638. {
  18639. private $ignoreRegex;
  18640. private $ignoreUpperBoundRegex;
  18641. public function __construct(array $reqList)
  18642. {
  18643. $ignoreAll = $ignoreUpperBound = [];
  18644. foreach ($reqList as $req) {
  18645. if (substr($req, -1) === '+') {
  18646. $ignoreUpperBound[] = substr($req, 0, -1);
  18647. } else {
  18648. $ignoreAll[] = $req;
  18649. }
  18650. }
  18651. $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll);
  18652. $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound);
  18653. }
  18654. public function isIgnored(string $req): bool
  18655. {
  18656. if (!PlatformRepository::isPlatformPackage($req)) {
  18657. return false;
  18658. }
  18659. return Preg::isMatch($this->ignoreRegex, $req);
  18660. }
  18661. public function isUpperBoundIgnored(string $req): bool
  18662. {
  18663. if (!PlatformRepository::isPlatformPackage($req)) {
  18664. return false;
  18665. }
  18666. return $this->isIgnored($req) || Preg::isMatch($this->ignoreUpperBoundRegex, $req);
  18667. }
  18668. public function filterConstraint(string $req, ConstraintInterface $constraint, bool $allowUpperBoundOverride = true): ConstraintInterface
  18669. {
  18670. if (!PlatformRepository::isPlatformPackage($req)) {
  18671. return $constraint;
  18672. }
  18673. if (!$allowUpperBoundOverride || !Preg::isMatch($this->ignoreUpperBoundRegex, $req)) {
  18674. return $constraint;
  18675. }
  18676. if (Preg::isMatch($this->ignoreRegex, $req)) {
  18677. return new MatchAllConstraint;
  18678. }
  18679. $intervals = Intervals::get($constraint);
  18680. $last = end($intervals['numeric']);
  18681. if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) {
  18682. $constraint = new MultiConstraint([$constraint, new Constraint('>=', $last->getEnd()->getVersion())], false);
  18683. }
  18684. return $constraint;
  18685. }
  18686. }
  18687. <?php declare(strict_types=1);
  18688. namespace Composer\Filter\PlatformRequirementFilter;
  18689. final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface
  18690. {
  18691. public function isIgnored(string $req): bool
  18692. {
  18693. return false;
  18694. }
  18695. public function isUpperBoundIgnored(string $req): bool
  18696. {
  18697. return false;
  18698. }
  18699. }
  18700. <?php declare(strict_types=1);
  18701. namespace Composer\Filter\PlatformRequirementFilter;
  18702. final class PlatformRequirementFilterFactory
  18703. {
  18704. public static function fromBoolOrList($boolOrList): PlatformRequirementFilterInterface
  18705. {
  18706. if (is_bool($boolOrList)) {
  18707. return $boolOrList ? self::ignoreAll() : self::ignoreNothing();
  18708. }
  18709. if (is_array($boolOrList)) {
  18710. return new IgnoreListPlatformRequirementFilter($boolOrList);
  18711. }
  18712. throw new \InvalidArgumentException(
  18713. sprintf(
  18714. 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.',
  18715. gettype($boolOrList)
  18716. )
  18717. );
  18718. }
  18719. public static function ignoreAll(): PlatformRequirementFilterInterface
  18720. {
  18721. return new IgnoreAllPlatformRequirementFilter();
  18722. }
  18723. public static function ignoreNothing(): PlatformRequirementFilterInterface
  18724. {
  18725. return new IgnoreNothingPlatformRequirementFilter();
  18726. }
  18727. }
  18728. <?php declare(strict_types=1);
  18729. namespace Composer\Filter\PlatformRequirementFilter;
  18730. interface PlatformRequirementFilterInterface
  18731. {
  18732. public function isIgnored(string $req): bool;
  18733. public function isUpperBoundIgnored(string $req): bool;
  18734. }
  18735. <?php declare(strict_types=1);
  18736. namespace Composer\IO;
  18737. use Composer\Config;
  18738. use Composer\Pcre\Preg;
  18739. use Composer\Util\ProcessExecutor;
  18740. use Psr\Log\LogLevel;
  18741. abstract class BaseIO implements IOInterface
  18742. {
  18743. protected $authentications = [];
  18744. public function getAuthentications()
  18745. {
  18746. return $this->authentications;
  18747. }
  18748. public function resetAuthentications()
  18749. {
  18750. $this->authentications = [];
  18751. }
  18752. public function hasAuthentication($repositoryName)
  18753. {
  18754. return isset($this->authentications[$repositoryName]);
  18755. }
  18756. public function getAuthentication($repositoryName)
  18757. {
  18758. if (isset($this->authentications[$repositoryName])) {
  18759. return $this->authentications[$repositoryName];
  18760. }
  18761. return ['username' => null, 'password' => null];
  18762. }
  18763. public function setAuthentication($repositoryName, $username, $password = null)
  18764. {
  18765. $this->authentications[$repositoryName] = ['username' => $username, 'password' => $password];
  18766. }
  18767. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  18768. {
  18769. $this->write($messages, $newline, $verbosity);
  18770. }
  18771. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  18772. {
  18773. $this->writeError($messages, $newline, $verbosity);
  18774. }
  18775. protected function checkAndSetAuthentication(string $repositoryName, string $username, ?string $password = null)
  18776. {
  18777. if ($this->hasAuthentication($repositoryName)) {
  18778. $auth = $this->getAuthentication($repositoryName);
  18779. if ($auth['username'] === $username && $auth['password'] === $password) {
  18780. return;
  18781. }
  18782. $this->writeError(
  18783. sprintf(
  18784. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  18785. $repositoryName
  18786. )
  18787. );
  18788. }
  18789. $this->setAuthentication($repositoryName, $username, $password);
  18790. }
  18791. public function loadConfiguration(Config $config)
  18792. {
  18793. $bitbucketOauth = $config->get('bitbucket-oauth');
  18794. $githubOauth = $config->get('github-oauth');
  18795. $gitlabOauth = $config->get('gitlab-oauth');
  18796. $gitlabToken = $config->get('gitlab-token');
  18797. $httpBasic = $config->get('http-basic');
  18798. $bearerToken = $config->get('bearer');
  18799. foreach ($bitbucketOauth as $domain => $cred) {
  18800. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  18801. }
  18802. foreach ($githubOauth as $domain => $token) {
  18803. if ($domain !== 'github.com' && !in_array($domain, $config->get('github-domains'), true)) {
  18804. $this->debug($domain.' is not in the configured github-domains, adding it implicitly as authentication is configured for this domain');
  18805. $config->merge(['config' => ['github-domains' => array_merge($config->get('github-domains'), [$domain])]], 'implicit-due-to-auth');
  18806. }
  18807. if (!Preg::isMatch('{^[.A-Za-z0-9_]+$}', $token)) {
  18808. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  18809. }
  18810. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  18811. }
  18812. foreach ($gitlabOauth as $domain => $token) {
  18813. if ($domain !== 'gitlab.com' && !in_array($domain, $config->get('gitlab-domains'), true)) {
  18814. $this->debug($domain.' is not in the configured gitlab-domains, adding it implicitly as authentication is configured for this domain');
  18815. $config->merge(['config' => ['gitlab-domains' => array_merge($config->get('gitlab-domains'), [$domain])]], 'implicit-due-to-auth');
  18816. }
  18817. $token = is_array($token) ? $token["token"] : $token;
  18818. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  18819. }
  18820. foreach ($gitlabToken as $domain => $token) {
  18821. if ($domain !== 'gitlab.com' && !in_array($domain, $config->get('gitlab-domains'), true)) {
  18822. $this->debug($domain.' is not in the configured gitlab-domains, adding it implicitly as authentication is configured for this domain');
  18823. $config->merge(['config' => ['gitlab-domains' => array_merge($config->get('gitlab-domains'), [$domain])]], 'implicit-due-to-auth');
  18824. }
  18825. $username = is_array($token) ? $token["username"] : $token;
  18826. $password = is_array($token) ? $token["token"] : 'private-token';
  18827. $this->checkAndSetAuthentication($domain, $username, $password);
  18828. }
  18829. foreach ($httpBasic as $domain => $cred) {
  18830. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  18831. }
  18832. foreach ($bearerToken as $domain => $token) {
  18833. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  18834. }
  18835. ProcessExecutor::setTimeout($config->get('process-timeout'));
  18836. }
  18837. public function emergency($message, array $context = []): void
  18838. {
  18839. $this->log(LogLevel::EMERGENCY, $message, $context);
  18840. }
  18841. public function alert($message, array $context = []): void
  18842. {
  18843. $this->log(LogLevel::ALERT, $message, $context);
  18844. }
  18845. public function critical($message, array $context = []): void
  18846. {
  18847. $this->log(LogLevel::CRITICAL, $message, $context);
  18848. }
  18849. public function error($message, array $context = []): void
  18850. {
  18851. $this->log(LogLevel::ERROR, $message, $context);
  18852. }
  18853. public function warning($message, array $context = []): void
  18854. {
  18855. $this->log(LogLevel::WARNING, $message, $context);
  18856. }
  18857. public function notice($message, array $context = []): void
  18858. {
  18859. $this->log(LogLevel::NOTICE, $message, $context);
  18860. }
  18861. public function info($message, array $context = []): void
  18862. {
  18863. $this->log(LogLevel::INFO, $message, $context);
  18864. }
  18865. public function debug($message, array $context = []): void
  18866. {
  18867. $this->log(LogLevel::DEBUG, $message, $context);
  18868. }
  18869. public function log($level, $message, array $context = []): void
  18870. {
  18871. $message = (string) $message;
  18872. if (in_array($level, [LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR])) {
  18873. $this->writeError('<error>'.$message.'</error>');
  18874. } elseif ($level === LogLevel::WARNING) {
  18875. $this->writeError('<warning>'.$message.'</warning>');
  18876. } elseif ($level === LogLevel::NOTICE) {
  18877. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  18878. } elseif ($level === LogLevel::INFO) {
  18879. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  18880. } else {
  18881. $this->writeError($message, true, self::DEBUG);
  18882. }
  18883. }
  18884. }
  18885. <?php declare(strict_types=1);
  18886. namespace Composer\IO;
  18887. use Composer\Pcre\Preg;
  18888. use Symfony\Component\Console\Helper\QuestionHelper;
  18889. use Symfony\Component\Console\Output\StreamOutput;
  18890. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  18891. use Symfony\Component\Console\Input\StreamableInputInterface;
  18892. use Symfony\Component\Console\Input\StringInput;
  18893. use Symfony\Component\Console\Helper\HelperSet;
  18894. class BufferIO extends ConsoleIO
  18895. {
  18896. protected $input;
  18897. protected $output;
  18898. public function __construct(string $input = '', int $verbosity = StreamOutput::VERBOSITY_NORMAL, ?OutputFormatterInterface $formatter = null)
  18899. {
  18900. $input = new StringInput($input);
  18901. $input->setInteractive(false);
  18902. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  18903. parent::__construct($input, $output, new HelperSet([
  18904. new QuestionHelper(),
  18905. ]));
  18906. }
  18907. public function getOutput(): string
  18908. {
  18909. fseek($this->output->getStream(), 0);
  18910. $output = stream_get_contents($this->output->getStream());
  18911. $output = Preg::replaceCallback("{(?<=^|\n|\x08)(.+?)(\x08+)}", static function ($matches): string {
  18912. assert(is_string($matches[1]));
  18913. assert(is_string($matches[2]));
  18914. $pre = strip_tags($matches[1]);
  18915. if (strlen($pre) === strlen($matches[2])) {
  18916. return '';
  18917. }
  18918. return rtrim($matches[1])."\n";
  18919. }, $output);
  18920. return $output;
  18921. }
  18922. public function setUserInputs(array $inputs): void
  18923. {
  18924. if (!$this->input instanceof StreamableInputInterface) {
  18925. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  18926. }
  18927. $this->input->setStream($this->createStream($inputs));
  18928. $this->input->setInteractive(true);
  18929. }
  18930. private function createStream(array $inputs)
  18931. {
  18932. $stream = fopen('php://memory', 'r+');
  18933. foreach ($inputs as $input) {
  18934. fwrite($stream, $input.PHP_EOL);
  18935. }
  18936. rewind($stream);
  18937. return $stream;
  18938. }
  18939. }
  18940. <?php declare(strict_types=1);
  18941. namespace Composer\IO;
  18942. use Composer\Question\StrictConfirmationQuestion;
  18943. use Symfony\Component\Console\Helper\HelperSet;
  18944. use Symfony\Component\Console\Helper\ProgressBar;
  18945. use Symfony\Component\Console\Helper\Table;
  18946. use Symfony\Component\Console\Input\InputInterface;
  18947. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  18948. use Symfony\Component\Console\Output\OutputInterface;
  18949. use Symfony\Component\Console\Question\ChoiceQuestion;
  18950. use Symfony\Component\Console\Question\Question;
  18951. class ConsoleIO extends BaseIO
  18952. {
  18953. protected $input;
  18954. protected $output;
  18955. protected $helperSet;
  18956. protected $lastMessage = '';
  18957. protected $lastMessageErr = '';
  18958. private $startTime;
  18959. private $verbosityMap;
  18960. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  18961. {
  18962. $this->input = $input;
  18963. $this->output = $output;
  18964. $this->helperSet = $helperSet;
  18965. $this->verbosityMap = [
  18966. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  18967. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  18968. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  18969. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  18970. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  18971. ];
  18972. }
  18973. public function enableDebugging(float $startTime)
  18974. {
  18975. $this->startTime = $startTime;
  18976. }
  18977. public function isInteractive()
  18978. {
  18979. return $this->input->isInteractive();
  18980. }
  18981. public function isDecorated()
  18982. {
  18983. return $this->output->isDecorated();
  18984. }
  18985. public function isVerbose()
  18986. {
  18987. return $this->output->isVerbose();
  18988. }
  18989. public function isVeryVerbose()
  18990. {
  18991. return $this->output->isVeryVerbose();
  18992. }
  18993. public function isDebug()
  18994. {
  18995. return $this->output->isDebug();
  18996. }
  18997. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL)
  18998. {
  18999. $this->doWrite($messages, $newline, false, $verbosity);
  19000. }
  19001. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19002. {
  19003. $this->doWrite($messages, $newline, true, $verbosity);
  19004. }
  19005. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19006. {
  19007. $this->doWrite($messages, $newline, false, $verbosity, true);
  19008. }
  19009. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19010. {
  19011. $this->doWrite($messages, $newline, true, $verbosity, true);
  19012. }
  19013. private function doWrite($messages, bool $newline, bool $stderr, int $verbosity, bool $raw = false): void
  19014. {
  19015. $sfVerbosity = $this->verbosityMap[$verbosity];
  19016. if ($sfVerbosity > $this->output->getVerbosity()) {
  19017. return;
  19018. }
  19019. if ($raw) {
  19020. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  19021. }
  19022. if (null !== $this->startTime) {
  19023. $memoryUsage = memory_get_usage() / 1024 / 1024;
  19024. $timeSpent = microtime(true) - $this->startTime;
  19025. $messages = array_map(static function ($message) use ($memoryUsage, $timeSpent): string {
  19026. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  19027. }, (array) $messages);
  19028. }
  19029. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  19030. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  19031. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  19032. return;
  19033. }
  19034. $this->output->write($messages, $newline, $sfVerbosity);
  19035. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  19036. }
  19037. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
  19038. {
  19039. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  19040. }
  19041. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
  19042. {
  19043. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  19044. }
  19045. private function doOverwrite($messages, bool $newline, ?int $size, bool $stderr, int $verbosity): void
  19046. {
  19047. $messages = implode($newline ? "\n" : '', (array) $messages);
  19048. if (!isset($size)) {
  19049. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  19050. }
  19051. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  19052. $this->doWrite($messages, false, $stderr, $verbosity);
  19053. $fill = $size - strlen(strip_tags($messages));
  19054. if ($fill > 0) {
  19055. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  19056. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  19057. }
  19058. if ($newline) {
  19059. $this->doWrite('', true, $stderr, $verbosity);
  19060. }
  19061. if ($stderr) {
  19062. $this->lastMessageErr = $messages;
  19063. } else {
  19064. $this->lastMessage = $messages;
  19065. }
  19066. }
  19067. public function getProgressBar(int $max = 0)
  19068. {
  19069. return new ProgressBar($this->getErrorOutput(), $max);
  19070. }
  19071. public function ask($question, $default = null)
  19072. {
  19073. $helper = $this->helperSet->get('question');
  19074. $question = new Question($question, $default);
  19075. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19076. }
  19077. public function askConfirmation($question, $default = true)
  19078. {
  19079. $helper = $this->helperSet->get('question');
  19080. $question = new StrictConfirmationQuestion($question, $default);
  19081. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19082. }
  19083. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  19084. {
  19085. $helper = $this->helperSet->get('question');
  19086. $question = new Question($question, $default);
  19087. $question->setValidator($validator);
  19088. $question->setMaxAttempts($attempts);
  19089. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19090. }
  19091. public function askAndHideAnswer($question)
  19092. {
  19093. $helper = $this->helperSet->get('question');
  19094. $question = new Question($question);
  19095. $question->setHidden(true);
  19096. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19097. }
  19098. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  19099. {
  19100. $helper = $this->helperSet->get('question');
  19101. $question = new ChoiceQuestion($question, $choices, $default);
  19102. $question->setMaxAttempts($attempts ?: null);
  19103. $question->setErrorMessage($errorMessage);
  19104. $question->setMultiselect($multiselect);
  19105. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  19106. $isAssoc = (bool) \count(array_filter(array_keys($choices), 'is_string'));
  19107. if ($isAssoc) {
  19108. return $result;
  19109. }
  19110. if (!is_array($result)) {
  19111. return (string) array_search($result, $choices, true);
  19112. }
  19113. $results = [];
  19114. foreach ($choices as $index => $choice) {
  19115. if (in_array($choice, $result, true)) {
  19116. $results[] = (string) $index;
  19117. }
  19118. }
  19119. return $results;
  19120. }
  19121. public function getTable(): Table
  19122. {
  19123. return new Table($this->output);
  19124. }
  19125. private function getErrorOutput(): OutputInterface
  19126. {
  19127. if ($this->output instanceof ConsoleOutputInterface) {
  19128. return $this->output->getErrorOutput();
  19129. }
  19130. return $this->output;
  19131. }
  19132. }
  19133. <?php declare(strict_types=1);
  19134. namespace Composer\IO;
  19135. use Composer\Config;
  19136. use Psr\Log\LoggerInterface;
  19137. interface IOInterface extends LoggerInterface
  19138. {
  19139. public const QUIET = 1;
  19140. public const NORMAL = 2;
  19141. public const VERBOSE = 4;
  19142. public const VERY_VERBOSE = 8;
  19143. public const DEBUG = 16;
  19144. public function isInteractive();
  19145. public function isVerbose();
  19146. public function isVeryVerbose();
  19147. public function isDebug();
  19148. public function isDecorated();
  19149. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19150. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19151. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19152. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19153. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
  19154. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
  19155. public function ask(string $question, $default = null);
  19156. public function askConfirmation(string $question, bool $default = true);
  19157. public function askAndValidate(string $question, callable $validator, ?int $attempts = null, $default = null);
  19158. public function askAndHideAnswer(string $question);
  19159. public function select(string $question, array $choices, $default, $attempts = false, string $errorMessage = 'Value "%s" is invalid', bool $multiselect = false);
  19160. public function getAuthentications();
  19161. public function hasAuthentication(string $repositoryName);
  19162. public function getAuthentication(string $repositoryName);
  19163. public function setAuthentication(string $repositoryName, string $username, ?string $password = null);
  19164. public function loadConfiguration(Config $config);
  19165. }
  19166. <?php declare(strict_types=1);
  19167. namespace Composer\IO;
  19168. class NullIO extends BaseIO
  19169. {
  19170. public function isInteractive(): bool
  19171. {
  19172. return false;
  19173. }
  19174. public function isVerbose(): bool
  19175. {
  19176. return false;
  19177. }
  19178. public function isVeryVerbose(): bool
  19179. {
  19180. return false;
  19181. }
  19182. public function isDebug(): bool
  19183. {
  19184. return false;
  19185. }
  19186. public function isDecorated(): bool
  19187. {
  19188. return false;
  19189. }
  19190. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL): void
  19191. {
  19192. }
  19193. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL): void
  19194. {
  19195. }
  19196. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
  19197. {
  19198. }
  19199. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
  19200. {
  19201. }
  19202. public function ask($question, $default = null)
  19203. {
  19204. return $default;
  19205. }
  19206. public function askConfirmation($question, $default = true): bool
  19207. {
  19208. return $default;
  19209. }
  19210. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  19211. {
  19212. return $default;
  19213. }
  19214. public function askAndHideAnswer($question): ?string
  19215. {
  19216. return null;
  19217. }
  19218. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  19219. {
  19220. return $default;
  19221. }
  19222. }
  19223. <?php declare(strict_types=1);
  19224. namespace Composer;
  19225. use Composer\Autoload\AutoloadGenerator;
  19226. use Composer\Console\GithubActionError;
  19227. use Composer\DependencyResolver\DefaultPolicy;
  19228. use Composer\DependencyResolver\LocalRepoTransaction;
  19229. use Composer\DependencyResolver\LockTransaction;
  19230. use Composer\DependencyResolver\Operation\UpdateOperation;
  19231. use Composer\DependencyResolver\Operation\InstallOperation;
  19232. use Composer\DependencyResolver\Operation\UninstallOperation;
  19233. use Composer\DependencyResolver\PoolOptimizer;
  19234. use Composer\DependencyResolver\Pool;
  19235. use Composer\DependencyResolver\Request;
  19236. use Composer\DependencyResolver\Solver;
  19237. use Composer\DependencyResolver\SolverProblemsException;
  19238. use Composer\DependencyResolver\PolicyInterface;
  19239. use Composer\Downloader\DownloadManager;
  19240. use Composer\Downloader\TransportException;
  19241. use Composer\EventDispatcher\EventDispatcher;
  19242. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  19243. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  19244. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  19245. use Composer\Installer\InstallationManager;
  19246. use Composer\Installer\InstallerEvents;
  19247. use Composer\Installer\SuggestedPackagesReporter;
  19248. use Composer\IO\IOInterface;
  19249. use Composer\Package\AliasPackage;
  19250. use Composer\Package\RootAliasPackage;
  19251. use Composer\Package\BasePackage;
  19252. use Composer\Package\CompletePackage;
  19253. use Composer\Package\CompletePackageInterface;
  19254. use Composer\Package\Link;
  19255. use Composer\Package\Loader\ArrayLoader;
  19256. use Composer\Package\Dumper\ArrayDumper;
  19257. use Composer\Package\Version\VersionParser;
  19258. use Composer\Package\Package;
  19259. use Composer\Repository\ArrayRepository;
  19260. use Composer\Repository\RepositorySet;
  19261. use Composer\Repository\CompositeRepository;
  19262. use Composer\Semver\Constraint\Constraint;
  19263. use Composer\Package\Locker;
  19264. use Composer\Package\RootPackageInterface;
  19265. use Composer\Repository\InstalledArrayRepository;
  19266. use Composer\Repository\InstalledRepositoryInterface;
  19267. use Composer\Repository\InstalledRepository;
  19268. use Composer\Repository\RootPackageRepository;
  19269. use Composer\Repository\PlatformRepository;
  19270. use Composer\Repository\RepositoryInterface;
  19271. use Composer\Repository\RepositoryManager;
  19272. use Composer\Repository\LockArrayRepository;
  19273. use Composer\Script\ScriptEvents;
  19274. use Composer\Semver\Constraint\ConstraintInterface;
  19275. use Composer\Advisory\Auditor;
  19276. use Composer\Util\Platform;
  19277. class Installer
  19278. {
  19279. public const ERROR_NONE = 0;
  19280. public const ERROR_GENERIC_FAILURE = 1;
  19281. public const ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE = 3;
  19282. public const ERROR_LOCK_FILE_INVALID = 4;
  19283. public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
  19284. public const ERROR_AUDIT_FAILED = 5;
  19285. protected $io;
  19286. protected $config;
  19287. protected $package;
  19288. protected $fixedRootPackage;
  19289. protected $downloadManager;
  19290. protected $repositoryManager;
  19291. protected $locker;
  19292. protected $installationManager;
  19293. protected $eventDispatcher;
  19294. protected $autoloadGenerator;
  19295. protected $preferSource = false;
  19296. protected $preferDist = false;
  19297. protected $optimizeAutoloader = false;
  19298. protected $classMapAuthoritative = false;
  19299. protected $apcuAutoloader = false;
  19300. protected $apcuAutoloaderPrefix = null;
  19301. protected $devMode = false;
  19302. protected $dryRun = false;
  19303. protected $downloadOnly = false;
  19304. protected $verbose = false;
  19305. protected $update = false;
  19306. protected $install = true;
  19307. protected $dumpAutoloader = true;
  19308. protected $runScripts = true;
  19309. protected $preferStable = false;
  19310. protected $preferLowest = false;
  19311. protected $minimalUpdate = false;
  19312. protected $writeLock;
  19313. protected $executeOperations = true;
  19314. protected $audit = true;
  19315. protected $errorOnAudit = false;
  19316. protected $auditFormat = Auditor::FORMAT_SUMMARY;
  19317. protected $updateMirrors = false;
  19318. protected $updateAllowList = null;
  19319. protected $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  19320. protected $suggestedPackagesReporter;
  19321. protected $platformRequirementFilter;
  19322. protected $additionalFixedRepository;
  19323. protected $temporaryConstraints = [];
  19324. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  19325. {
  19326. $this->io = $io;
  19327. $this->config = $config;
  19328. $this->package = $package;
  19329. $this->downloadManager = $downloadManager;
  19330. $this->repositoryManager = $repositoryManager;
  19331. $this->locker = $locker;
  19332. $this->installationManager = $installationManager;
  19333. $this->eventDispatcher = $eventDispatcher;
  19334. $this->autoloadGenerator = $autoloadGenerator;
  19335. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  19336. $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  19337. $this->writeLock = $config->get('lock');
  19338. }
  19339. public function run(): int
  19340. {
  19341. gc_collect_cycles();
  19342. gc_disable();
  19343. if ($this->updateAllowList !== null && $this->updateMirrors) {
  19344. throw new \RuntimeException("The installer options updateMirrors and updateAllowList are mutually exclusive.");
  19345. }
  19346. $isFreshInstall = $this->repositoryManager->getLocalRepository()->isFresh();
  19347. if (!$this->update && !$this->locker->isLocked()) {
  19348. $this->io->writeError('<warning>No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.</warning>');
  19349. $this->update = true;
  19350. }
  19351. if ($this->dryRun) {
  19352. $this->verbose = true;
  19353. $this->runScripts = false;
  19354. $this->executeOperations = false;
  19355. $this->writeLock = false;
  19356. $this->dumpAutoloader = false;
  19357. $this->mockLocalRepositories($this->repositoryManager);
  19358. }
  19359. if ($this->downloadOnly) {
  19360. $this->dumpAutoloader = false;
  19361. }
  19362. if ($this->update && !$this->install) {
  19363. $this->dumpAutoloader = false;
  19364. }
  19365. if ($this->runScripts) {
  19366. Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
  19367. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  19368. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  19369. }
  19370. $this->downloadManager->setPreferSource($this->preferSource);
  19371. $this->downloadManager->setPreferDist($this->preferDist);
  19372. $localRepo = $this->repositoryManager->getLocalRepository();
  19373. try {
  19374. if ($this->update) {
  19375. $res = $this->doUpdate($localRepo, $this->install);
  19376. } else {
  19377. $res = $this->doInstall($localRepo);
  19378. }
  19379. if ($res !== 0) {
  19380. return $res;
  19381. }
  19382. } catch (\Exception $e) {
  19383. if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
  19384. $this->installationManager->notifyInstalls($this->io);
  19385. }
  19386. throw $e;
  19387. }
  19388. if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
  19389. $this->installationManager->notifyInstalls($this->io);
  19390. }
  19391. if ($this->update) {
  19392. $installedRepo = new InstalledRepository([
  19393. $this->locker->getLockedRepository($this->devMode),
  19394. $this->createPlatformRepo(false),
  19395. new RootPackageRepository(clone $this->package),
  19396. ]);
  19397. if ($isFreshInstall) {
  19398. $this->suggestedPackagesReporter->addSuggestionsFromPackage($this->package);
  19399. }
  19400. $this->suggestedPackagesReporter->outputMinimalistic($installedRepo);
  19401. }
  19402. $lockedRepository = $this->locker->getLockedRepository(true);
  19403. foreach ($lockedRepository->getPackages() as $package) {
  19404. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  19405. continue;
  19406. }
  19407. $replacement = is_string($package->getReplacementPackage())
  19408. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  19409. : 'No replacement was suggested';
  19410. $this->io->writeError(
  19411. sprintf(
  19412. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  19413. $package->getPrettyName(),
  19414. $replacement
  19415. )
  19416. );
  19417. }
  19418. if ($this->dumpAutoloader) {
  19419. if ($this->optimizeAutoloader) {
  19420. $this->io->writeError('<info>Generating optimized autoload files</info>');
  19421. } else {
  19422. $this->io->writeError('<info>Generating autoload files</info>');
  19423. }
  19424. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  19425. $this->autoloadGenerator->setApcu($this->apcuAutoloader, $this->apcuAutoloaderPrefix);
  19426. $this->autoloadGenerator->setRunScripts($this->runScripts);
  19427. $this->autoloadGenerator->setPlatformRequirementFilter($this->platformRequirementFilter);
  19428. $this
  19429. ->autoloadGenerator
  19430. ->dump(
  19431. $this->config,
  19432. $localRepo,
  19433. $this->package,
  19434. $this->installationManager,
  19435. 'composer',
  19436. $this->optimizeAutoloader,
  19437. null,
  19438. $this->locker
  19439. );
  19440. }
  19441. if ($this->install && $this->executeOperations) {
  19442. foreach ($localRepo->getPackages() as $package) {
  19443. $this->installationManager->ensureBinariesPresence($package);
  19444. }
  19445. }
  19446. $fundEnv = Platform::getEnv('COMPOSER_FUND');
  19447. $showFunding = true;
  19448. if (is_numeric($fundEnv)) {
  19449. $showFunding = intval($fundEnv) !== 0;
  19450. }
  19451. if ($showFunding) {
  19452. $fundingCount = 0;
  19453. foreach ($localRepo->getPackages() as $package) {
  19454. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  19455. $fundingCount++;
  19456. }
  19457. }
  19458. if ($fundingCount > 0) {
  19459. $this->io->writeError([
  19460. sprintf(
  19461. "<info>%d package%s you are using %s looking for funding.</info>",
  19462. $fundingCount,
  19463. 1 === $fundingCount ? '' : 's',
  19464. 1 === $fundingCount ? 'is' : 'are'
  19465. ),
  19466. '<info>Use the `composer fund` command to find out more!</info>',
  19467. ]);
  19468. }
  19469. }
  19470. if ($this->runScripts) {
  19471. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  19472. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  19473. }
  19474. if (!defined('HHVM_VERSION')) {
  19475. gc_enable();
  19476. }
  19477. if ($this->audit) {
  19478. if ($this->update && !$this->install) {
  19479. $packages = $lockedRepository->getCanonicalPackages();
  19480. $target = 'locked';
  19481. } else {
  19482. $packages = $localRepo->getCanonicalPackages();
  19483. $target = 'installed';
  19484. }
  19485. if (count($packages) > 0) {
  19486. try {
  19487. $auditor = new Auditor();
  19488. $repoSet = new RepositorySet();
  19489. foreach ($this->repositoryManager->getRepositories() as $repo) {
  19490. $repoSet->addRepository($repo);
  19491. }
  19492. $auditConfig = $this->config->get('audit');
  19493. return $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat, true, $auditConfig['ignore'] ?? [], $auditConfig['abandoned'] ?? Auditor::ABANDONED_FAIL) > 0 && $this->errorOnAudit ? self::ERROR_AUDIT_FAILED : 0;
  19494. } catch (TransportException $e) {
  19495. $this->io->error('Failed to audit '.$target.' packages.');
  19496. if ($this->io->isVerbose()) {
  19497. $this->io->error('['.get_class($e).'] '.$e->getMessage());
  19498. }
  19499. }
  19500. } else {
  19501. $this->io->writeError('No '.$target.' packages - skipping audit.');
  19502. }
  19503. }
  19504. return 0;
  19505. }
  19506. protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doInstall): int
  19507. {
  19508. $platformRepo = $this->createPlatformRepo(true);
  19509. $aliases = $this->getRootAliases(true);
  19510. $lockedRepository = null;
  19511. try {
  19512. if ($this->locker->isLocked()) {
  19513. $lockedRepository = $this->locker->getLockedRepository(true);
  19514. }
  19515. } catch (\Seld\JsonLint\ParsingException $e) {
  19516. if ($this->updateAllowList !== null || $this->updateMirrors) {
  19517. throw $e;
  19518. }
  19519. }
  19520. if (($this->updateAllowList !== null || $this->updateMirrors) && !$lockedRepository) {
  19521. $this->io->writeError('<error>Cannot update ' . ($this->updateMirrors ? 'lock file information' : 'only a partial set of packages') . ' without a lock file present. Run `composer update` to generate a lock file.</error>', true, IOInterface::QUIET);
  19522. return self::ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE;
  19523. }
  19524. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  19525. $policy = $this->createPolicy(true, $lockedRepository);
  19526. $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
  19527. $repositories = $this->repositoryManager->getRepositories();
  19528. foreach ($repositories as $repository) {
  19529. $repositorySet->addRepository($repository);
  19530. }
  19531. if ($lockedRepository) {
  19532. $repositorySet->addRepository($lockedRepository);
  19533. }
  19534. $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
  19535. $this->requirePackagesForUpdate($request, $lockedRepository, true);
  19536. if ($this->updateAllowList !== null) {
  19537. $request->setUpdateAllowList($this->updateAllowList, $this->updateAllowTransitiveDependencies);
  19538. }
  19539. $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher, $this->createPoolOptimizer($policy));
  19540. $this->io->writeError('<info>Updating dependencies</info>');
  19541. $solver = new Solver($policy, $pool, $this->io);
  19542. try {
  19543. $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  19544. $ruleSetSize = $solver->getRuleSetSize();
  19545. $solver = null;
  19546. } catch (SolverProblemsException $e) {
  19547. $err = 'Your requirements could not be resolved to an installable set of packages.';
  19548. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
  19549. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  19550. $this->io->writeError($prettyProblem);
  19551. if (!$this->devMode) {
  19552. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  19553. }
  19554. $ghe = new GithubActionError($this->io);
  19555. $ghe->emit($err."\n".$prettyProblem);
  19556. return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
  19557. }
  19558. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  19559. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  19560. $pool = null;
  19561. if (!$lockTransaction->getOperations()) {
  19562. $this->io->writeError('Nothing to modify in lock file');
  19563. }
  19564. $exitCode = $this->extractDevPackages($lockTransaction, $platformRepo, $aliases, $policy, $lockedRepository);
  19565. if ($exitCode !== 0) {
  19566. return $exitCode;
  19567. }
  19568. if (method_exists('Composer\Semver\CompilingMatcher', 'clear')) {
  19569. \Composer\Semver\CompilingMatcher::clear();
  19570. }
  19571. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  19572. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  19573. $installsUpdates = $uninstalls = [];
  19574. if ($lockTransaction->getOperations()) {
  19575. $installNames = $updateNames = $uninstallNames = [];
  19576. foreach ($lockTransaction->getOperations() as $operation) {
  19577. if ($operation instanceof InstallOperation) {
  19578. $installsUpdates[] = $operation;
  19579. $installNames[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  19580. } elseif ($operation instanceof UpdateOperation) {
  19581. if ($this->updateMirrors
  19582. && $operation->getInitialPackage()->getName() === $operation->getTargetPackage()->getName()
  19583. && $operation->getInitialPackage()->getVersion() === $operation->getTargetPackage()->getVersion()
  19584. ) {
  19585. continue;
  19586. }
  19587. $installsUpdates[] = $operation;
  19588. $updateNames[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  19589. } elseif ($operation instanceof UninstallOperation) {
  19590. $uninstalls[] = $operation;
  19591. $uninstallNames[] = $operation->getPackage()->getPrettyName();
  19592. }
  19593. }
  19594. if ($this->config->get('lock')) {
  19595. $this->io->writeError(sprintf(
  19596. "<info>Lock file operations: %d install%s, %d update%s, %d removal%s</info>",
  19597. count($installNames),
  19598. 1 === count($installNames) ? '' : 's',
  19599. count($updateNames),
  19600. 1 === count($updateNames) ? '' : 's',
  19601. count($uninstalls),
  19602. 1 === count($uninstalls) ? '' : 's'
  19603. ));
  19604. if ($installNames) {
  19605. $this->io->writeError("Installs: ".implode(', ', $installNames), true, IOInterface::VERBOSE);
  19606. }
  19607. if ($updateNames) {
  19608. $this->io->writeError("Updates: ".implode(', ', $updateNames), true, IOInterface::VERBOSE);
  19609. }
  19610. if ($uninstalls) {
  19611. $this->io->writeError("Removals: ".implode(', ', $uninstallNames), true, IOInterface::VERBOSE);
  19612. }
  19613. }
  19614. }
  19615. $sortByName = static function ($a, $b): int {
  19616. if ($a instanceof UpdateOperation) {
  19617. $a = $a->getTargetPackage()->getName();
  19618. } else {
  19619. $a = $a->getPackage()->getName();
  19620. }
  19621. if ($b instanceof UpdateOperation) {
  19622. $b = $b->getTargetPackage()->getName();
  19623. } else {
  19624. $b = $b->getPackage()->getName();
  19625. }
  19626. return strcmp($a, $b);
  19627. };
  19628. usort($uninstalls, $sortByName);
  19629. usort($installsUpdates, $sortByName);
  19630. foreach (array_merge($uninstalls, $installsUpdates) as $operation) {
  19631. if ($operation instanceof InstallOperation) {
  19632. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  19633. }
  19634. if ($this->config->get('lock') && (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug())) {
  19635. $sourceRepo = '';
  19636. if ($this->io->isVeryVerbose() && false === strpos($operation->getOperationType(), 'Alias')) {
  19637. $operationPkg = ($operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage());
  19638. if ($operationPkg->getRepository() !== null) {
  19639. $sourceRepo = ' from ' . $operationPkg->getRepository()->getRepoName();
  19640. }
  19641. }
  19642. $this->io->writeError(' - ' . $operation->show(true) . $sourceRepo);
  19643. }
  19644. }
  19645. $updatedLock = $this->locker->setLockData(
  19646. $lockTransaction->getNewLockPackages(false, $this->updateMirrors),
  19647. $lockTransaction->getNewLockPackages(true, $this->updateMirrors),
  19648. $platformReqs,
  19649. $platformDevReqs,
  19650. $lockTransaction->getAliases($aliases),
  19651. $this->package->getMinimumStability(),
  19652. $this->package->getStabilityFlags(),
  19653. $this->preferStable || $this->package->getPreferStable(),
  19654. $this->preferLowest,
  19655. $this->config->get('platform') ?: [],
  19656. $this->writeLock && $this->executeOperations
  19657. );
  19658. if ($updatedLock && $this->writeLock && $this->executeOperations) {
  19659. $this->io->writeError('<info>Writing lock file</info>');
  19660. }
  19661. if ($doInstall) {
  19662. return $this->doInstall($localRepo, true);
  19663. }
  19664. return 0;
  19665. }
  19666. protected function extractDevPackages(LockTransaction $lockTransaction, PlatformRepository $platformRepo, array $aliases, PolicyInterface $policy, ?LockArrayRepository $lockedRepository = null): int
  19667. {
  19668. if (!$this->package->getDevRequires()) {
  19669. return 0;
  19670. }
  19671. $resultRepo = new ArrayRepository([]);
  19672. $loader = new ArrayLoader(null, true);
  19673. $dumper = new ArrayDumper();
  19674. foreach ($lockTransaction->getNewLockPackages(false) as $pkg) {
  19675. $resultRepo->addPackage($loader->load($dumper->dump($pkg)));
  19676. }
  19677. $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
  19678. $repositorySet->addRepository($resultRepo);
  19679. $request = $this->createRequest($this->fixedRootPackage, $platformRepo);
  19680. $this->requirePackagesForUpdate($request, $lockedRepository, false);
  19681. $pool = $repositorySet->createPoolWithAllPackages();
  19682. $solver = new Solver($policy, $pool, $this->io);
  19683. try {
  19684. $nonDevLockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  19685. $solver = null;
  19686. } catch (SolverProblemsException $e) {
  19687. $err = 'Unable to find a compatible set of packages based on your non-dev requirements alone.';
  19688. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose(), true);
  19689. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  19690. $this->io->writeError('Your requirements can be resolved successfully when require-dev packages are present.');
  19691. $this->io->writeError('You may need to move packages from require-dev or some of their dependencies to require.');
  19692. $this->io->writeError($prettyProblem);
  19693. $ghe = new GithubActionError($this->io);
  19694. $ghe->emit($err."\n".$prettyProblem);
  19695. return $e->getCode();
  19696. }
  19697. $lockTransaction->setNonDevPackages($nonDevLockTransaction);
  19698. return 0;
  19699. }
  19700. protected function doInstall(InstalledRepositoryInterface $localRepo, bool $alreadySolved = false): int
  19701. {
  19702. if ($this->config->get('lock')) {
  19703. $this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  19704. }
  19705. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  19706. if (!$alreadySolved) {
  19707. $this->io->writeError('<info>Verifying lock file contents can be installed on current platform.</info>');
  19708. $platformRepo = $this->createPlatformRepo(false);
  19709. $policy = $this->createPolicy(false);
  19710. $repositorySet = $this->createRepositorySet(false, $platformRepo, [], $lockedRepository);
  19711. $repositorySet->addRepository($lockedRepository);
  19712. $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
  19713. if (!$this->locker->isFresh()) {
  19714. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.</warning>', true, IOInterface::QUIET);
  19715. }
  19716. $missingRequirementInfo = $this->locker->getMissingRequirementInfo($this->package, $this->devMode);
  19717. if ($missingRequirementInfo !== []) {
  19718. $this->io->writeError($missingRequirementInfo);
  19719. return self::ERROR_LOCK_FILE_INVALID;
  19720. }
  19721. foreach ($lockedRepository->getPackages() as $package) {
  19722. $request->fixLockedPackage($package);
  19723. }
  19724. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  19725. $request->requireName($link->getTarget(), $link->getConstraint());
  19726. }
  19727. $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher);
  19728. $solver = new Solver($policy, $pool, $this->io);
  19729. try {
  19730. $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  19731. $solver = null;
  19732. if (0 !== count($lockTransaction->getOperations())) {
  19733. $this->io->writeError('<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>', true, IOInterface::QUIET);
  19734. return self::ERROR_LOCK_FILE_INVALID;
  19735. }
  19736. } catch (SolverProblemsException $e) {
  19737. $err = 'Your lock file does not contain a compatible set of packages. Please run composer update.';
  19738. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
  19739. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  19740. $this->io->writeError($prettyProblem);
  19741. $ghe = new GithubActionError($this->io);
  19742. $ghe->emit($err."\n".$prettyProblem);
  19743. return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
  19744. }
  19745. }
  19746. $localRepoTransaction = new LocalRepoTransaction($lockedRepository, $localRepo);
  19747. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_OPERATIONS_EXEC, $this->devMode, $this->executeOperations, $localRepoTransaction);
  19748. $installs = $updates = $uninstalls = [];
  19749. foreach ($localRepoTransaction->getOperations() as $operation) {
  19750. if ($operation instanceof InstallOperation) {
  19751. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  19752. } elseif ($operation instanceof UpdateOperation) {
  19753. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  19754. } elseif ($operation instanceof UninstallOperation) {
  19755. $uninstalls[] = $operation->getPackage()->getPrettyName();
  19756. }
  19757. }
  19758. if ($installs === [] && $updates === [] && $uninstalls === []) {
  19759. $this->io->writeError('Nothing to install, update or remove');
  19760. } else {
  19761. $this->io->writeError(sprintf(
  19762. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  19763. count($installs),
  19764. 1 === count($installs) ? '' : 's',
  19765. count($updates),
  19766. 1 === count($updates) ? '' : 's',
  19767. count($uninstalls),
  19768. 1 === count($uninstalls) ? '' : 's'
  19769. ));
  19770. if ($installs) {
  19771. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  19772. }
  19773. if ($updates) {
  19774. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  19775. }
  19776. if ($uninstalls) {
  19777. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  19778. }
  19779. }
  19780. if ($this->executeOperations) {
  19781. $localRepo->setDevPackageNames($this->locker->getDevPackageNames());
  19782. $this->installationManager->execute($localRepo, $localRepoTransaction->getOperations(), $this->devMode, $this->runScripts, $this->downloadOnly);
  19783. if (count($localRepoTransaction->getOperations()) > 0) {
  19784. $vendorDir = $this->config->get('vendor-dir');
  19785. if (is_dir($vendorDir)) {
  19786. @touch($vendorDir);
  19787. }
  19788. }
  19789. } else {
  19790. foreach ($localRepoTransaction->getOperations() as $operation) {
  19791. if (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug()) {
  19792. $this->io->writeError(' - ' . $operation->show(false));
  19793. }
  19794. }
  19795. }
  19796. return 0;
  19797. }
  19798. protected function createPlatformRepo(bool $forUpdate): PlatformRepository
  19799. {
  19800. if ($forUpdate) {
  19801. $platformOverrides = $this->config->get('platform') ?: [];
  19802. } else {
  19803. $platformOverrides = $this->locker->getPlatformOverrides();
  19804. }
  19805. return new PlatformRepository([], $platformOverrides);
  19806. }
  19807. private function createRepositorySet(bool $forUpdate, PlatformRepository $platformRepo, array $rootAliases = [], ?RepositoryInterface $lockedRepository = null): RepositorySet
  19808. {
  19809. if ($forUpdate) {
  19810. $minimumStability = $this->package->getMinimumStability();
  19811. $stabilityFlags = $this->package->getStabilityFlags();
  19812. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  19813. } else {
  19814. $minimumStability = $this->locker->getMinimumStability();
  19815. $stabilityFlags = $this->locker->getStabilityFlags();
  19816. $requires = [];
  19817. foreach ($lockedRepository->getPackages() as $package) {
  19818. $constraint = new Constraint('=', $package->getVersion());
  19819. $constraint->setPrettyString($package->getPrettyVersion());
  19820. $requires[$package->getName()] = $constraint;
  19821. }
  19822. }
  19823. $rootRequires = [];
  19824. foreach ($requires as $req => $constraint) {
  19825. if ($constraint instanceof Link) {
  19826. $constraint = $constraint->getConstraint();
  19827. }
  19828. if ($this->platformRequirementFilter->isIgnored($req)) {
  19829. continue;
  19830. } elseif ($this->platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  19831. $constraint = $this->platformRequirementFilter->filterConstraint($req, $constraint);
  19832. }
  19833. $rootRequires[$req] = $constraint;
  19834. }
  19835. $this->fixedRootPackage = clone $this->package;
  19836. $this->fixedRootPackage->setRequires([]);
  19837. $this->fixedRootPackage->setDevRequires([]);
  19838. $stabilityFlags[$this->package->getName()] = BasePackage::$stabilities[VersionParser::parseStability($this->package->getVersion())];
  19839. $repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $this->package->getReferences(), $rootRequires, $this->temporaryConstraints);
  19840. $repositorySet->addRepository(new RootPackageRepository($this->fixedRootPackage));
  19841. $repositorySet->addRepository($platformRepo);
  19842. if ($this->additionalFixedRepository) {
  19843. $additionalFixedRepositories = $this->additionalFixedRepository;
  19844. if ($additionalFixedRepositories instanceof CompositeRepository) {
  19845. $additionalFixedRepositories = $additionalFixedRepositories->getRepositories();
  19846. } else {
  19847. $additionalFixedRepositories = [$additionalFixedRepositories];
  19848. }
  19849. foreach ($additionalFixedRepositories as $additionalFixedRepository) {
  19850. if ($additionalFixedRepository instanceof InstalledRepository || $additionalFixedRepository instanceof InstalledRepositoryInterface) {
  19851. $repositorySet->allowInstalledRepositories();
  19852. break;
  19853. }
  19854. }
  19855. $repositorySet->addRepository($this->additionalFixedRepository);
  19856. }
  19857. return $repositorySet;
  19858. }
  19859. private function createPolicy(bool $forUpdate, ?LockArrayRepository $lockedRepo = null): DefaultPolicy
  19860. {
  19861. $preferStable = null;
  19862. $preferLowest = null;
  19863. if (!$forUpdate) {
  19864. $preferStable = $this->locker->getPreferStable();
  19865. $preferLowest = $this->locker->getPreferLowest();
  19866. }
  19867. if (null === $preferStable) {
  19868. $preferStable = $this->preferStable || $this->package->getPreferStable();
  19869. }
  19870. if (null === $preferLowest) {
  19871. $preferLowest = $this->preferLowest;
  19872. }
  19873. $preferredVersions = null;
  19874. if ($forUpdate && $this->minimalUpdate && $this->updateAllowList !== null && $lockedRepo !== null) {
  19875. $preferredVersions = [];
  19876. foreach ($lockedRepo->getPackages() as $pkg) {
  19877. if ($pkg instanceof AliasPackage || in_array($pkg->getName(), $this->updateAllowList, true)) {
  19878. continue;
  19879. }
  19880. $preferredVersions[$pkg->getName()] = $pkg->getVersion();
  19881. }
  19882. }
  19883. return new DefaultPolicy($preferStable, $preferLowest, $preferredVersions);
  19884. }
  19885. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, ?LockArrayRepository $lockedRepository = null): Request
  19886. {
  19887. $request = new Request($lockedRepository);
  19888. $request->fixPackage($rootPackage);
  19889. if ($rootPackage instanceof RootAliasPackage) {
  19890. $request->fixPackage($rootPackage->getAliasOf());
  19891. }
  19892. $fixedPackages = $platformRepo->getPackages();
  19893. if ($this->additionalFixedRepository) {
  19894. $fixedPackages = array_merge($fixedPackages, $this->additionalFixedRepository->getPackages());
  19895. }
  19896. $provided = $rootPackage->getProvides();
  19897. foreach ($fixedPackages as $package) {
  19898. if ($package->getRepository() !== $platformRepo
  19899. || !isset($provided[$package->getName()])
  19900. || !$provided[$package->getName()]->getConstraint()->matches(new Constraint('=', $package->getVersion()))
  19901. ) {
  19902. $request->fixPackage($package);
  19903. }
  19904. }
  19905. return $request;
  19906. }
  19907. private function requirePackagesForUpdate(Request $request, ?LockArrayRepository $lockedRepository = null, bool $includeDevRequires = true): void
  19908. {
  19909. if ($this->updateMirrors) {
  19910. $excludedPackages = [];
  19911. if (!$includeDevRequires) {
  19912. $excludedPackages = array_flip($this->locker->getDevPackageNames());
  19913. }
  19914. foreach ($lockedRepository->getPackages() as $lockedPackage) {
  19915. if (!$lockedPackage instanceof AliasPackage && !isset($excludedPackages[$lockedPackage->getName()])) {
  19916. $request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
  19917. }
  19918. }
  19919. } else {
  19920. $links = $this->package->getRequires();
  19921. if ($includeDevRequires) {
  19922. $links = array_merge($links, $this->package->getDevRequires());
  19923. }
  19924. foreach ($links as $link) {
  19925. $request->requireName($link->getTarget(), $link->getConstraint());
  19926. }
  19927. }
  19928. }
  19929. private function getRootAliases(bool $forUpdate): array
  19930. {
  19931. if ($forUpdate) {
  19932. $aliases = $this->package->getAliases();
  19933. } else {
  19934. $aliases = $this->locker->getAliases();
  19935. }
  19936. return $aliases;
  19937. }
  19938. private function extractPlatformRequirements(array $links): array
  19939. {
  19940. $platformReqs = [];
  19941. foreach ($links as $link) {
  19942. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  19943. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  19944. }
  19945. }
  19946. return $platformReqs;
  19947. }
  19948. private function mockLocalRepositories(RepositoryManager $rm): void
  19949. {
  19950. $packages = [];
  19951. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  19952. $packages[(string) $package] = clone $package;
  19953. }
  19954. foreach ($packages as $key => $package) {
  19955. if ($package instanceof AliasPackage) {
  19956. $alias = (string) $package->getAliasOf();
  19957. $className = get_class($package);
  19958. $packages[$key] = new $className($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  19959. }
  19960. }
  19961. $rm->setLocalRepository(
  19962. new InstalledArrayRepository($packages)
  19963. );
  19964. }
  19965. private function createPoolOptimizer(PolicyInterface $policy): ?PoolOptimizer
  19966. {
  19967. if ('0' === Platform::getEnv('COMPOSER_POOL_OPTIMIZER')) {
  19968. $this->io->write('Pool Optimizer was disabled for debugging purposes.', true, IOInterface::DEBUG);
  19969. return null;
  19970. }
  19971. return new PoolOptimizer($policy);
  19972. }
  19973. public static function create(IOInterface $io, Composer $composer): self
  19974. {
  19975. return new static(
  19976. $io,
  19977. $composer->getConfig(),
  19978. $composer->getPackage(),
  19979. $composer->getDownloadManager(),
  19980. $composer->getRepositoryManager(),
  19981. $composer->getLocker(),
  19982. $composer->getInstallationManager(),
  19983. $composer->getEventDispatcher(),
  19984. $composer->getAutoloadGenerator()
  19985. );
  19986. }
  19987. public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository): self
  19988. {
  19989. $this->additionalFixedRepository = $additionalFixedRepository;
  19990. return $this;
  19991. }
  19992. public function setTemporaryConstraints(array $constraints): self
  19993. {
  19994. $this->temporaryConstraints = $constraints;
  19995. return $this;
  19996. }
  19997. public function setDryRun(bool $dryRun = true): self
  19998. {
  19999. $this->dryRun = (bool) $dryRun;
  20000. return $this;
  20001. }
  20002. public function isDryRun(): bool
  20003. {
  20004. return $this->dryRun;
  20005. }
  20006. public function setDownloadOnly(bool $downloadOnly = true): self
  20007. {
  20008. $this->downloadOnly = $downloadOnly;
  20009. return $this;
  20010. }
  20011. public function setPreferSource(bool $preferSource = true): self
  20012. {
  20013. $this->preferSource = (bool) $preferSource;
  20014. return $this;
  20015. }
  20016. public function setPreferDist(bool $preferDist = true): self
  20017. {
  20018. $this->preferDist = (bool) $preferDist;
  20019. return $this;
  20020. }
  20021. public function setOptimizeAutoloader(bool $optimizeAutoloader): self
  20022. {
  20023. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  20024. if (!$this->optimizeAutoloader) {
  20025. $this->setClassMapAuthoritative(false);
  20026. }
  20027. return $this;
  20028. }
  20029. public function setClassMapAuthoritative(bool $classMapAuthoritative): self
  20030. {
  20031. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  20032. if ($this->classMapAuthoritative) {
  20033. $this->setOptimizeAutoloader(true);
  20034. }
  20035. return $this;
  20036. }
  20037. public function setApcuAutoloader(bool $apcuAutoloader, ?string $apcuAutoloaderPrefix = null): self
  20038. {
  20039. $this->apcuAutoloader = $apcuAutoloader;
  20040. $this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
  20041. return $this;
  20042. }
  20043. public function setUpdate(bool $update): self
  20044. {
  20045. $this->update = (bool) $update;
  20046. return $this;
  20047. }
  20048. public function setInstall(bool $install): self
  20049. {
  20050. $this->install = (bool) $install;
  20051. return $this;
  20052. }
  20053. public function setDevMode(bool $devMode = true): self
  20054. {
  20055. $this->devMode = (bool) $devMode;
  20056. return $this;
  20057. }
  20058. public function setDumpAutoloader(bool $dumpAutoloader = true): self
  20059. {
  20060. $this->dumpAutoloader = (bool) $dumpAutoloader;
  20061. return $this;
  20062. }
  20063. public function setRunScripts(bool $runScripts = true): self
  20064. {
  20065. $this->runScripts = (bool) $runScripts;
  20066. return $this;
  20067. }
  20068. public function setConfig(Config $config): self
  20069. {
  20070. $this->config = $config;
  20071. return $this;
  20072. }
  20073. public function setVerbose(bool $verbose = true): self
  20074. {
  20075. $this->verbose = (bool) $verbose;
  20076. return $this;
  20077. }
  20078. public function isVerbose(): bool
  20079. {
  20080. return $this->verbose;
  20081. }
  20082. public function setIgnorePlatformRequirements($ignorePlatformReqs): self
  20083. {
  20084. trigger_error('Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
  20085. return $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
  20086. }
  20087. public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): self
  20088. {
  20089. $this->platformRequirementFilter = $platformRequirementFilter;
  20090. return $this;
  20091. }
  20092. public function setUpdateMirrors(bool $updateMirrors): self
  20093. {
  20094. $this->updateMirrors = $updateMirrors;
  20095. return $this;
  20096. }
  20097. public function setUpdateAllowList(array $packages): self
  20098. {
  20099. if (count($packages) === 0) {
  20100. $this->updateAllowList = null;
  20101. } else {
  20102. $this->updateAllowList = array_values(array_unique(array_map('strtolower', $packages)));
  20103. }
  20104. return $this;
  20105. }
  20106. public function setUpdateAllowTransitiveDependencies(int $updateAllowTransitiveDependencies): self
  20107. {
  20108. if (!in_array($updateAllowTransitiveDependencies, [Request::UPDATE_ONLY_LISTED, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS], true)) {
  20109. throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
  20110. }
  20111. $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
  20112. return $this;
  20113. }
  20114. public function setPreferStable(bool $preferStable = true): self
  20115. {
  20116. $this->preferStable = $preferStable;
  20117. return $this;
  20118. }
  20119. public function setPreferLowest(bool $preferLowest = true): self
  20120. {
  20121. $this->preferLowest = $preferLowest;
  20122. return $this;
  20123. }
  20124. public function setMinimalUpdate(bool $minimalUpdate = true): self
  20125. {
  20126. $this->minimalUpdate = $minimalUpdate;
  20127. return $this;
  20128. }
  20129. public function setWriteLock(bool $writeLock = true): self
  20130. {
  20131. $this->writeLock = $writeLock;
  20132. return $this;
  20133. }
  20134. public function setExecuteOperations(bool $executeOperations = true): self
  20135. {
  20136. $this->executeOperations = $executeOperations;
  20137. return $this;
  20138. }
  20139. public function setAudit(bool $audit): self
  20140. {
  20141. $this->audit = $audit;
  20142. return $this;
  20143. }
  20144. public function setErrorOnAudit(bool $errorOnAudit): self
  20145. {
  20146. $this->errorOnAudit = $errorOnAudit;
  20147. return $this;
  20148. }
  20149. public function setAuditFormat(string $auditFormat): self
  20150. {
  20151. $this->auditFormat = $auditFormat;
  20152. return $this;
  20153. }
  20154. public function disablePlugins(): self
  20155. {
  20156. $this->installationManager->disablePlugins();
  20157. return $this;
  20158. }
  20159. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): self
  20160. {
  20161. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  20162. return $this;
  20163. }
  20164. }
  20165. <?php declare(strict_types=1);
  20166. namespace Composer\Installer;
  20167. use Composer\IO\IOInterface;
  20168. use Composer\Package\PackageInterface;
  20169. use Composer\Pcre\Preg;
  20170. use Composer\Util\Filesystem;
  20171. use Composer\Util\Platform;
  20172. use Composer\Util\ProcessExecutor;
  20173. use Composer\Util\Silencer;
  20174. class BinaryInstaller
  20175. {
  20176. protected $binDir;
  20177. protected $binCompat;
  20178. protected $io;
  20179. protected $filesystem;
  20180. private $vendorDir;
  20181. public function __construct(IOInterface $io, string $binDir, string $binCompat, ?Filesystem $filesystem = null, ?string $vendorDir = null)
  20182. {
  20183. $this->binDir = $binDir;
  20184. $this->binCompat = $binCompat;
  20185. $this->io = $io;
  20186. $this->filesystem = $filesystem ?: new Filesystem();
  20187. $this->vendorDir = $vendorDir;
  20188. }
  20189. public function installBinaries(PackageInterface $package, string $installPath, bool $warnOnOverwrite = true): void
  20190. {
  20191. $binaries = $this->getBinaries($package);
  20192. if (!$binaries) {
  20193. return;
  20194. }
  20195. Platform::workaroundFilesystemIssues();
  20196. foreach ($binaries as $bin) {
  20197. $binPath = $installPath.'/'.$bin;
  20198. if (!file_exists($binPath)) {
  20199. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  20200. continue;
  20201. }
  20202. if (is_dir($binPath)) {
  20203. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': found a directory at that path</warning>');
  20204. continue;
  20205. }
  20206. if (!$this->filesystem->isAbsolutePath($binPath)) {
  20207. $binPath = realpath($binPath);
  20208. }
  20209. $this->initializeBinDir();
  20210. $link = $this->binDir.'/'.basename($bin);
  20211. if (file_exists($link)) {
  20212. if (!is_link($link)) {
  20213. if ($warnOnOverwrite) {
  20214. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  20215. }
  20216. continue;
  20217. }
  20218. if (realpath($link) === realpath($binPath)) {
  20219. $this->filesystem->unlink($link);
  20220. }
  20221. }
  20222. $binCompat = $this->binCompat;
  20223. if ($binCompat === "auto" && (Platform::isWindows() || Platform::isWindowsSubsystemForLinux())) {
  20224. $binCompat = 'full';
  20225. }
  20226. if ($binCompat === "full") {
  20227. $this->installFullBinaries($binPath, $link, $bin, $package);
  20228. } else {
  20229. $this->installUnixyProxyBinaries($binPath, $link);
  20230. }
  20231. Silencer::call('chmod', $binPath, 0777 & ~umask());
  20232. }
  20233. }
  20234. public function removeBinaries(PackageInterface $package): void
  20235. {
  20236. $this->initializeBinDir();
  20237. $binaries = $this->getBinaries($package);
  20238. if (!$binaries) {
  20239. return;
  20240. }
  20241. foreach ($binaries as $bin) {
  20242. $link = $this->binDir.'/'.basename($bin);
  20243. if (is_link($link) || file_exists($link)) {
  20244. $this->filesystem->unlink($link);
  20245. }
  20246. if (is_file($link.'.bat')) {
  20247. $this->filesystem->unlink($link.'.bat');
  20248. }
  20249. }
  20250. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  20251. Silencer::call('rmdir', $this->binDir);
  20252. }
  20253. }
  20254. public static function determineBinaryCaller(string $bin): string
  20255. {
  20256. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  20257. return 'call';
  20258. }
  20259. $handle = fopen($bin, 'r');
  20260. $line = fgets($handle);
  20261. fclose($handle);
  20262. if (Preg::isMatchStrictGroups('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', (string) $line, $match)) {
  20263. return trim($match[1]);
  20264. }
  20265. return 'php';
  20266. }
  20267. protected function getBinaries(PackageInterface $package): array
  20268. {
  20269. return $package->getBinaries();
  20270. }
  20271. protected function installFullBinaries(string $binPath, string $link, string $bin, PackageInterface $package): void
  20272. {
  20273. if ('.bat' !== substr($binPath, -4)) {
  20274. $this->installUnixyProxyBinaries($binPath, $link);
  20275. $link .= '.bat';
  20276. if (file_exists($link)) {
  20277. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  20278. }
  20279. }
  20280. if (!file_exists($link)) {
  20281. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  20282. Silencer::call('chmod', $link, 0777 & ~umask());
  20283. }
  20284. }
  20285. protected function installUnixyProxyBinaries(string $binPath, string $link): void
  20286. {
  20287. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  20288. Silencer::call('chmod', $link, 0777 & ~umask());
  20289. }
  20290. protected function initializeBinDir(): void
  20291. {
  20292. $this->filesystem->ensureDirectoryExists($this->binDir);
  20293. $this->binDir = realpath($this->binDir);
  20294. }
  20295. protected function generateWindowsProxyCode(string $bin, string $link): string
  20296. {
  20297. $binPath = $this->filesystem->findShortestPath($link, $bin);
  20298. $caller = self::determineBinaryCaller($bin);
  20299. if ($caller === 'php') {
  20300. return "@ECHO OFF\r\n".
  20301. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  20302. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape(basename($link, '.bat')), '"\'')."\r\n".
  20303. "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
  20304. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  20305. }
  20306. return "@ECHO OFF\r\n".
  20307. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  20308. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  20309. "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
  20310. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  20311. }
  20312. protected function generateUnixyProxyCode(string $bin, string $link): string
  20313. {
  20314. $binPath = $this->filesystem->findShortestPath($link, $bin);
  20315. $binDir = ProcessExecutor::escape(dirname($binPath));
  20316. $binFile = basename($binPath);
  20317. $binContents = file_get_contents($bin);
  20318. if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) {
  20319. $proxyCode = $match[1] === null ? '#!/usr/bin/env php' : trim($match[1]);
  20320. $binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true);
  20321. $streamProxyCode = $streamHint = '';
  20322. $globalsCode = '$GLOBALS[\'_composer_bin_dir\'] = __DIR__;'."\n";
  20323. $phpunitHack1 = $phpunitHack2 = '';
  20324. if ($this->vendorDir) {
  20325. $globalsCode .= '$GLOBALS[\'_composer_autoload_path\'] = ' . $this->filesystem->findShortestPathCode($link, $this->vendorDir . '/autoload.php', false, true).";\n";
  20326. }
  20327. if ($this->filesystem->normalizePath($bin) === $this->filesystem->normalizePath($this->vendorDir.'/phpunit/phpunit/phpunit')) {
  20328. $globalsCode .= '$GLOBALS[\'__PHPUNIT_ISOLATION_EXCLUDE_LIST\'] = $GLOBALS[\'__PHPUNIT_ISOLATION_BLACKLIST\'] = array(realpath('.$binPathExported.'));'."\n";
  20329. $phpunitHack1 = "'phpvfscomposer://'.";
  20330. $phpunitHack2 = '
  20331. $data = str_replace(\'__DIR__\', var_export(dirname($this->realpath), true), $data);
  20332. $data = str_replace(\'__FILE__\', var_export($this->realpath, true), $data);';
  20333. }
  20334. if (trim((string) $match[0]) !== '<?php') {
  20335. $streamHint = ' using a stream wrapper to prevent the shebang from being output on PHP<8'."\n *";
  20336. $streamProxyCode = <<<STREAMPROXY
  20337. if (PHP_VERSION_ID < 80000) {
  20338. if (!class_exists('Composer\BinProxyWrapper')) {
  20339. /**
  20340. * @internal
  20341. */
  20342. final class BinProxyWrapper
  20343. {
  20344. private \$handle;
  20345. private \$position;
  20346. private \$realpath;
  20347. public function stream_open(\$path, \$mode, \$options, &\$opened_path)
  20348. {
  20349. // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
  20350. \$opened_path = substr(\$path, 17);
  20351. \$this->realpath = realpath(\$opened_path) ?: \$opened_path;
  20352. \$opened_path = $phpunitHack1\$this->realpath;
  20353. \$this->handle = fopen(\$this->realpath, \$mode);
  20354. \$this->position = 0;
  20355. return (bool) \$this->handle;
  20356. }
  20357. public function stream_read(\$count)
  20358. {
  20359. \$data = fread(\$this->handle, \$count);
  20360. if (\$this->position === 0) {
  20361. \$data = preg_replace('{^#!.*\\r?\\n}', '', \$data);
  20362. }$phpunitHack2
  20363. \$this->position += strlen(\$data);
  20364. return \$data;
  20365. }
  20366. public function stream_cast(\$castAs)
  20367. {
  20368. return \$this->handle;
  20369. }
  20370. public function stream_close()
  20371. {
  20372. fclose(\$this->handle);
  20373. }
  20374. public function stream_lock(\$operation)
  20375. {
  20376. return \$operation ? flock(\$this->handle, \$operation) : true;
  20377. }
  20378. public function stream_seek(\$offset, \$whence)
  20379. {
  20380. if (0 === fseek(\$this->handle, \$offset, \$whence)) {
  20381. \$this->position = ftell(\$this->handle);
  20382. return true;
  20383. }
  20384. return false;
  20385. }
  20386. public function stream_tell()
  20387. {
  20388. return \$this->position;
  20389. }
  20390. public function stream_eof()
  20391. {
  20392. return feof(\$this->handle);
  20393. }
  20394. public function stream_stat()
  20395. {
  20396. return array();
  20397. }
  20398. public function stream_set_option(\$option, \$arg1, \$arg2)
  20399. {
  20400. return true;
  20401. }
  20402. public function url_stat(\$path, \$flags)
  20403. {
  20404. \$path = substr(\$path, 17);
  20405. if (file_exists(\$path)) {
  20406. return stat(\$path);
  20407. }
  20408. return false;
  20409. }
  20410. }
  20411. }
  20412. if (
  20413. (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
  20414. || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
  20415. ) {
  20416. return include("phpvfscomposer://" . $binPathExported);
  20417. }
  20418. }
  20419. STREAMPROXY;
  20420. }
  20421. return $proxyCode . "\n" . <<<PROXY
  20422. <?php
  20423. /**
  20424. * Proxy PHP file generated by Composer
  20425. *
  20426. * This file includes the referenced bin path ($binPath)
  20427. *$streamHint
  20428. * @generated
  20429. */
  20430. namespace Composer;
  20431. $globalsCode
  20432. $streamProxyCode
  20433. return include $binPathExported;
  20434. PROXY;
  20435. }
  20436. return <<<PROXY
  20437. #!/usr/bin/env sh
  20438. # Support bash to support `source` with fallback on $0 if this does not run with bash
  20439. # https://stackoverflow.com/a/35006505/6512
  20440. selfArg="\$BASH_SOURCE"
  20441. if [ -z "\$selfArg" ]; then
  20442. selfArg="\$0"
  20443. fi
  20444. self=\$(realpath \$selfArg 2> /dev/null)
  20445. if [ -z "\$self" ]; then
  20446. self="\$selfArg"
  20447. fi
  20448. dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  20449. if [ -d /proc/cygdrive ]; then
  20450. case \$(which php) in
  20451. \$(readlink -n /proc/cygdrive)/*)
  20452. # We are in Cygwin using Windows php, so the path must be translated
  20453. dir=\$(cygpath -m "\$dir");
  20454. ;;
  20455. esac
  20456. fi
  20457. export COMPOSER_RUNTIME_BIN_DIR="\$(cd "\${self%[/\\\\]*}" > /dev/null; pwd)"
  20458. # If bash is sourcing this file, we have to source the target as well
  20459. bashSource="\$BASH_SOURCE"
  20460. if [ -n "\$bashSource" ]; then
  20461. if [ "\$bashSource" != "\$0" ]; then
  20462. source "\${dir}/$binFile" "\$@"
  20463. return
  20464. fi
  20465. fi
  20466. "\${dir}/$binFile" "\$@"
  20467. PROXY;
  20468. }
  20469. }
  20470. <?php declare(strict_types=1);
  20471. namespace Composer\Installer;
  20472. use Composer\Package\PackageInterface;
  20473. interface BinaryPresenceInterface
  20474. {
  20475. public function ensureBinariesPresence(PackageInterface $package);
  20476. }
  20477. <?php declare(strict_types=1);
  20478. namespace Composer\Installer;
  20479. use Composer\IO\IOInterface;
  20480. use Composer\IO\ConsoleIO;
  20481. use Composer\Package\PackageInterface;
  20482. use Composer\Package\AliasPackage;
  20483. use Composer\Repository\InstalledRepositoryInterface;
  20484. use Composer\DependencyResolver\Operation\OperationInterface;
  20485. use Composer\DependencyResolver\Operation\InstallOperation;
  20486. use Composer\DependencyResolver\Operation\UpdateOperation;
  20487. use Composer\DependencyResolver\Operation\UninstallOperation;
  20488. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  20489. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  20490. use Composer\Downloader\FileDownloader;
  20491. use Composer\EventDispatcher\EventDispatcher;
  20492. use Composer\Util\Loop;
  20493. use Composer\Util\Platform;
  20494. use React\Promise\PromiseInterface;
  20495. use Seld\Signal\SignalHandler;
  20496. class InstallationManager
  20497. {
  20498. private $installers = [];
  20499. private $cache = [];
  20500. private $notifiablePackages = [];
  20501. private $loop;
  20502. private $io;
  20503. private $eventDispatcher;
  20504. private $outputProgress;
  20505. public function __construct(Loop $loop, IOInterface $io, ?EventDispatcher $eventDispatcher = null)
  20506. {
  20507. $this->loop = $loop;
  20508. $this->io = $io;
  20509. $this->eventDispatcher = $eventDispatcher;
  20510. }
  20511. public function reset(): void
  20512. {
  20513. $this->notifiablePackages = [];
  20514. FileDownloader::$downloadMetadata = [];
  20515. }
  20516. public function addInstaller(InstallerInterface $installer): void
  20517. {
  20518. array_unshift($this->installers, $installer);
  20519. $this->cache = [];
  20520. }
  20521. public function removeInstaller(InstallerInterface $installer): void
  20522. {
  20523. if (false !== ($key = array_search($installer, $this->installers, true))) {
  20524. array_splice($this->installers, $key, 1);
  20525. $this->cache = [];
  20526. }
  20527. }
  20528. public function disablePlugins(): void
  20529. {
  20530. foreach ($this->installers as $i => $installer) {
  20531. if (!$installer instanceof PluginInstaller) {
  20532. continue;
  20533. }
  20534. $installer->disablePlugins();
  20535. }
  20536. }
  20537. public function getInstaller(string $type): InstallerInterface
  20538. {
  20539. $type = strtolower($type);
  20540. if (isset($this->cache[$type])) {
  20541. return $this->cache[$type];
  20542. }
  20543. foreach ($this->installers as $installer) {
  20544. if ($installer->supports($type)) {
  20545. return $this->cache[$type] = $installer;
  20546. }
  20547. }
  20548. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  20549. }
  20550. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
  20551. {
  20552. if ($package instanceof AliasPackage) {
  20553. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  20554. }
  20555. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  20556. }
  20557. public function ensureBinariesPresence(PackageInterface $package): void
  20558. {
  20559. try {
  20560. $installer = $this->getInstaller($package->getType());
  20561. } catch (\InvalidArgumentException $e) {
  20562. return;
  20563. }
  20564. if ($installer instanceof BinaryPresenceInterface) {
  20565. $installer->ensureBinariesPresence($package);
  20566. }
  20567. }
  20568. public function execute(InstalledRepositoryInterface $repo, array $operations, bool $devMode = true, bool $runScripts = true, bool $downloadOnly = false): void
  20569. {
  20570. $cleanupPromises = [];
  20571. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) use (&$cleanupPromises) {
  20572. $this->io->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  20573. $this->runCleanup($cleanupPromises);
  20574. $handler->exitWithLastSignal();
  20575. });
  20576. try {
  20577. $batches = [];
  20578. $batch = [];
  20579. foreach ($operations as $index => $operation) {
  20580. if ($operation instanceof UpdateOperation || $operation instanceof InstallOperation) {
  20581. $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
  20582. if ($package->getType() === 'composer-plugin' && ($extra = $package->getExtra()) && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true) {
  20583. if ($batch) {
  20584. $batches[] = $batch;
  20585. }
  20586. $batches[] = [$index => $operation];
  20587. $batch = [];
  20588. continue;
  20589. }
  20590. }
  20591. $batch[$index] = $operation;
  20592. }
  20593. if ($batch) {
  20594. $batches[] = $batch;
  20595. }
  20596. foreach ($batches as $batch) {
  20597. $this->downloadAndExecuteBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts, $downloadOnly, $operations);
  20598. }
  20599. } catch (\Exception $e) {
  20600. $this->runCleanup($cleanupPromises);
  20601. throw $e;
  20602. } finally {
  20603. $signalHandler->unregister();
  20604. }
  20605. if ($downloadOnly) {
  20606. return;
  20607. }
  20608. $repo->write($devMode, $this);
  20609. }
  20610. private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, bool $devMode, bool $runScripts, bool $downloadOnly, array $allOperations): void
  20611. {
  20612. $promises = [];
  20613. foreach ($operations as $index => $operation) {
  20614. $opType = $operation->getOperationType();
  20615. if (!in_array($opType, ['update', 'install', 'uninstall'])) {
  20616. continue;
  20617. }
  20618. if ($opType === 'update') {
  20619. $package = $operation->getTargetPackage();
  20620. $initialPackage = $operation->getInitialPackage();
  20621. } else {
  20622. $package = $operation->getPackage();
  20623. $initialPackage = null;
  20624. }
  20625. $installer = $this->getInstaller($package->getType());
  20626. $cleanupPromises[$index] = static function () use ($opType, $installer, $package, $initialPackage): ?PromiseInterface {
  20627. if (!$package->getInstallationSource()) {
  20628. return \React\Promise\resolve(null);
  20629. }
  20630. return $installer->cleanup($opType, $package, $initialPackage);
  20631. };
  20632. if ($opType !== 'uninstall') {
  20633. $promise = $installer->download($package, $initialPackage);
  20634. if (null !== $promise) {
  20635. $promises[] = $promise;
  20636. }
  20637. }
  20638. }
  20639. if (count($promises)) {
  20640. $this->waitOnPromises($promises);
  20641. }
  20642. if ($downloadOnly) {
  20643. $this->runCleanup($cleanupPromises);
  20644. return;
  20645. }
  20646. $batches = [];
  20647. $batch = [];
  20648. foreach ($operations as $index => $operation) {
  20649. if ($operation instanceof InstallOperation || $operation instanceof UpdateOperation) {
  20650. $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
  20651. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  20652. if ($batch) {
  20653. $batches[] = $batch;
  20654. }
  20655. $batches[] = [$index => $operation];
  20656. $batch = [];
  20657. continue;
  20658. }
  20659. }
  20660. $batch[$index] = $operation;
  20661. }
  20662. if ($batch) {
  20663. $batches[] = $batch;
  20664. }
  20665. foreach ($batches as $batch) {
  20666. $this->executeBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts, $allOperations);
  20667. }
  20668. }
  20669. private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
  20670. {
  20671. $promises = [];
  20672. $postExecCallbacks = [];
  20673. foreach ($operations as $index => $operation) {
  20674. $opType = $operation->getOperationType();
  20675. if (!in_array($opType, ['update', 'install', 'uninstall'])) {
  20676. if ($this->io->isDebug()) {
  20677. $this->io->writeError(' - ' . $operation->show(false));
  20678. }
  20679. $this->{$opType}($repo, $operation);
  20680. continue;
  20681. }
  20682. if ($opType === 'update') {
  20683. $package = $operation->getTargetPackage();
  20684. $initialPackage = $operation->getInitialPackage();
  20685. } else {
  20686. $package = $operation->getPackage();
  20687. $initialPackage = null;
  20688. }
  20689. $installer = $this->getInstaller($package->getType());
  20690. $eventName = [
  20691. 'install' => PackageEvents::PRE_PACKAGE_INSTALL,
  20692. 'update' => PackageEvents::PRE_PACKAGE_UPDATE,
  20693. 'uninstall' => PackageEvents::PRE_PACKAGE_UNINSTALL,
  20694. ][$opType] ?? null;
  20695. if (null !== $eventName && $runScripts && $this->eventDispatcher) {
  20696. $this->eventDispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
  20697. }
  20698. $dispatcher = $this->eventDispatcher;
  20699. $io = $this->io;
  20700. $promise = $installer->prepare($opType, $package, $initialPackage);
  20701. if (!$promise instanceof PromiseInterface) {
  20702. $promise = \React\Promise\resolve(null);
  20703. }
  20704. $promise = $promise->then(function () use ($opType, $repo, $operation) {
  20705. return $this->{$opType}($repo, $operation);
  20706. })->then($cleanupPromises[$index])
  20707. ->then(function () use ($devMode, $repo): void {
  20708. $repo->write($devMode, $this);
  20709. }, static function ($e) use ($opType, $package, $io): void {
  20710. $io->writeError(' <error>' . ucfirst($opType) .' of '.$package->getPrettyName().' failed</error>');
  20711. throw $e;
  20712. });
  20713. $eventName = [
  20714. 'install' => PackageEvents::POST_PACKAGE_INSTALL,
  20715. 'update' => PackageEvents::POST_PACKAGE_UPDATE,
  20716. 'uninstall' => PackageEvents::POST_PACKAGE_UNINSTALL,
  20717. ][$opType] ?? null;
  20718. if (null !== $eventName && $runScripts && $dispatcher) {
  20719. $postExecCallbacks[] = static function () use ($dispatcher, $eventName, $devMode, $repo, $allOperations, $operation): void {
  20720. $dispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
  20721. };
  20722. }
  20723. $promises[] = $promise;
  20724. }
  20725. if (count($promises)) {
  20726. $this->waitOnPromises($promises);
  20727. }
  20728. Platform::workaroundFilesystemIssues();
  20729. foreach ($postExecCallbacks as $cb) {
  20730. $cb();
  20731. }
  20732. }
  20733. private function waitOnPromises(array $promises): void
  20734. {
  20735. $progress = null;
  20736. if (
  20737. $this->outputProgress
  20738. && $this->io instanceof ConsoleIO
  20739. && !Platform::getEnv('CI')
  20740. && !$this->io->isDebug()
  20741. && count($promises) > 1
  20742. ) {
  20743. $progress = $this->io->getProgressBar();
  20744. }
  20745. $this->loop->wait($promises, $progress);
  20746. if ($progress) {
  20747. $progress->clear();
  20748. if (!$this->io->isDecorated()) {
  20749. $this->io->writeError('');
  20750. }
  20751. }
  20752. }
  20753. public function download(PackageInterface $package): ?PromiseInterface
  20754. {
  20755. $installer = $this->getInstaller($package->getType());
  20756. $promise = $installer->cleanup("install", $package);
  20757. return $promise;
  20758. }
  20759. public function install(InstalledRepositoryInterface $repo, InstallOperation $operation): ?PromiseInterface
  20760. {
  20761. $package = $operation->getPackage();
  20762. $installer = $this->getInstaller($package->getType());
  20763. $promise = $installer->install($repo, $package);
  20764. $this->markForNotification($package);
  20765. return $promise;
  20766. }
  20767. public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation): ?PromiseInterface
  20768. {
  20769. $initial = $operation->getInitialPackage();
  20770. $target = $operation->getTargetPackage();
  20771. $initialType = $initial->getType();
  20772. $targetType = $target->getType();
  20773. if ($initialType === $targetType) {
  20774. $installer = $this->getInstaller($initialType);
  20775. $promise = $installer->update($repo, $initial, $target);
  20776. $this->markForNotification($target);
  20777. } else {
  20778. $promise = $this->getInstaller($initialType)->uninstall($repo, $initial);
  20779. if (!$promise instanceof PromiseInterface) {
  20780. $promise = \React\Promise\resolve(null);
  20781. }
  20782. $installer = $this->getInstaller($targetType);
  20783. $promise = $promise->then(static function () use ($installer, $repo, $target): PromiseInterface {
  20784. $promise = $installer->install($repo, $target);
  20785. if ($promise instanceof PromiseInterface) {
  20786. return $promise;
  20787. }
  20788. return \React\Promise\resolve(null);
  20789. });
  20790. }
  20791. return $promise;
  20792. }
  20793. public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation): ?PromiseInterface
  20794. {
  20795. $package = $operation->getPackage();
  20796. $installer = $this->getInstaller($package->getType());
  20797. return $installer->uninstall($repo, $package);
  20798. }
  20799. public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void
  20800. {
  20801. $package = $operation->getPackage();
  20802. if (!$repo->hasPackage($package)) {
  20803. $repo->addPackage(clone $package);
  20804. }
  20805. }
  20806. public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void
  20807. {
  20808. $package = $operation->getPackage();
  20809. $repo->removePackage($package);
  20810. }
  20811. public function getInstallPath(PackageInterface $package): ?string
  20812. {
  20813. $installer = $this->getInstaller($package->getType());
  20814. return $installer->getInstallPath($package);
  20815. }
  20816. public function setOutputProgress(bool $outputProgress): void
  20817. {
  20818. $this->outputProgress = $outputProgress;
  20819. }
  20820. public function notifyInstalls(IOInterface $io): void
  20821. {
  20822. $promises = [];
  20823. try {
  20824. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  20825. if (strpos($repoUrl, '%package%')) {
  20826. foreach ($packages as $package) {
  20827. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  20828. $params = [
  20829. 'version' => $package->getPrettyVersion(),
  20830. 'version_normalized' => $package->getVersion(),
  20831. ];
  20832. $opts = [
  20833. 'retry-auth-failure' => false,
  20834. 'http' => [
  20835. 'method' => 'POST',
  20836. 'header' => ['Content-type: application/x-www-form-urlencoded'],
  20837. 'content' => http_build_query($params, '', '&'),
  20838. 'timeout' => 3,
  20839. ],
  20840. ];
  20841. $promises[] = $this->loop->getHttpDownloader()->add($url, $opts);
  20842. }
  20843. continue;
  20844. }
  20845. $postData = ['downloads' => []];
  20846. foreach ($packages as $package) {
  20847. $packageNotification = [
  20848. 'name' => $package->getPrettyName(),
  20849. 'version' => $package->getVersion(),
  20850. ];
  20851. if (strpos($repoUrl, 'packagist.org/') !== false) {
  20852. if (isset(FileDownloader::$downloadMetadata[$package->getName()])) {
  20853. $packageNotification['downloaded'] = FileDownloader::$downloadMetadata[$package->getName()];
  20854. } else {
  20855. $packageNotification['downloaded'] = false;
  20856. }
  20857. }
  20858. $postData['downloads'][] = $packageNotification;
  20859. }
  20860. $opts = [
  20861. 'retry-auth-failure' => false,
  20862. 'http' => [
  20863. 'method' => 'POST',
  20864. 'header' => ['Content-Type: application/json'],
  20865. 'content' => json_encode($postData),
  20866. 'timeout' => 6,
  20867. ],
  20868. ];
  20869. $promises[] = $this->loop->getHttpDownloader()->add($repoUrl, $opts);
  20870. }
  20871. $this->loop->wait($promises);
  20872. } catch (\Exception $e) {
  20873. }
  20874. $this->reset();
  20875. }
  20876. private function markForNotification(PackageInterface $package): void
  20877. {
  20878. if ($package->getNotificationUrl()) {
  20879. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  20880. }
  20881. }
  20882. private function runCleanup(array $cleanupPromises): void
  20883. {
  20884. $promises = [];
  20885. $this->loop->abortJobs();
  20886. foreach ($cleanupPromises as $cleanup) {
  20887. $promises[] = new \React\Promise\Promise(static function ($resolve) use ($cleanup): void {
  20888. $promise = $cleanup();
  20889. if (!$promise instanceof PromiseInterface) {
  20890. $resolve(null);
  20891. } else {
  20892. $promise->then(static function () use ($resolve): void {
  20893. $resolve(null);
  20894. });
  20895. }
  20896. });
  20897. }
  20898. if (!empty($promises)) {
  20899. $this->loop->wait($promises);
  20900. }
  20901. }
  20902. }
  20903. <?php declare(strict_types=1);
  20904. namespace Composer\Installer;
  20905. use Composer\Composer;
  20906. use Composer\DependencyResolver\Transaction;
  20907. use Composer\EventDispatcher\Event;
  20908. use Composer\IO\IOInterface;
  20909. class InstallerEvent extends Event
  20910. {
  20911. private $composer;
  20912. private $io;
  20913. private $devMode;
  20914. private $executeOperations;
  20915. private $transaction;
  20916. public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, bool $executeOperations, Transaction $transaction)
  20917. {
  20918. parent::__construct($eventName);
  20919. $this->composer = $composer;
  20920. $this->io = $io;
  20921. $this->devMode = $devMode;
  20922. $this->executeOperations = $executeOperations;
  20923. $this->transaction = $transaction;
  20924. }
  20925. public function getComposer(): Composer
  20926. {
  20927. return $this->composer;
  20928. }
  20929. public function getIO(): IOInterface
  20930. {
  20931. return $this->io;
  20932. }
  20933. public function isDevMode(): bool
  20934. {
  20935. return $this->devMode;
  20936. }
  20937. public function isExecutingOperations(): bool
  20938. {
  20939. return $this->executeOperations;
  20940. }
  20941. public function getTransaction(): ?Transaction
  20942. {
  20943. return $this->transaction;
  20944. }
  20945. }
  20946. <?php declare(strict_types=1);
  20947. namespace Composer\Installer;
  20948. class InstallerEvents
  20949. {
  20950. public const PRE_OPERATIONS_EXEC = 'pre-operations-exec';
  20951. }
  20952. <?php declare(strict_types=1);
  20953. namespace Composer\Installer;
  20954. use Composer\Package\PackageInterface;
  20955. use Composer\Repository\InstalledRepositoryInterface;
  20956. use InvalidArgumentException;
  20957. use React\Promise\PromiseInterface;
  20958. interface InstallerInterface
  20959. {
  20960. public function supports(string $packageType);
  20961. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  20962. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null);
  20963. public function prepare(string $type, PackageInterface $package, ?PackageInterface $prevPackage = null);
  20964. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  20965. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  20966. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  20967. public function cleanup(string $type, PackageInterface $package, ?PackageInterface $prevPackage = null);
  20968. public function getInstallPath(PackageInterface $package);
  20969. }
  20970. <?php declare(strict_types=1);
  20971. namespace Composer\Installer;
  20972. use Composer\Composer;
  20973. use Composer\IO\IOInterface;
  20974. use Composer\PartialComposer;
  20975. use Composer\Pcre\Preg;
  20976. use Composer\Repository\InstalledRepositoryInterface;
  20977. use Composer\Package\PackageInterface;
  20978. use Composer\Util\Filesystem;
  20979. use Composer\Util\Silencer;
  20980. use Composer\Util\Platform;
  20981. use React\Promise\PromiseInterface;
  20982. use Composer\Downloader\DownloadManager;
  20983. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  20984. {
  20985. protected $composer;
  20986. protected $vendorDir;
  20987. protected $downloadManager;
  20988. protected $io;
  20989. protected $type;
  20990. protected $filesystem;
  20991. protected $binaryInstaller;
  20992. public function __construct(IOInterface $io, PartialComposer $composer, ?string $type = 'library', ?Filesystem $filesystem = null, ?BinaryInstaller $binaryInstaller = null)
  20993. {
  20994. $this->composer = $composer;
  20995. $this->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
  20996. $this->io = $io;
  20997. $this->type = $type;
  20998. $this->filesystem = $filesystem ?: new Filesystem();
  20999. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  21000. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem, $this->vendorDir);
  21001. }
  21002. public function supports(string $packageType)
  21003. {
  21004. return $packageType === $this->type || null === $this->type;
  21005. }
  21006. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  21007. {
  21008. if (!$repo->hasPackage($package)) {
  21009. return false;
  21010. }
  21011. $installPath = $this->getInstallPath($package);
  21012. if (Filesystem::isReadable($installPath)) {
  21013. return true;
  21014. }
  21015. if (Platform::isWindows() && $this->filesystem->isJunction($installPath)) {
  21016. return true;
  21017. }
  21018. if (is_link($installPath)) {
  21019. if (realpath($installPath) === false) {
  21020. return false;
  21021. }
  21022. return true;
  21023. }
  21024. return false;
  21025. }
  21026. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21027. {
  21028. $this->initializeVendorDir();
  21029. $downloadPath = $this->getInstallPath($package);
  21030. return $this->getDownloadManager()->download($package, $downloadPath, $prevPackage);
  21031. }
  21032. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21033. {
  21034. $this->initializeVendorDir();
  21035. $downloadPath = $this->getInstallPath($package);
  21036. return $this->getDownloadManager()->prepare($type, $package, $downloadPath, $prevPackage);
  21037. }
  21038. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21039. {
  21040. $this->initializeVendorDir();
  21041. $downloadPath = $this->getInstallPath($package);
  21042. return $this->getDownloadManager()->cleanup($type, $package, $downloadPath, $prevPackage);
  21043. }
  21044. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21045. {
  21046. $this->initializeVendorDir();
  21047. $downloadPath = $this->getInstallPath($package);
  21048. if (!Filesystem::isReadable($downloadPath) && $repo->hasPackage($package)) {
  21049. $this->binaryInstaller->removeBinaries($package);
  21050. }
  21051. $promise = $this->installCode($package);
  21052. if (!$promise instanceof PromiseInterface) {
  21053. $promise = \React\Promise\resolve(null);
  21054. }
  21055. $binaryInstaller = $this->binaryInstaller;
  21056. $installPath = $this->getInstallPath($package);
  21057. return $promise->then(static function () use ($binaryInstaller, $installPath, $package, $repo): void {
  21058. $binaryInstaller->installBinaries($package, $installPath);
  21059. if (!$repo->hasPackage($package)) {
  21060. $repo->addPackage(clone $package);
  21061. }
  21062. });
  21063. }
  21064. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21065. {
  21066. if (!$repo->hasPackage($initial)) {
  21067. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  21068. }
  21069. $this->initializeVendorDir();
  21070. $this->binaryInstaller->removeBinaries($initial);
  21071. $promise = $this->updateCode($initial, $target);
  21072. if (!$promise instanceof PromiseInterface) {
  21073. $promise = \React\Promise\resolve(null);
  21074. }
  21075. $binaryInstaller = $this->binaryInstaller;
  21076. $installPath = $this->getInstallPath($target);
  21077. return $promise->then(static function () use ($binaryInstaller, $installPath, $target, $initial, $repo): void {
  21078. $binaryInstaller->installBinaries($target, $installPath);
  21079. $repo->removePackage($initial);
  21080. if (!$repo->hasPackage($target)) {
  21081. $repo->addPackage(clone $target);
  21082. }
  21083. });
  21084. }
  21085. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21086. {
  21087. if (!$repo->hasPackage($package)) {
  21088. throw new \InvalidArgumentException('Package is not installed: '.$package);
  21089. }
  21090. $promise = $this->removeCode($package);
  21091. if (!$promise instanceof PromiseInterface) {
  21092. $promise = \React\Promise\resolve(null);
  21093. }
  21094. $binaryInstaller = $this->binaryInstaller;
  21095. $downloadPath = $this->getPackageBasePath($package);
  21096. $filesystem = $this->filesystem;
  21097. return $promise->then(static function () use ($binaryInstaller, $filesystem, $downloadPath, $package, $repo): void {
  21098. $binaryInstaller->removeBinaries($package);
  21099. $repo->removePackage($package);
  21100. if (strpos($package->getName(), '/')) {
  21101. $packageVendorDir = dirname($downloadPath);
  21102. if (is_dir($packageVendorDir) && $filesystem->isDirEmpty($packageVendorDir)) {
  21103. Silencer::call('rmdir', $packageVendorDir);
  21104. }
  21105. }
  21106. });
  21107. }
  21108. public function getInstallPath(PackageInterface $package)
  21109. {
  21110. $this->initializeVendorDir();
  21111. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  21112. $targetDir = $package->getTargetDir();
  21113. return $basePath . ($targetDir ? '/'.$targetDir : '');
  21114. }
  21115. public function ensureBinariesPresence(PackageInterface $package)
  21116. {
  21117. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  21118. }
  21119. protected function getPackageBasePath(PackageInterface $package)
  21120. {
  21121. $installPath = $this->getInstallPath($package);
  21122. $targetDir = $package->getTargetDir();
  21123. if ($targetDir) {
  21124. return Preg::replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  21125. }
  21126. return $installPath;
  21127. }
  21128. protected function installCode(PackageInterface $package)
  21129. {
  21130. $downloadPath = $this->getInstallPath($package);
  21131. return $this->getDownloadManager()->install($package, $downloadPath);
  21132. }
  21133. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  21134. {
  21135. $initialDownloadPath = $this->getInstallPath($initial);
  21136. $targetDownloadPath = $this->getInstallPath($target);
  21137. if ($targetDownloadPath !== $initialDownloadPath) {
  21138. if (strpos($initialDownloadPath, $targetDownloadPath) === 0
  21139. || strpos($targetDownloadPath, $initialDownloadPath) === 0
  21140. ) {
  21141. $promise = $this->removeCode($initial);
  21142. if (!$promise instanceof PromiseInterface) {
  21143. $promise = \React\Promise\resolve(null);
  21144. }
  21145. return $promise->then(function () use ($target): PromiseInterface {
  21146. $promise = $this->installCode($target);
  21147. if ($promise instanceof PromiseInterface) {
  21148. return $promise;
  21149. }
  21150. return \React\Promise\resolve(null);
  21151. });
  21152. }
  21153. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  21154. }
  21155. return $this->getDownloadManager()->update($initial, $target, $targetDownloadPath);
  21156. }
  21157. protected function removeCode(PackageInterface $package)
  21158. {
  21159. $downloadPath = $this->getPackageBasePath($package);
  21160. return $this->getDownloadManager()->remove($package, $downloadPath);
  21161. }
  21162. protected function initializeVendorDir()
  21163. {
  21164. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  21165. $this->vendorDir = realpath($this->vendorDir);
  21166. }
  21167. protected function getDownloadManager(): DownloadManager
  21168. {
  21169. assert($this->downloadManager instanceof DownloadManager, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance to be able to install/... packages'));
  21170. return $this->downloadManager;
  21171. }
  21172. }
  21173. <?php declare(strict_types=1);
  21174. namespace Composer\Installer;
  21175. use Composer\Repository\InstalledRepositoryInterface;
  21176. use Composer\Package\PackageInterface;
  21177. use Composer\IO\IOInterface;
  21178. use Composer\DependencyResolver\Operation\UpdateOperation;
  21179. use Composer\DependencyResolver\Operation\InstallOperation;
  21180. use Composer\DependencyResolver\Operation\UninstallOperation;
  21181. class MetapackageInstaller implements InstallerInterface
  21182. {
  21183. private $io;
  21184. public function __construct(IOInterface $io)
  21185. {
  21186. $this->io = $io;
  21187. }
  21188. public function supports(string $packageType)
  21189. {
  21190. return $packageType === 'metapackage';
  21191. }
  21192. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  21193. {
  21194. return $repo->hasPackage($package);
  21195. }
  21196. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21197. {
  21198. return \React\Promise\resolve(null);
  21199. }
  21200. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21201. {
  21202. return \React\Promise\resolve(null);
  21203. }
  21204. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21205. {
  21206. return \React\Promise\resolve(null);
  21207. }
  21208. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21209. {
  21210. $this->io->writeError(" - " . InstallOperation::format($package));
  21211. $repo->addPackage(clone $package);
  21212. return \React\Promise\resolve(null);
  21213. }
  21214. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21215. {
  21216. if (!$repo->hasPackage($initial)) {
  21217. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  21218. }
  21219. $this->io->writeError(" - " . UpdateOperation::format($initial, $target));
  21220. $repo->removePackage($initial);
  21221. $repo->addPackage(clone $target);
  21222. return \React\Promise\resolve(null);
  21223. }
  21224. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21225. {
  21226. if (!$repo->hasPackage($package)) {
  21227. throw new \InvalidArgumentException('Package is not installed: '.$package);
  21228. }
  21229. $this->io->writeError(" - " . UninstallOperation::format($package));
  21230. $repo->removePackage($package);
  21231. return \React\Promise\resolve(null);
  21232. }
  21233. public function getInstallPath(PackageInterface $package)
  21234. {
  21235. return null;
  21236. }
  21237. }
  21238. <?php declare(strict_types=1);
  21239. namespace Composer\Installer;
  21240. use Composer\Repository\InstalledRepositoryInterface;
  21241. use Composer\Package\PackageInterface;
  21242. class NoopInstaller implements InstallerInterface
  21243. {
  21244. public function supports(string $packageType)
  21245. {
  21246. return true;
  21247. }
  21248. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  21249. {
  21250. return $repo->hasPackage($package);
  21251. }
  21252. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21253. {
  21254. return \React\Promise\resolve(null);
  21255. }
  21256. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21257. {
  21258. return \React\Promise\resolve(null);
  21259. }
  21260. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21261. {
  21262. return \React\Promise\resolve(null);
  21263. }
  21264. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21265. {
  21266. if (!$repo->hasPackage($package)) {
  21267. $repo->addPackage(clone $package);
  21268. }
  21269. return \React\Promise\resolve(null);
  21270. }
  21271. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21272. {
  21273. if (!$repo->hasPackage($initial)) {
  21274. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  21275. }
  21276. $repo->removePackage($initial);
  21277. if (!$repo->hasPackage($target)) {
  21278. $repo->addPackage(clone $target);
  21279. }
  21280. return \React\Promise\resolve(null);
  21281. }
  21282. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21283. {
  21284. if (!$repo->hasPackage($package)) {
  21285. throw new \InvalidArgumentException('Package is not installed: '.$package);
  21286. }
  21287. $repo->removePackage($package);
  21288. return \React\Promise\resolve(null);
  21289. }
  21290. public function getInstallPath(PackageInterface $package)
  21291. {
  21292. $targetDir = $package->getTargetDir();
  21293. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  21294. }
  21295. }
  21296. <?php declare(strict_types=1);
  21297. namespace Composer\Installer;
  21298. use Composer\Composer;
  21299. use Composer\IO\IOInterface;
  21300. use Composer\DependencyResolver\Operation\OperationInterface;
  21301. use Composer\Repository\RepositoryInterface;
  21302. use Composer\EventDispatcher\Event;
  21303. class PackageEvent extends Event
  21304. {
  21305. private $composer;
  21306. private $io;
  21307. private $devMode;
  21308. private $localRepo;
  21309. private $operations;
  21310. private $operation;
  21311. public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
  21312. {
  21313. parent::__construct($eventName);
  21314. $this->composer = $composer;
  21315. $this->io = $io;
  21316. $this->devMode = $devMode;
  21317. $this->localRepo = $localRepo;
  21318. $this->operations = $operations;
  21319. $this->operation = $operation;
  21320. }
  21321. public function getComposer(): Composer
  21322. {
  21323. return $this->composer;
  21324. }
  21325. public function getIO(): IOInterface
  21326. {
  21327. return $this->io;
  21328. }
  21329. public function isDevMode(): bool
  21330. {
  21331. return $this->devMode;
  21332. }
  21333. public function getLocalRepo(): RepositoryInterface
  21334. {
  21335. return $this->localRepo;
  21336. }
  21337. public function getOperations(): array
  21338. {
  21339. return $this->operations;
  21340. }
  21341. public function getOperation(): OperationInterface
  21342. {
  21343. return $this->operation;
  21344. }
  21345. }
  21346. <?php declare(strict_types=1);
  21347. namespace Composer\Installer;
  21348. class PackageEvents
  21349. {
  21350. public const PRE_PACKAGE_INSTALL = 'pre-package-install';
  21351. public const POST_PACKAGE_INSTALL = 'post-package-install';
  21352. public const PRE_PACKAGE_UPDATE = 'pre-package-update';
  21353. public const POST_PACKAGE_UPDATE = 'post-package-update';
  21354. public const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  21355. public const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  21356. }
  21357. <?php declare(strict_types=1);
  21358. namespace Composer\Installer;
  21359. use Composer\Composer;
  21360. use Composer\IO\IOInterface;
  21361. use Composer\PartialComposer;
  21362. use Composer\Repository\InstalledRepositoryInterface;
  21363. use Composer\Package\PackageInterface;
  21364. use Composer\Plugin\PluginManager;
  21365. use Composer\Util\Filesystem;
  21366. use Composer\Util\Platform;
  21367. use React\Promise\PromiseInterface;
  21368. class PluginInstaller extends LibraryInstaller
  21369. {
  21370. public function __construct(IOInterface $io, PartialComposer $composer, ?Filesystem $fs = null, ?BinaryInstaller $binaryInstaller = null)
  21371. {
  21372. parent::__construct($io, $composer, 'composer-plugin', $fs, $binaryInstaller);
  21373. }
  21374. public function supports(string $packageType)
  21375. {
  21376. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  21377. }
  21378. public function disablePlugins(): void
  21379. {
  21380. $this->getPluginManager()->disablePlugins();
  21381. }
  21382. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21383. {
  21384. if (($type === 'install' || $type === 'update') && !$this->getPluginManager()->arePluginsDisabled('local')) {
  21385. $this->getPluginManager()->isPluginAllowed($package->getName(), false, true === ($package->getExtra()['plugin-optional'] ?? false));
  21386. }
  21387. return parent::prepare($type, $package, $prevPackage);
  21388. }
  21389. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21390. {
  21391. $extra = $package->getExtra();
  21392. if (empty($extra['class'])) {
  21393. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  21394. }
  21395. return parent::download($package, $prevPackage);
  21396. }
  21397. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21398. {
  21399. $promise = parent::install($repo, $package);
  21400. if (!$promise instanceof PromiseInterface) {
  21401. $promise = \React\Promise\resolve(null);
  21402. }
  21403. return $promise->then(function () use ($package, $repo): void {
  21404. try {
  21405. Platform::workaroundFilesystemIssues();
  21406. $this->getPluginManager()->registerPackage($package, true);
  21407. } catch (\Exception $e) {
  21408. $this->rollbackInstall($e, $repo, $package);
  21409. }
  21410. });
  21411. }
  21412. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21413. {
  21414. $promise = parent::update($repo, $initial, $target);
  21415. if (!$promise instanceof PromiseInterface) {
  21416. $promise = \React\Promise\resolve(null);
  21417. }
  21418. return $promise->then(function () use ($initial, $target, $repo): void {
  21419. try {
  21420. Platform::workaroundFilesystemIssues();
  21421. $this->getPluginManager()->deactivatePackage($initial);
  21422. $this->getPluginManager()->registerPackage($target, true);
  21423. } catch (\Exception $e) {
  21424. $this->rollbackInstall($e, $repo, $target);
  21425. }
  21426. });
  21427. }
  21428. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21429. {
  21430. $this->getPluginManager()->uninstallPackage($package);
  21431. return parent::uninstall($repo, $package);
  21432. }
  21433. private function rollbackInstall(\Exception $e, InstalledRepositoryInterface $repo, PackageInterface $package): void
  21434. {
  21435. $this->io->writeError('Plugin initialization failed ('.$e->getMessage().'), uninstalling plugin');
  21436. parent::uninstall($repo, $package);
  21437. throw $e;
  21438. }
  21439. protected function getPluginManager(): PluginManager
  21440. {
  21441. assert($this->composer instanceof Composer, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance.'));
  21442. $pluginManager = $this->composer->getPluginManager();
  21443. return $pluginManager;
  21444. }
  21445. }
  21446. <?php declare(strict_types=1);
  21447. namespace Composer\Installer;
  21448. use React\Promise\PromiseInterface;
  21449. use Composer\Package\PackageInterface;
  21450. use Composer\Downloader\DownloadManager;
  21451. use Composer\Repository\InstalledRepositoryInterface;
  21452. use Composer\Util\Filesystem;
  21453. class ProjectInstaller implements InstallerInterface
  21454. {
  21455. private $installPath;
  21456. private $downloadManager;
  21457. private $filesystem;
  21458. public function __construct(string $installPath, DownloadManager $dm, Filesystem $fs)
  21459. {
  21460. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  21461. $this->downloadManager = $dm;
  21462. $this->filesystem = $fs;
  21463. }
  21464. public function supports(string $packageType): bool
  21465. {
  21466. return true;
  21467. }
  21468. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
  21469. {
  21470. return false;
  21471. }
  21472. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
  21473. {
  21474. $installPath = $this->installPath;
  21475. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  21476. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  21477. }
  21478. if (!is_dir($installPath)) {
  21479. mkdir($installPath, 0777, true);
  21480. }
  21481. return $this->downloadManager->download($package, $installPath, $prevPackage);
  21482. }
  21483. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
  21484. {
  21485. return $this->downloadManager->prepare($type, $package, $this->installPath, $prevPackage);
  21486. }
  21487. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
  21488. {
  21489. return $this->downloadManager->cleanup($type, $package, $this->installPath, $prevPackage);
  21490. }
  21491. public function install(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
  21492. {
  21493. return $this->downloadManager->install($package, $this->installPath);
  21494. }
  21495. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target): ?PromiseInterface
  21496. {
  21497. throw new \InvalidArgumentException("not supported");
  21498. }
  21499. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
  21500. {
  21501. throw new \InvalidArgumentException("not supported");
  21502. }
  21503. public function getInstallPath(PackageInterface $package): string
  21504. {
  21505. return $this->installPath;
  21506. }
  21507. }
  21508. <?php declare(strict_types=1);
  21509. namespace Composer\Installer;
  21510. use Composer\IO\IOInterface;
  21511. use Composer\Package\PackageInterface;
  21512. use Composer\Pcre\Preg;
  21513. use Composer\Repository\InstalledRepository;
  21514. use Symfony\Component\Console\Formatter\OutputFormatter;
  21515. class SuggestedPackagesReporter
  21516. {
  21517. public const MODE_LIST = 1;
  21518. public const MODE_BY_PACKAGE = 2;
  21519. public const MODE_BY_SUGGESTION = 4;
  21520. protected $suggestedPackages = [];
  21521. private $io;
  21522. public function __construct(IOInterface $io)
  21523. {
  21524. $this->io = $io;
  21525. }
  21526. public function getPackages(): array
  21527. {
  21528. return $this->suggestedPackages;
  21529. }
  21530. public function addPackage(string $source, string $target, string $reason): SuggestedPackagesReporter
  21531. {
  21532. $this->suggestedPackages[] = [
  21533. 'source' => $source,
  21534. 'target' => $target,
  21535. 'reason' => $reason,
  21536. ];
  21537. return $this;
  21538. }
  21539. public function addSuggestionsFromPackage(PackageInterface $package): SuggestedPackagesReporter
  21540. {
  21541. $source = $package->getPrettyName();
  21542. foreach ($package->getSuggests() as $target => $reason) {
  21543. $this->addPackage(
  21544. $source,
  21545. $target,
  21546. $reason
  21547. );
  21548. }
  21549. return $this;
  21550. }
  21551. public function output(int $mode, ?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): void
  21552. {
  21553. $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
  21554. $suggesters = [];
  21555. $suggested = [];
  21556. foreach ($suggestedPackages as $suggestion) {
  21557. $suggesters[$suggestion['source']][$suggestion['target']] = $suggestion['reason'];
  21558. $suggested[$suggestion['target']][$suggestion['source']] = $suggestion['reason'];
  21559. }
  21560. ksort($suggesters);
  21561. ksort($suggested);
  21562. if ($mode & self::MODE_LIST) {
  21563. foreach (array_keys($suggested) as $name) {
  21564. $this->io->write(sprintf('<info>%s</info>', $name));
  21565. }
  21566. return;
  21567. }
  21568. if ($mode & self::MODE_BY_PACKAGE) {
  21569. foreach ($suggesters as $suggester => $suggestions) {
  21570. $this->io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  21571. foreach ($suggestions as $suggestion => $reason) {
  21572. $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggestion, $this->escapeOutput($reason)));
  21573. }
  21574. $this->io->write('');
  21575. }
  21576. }
  21577. if ($mode & self::MODE_BY_SUGGESTION) {
  21578. if ($mode & self::MODE_BY_PACKAGE) {
  21579. $this->io->write(str_repeat('-', 78));
  21580. }
  21581. foreach ($suggested as $suggestion => $suggesters) {
  21582. $this->io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  21583. foreach ($suggesters as $suggester => $reason) {
  21584. $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggester, $this->escapeOutput($reason)));
  21585. }
  21586. $this->io->write('');
  21587. }
  21588. }
  21589. if ($onlyDependentsOf) {
  21590. $allSuggestedPackages = $this->getFilteredSuggestions($installedRepo);
  21591. $diff = count($allSuggestedPackages) - count($suggestedPackages);
  21592. if ($diff) {
  21593. $this->io->write('<info>'.$diff.' additional suggestions</info> by transitive dependencies can be shown with <info>--all</info>');
  21594. }
  21595. }
  21596. }
  21597. public function outputMinimalistic(?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): void
  21598. {
  21599. $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
  21600. if ($suggestedPackages) {
  21601. $this->io->writeError('<info>'.count($suggestedPackages).' package suggestions were added by new dependencies, use `composer suggest` to see details.</info>');
  21602. }
  21603. }
  21604. private function getFilteredSuggestions(?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): array
  21605. {
  21606. $suggestedPackages = $this->getPackages();
  21607. $installedNames = [];
  21608. if (null !== $installedRepo && !empty($suggestedPackages)) {
  21609. foreach ($installedRepo->getPackages() as $package) {
  21610. $installedNames = array_merge(
  21611. $installedNames,
  21612. $package->getNames()
  21613. );
  21614. }
  21615. }
  21616. $sourceFilter = [];
  21617. if ($onlyDependentsOf) {
  21618. $sourceFilter = array_map(static function ($link): string {
  21619. return $link->getTarget();
  21620. }, array_merge($onlyDependentsOf->getRequires(), $onlyDependentsOf->getDevRequires()));
  21621. $sourceFilter[] = $onlyDependentsOf->getName();
  21622. }
  21623. $suggestions = [];
  21624. foreach ($suggestedPackages as $suggestion) {
  21625. if (in_array($suggestion['target'], $installedNames) || ($sourceFilter && !in_array($suggestion['source'], $sourceFilter))) {
  21626. continue;
  21627. }
  21628. $suggestions[] = $suggestion;
  21629. }
  21630. return $suggestions;
  21631. }
  21632. private function escapeOutput(string $string): string
  21633. {
  21634. return OutputFormatter::escape(
  21635. $this->removeControlCharacters($string)
  21636. );
  21637. }
  21638. private function removeControlCharacters(string $string): string
  21639. {
  21640. return Preg::replace(
  21641. '/[[:cntrl:]]/',
  21642. '',
  21643. str_replace("\n", ' ', $string)
  21644. );
  21645. }
  21646. }
  21647. <?php declare(strict_types=1);
  21648. namespace Composer\Json;
  21649. use Composer\Pcre\Preg;
  21650. use Composer\Util\Filesystem;
  21651. use JsonSchema\Validator;
  21652. use Seld\JsonLint\JsonParser;
  21653. use Seld\JsonLint\ParsingException;
  21654. use Composer\Util\HttpDownloader;
  21655. use Composer\IO\IOInterface;
  21656. use Composer\Downloader\TransportException;
  21657. class JsonFile
  21658. {
  21659. public const LAX_SCHEMA = 1;
  21660. public const STRICT_SCHEMA = 2;
  21661. public const AUTH_SCHEMA = 3;
  21662. public const JSON_UNESCAPED_SLASHES = 64;
  21663. public const JSON_PRETTY_PRINT = 128;
  21664. public const JSON_UNESCAPED_UNICODE = 256;
  21665. public const COMPOSER_SCHEMA_PATH = __DIR__ . '/../../../res/composer-schema.json';
  21666. public const INDENT_DEFAULT = ' ';
  21667. private $path;
  21668. private $httpDownloader;
  21669. private $io;
  21670. private $indent = self::INDENT_DEFAULT;
  21671. public function __construct(string $path, ?HttpDownloader $httpDownloader = null, ?IOInterface $io = null)
  21672. {
  21673. $this->path = $path;
  21674. if (null === $httpDownloader && Preg::isMatch('{^https?://}i', $path)) {
  21675. throw new \InvalidArgumentException('http urls require a HttpDownloader instance to be passed');
  21676. }
  21677. $this->httpDownloader = $httpDownloader;
  21678. $this->io = $io;
  21679. }
  21680. public function getPath(): string
  21681. {
  21682. return $this->path;
  21683. }
  21684. public function exists(): bool
  21685. {
  21686. return is_file($this->path);
  21687. }
  21688. public function read()
  21689. {
  21690. try {
  21691. if ($this->httpDownloader) {
  21692. $json = $this->httpDownloader->get($this->path)->getBody();
  21693. } else {
  21694. if (!Filesystem::isReadable($this->path)) {
  21695. throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
  21696. }
  21697. if ($this->io && $this->io->isDebug()) {
  21698. $realpathInfo = '';
  21699. $realpath = realpath($this->path);
  21700. if (false !== $realpath && $realpath !== $this->path) {
  21701. $realpathInfo = ' (' . $realpath . ')';
  21702. }
  21703. $this->io->writeError('Reading ' . $this->path . $realpathInfo);
  21704. }
  21705. $json = file_get_contents($this->path);
  21706. }
  21707. } catch (TransportException $e) {
  21708. throw new \RuntimeException($e->getMessage(), 0, $e);
  21709. } catch (\Exception $e) {
  21710. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  21711. }
  21712. if ($json === false) {
  21713. throw new \RuntimeException('Could not read '.$this->path);
  21714. }
  21715. $this->indent = self::detectIndenting($json);
  21716. return static::parseJson($json, $this->path);
  21717. }
  21718. public function write(array $hash, int $options = JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
  21719. {
  21720. if ($this->path === 'php://memory') {
  21721. file_put_contents($this->path, static::encode($hash, $options, $this->indent));
  21722. return;
  21723. }
  21724. $dir = dirname($this->path);
  21725. if (!is_dir($dir)) {
  21726. if (file_exists($dir)) {
  21727. throw new \UnexpectedValueException(
  21728. realpath($dir).' exists and is not a directory.'
  21729. );
  21730. }
  21731. if (!@mkdir($dir, 0777, true)) {
  21732. throw new \UnexpectedValueException(
  21733. $dir.' does not exist and could not be created.'
  21734. );
  21735. }
  21736. }
  21737. $retries = 3;
  21738. while ($retries--) {
  21739. try {
  21740. $this->filePutContentsIfModified($this->path, static::encode($hash, $options, $this->indent). ($options & JSON_PRETTY_PRINT ? "\n" : ''));
  21741. break;
  21742. } catch (\Exception $e) {
  21743. if ($retries > 0) {
  21744. usleep(500000);
  21745. continue;
  21746. }
  21747. throw $e;
  21748. }
  21749. }
  21750. }
  21751. private function filePutContentsIfModified(string $path, string $content)
  21752. {
  21753. $currentContent = @file_get_contents($path);
  21754. if (false === $currentContent || $currentContent !== $content) {
  21755. return file_put_contents($path, $content);
  21756. }
  21757. return 0;
  21758. }
  21759. public function validateSchema(int $schema = self::STRICT_SCHEMA, ?string $schemaFile = null): bool
  21760. {
  21761. if (!Filesystem::isReadable($this->path)) {
  21762. throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
  21763. }
  21764. $content = file_get_contents($this->path);
  21765. $data = json_decode($content);
  21766. if (null === $data && 'null' !== $content) {
  21767. self::validateSyntax($content, $this->path);
  21768. }
  21769. return self::validateJsonSchema($this->path, $data, $schema, $schemaFile);
  21770. }
  21771. public static function validateJsonSchema(string $source, $data, int $schema, ?string $schemaFile = null): bool
  21772. {
  21773. $isComposerSchemaFile = false;
  21774. if (null === $schemaFile) {
  21775. $isComposerSchemaFile = true;
  21776. $schemaFile = self::COMPOSER_SCHEMA_PATH;
  21777. }
  21778. if (false === strpos($schemaFile, '://')) {
  21779. $schemaFile = 'file://' . $schemaFile;
  21780. }
  21781. $schemaData = (object) ['$ref' => $schemaFile];
  21782. if ($schema === self::LAX_SCHEMA) {
  21783. $schemaData->additionalProperties = true;
  21784. $schemaData->required = [];
  21785. } elseif ($schema === self::STRICT_SCHEMA && $isComposerSchemaFile) {
  21786. $schemaData->additionalProperties = false;
  21787. $schemaData->required = ['name', 'description'];
  21788. } elseif ($schema === self::AUTH_SCHEMA && $isComposerSchemaFile) {
  21789. $schemaData = (object) ['$ref' => $schemaFile.'#/properties/config', '$schema' => "https://json-schema.org/draft-04/schema#"];
  21790. }
  21791. $validator = new Validator();
  21792. $validator->check($data, $schemaData);
  21793. if (!$validator->isValid()) {
  21794. $errors = [];
  21795. foreach ((array) $validator->getErrors() as $error) {
  21796. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  21797. }
  21798. throw new JsonValidationException('"'.$source.'" does not match the expected JSON schema', $errors);
  21799. }
  21800. return true;
  21801. }
  21802. public static function encode($data, int $options = 448, string $indent = self::INDENT_DEFAULT): string
  21803. {
  21804. $json = json_encode($data, $options);
  21805. if (false === $json) {
  21806. self::throwEncodeError(json_last_error());
  21807. }
  21808. if (($options & JSON_PRETTY_PRINT) > 0 && $indent !== self::INDENT_DEFAULT ) {
  21809. return Preg::replaceCallback(
  21810. '#^ {4,}#m',
  21811. static function ($match) use ($indent): string {
  21812. return str_repeat($indent, (int)(strlen($match[0] ?? '') / 4));
  21813. },
  21814. $json
  21815. );
  21816. }
  21817. return $json;
  21818. }
  21819. private static function throwEncodeError(int $code): void
  21820. {
  21821. switch ($code) {
  21822. case JSON_ERROR_DEPTH:
  21823. $msg = 'Maximum stack depth exceeded';
  21824. break;
  21825. case JSON_ERROR_STATE_MISMATCH:
  21826. $msg = 'Underflow or the modes mismatch';
  21827. break;
  21828. case JSON_ERROR_CTRL_CHAR:
  21829. $msg = 'Unexpected control character found';
  21830. break;
  21831. case JSON_ERROR_UTF8:
  21832. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  21833. break;
  21834. default:
  21835. $msg = 'Unknown error';
  21836. }
  21837. throw new \RuntimeException('JSON encoding failed: '.$msg);
  21838. }
  21839. public static function parseJson(?string $json, ?string $file = null)
  21840. {
  21841. if (null === $json) {
  21842. return null;
  21843. }
  21844. $data = json_decode($json, true);
  21845. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  21846. self::validateSyntax($json, $file);
  21847. }
  21848. return $data;
  21849. }
  21850. protected static function validateSyntax(string $json, ?string $file = null): bool
  21851. {
  21852. $parser = new JsonParser();
  21853. $result = $parser->lint($json);
  21854. if (null === $result) {
  21855. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  21856. if ($file === null) {
  21857. throw new \UnexpectedValueException('The input is not UTF-8, could not parse as JSON');
  21858. } else {
  21859. throw new \UnexpectedValueException('"' . $file . '" is not UTF-8, could not parse as JSON');
  21860. }
  21861. }
  21862. return true;
  21863. }
  21864. if ($file === null) {
  21865. throw new ParsingException('The input does not contain valid JSON' . "\n" . $result->getMessage(),
  21866. $result->getDetails());
  21867. } else {
  21868. throw new ParsingException('"' . $file . '" does not contain valid JSON' . "\n" . $result->getMessage(),
  21869. $result->getDetails());
  21870. }
  21871. }
  21872. public static function detectIndenting(?string $json): string
  21873. {
  21874. if (Preg::isMatchStrictGroups('#^([ \t]+)"#m', $json ?? '', $match)) {
  21875. return $match[1];
  21876. }
  21877. return self::INDENT_DEFAULT;
  21878. }
  21879. }
  21880. <?php declare(strict_types=1);
  21881. namespace Composer\Json;
  21882. use Composer\Pcre\Preg;
  21883. class JsonFormatter
  21884. {
  21885. public static function format(string $json, bool $unescapeUnicode, bool $unescapeSlashes): string
  21886. {
  21887. $result = '';
  21888. $pos = 0;
  21889. $strLen = strlen($json);
  21890. $indentStr = ' ';
  21891. $newLine = "\n";
  21892. $outOfQuotes = true;
  21893. $buffer = '';
  21894. $noescape = true;
  21895. for ($i = 0; $i < $strLen; $i++) {
  21896. $char = substr($json, $i, 1);
  21897. if ('"' === $char && $noescape) {
  21898. $outOfQuotes = !$outOfQuotes;
  21899. }
  21900. if (!$outOfQuotes) {
  21901. $buffer .= $char;
  21902. $noescape = '\\' === $char ? !$noescape : true;
  21903. continue;
  21904. }
  21905. if ('' !== $buffer) {
  21906. if ($unescapeSlashes) {
  21907. $buffer = str_replace('\\/', '/', $buffer);
  21908. }
  21909. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  21910. $buffer = Preg::replaceCallback('/(\\\\+)u([0-9a-f]{4})/i', static function ($match) {
  21911. assert(is_string($match[1]));
  21912. assert(is_string($match[2]));
  21913. $l = strlen($match[1]);
  21914. if ($l % 2) {
  21915. $code = hexdec($match[2]);
  21916. if (0xD800 <= $code && 0xDFFF >= $code) {
  21917. return $match[0];
  21918. }
  21919. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  21920. pack('H*', $match[2]),
  21921. 'UTF-8',
  21922. 'UCS-2BE'
  21923. );
  21924. }
  21925. return $match[0];
  21926. }, $buffer);
  21927. }
  21928. $result .= $buffer.$char;
  21929. $buffer = '';
  21930. continue;
  21931. }
  21932. if (':' === $char) {
  21933. $char .= ' ';
  21934. } elseif ('}' === $char || ']' === $char) {
  21935. $pos--;
  21936. $prevChar = substr($json, $i - 1, 1);
  21937. if ('{' !== $prevChar && '[' !== $prevChar) {
  21938. $result .= $newLine;
  21939. $result .= str_repeat($indentStr, $pos);
  21940. } else {
  21941. $result = rtrim($result);
  21942. }
  21943. }
  21944. $result .= $char;
  21945. if (',' === $char || '{' === $char || '[' === $char) {
  21946. $result .= $newLine;
  21947. if ('{' === $char || '[' === $char) {
  21948. $pos++;
  21949. }
  21950. $result .= str_repeat($indentStr, $pos);
  21951. }
  21952. }
  21953. return $result;
  21954. }
  21955. }
  21956. <?php declare(strict_types=1);
  21957. namespace Composer\Json;
  21958. use Composer\Pcre\Preg;
  21959. use Composer\Repository\PlatformRepository;
  21960. class JsonManipulator
  21961. {
  21962. private const DEFINES = '(?(DEFINE)
  21963. (?<number> -? (?= [1-9]|0(?!\d) ) \d++ (?:\.\d++)? (?:[eE] [+-]?+ \d++)? )
  21964. (?<boolean> true | false | null )
  21965. (?<string> " (?:[^"\\\\]*+ | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  21966. (?<array> \[ (?: (?&json) \s*+ (?: , (?&json) \s*+ )*+ )?+ \s*+ \] )
  21967. (?<pair> \s*+ (?&string) \s*+ : (?&json) \s*+ )
  21968. (?<object> \{ (?: (?&pair) (?: , (?&pair) )*+ )?+ \s*+ \} )
  21969. (?<json> \s*+ (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  21970. )';
  21971. private $contents;
  21972. private $newline;
  21973. private $indent;
  21974. public function __construct(string $contents)
  21975. {
  21976. $contents = trim($contents);
  21977. if ($contents === '') {
  21978. $contents = '{}';
  21979. }
  21980. if (!Preg::isMatch('#^\{(.*)\}$#s', $contents)) {
  21981. throw new \InvalidArgumentException('The json file must be an object ({})');
  21982. }
  21983. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  21984. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  21985. $this->detectIndenting();
  21986. }
  21987. public function getContents(): string
  21988. {
  21989. return $this->contents . $this->newline;
  21990. }
  21991. public function addLink(string $type, string $package, string $constraint, bool $sortPackages = false): bool
  21992. {
  21993. $decoded = JsonFile::parseJson($this->contents);
  21994. if (!isset($decoded[$type])) {
  21995. return $this->addMainKey($type, [$package => $constraint]);
  21996. }
  21997. $regex = '{'.self::DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  21998. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  21999. if (!Preg::isMatch($regex, $this->contents, $matches)) {
  22000. return false;
  22001. }
  22002. assert(is_string($matches['start']));
  22003. assert(is_string($matches['value']));
  22004. assert(is_string($matches['end']));
  22005. $links = $matches['value'];
  22006. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  22007. $regex = '{'.self::DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  22008. if (Preg::isMatch($regex, $links, $packageMatches)) {
  22009. assert(is_string($packageMatches['package']));
  22010. $existingPackage = $packageMatches['package'];
  22011. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  22012. $links = Preg::replaceCallback('{'.self::DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', static function ($m) use ($existingPackage, $constraint): string {
  22013. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  22014. }, $links);
  22015. } else {
  22016. if (Preg::isMatchStrictGroups('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  22017. $links = Preg::replace(
  22018. '{'.preg_quote($match[1]).'$}',
  22019. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  22020. $links
  22021. );
  22022. } else {
  22023. $links = '{' . $this->newline .
  22024. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  22025. $this->indent . '}';
  22026. }
  22027. }
  22028. if (true === $sortPackages) {
  22029. $requirements = json_decode($links, true);
  22030. $this->sortPackages($requirements);
  22031. $links = $this->format($requirements);
  22032. }
  22033. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  22034. return true;
  22035. }
  22036. private function sortPackages(array &$packages = []): void
  22037. {
  22038. $prefix = static function ($requirement): string {
  22039. if (PlatformRepository::isPlatformPackage($requirement)) {
  22040. return Preg::replace(
  22041. [
  22042. '/^php/',
  22043. '/^hhvm/',
  22044. '/^ext/',
  22045. '/^lib/',
  22046. '/^\D/',
  22047. ],
  22048. [
  22049. '0-$0',
  22050. '1-$0',
  22051. '2-$0',
  22052. '3-$0',
  22053. '4-$0',
  22054. ],
  22055. $requirement
  22056. );
  22057. }
  22058. return '5-'.$requirement;
  22059. };
  22060. uksort($packages, static function ($a, $b) use ($prefix): int {
  22061. return strnatcmp($prefix($a), $prefix($b));
  22062. });
  22063. }
  22064. public function addRepository(string $name, $config, bool $append = true): bool
  22065. {
  22066. return $this->addSubNode('repositories', $name, $config, $append);
  22067. }
  22068. public function removeRepository(string $name): bool
  22069. {
  22070. return $this->removeSubNode('repositories', $name);
  22071. }
  22072. public function addConfigSetting(string $name, $value): bool
  22073. {
  22074. return $this->addSubNode('config', $name, $value);
  22075. }
  22076. public function removeConfigSetting(string $name): bool
  22077. {
  22078. return $this->removeSubNode('config', $name);
  22079. }
  22080. public function addProperty(string $name, $value): bool
  22081. {
  22082. if (strpos($name, 'suggest.') === 0) {
  22083. return $this->addSubNode('suggest', substr($name, 8), $value);
  22084. }
  22085. if (strpos($name, 'extra.') === 0) {
  22086. return $this->addSubNode('extra', substr($name, 6), $value);
  22087. }
  22088. if (strpos($name, 'scripts.') === 0) {
  22089. return $this->addSubNode('scripts', substr($name, 8), $value);
  22090. }
  22091. return $this->addMainKey($name, $value);
  22092. }
  22093. public function removeProperty(string $name): bool
  22094. {
  22095. if (strpos($name, 'suggest.') === 0) {
  22096. return $this->removeSubNode('suggest', substr($name, 8));
  22097. }
  22098. if (strpos($name, 'extra.') === 0) {
  22099. return $this->removeSubNode('extra', substr($name, 6));
  22100. }
  22101. if (strpos($name, 'scripts.') === 0) {
  22102. return $this->removeSubNode('scripts', substr($name, 8));
  22103. }
  22104. return $this->removeMainKey($name);
  22105. }
  22106. public function addSubNode(string $mainNode, string $name, $value, bool $append = true): bool
  22107. {
  22108. $decoded = JsonFile::parseJson($this->contents);
  22109. $subName = null;
  22110. if (in_array($mainNode, ['config', 'extra', 'scripts']) && false !== strpos($name, '.')) {
  22111. [$name, $subName] = explode('.', $name, 2);
  22112. }
  22113. if (!isset($decoded[$mainNode])) {
  22114. if ($subName !== null) {
  22115. $this->addMainKey($mainNode, [$name => [$subName => $value]]);
  22116. } else {
  22117. $this->addMainKey($mainNode, [$name => $value]);
  22118. }
  22119. return true;
  22120. }
  22121. $nodeRegex = '{'.self::DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  22122. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  22123. try {
  22124. if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
  22125. return false;
  22126. }
  22127. } catch (\RuntimeException $e) {
  22128. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  22129. return false;
  22130. }
  22131. throw $e;
  22132. }
  22133. assert(is_string($match['start']));
  22134. assert(is_string($match['content']));
  22135. assert(is_string($match['end']));
  22136. $children = $match['content'];
  22137. if (!@json_decode($children)) {
  22138. return false;
  22139. }
  22140. $childRegex = '{'.self::DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  22141. if (Preg::isMatch($childRegex, $children, $matches)) {
  22142. $children = Preg::replaceCallback($childRegex, function ($matches) use ($subName, $value): string {
  22143. if ($subName !== null && is_string($matches['content'])) {
  22144. $curVal = json_decode($matches['content'], true);
  22145. if (!is_array($curVal)) {
  22146. $curVal = [];
  22147. }
  22148. $curVal[$subName] = $value;
  22149. $value = $curVal;
  22150. }
  22151. return $matches['start'] . $this->format($value, 1) . $matches['end'];
  22152. }, $children);
  22153. } else {
  22154. Preg::match('#^{ (?P<leadingspace>\s*?) (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  22155. $whitespace = '';
  22156. if (!empty($match['trailingspace'])) {
  22157. $whitespace = $match['trailingspace'];
  22158. }
  22159. if (!empty($match['content'])) {
  22160. if ($subName !== null) {
  22161. $value = [$subName => $value];
  22162. }
  22163. if ($append) {
  22164. $children = Preg::replace(
  22165. '#'.$whitespace.'}$#',
  22166. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  22167. $children
  22168. );
  22169. } else {
  22170. $whitespace = '';
  22171. if (!empty($match['leadingspace'])) {
  22172. $whitespace = $match['leadingspace'];
  22173. }
  22174. $children = Preg::replace(
  22175. '#^{'.$whitespace.'#',
  22176. addcslashes('{' . $whitespace . JsonFile::encode($name).': '.$this->format($value, 1) . ',' . $this->newline . $this->indent . $this->indent, '\\$'),
  22177. $children
  22178. );
  22179. }
  22180. } else {
  22181. if ($subName !== null) {
  22182. $value = [$subName => $value];
  22183. }
  22184. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  22185. }
  22186. }
  22187. $this->contents = Preg::replaceCallback($nodeRegex, static function ($m) use ($children): string {
  22188. return $m['start'] . $children . $m['end'];
  22189. }, $this->contents);
  22190. return true;
  22191. }
  22192. public function removeSubNode(string $mainNode, string $name): bool
  22193. {
  22194. $decoded = JsonFile::parseJson($this->contents);
  22195. if (empty($decoded[$mainNode])) {
  22196. return true;
  22197. }
  22198. $nodeRegex = '{'.self::DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  22199. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  22200. try {
  22201. if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
  22202. return false;
  22203. }
  22204. } catch (\RuntimeException $e) {
  22205. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  22206. return false;
  22207. }
  22208. throw $e;
  22209. }
  22210. assert(is_string($match['start']));
  22211. assert(is_string($match['content']));
  22212. assert(is_string($match['end']));
  22213. $children = $match['content'];
  22214. if (!@json_decode($children, true)) {
  22215. return false;
  22216. }
  22217. $subName = null;
  22218. if (in_array($mainNode, ['config', 'extra', 'scripts']) && false !== strpos($name, '.')) {
  22219. [$name, $subName] = explode('.', $name, 2);
  22220. }
  22221. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  22222. return true;
  22223. }
  22224. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  22225. if (Preg::isMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  22226. if (Preg::isMatchAll('{'.self::DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  22227. $bestMatch = '';
  22228. foreach ($matches[0] as $match) {
  22229. assert(is_string($match));
  22230. if (strlen($bestMatch) < strlen($match)) {
  22231. $bestMatch = $match;
  22232. }
  22233. }
  22234. $childrenClean = Preg::replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  22235. if (1 !== $count) {
  22236. $childrenClean = Preg::replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  22237. if (1 !== $count) {
  22238. return false;
  22239. }
  22240. }
  22241. }
  22242. } else {
  22243. $childrenClean = $children;
  22244. }
  22245. if (!isset($childrenClean)) {
  22246. throw new \InvalidArgumentException("JsonManipulator: \$childrenClean is not defined. Please report at https://github.com/composer/composer/issues/new.");
  22247. }
  22248. unset($match);
  22249. Preg::match('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  22250. if (empty($match['content'])) {
  22251. $newline = $this->newline;
  22252. $indent = $this->indent;
  22253. $this->contents = Preg::replaceCallback($nodeRegex, static function ($matches) use ($indent, $newline): string {
  22254. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  22255. }, $this->contents);
  22256. if ($subName !== null) {
  22257. $curVal = json_decode($children, true);
  22258. unset($curVal[$name][$subName]);
  22259. $this->addSubNode($mainNode, $name, $curVal[$name]);
  22260. }
  22261. return true;
  22262. }
  22263. $this->contents = Preg::replaceCallback($nodeRegex, function ($matches) use ($name, $subName, $childrenClean): string {
  22264. assert(is_string($matches['content']));
  22265. if ($subName !== null) {
  22266. $curVal = json_decode($matches['content'], true);
  22267. unset($curVal[$name][$subName]);
  22268. $childrenClean = $this->format($curVal);
  22269. }
  22270. return $matches['start'] . $childrenClean . $matches['end'];
  22271. }, $this->contents);
  22272. return true;
  22273. }
  22274. public function addMainKey(string $key, $content): bool
  22275. {
  22276. $decoded = JsonFile::parseJson($this->contents);
  22277. $content = $this->format($content);
  22278. $regex = '{'.self::DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  22279. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  22280. if (isset($decoded[$key]) && Preg::isMatch($regex, $this->contents, $matches)) {
  22281. if (!@json_decode('{'.$matches['key'].'}')) {
  22282. return false;
  22283. }
  22284. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  22285. return true;
  22286. }
  22287. if (Preg::isMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  22288. $this->contents = Preg::replace(
  22289. '#'.$match[1].'\}$#',
  22290. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  22291. $this->contents
  22292. );
  22293. return true;
  22294. }
  22295. $this->contents = Preg::replace(
  22296. '#\}$#',
  22297. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  22298. $this->contents
  22299. );
  22300. return true;
  22301. }
  22302. public function removeMainKey(string $key): bool
  22303. {
  22304. $decoded = JsonFile::parseJson($this->contents);
  22305. if (!array_key_exists($key, $decoded)) {
  22306. return true;
  22307. }
  22308. $regex = '{'.self::DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  22309. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  22310. if (Preg::isMatch($regex, $this->contents, $matches)) {
  22311. assert(is_string($matches['start']));
  22312. assert(is_string($matches['removal']));
  22313. assert(is_string($matches['end']));
  22314. if (!@json_decode('{'.$matches['removal'].'}')) {
  22315. return false;
  22316. }
  22317. if (Preg::isMatchStrictGroups('#,\s*$#', $matches['start']) && Preg::isMatch('#^\}$#', $matches['end'])) {
  22318. $matches['start'] = rtrim(Preg::replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  22319. }
  22320. $this->contents = $matches['start'] . $matches['end'];
  22321. if (Preg::isMatch('#^\{\s*\}\s*$#', $this->contents)) {
  22322. $this->contents = "{\n}";
  22323. }
  22324. return true;
  22325. }
  22326. return false;
  22327. }
  22328. public function removeMainKeyIfEmpty(string $key): bool
  22329. {
  22330. $decoded = JsonFile::parseJson($this->contents);
  22331. if (!array_key_exists($key, $decoded)) {
  22332. return true;
  22333. }
  22334. if (is_array($decoded[$key]) && count($decoded[$key]) === 0) {
  22335. return $this->removeMainKey($key);
  22336. }
  22337. return true;
  22338. }
  22339. public function format($data, int $depth = 0): string
  22340. {
  22341. if (is_array($data)) {
  22342. reset($data);
  22343. if (is_numeric(key($data))) {
  22344. foreach ($data as $key => $val) {
  22345. $data[$key] = $this->format($val, $depth + 1);
  22346. }
  22347. return '['.implode(', ', $data).']';
  22348. }
  22349. $out = '{' . $this->newline;
  22350. $elems = [];
  22351. foreach ($data as $key => $val) {
  22352. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  22353. }
  22354. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  22355. }
  22356. return JsonFile::encode($data);
  22357. }
  22358. protected function detectIndenting(): void
  22359. {
  22360. $this->indent = JsonFile::detectIndenting($this->contents);
  22361. }
  22362. }
  22363. <?php declare(strict_types=1);
  22364. namespace Composer\Json;
  22365. use Exception;
  22366. class JsonValidationException extends Exception
  22367. {
  22368. protected $errors;
  22369. public function __construct(string $message, array $errors = [], ?Exception $previous = null)
  22370. {
  22371. $this->errors = $errors;
  22372. parent::__construct((string) $message, 0, $previous);
  22373. }
  22374. public function getErrors(): array
  22375. {
  22376. return $this->errors;
  22377. }
  22378. }
  22379. <?php declare(strict_types=1);
  22380. namespace Composer\PHPStan;
  22381. use Composer\Config;
  22382. use Composer\Json\JsonFile;
  22383. use PhpParser\Node\Expr\MethodCall;
  22384. use PHPStan\Analyser\Scope;
  22385. use PHPStan\Reflection\MethodReflection;
  22386. use PHPStan\Reflection\ParametersAcceptorSelector;
  22387. use PHPStan\Type\ArrayType;
  22388. use PHPStan\Type\BooleanType;
  22389. use PHPStan\Type\Constant\ConstantArrayType;
  22390. use PHPStan\Type\Constant\ConstantBooleanType;
  22391. use PHPStan\Type\Constant\ConstantStringType;
  22392. use PHPStan\Type\DynamicMethodReturnTypeExtension;
  22393. use PHPStan\Type\IntegerRangeType;
  22394. use PHPStan\Type\IntegerType;
  22395. use PHPStan\Type\MixedType;
  22396. use PHPStan\Type\StringType;
  22397. use PHPStan\Type\Type;
  22398. use PHPStan\Type\TypeCombinator;
  22399. use PHPStan\Type\TypeUtils;
  22400. use PHPStan\Type\UnionType;
  22401. final class ConfigReturnTypeExtension implements DynamicMethodReturnTypeExtension
  22402. {
  22403. private $properties = [];
  22404. public function __construct()
  22405. {
  22406. $schema = JsonFile::parseJson((string) file_get_contents(JsonFile::COMPOSER_SCHEMA_PATH));
  22407. foreach ($schema['properties']['config']['properties'] as $prop => $conf) {
  22408. $type = $this->parseType($conf, $prop);
  22409. $this->properties[$prop] = $type;
  22410. }
  22411. }
  22412. public function getClass(): string
  22413. {
  22414. return Config::class;
  22415. }
  22416. public function isMethodSupported(MethodReflection $methodReflection): bool
  22417. {
  22418. return strtolower($methodReflection->getName()) === 'get';
  22419. }
  22420. public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
  22421. {
  22422. $args = $methodCall->getArgs();
  22423. $defaultReturn = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
  22424. if (count($args) < 1) {
  22425. return $defaultReturn;
  22426. }
  22427. $keyType = $scope->getType($args[0]->value);
  22428. if (method_exists($keyType, 'getConstantStrings')) {
  22429. $strings = $keyType->getConstantStrings();
  22430. } else {
  22431. $strings = TypeUtils::getConstantStrings($keyType);
  22432. }
  22433. if ($strings !== []) {
  22434. $types = [];
  22435. foreach($strings as $string) {
  22436. if (!isset($this->properties[$string->getValue()])) {
  22437. return $defaultReturn;
  22438. }
  22439. $types[] = $this->properties[$string->getValue()];
  22440. }
  22441. return TypeCombinator::union(...$types);
  22442. }
  22443. return $defaultReturn;
  22444. }
  22445. private function parseType(array $def, string $path): Type
  22446. {
  22447. if (isset($def['type'])) {
  22448. $types = [];
  22449. foreach ((array) $def['type'] as $type) {
  22450. switch ($type) {
  22451. case 'integer':
  22452. if (in_array($path, ['process-timeout', 'cache-ttl', 'cache-files-ttl', 'cache-files-maxsize'], true)) {
  22453. $types[] = IntegerRangeType::createAllGreaterThanOrEqualTo(0);
  22454. } else {
  22455. $types[] = new IntegerType();
  22456. }
  22457. break;
  22458. case 'string':
  22459. if ($path === 'cache-files-maxsize') {
  22460. } elseif ($path === 'discard-changes') {
  22461. $types[] = new ConstantStringType('stash');
  22462. } elseif ($path === 'use-parent-dir') {
  22463. $types[] = new ConstantStringType('prompt');
  22464. } elseif ($path === 'store-auths') {
  22465. $types[] = new ConstantStringType('prompt');
  22466. } elseif ($path === 'platform-check') {
  22467. $types[] = new ConstantStringType('php-only');
  22468. } elseif ($path === 'github-protocols') {
  22469. $types[] = new UnionType([new ConstantStringType('git'), new ConstantStringType('https'), new ConstantStringType('ssh'), new ConstantStringType('http')]);
  22470. } elseif (str_starts_with($path, 'preferred-install')) {
  22471. $types[] = new UnionType([new ConstantStringType('source'), new ConstantStringType('dist'), new ConstantStringType('auto')]);
  22472. } else {
  22473. $types[] = new StringType();
  22474. }
  22475. break;
  22476. case 'boolean':
  22477. if ($path === 'platform.additionalProperties') {
  22478. $types[] = new ConstantBooleanType(false);
  22479. } else {
  22480. $types[] = new BooleanType();
  22481. }
  22482. break;
  22483. case 'object':
  22484. $addlPropType = null;
  22485. if (isset($def['additionalProperties'])) {
  22486. $addlPropType = $this->parseType($def['additionalProperties'], $path.'.additionalProperties');
  22487. }
  22488. if (isset($def['properties'])) {
  22489. $keyNames = [];
  22490. $valTypes = [];
  22491. $optionalKeys = [];
  22492. $propIndex = 0;
  22493. foreach ($def['properties'] as $propName => $propdef) {
  22494. $keyNames[] = new ConstantStringType($propName);
  22495. $valType = $this->parseType($propdef, $path.'.'.$propName);
  22496. if (!isset($def['required']) || !in_array($propName, $def['required'], true)) {
  22497. $valType = TypeCombinator::addNull($valType);
  22498. $optionalKeys[] = $propIndex;
  22499. }
  22500. $valTypes[] = $valType;
  22501. $propIndex++;
  22502. }
  22503. if ($addlPropType !== null) {
  22504. $types[] = new ArrayType(TypeCombinator::union(new StringType(), ...$keyNames), TypeCombinator::union($addlPropType, ...$valTypes));
  22505. } else {
  22506. $types[] = new ConstantArrayType($keyNames, $valTypes, [0], $optionalKeys);
  22507. }
  22508. } else {
  22509. $types[] = new ArrayType(new StringType(), $addlPropType ?? new MixedType());
  22510. }
  22511. break;
  22512. case 'array':
  22513. if (isset($def['items'])) {
  22514. $valType = $this->parseType($def['items'], $path.'.items');
  22515. } else {
  22516. $valType = new MixedType();
  22517. }
  22518. $types[] = new ArrayType(new IntegerType(), $valType);
  22519. break;
  22520. default:
  22521. $types[] = new MixedType();
  22522. }
  22523. }
  22524. $type = TypeCombinator::union(...$types);
  22525. } elseif (isset($def['enum'])) {
  22526. $type = TypeCombinator::union(...array_map(static function (string $value): ConstantStringType {
  22527. return new ConstantStringType($value);
  22528. }, $def['enum']));
  22529. } else {
  22530. $type = new MixedType();
  22531. }
  22532. if ($path === 'allow-plugins' && time() < strtotime('2022-07-01')) {
  22533. $type = TypeCombinator::addNull($type);
  22534. }
  22535. if (in_array($path, ['autoloader-suffix', 'gitlab-protocol'], true)) {
  22536. $type = TypeCombinator::addNull($type);
  22537. }
  22538. return $type;
  22539. }
  22540. }
  22541. <?php declare(strict_types=1);
  22542. namespace Composer\PHPStan;
  22543. use Composer\DependencyResolver\Rule;
  22544. use Composer\Package\BasePackage;
  22545. use Composer\Package\Link;
  22546. use Composer\Semver\Constraint\ConstraintInterface;
  22547. use PhpParser\Node\Expr\MethodCall;
  22548. use PHPStan\Analyser\Scope;
  22549. use PHPStan\Reflection\MethodReflection;
  22550. use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
  22551. use PHPStan\Type\Constant\ConstantArrayType;
  22552. use PHPStan\Type\Constant\ConstantStringType;
  22553. use PHPStan\Type\Constant\ConstantIntegerType;
  22554. use PHPStan\Type\DynamicMethodReturnTypeExtension;
  22555. use PHPStan\Type\IntegerType;
  22556. use PHPStan\Type\StringType;
  22557. use PHPStan\Type\Type;
  22558. use PHPStan\Type\ObjectType;
  22559. use PHPStan\Type\TypeCombinator;
  22560. use PhpParser\Node\Identifier;
  22561. final class RuleReasonDataReturnTypeExtension implements DynamicMethodReturnTypeExtension
  22562. {
  22563. public function getClass(): string
  22564. {
  22565. return Rule::class;
  22566. }
  22567. public function isMethodSupported(MethodReflection $methodReflection): bool
  22568. {
  22569. return strtolower($methodReflection->getName()) === 'getreasondata';
  22570. }
  22571. public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
  22572. {
  22573. $reasonType = $scope->getType(new MethodCall($methodCall->var, new Identifier('getReason')));
  22574. $types = [
  22575. Rule::RULE_ROOT_REQUIRE => new ConstantArrayType([new ConstantStringType('packageName'), new ConstantStringType('constraint')], [new StringType, new ObjectType(ConstraintInterface::class)]),
  22576. Rule::RULE_FIXED => new ConstantArrayType([new ConstantStringType('package')], [new ObjectType(BasePackage::class)]),
  22577. Rule::RULE_PACKAGE_CONFLICT => new ObjectType(Link::class),
  22578. Rule::RULE_PACKAGE_REQUIRES => new ObjectType(Link::class),
  22579. Rule::RULE_PACKAGE_SAME_NAME => TypeCombinator::intersect(new StringType, new AccessoryNonEmptyStringType()),
  22580. Rule::RULE_LEARNED => new IntegerType(),
  22581. Rule::RULE_PACKAGE_ALIAS => new ObjectType(BasePackage::class),
  22582. Rule::RULE_PACKAGE_INVERSE_ALIAS => new ObjectType(BasePackage::class),
  22583. ];
  22584. foreach ($types as $const => $type) {
  22585. if ((new ConstantIntegerType($const))->isSuperTypeOf($reasonType)->yes()) {
  22586. return $type;
  22587. }
  22588. }
  22589. return TypeCombinator::union(...$types);
  22590. }
  22591. }
  22592. <?php declare(strict_types=1);
  22593. namespace Composer\Package;
  22594. use Composer\Semver\Constraint\Constraint;
  22595. use Composer\Package\Version\VersionParser;
  22596. class AliasPackage extends BasePackage
  22597. {
  22598. protected $version;
  22599. protected $prettyVersion;
  22600. protected $dev;
  22601. protected $rootPackageAlias = false;
  22602. protected $stability;
  22603. protected $hasSelfVersionRequires = false;
  22604. protected $aliasOf;
  22605. protected $requires;
  22606. protected $devRequires;
  22607. protected $conflicts;
  22608. protected $provides;
  22609. protected $replaces;
  22610. public function __construct(BasePackage $aliasOf, string $version, string $prettyVersion)
  22611. {
  22612. parent::__construct($aliasOf->getName());
  22613. $this->version = $version;
  22614. $this->prettyVersion = $prettyVersion;
  22615. $this->aliasOf = $aliasOf;
  22616. $this->stability = VersionParser::parseStability($version);
  22617. $this->dev = $this->stability === 'dev';
  22618. foreach (Link::$TYPES as $type) {
  22619. $links = $aliasOf->{'get' . ucfirst($type)}();
  22620. $this->{$type} = $this->replaceSelfVersionDependencies($links, $type);
  22621. }
  22622. }
  22623. public function getAliasOf()
  22624. {
  22625. return $this->aliasOf;
  22626. }
  22627. public function getVersion(): string
  22628. {
  22629. return $this->version;
  22630. }
  22631. public function getStability(): string
  22632. {
  22633. return $this->stability;
  22634. }
  22635. public function getPrettyVersion(): string
  22636. {
  22637. return $this->prettyVersion;
  22638. }
  22639. public function isDev(): bool
  22640. {
  22641. return $this->dev;
  22642. }
  22643. public function getRequires(): array
  22644. {
  22645. return $this->requires;
  22646. }
  22647. public function getConflicts(): array
  22648. {
  22649. return $this->conflicts;
  22650. }
  22651. public function getProvides(): array
  22652. {
  22653. return $this->provides;
  22654. }
  22655. public function getReplaces(): array
  22656. {
  22657. return $this->replaces;
  22658. }
  22659. public function getDevRequires(): array
  22660. {
  22661. return $this->devRequires;
  22662. }
  22663. public function setRootPackageAlias(bool $value): void
  22664. {
  22665. $this->rootPackageAlias = $value;
  22666. }
  22667. public function isRootPackageAlias(): bool
  22668. {
  22669. return $this->rootPackageAlias;
  22670. }
  22671. protected function replaceSelfVersionDependencies(array $links, $linkType): array
  22672. {
  22673. $prettyVersion = $this->prettyVersion;
  22674. if ($prettyVersion === VersionParser::DEFAULT_BRANCH_ALIAS) {
  22675. $prettyVersion = $this->aliasOf->getPrettyVersion();
  22676. }
  22677. if (\in_array($linkType, [Link::TYPE_CONFLICT, Link::TYPE_PROVIDE, Link::TYPE_REPLACE], true)) {
  22678. $newLinks = [];
  22679. foreach ($links as $link) {
  22680. if ('self.version' === $link->getPrettyConstraint()) {
  22681. $newLinks[] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
  22682. $constraint->setPrettyString($prettyVersion);
  22683. }
  22684. }
  22685. $links = array_merge($links, $newLinks);
  22686. } else {
  22687. foreach ($links as $index => $link) {
  22688. if ('self.version' === $link->getPrettyConstraint()) {
  22689. if ($linkType === Link::TYPE_REQUIRE) {
  22690. $this->hasSelfVersionRequires = true;
  22691. }
  22692. $links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
  22693. $constraint->setPrettyString($prettyVersion);
  22694. }
  22695. }
  22696. }
  22697. return $links;
  22698. }
  22699. public function hasSelfVersionRequires(): bool
  22700. {
  22701. return $this->hasSelfVersionRequires;
  22702. }
  22703. public function __toString(): string
  22704. {
  22705. return parent::__toString().' ('.($this->rootPackageAlias ? 'root ' : ''). 'alias of '.$this->aliasOf->getVersion().')';
  22706. }
  22707. public function getType(): string
  22708. {
  22709. return $this->aliasOf->getType();
  22710. }
  22711. public function getTargetDir(): ?string
  22712. {
  22713. return $this->aliasOf->getTargetDir();
  22714. }
  22715. public function getExtra(): array
  22716. {
  22717. return $this->aliasOf->getExtra();
  22718. }
  22719. public function setInstallationSource(?string $type): void
  22720. {
  22721. $this->aliasOf->setInstallationSource($type);
  22722. }
  22723. public function getInstallationSource(): ?string
  22724. {
  22725. return $this->aliasOf->getInstallationSource();
  22726. }
  22727. public function getSourceType(): ?string
  22728. {
  22729. return $this->aliasOf->getSourceType();
  22730. }
  22731. public function getSourceUrl(): ?string
  22732. {
  22733. return $this->aliasOf->getSourceUrl();
  22734. }
  22735. public function getSourceUrls(): array
  22736. {
  22737. return $this->aliasOf->getSourceUrls();
  22738. }
  22739. public function getSourceReference(): ?string
  22740. {
  22741. return $this->aliasOf->getSourceReference();
  22742. }
  22743. public function setSourceReference(?string $reference): void
  22744. {
  22745. $this->aliasOf->setSourceReference($reference);
  22746. }
  22747. public function setSourceMirrors(?array $mirrors): void
  22748. {
  22749. $this->aliasOf->setSourceMirrors($mirrors);
  22750. }
  22751. public function getSourceMirrors(): ?array
  22752. {
  22753. return $this->aliasOf->getSourceMirrors();
  22754. }
  22755. public function getDistType(): ?string
  22756. {
  22757. return $this->aliasOf->getDistType();
  22758. }
  22759. public function getDistUrl(): ?string
  22760. {
  22761. return $this->aliasOf->getDistUrl();
  22762. }
  22763. public function getDistUrls(): array
  22764. {
  22765. return $this->aliasOf->getDistUrls();
  22766. }
  22767. public function getDistReference(): ?string
  22768. {
  22769. return $this->aliasOf->getDistReference();
  22770. }
  22771. public function setDistReference(?string $reference): void
  22772. {
  22773. $this->aliasOf->setDistReference($reference);
  22774. }
  22775. public function getDistSha1Checksum(): ?string
  22776. {
  22777. return $this->aliasOf->getDistSha1Checksum();
  22778. }
  22779. public function setTransportOptions(array $options): void
  22780. {
  22781. $this->aliasOf->setTransportOptions($options);
  22782. }
  22783. public function getTransportOptions(): array
  22784. {
  22785. return $this->aliasOf->getTransportOptions();
  22786. }
  22787. public function setDistMirrors(?array $mirrors): void
  22788. {
  22789. $this->aliasOf->setDistMirrors($mirrors);
  22790. }
  22791. public function getDistMirrors(): ?array
  22792. {
  22793. return $this->aliasOf->getDistMirrors();
  22794. }
  22795. public function getAutoload(): array
  22796. {
  22797. return $this->aliasOf->getAutoload();
  22798. }
  22799. public function getDevAutoload(): array
  22800. {
  22801. return $this->aliasOf->getDevAutoload();
  22802. }
  22803. public function getIncludePaths(): array
  22804. {
  22805. return $this->aliasOf->getIncludePaths();
  22806. }
  22807. public function getReleaseDate(): ?\DateTimeInterface
  22808. {
  22809. return $this->aliasOf->getReleaseDate();
  22810. }
  22811. public function getBinaries(): array
  22812. {
  22813. return $this->aliasOf->getBinaries();
  22814. }
  22815. public function getSuggests(): array
  22816. {
  22817. return $this->aliasOf->getSuggests();
  22818. }
  22819. public function getNotificationUrl(): ?string
  22820. {
  22821. return $this->aliasOf->getNotificationUrl();
  22822. }
  22823. public function isDefaultBranch(): bool
  22824. {
  22825. return $this->aliasOf->isDefaultBranch();
  22826. }
  22827. public function setDistUrl(?string $url): void
  22828. {
  22829. $this->aliasOf->setDistUrl($url);
  22830. }
  22831. public function setDistType(?string $type): void
  22832. {
  22833. $this->aliasOf->setDistType($type);
  22834. }
  22835. public function setSourceDistReferences(string $reference): void
  22836. {
  22837. $this->aliasOf->setSourceDistReferences($reference);
  22838. }
  22839. }
  22840. <?php declare(strict_types=1);
  22841. namespace Composer\Package\Archiver;
  22842. use FilterIterator;
  22843. use Iterator;
  22844. use PharData;
  22845. use SplFileInfo;
  22846. class ArchivableFilesFilter extends FilterIterator
  22847. {
  22848. private $dirs = [];
  22849. public function accept(): bool
  22850. {
  22851. $file = $this->getInnerIterator()->current();
  22852. if ($file->isDir()) {
  22853. $this->dirs[] = (string) $file;
  22854. return false;
  22855. }
  22856. return true;
  22857. }
  22858. public function addEmptyDir(PharData $phar, string $sources): void
  22859. {
  22860. foreach ($this->dirs as $filepath) {
  22861. $localname = str_replace($sources . "/", '', $filepath);
  22862. $phar->addEmptyDir($localname);
  22863. }
  22864. }
  22865. }
  22866. <?php declare(strict_types=1);
  22867. namespace Composer\Package\Archiver;
  22868. use Composer\Pcre\Preg;
  22869. use Composer\Util\Filesystem;
  22870. use FilesystemIterator;
  22871. use FilterIterator;
  22872. use Iterator;
  22873. use Symfony\Component\Finder\Finder;
  22874. use Symfony\Component\Finder\SplFileInfo;
  22875. class ArchivableFilesFinder extends FilterIterator
  22876. {
  22877. protected $finder;
  22878. public function __construct(string $sources, array $excludes, bool $ignoreFilters = false)
  22879. {
  22880. $fs = new Filesystem();
  22881. $sources = $fs->normalizePath(realpath($sources));
  22882. if ($ignoreFilters) {
  22883. $filters = [];
  22884. } else {
  22885. $filters = [
  22886. new GitExcludeFilter($sources),
  22887. new ComposerExcludeFilter($sources, $excludes),
  22888. ];
  22889. }
  22890. $this->finder = new Finder();
  22891. $filter = static function (\SplFileInfo $file) use ($sources, $filters, $fs): bool {
  22892. if ($file->isLink() && ($file->getRealPath() === false || strpos($file->getRealPath(), $sources) !== 0)) {
  22893. return false;
  22894. }
  22895. $relativePath = Preg::replace(
  22896. '#^'.preg_quote($sources, '#').'#',
  22897. '',
  22898. $fs->normalizePath($file->getRealPath())
  22899. );
  22900. $exclude = false;
  22901. foreach ($filters as $filter) {
  22902. $exclude = $filter->filter($relativePath, $exclude);
  22903. }
  22904. return !$exclude;
  22905. };
  22906. if (method_exists($filter, 'bindTo')) {
  22907. $filter = $filter->bindTo(null);
  22908. }
  22909. $this->finder
  22910. ->in($sources)
  22911. ->filter($filter)
  22912. ->ignoreVCS(true)
  22913. ->ignoreDotFiles(false)
  22914. ->sortByName();
  22915. parent::__construct($this->finder->getIterator());
  22916. }
  22917. public function accept(): bool
  22918. {
  22919. $current = $this->getInnerIterator()->current();
  22920. if (!$current->isDir()) {
  22921. return true;
  22922. }
  22923. $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS);
  22924. return !$iterator->valid();
  22925. }
  22926. }
  22927. <?php declare(strict_types=1);
  22928. namespace Composer\Package\Archiver;
  22929. use Composer\Downloader\DownloadManager;
  22930. use Composer\Package\RootPackageInterface;
  22931. use Composer\Pcre\Preg;
  22932. use Composer\Util\Filesystem;
  22933. use Composer\Util\Loop;
  22934. use Composer\Util\SyncHelper;
  22935. use Composer\Json\JsonFile;
  22936. use Composer\Package\CompletePackageInterface;
  22937. class ArchiveManager
  22938. {
  22939. protected $downloadManager;
  22940. protected $loop;
  22941. protected $archivers = [];
  22942. protected $overwriteFiles = true;
  22943. public function __construct(DownloadManager $downloadManager, Loop $loop)
  22944. {
  22945. $this->downloadManager = $downloadManager;
  22946. $this->loop = $loop;
  22947. }
  22948. public function addArchiver(ArchiverInterface $archiver): void
  22949. {
  22950. $this->archivers[] = $archiver;
  22951. }
  22952. public function setOverwriteFiles(bool $overwriteFiles): self
  22953. {
  22954. $this->overwriteFiles = $overwriteFiles;
  22955. return $this;
  22956. }
  22957. public function getPackageFilenameParts(CompletePackageInterface $package): array
  22958. {
  22959. $baseName = $package->getArchiveName();
  22960. if (null === $baseName) {
  22961. $baseName = Preg::replace('#[^a-z0-9-_]#i', '-', $package->getName());
  22962. }
  22963. $parts = [
  22964. 'base' => $baseName,
  22965. ];
  22966. $distReference = $package->getDistReference();
  22967. if (null !== $distReference && Preg::isMatch('{^[a-f0-9]{40}$}', $distReference)) {
  22968. $parts['dist_reference'] = $distReference;
  22969. $parts['dist_type'] = $package->getDistType();
  22970. } else {
  22971. $parts['version'] = $package->getPrettyVersion();
  22972. $parts['dist_reference'] = $distReference;
  22973. }
  22974. $sourceReference = $package->getSourceReference();
  22975. if (null !== $sourceReference) {
  22976. $parts['source_reference'] = substr(sha1($sourceReference), 0, 6);
  22977. }
  22978. $parts = array_filter($parts);
  22979. foreach ($parts as $key => $part) {
  22980. $parts[$key] = str_replace('/', '-', $part);
  22981. }
  22982. return $parts;
  22983. }
  22984. public function getPackageFilenameFromParts(array $parts): string
  22985. {
  22986. return implode('-', $parts);
  22987. }
  22988. public function getPackageFilename(CompletePackageInterface $package): string
  22989. {
  22990. return $this->getPackageFilenameFromParts($this->getPackageFilenameParts($package));
  22991. }
  22992. public function archive(CompletePackageInterface $package, string $format, string $targetDir, ?string $fileName = null, bool $ignoreFilters = false): string
  22993. {
  22994. if (empty($format)) {
  22995. throw new \InvalidArgumentException('Format must be specified');
  22996. }
  22997. $usableArchiver = null;
  22998. foreach ($this->archivers as $archiver) {
  22999. if ($archiver->supports($format, $package->getSourceType())) {
  23000. $usableArchiver = $archiver;
  23001. break;
  23002. }
  23003. }
  23004. if (null === $usableArchiver) {
  23005. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  23006. }
  23007. $filesystem = new Filesystem();
  23008. if ($package instanceof RootPackageInterface) {
  23009. $sourcePath = realpath('.');
  23010. } else {
  23011. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  23012. $filesystem->ensureDirectoryExists($sourcePath);
  23013. try {
  23014. $promise = $this->downloadManager->download($package, $sourcePath);
  23015. SyncHelper::await($this->loop, $promise);
  23016. $promise = $this->downloadManager->install($package, $sourcePath);
  23017. SyncHelper::await($this->loop, $promise);
  23018. } catch (\Exception $e) {
  23019. $filesystem->removeDirectory($sourcePath);
  23020. throw $e;
  23021. }
  23022. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  23023. $jsonFile = new JsonFile($composerJsonPath);
  23024. $jsonData = $jsonFile->read();
  23025. if (!empty($jsonData['archive']['name'])) {
  23026. $package->setArchiveName($jsonData['archive']['name']);
  23027. }
  23028. if (!empty($jsonData['archive']['exclude'])) {
  23029. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  23030. }
  23031. }
  23032. }
  23033. $supportedFormats = $this->getSupportedFormats();
  23034. $packageNameParts = null === $fileName ?
  23035. $this->getPackageFilenameParts($package)
  23036. : ['base' => $fileName];
  23037. $packageName = $this->getPackageFilenameFromParts($packageNameParts);
  23038. $excludePatterns = $this->buildExcludePatterns($packageNameParts, $supportedFormats);
  23039. $filesystem->ensureDirectoryExists($targetDir);
  23040. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  23041. $filesystem->ensureDirectoryExists(dirname($target));
  23042. if (!$this->overwriteFiles && file_exists($target)) {
  23043. return $target;
  23044. }
  23045. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  23046. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  23047. $archivePath = $usableArchiver->archive(
  23048. $sourcePath,
  23049. $tempTarget,
  23050. $format,
  23051. array_merge($excludePatterns, $package->getArchiveExcludes()),
  23052. $ignoreFilters
  23053. );
  23054. $filesystem->rename($archivePath, $target);
  23055. if (!$package instanceof RootPackageInterface) {
  23056. $filesystem->removeDirectory($sourcePath);
  23057. }
  23058. $filesystem->remove($tempTarget);
  23059. return $target;
  23060. }
  23061. private function buildExcludePatterns(array $parts, array $formats): array
  23062. {
  23063. $base = $parts['base'];
  23064. if (count($parts) > 1) {
  23065. $base .= '-*';
  23066. }
  23067. $patterns = [];
  23068. foreach ($formats as $format) {
  23069. $patterns[] = "$base.$format";
  23070. }
  23071. return $patterns;
  23072. }
  23073. private function getSupportedFormats(): array
  23074. {
  23075. $formats = [];
  23076. foreach ($this->archivers as $archiver) {
  23077. $items = [];
  23078. switch (get_class($archiver)) {
  23079. case ZipArchiver::class:
  23080. $items = ['zip'];
  23081. break;
  23082. case PharArchiver::class:
  23083. $items = ['zip', 'tar', 'tar.gz', 'tar.bz2'];
  23084. break;
  23085. }
  23086. $formats = array_merge($formats, $items);
  23087. }
  23088. return array_unique($formats);
  23089. }
  23090. }
  23091. <?php declare(strict_types=1);
  23092. namespace Composer\Package\Archiver;
  23093. interface ArchiverInterface
  23094. {
  23095. public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string;
  23096. public function supports(string $format, ?string $sourceType): bool;
  23097. }
  23098. <?php declare(strict_types=1);
  23099. namespace Composer\Package\Archiver;
  23100. use Composer\Pcre\Preg;
  23101. use Symfony\Component\Finder;
  23102. abstract class BaseExcludeFilter
  23103. {
  23104. protected $sourcePath;
  23105. protected $excludePatterns;
  23106. public function __construct(string $sourcePath)
  23107. {
  23108. $this->sourcePath = $sourcePath;
  23109. $this->excludePatterns = [];
  23110. }
  23111. public function filter(string $relativePath, bool $exclude): bool
  23112. {
  23113. foreach ($this->excludePatterns as $patternData) {
  23114. [$pattern, $negate, $stripLeadingSlash] = $patternData;
  23115. if ($stripLeadingSlash) {
  23116. $path = substr($relativePath, 1);
  23117. } else {
  23118. $path = $relativePath;
  23119. }
  23120. try {
  23121. if (Preg::isMatch($pattern, $path)) {
  23122. $exclude = !$negate;
  23123. }
  23124. } catch (\RuntimeException $e) {
  23125. }
  23126. }
  23127. return $exclude;
  23128. }
  23129. protected function parseLines(array $lines, callable $lineParser): array
  23130. {
  23131. return array_filter(
  23132. array_map(
  23133. static function ($line) use ($lineParser) {
  23134. $line = trim($line);
  23135. if (!$line || 0 === strpos($line, '#')) {
  23136. return null;
  23137. }
  23138. return $lineParser($line);
  23139. },
  23140. $lines
  23141. ),
  23142. static function ($pattern): bool {
  23143. return $pattern !== null;
  23144. }
  23145. );
  23146. }
  23147. protected function generatePatterns(array $rules): array
  23148. {
  23149. $patterns = [];
  23150. foreach ($rules as $rule) {
  23151. $patterns[] = $this->generatePattern($rule);
  23152. }
  23153. return $patterns;
  23154. }
  23155. protected function generatePattern(string $rule): array
  23156. {
  23157. $negate = false;
  23158. $pattern = '';
  23159. if ($rule !== '' && $rule[0] === '!') {
  23160. $negate = true;
  23161. $rule = ltrim($rule, '!');
  23162. }
  23163. $firstSlashPosition = strpos($rule, '/');
  23164. if (0 === $firstSlashPosition) {
  23165. $pattern = '^/';
  23166. } elseif (false === $firstSlashPosition || strlen($rule) - 1 === $firstSlashPosition) {
  23167. $pattern = '/';
  23168. }
  23169. $rule = trim($rule, '/');
  23170. $rule = substr(Finder\Glob::toRegex($rule), 2, -2);
  23171. return ['{'.$pattern.$rule.'(?=$|/)}', $negate, false];
  23172. }
  23173. }
  23174. <?php declare(strict_types=1);
  23175. namespace Composer\Package\Archiver;
  23176. class ComposerExcludeFilter extends BaseExcludeFilter
  23177. {
  23178. public function __construct(string $sourcePath, array $excludeRules)
  23179. {
  23180. parent::__construct($sourcePath);
  23181. $this->excludePatterns = $this->generatePatterns($excludeRules);
  23182. }
  23183. }
  23184. <?php declare(strict_types=1);
  23185. namespace Composer\Package\Archiver;
  23186. use Composer\Pcre\Preg;
  23187. class GitExcludeFilter extends BaseExcludeFilter
  23188. {
  23189. public function __construct(string $sourcePath)
  23190. {
  23191. parent::__construct($sourcePath);
  23192. if (file_exists($sourcePath.'/.gitattributes')) {
  23193. $this->excludePatterns = array_merge(
  23194. $this->excludePatterns,
  23195. $this->parseLines(
  23196. file($sourcePath.'/.gitattributes'),
  23197. [$this, 'parseGitAttributesLine']
  23198. )
  23199. );
  23200. }
  23201. }
  23202. public function parseGitAttributesLine(string $line): ?array
  23203. {
  23204. $parts = Preg::split('#\s+#', $line);
  23205. if (count($parts) === 2 && $parts[1] === 'export-ignore') {
  23206. return $this->generatePattern($parts[0]);
  23207. }
  23208. if (count($parts) === 2 && $parts[1] === '-export-ignore') {
  23209. return $this->generatePattern('!'.$parts[0]);
  23210. }
  23211. return null;
  23212. }
  23213. }
  23214. <?php declare(strict_types=1);
  23215. namespace Composer\Package\Archiver;
  23216. class PharArchiver implements ArchiverInterface
  23217. {
  23218. protected static $formats = [
  23219. 'zip' => \Phar::ZIP,
  23220. 'tar' => \Phar::TAR,
  23221. 'tar.gz' => \Phar::TAR,
  23222. 'tar.bz2' => \Phar::TAR,
  23223. ];
  23224. protected static $compressFormats = [
  23225. 'tar.gz' => \Phar::GZ,
  23226. 'tar.bz2' => \Phar::BZ2,
  23227. ];
  23228. public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string
  23229. {
  23230. $sources = realpath($sources);
  23231. if (file_exists($target)) {
  23232. unlink($target);
  23233. }
  23234. try {
  23235. $filename = substr($target, 0, strrpos($target, $format) - 1);
  23236. if (isset(static::$compressFormats[$format])) {
  23237. $target = $filename . '.tar';
  23238. }
  23239. $phar = new \PharData(
  23240. $target,
  23241. \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO,
  23242. '',
  23243. static::$formats[$format]
  23244. );
  23245. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  23246. $filesOnly = new ArchivableFilesFilter($files);
  23247. $phar->buildFromIterator($filesOnly, $sources);
  23248. $filesOnly->addEmptyDir($phar, $sources);
  23249. if (isset(static::$compressFormats[$format])) {
  23250. if (!$phar->canCompress(static::$compressFormats[$format])) {
  23251. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  23252. }
  23253. unlink($target);
  23254. $phar->compress(static::$compressFormats[$format]);
  23255. $target = $filename . '.' . $format;
  23256. }
  23257. return $target;
  23258. } catch (\UnexpectedValueException $e) {
  23259. $message = sprintf(
  23260. "Could not create archive '%s' from '%s': %s",
  23261. $target,
  23262. $sources,
  23263. $e->getMessage()
  23264. );
  23265. throw new \RuntimeException($message, $e->getCode(), $e);
  23266. }
  23267. }
  23268. public function supports(string $format, ?string $sourceType): bool
  23269. {
  23270. return isset(static::$formats[$format]);
  23271. }
  23272. }
  23273. <?php declare(strict_types=1);
  23274. namespace Composer\Package\Archiver;
  23275. use ZipArchive;
  23276. use Composer\Util\Filesystem;
  23277. class ZipArchiver implements ArchiverInterface
  23278. {
  23279. protected static $formats = [
  23280. 'zip' => true,
  23281. ];
  23282. public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string
  23283. {
  23284. $fs = new Filesystem();
  23285. $sourcesRealpath = realpath($sources);
  23286. if (false !== $sourcesRealpath) {
  23287. $sources = $sourcesRealpath;
  23288. }
  23289. unset($sourcesRealpath);
  23290. $sources = $fs->normalizePath($sources);
  23291. $zip = new ZipArchive();
  23292. $res = $zip->open($target, ZipArchive::CREATE);
  23293. if ($res === true) {
  23294. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  23295. foreach ($files as $file) {
  23296. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  23297. $localname = $filepath;
  23298. if (strpos($localname, $sources . '/') === 0) {
  23299. $localname = substr($localname, strlen($sources . '/'));
  23300. }
  23301. if ($file->isDir()) {
  23302. $zip->addEmptyDir($localname);
  23303. } else {
  23304. $zip->addFile($filepath, $localname);
  23305. }
  23306. if (method_exists($zip, 'setExternalAttributesName')) {
  23307. $perms = fileperms($filepath);
  23308. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  23309. }
  23310. }
  23311. if ($zip->close()) {
  23312. return $target;
  23313. }
  23314. }
  23315. $message = sprintf(
  23316. "Could not create archive '%s' from '%s': %s",
  23317. $target,
  23318. $sources,
  23319. $zip->getStatusString()
  23320. );
  23321. throw new \RuntimeException($message);
  23322. }
  23323. public function supports(string $format, ?string $sourceType): bool
  23324. {
  23325. return isset(static::$formats[$format]) && $this->compressionAvailable();
  23326. }
  23327. private function compressionAvailable(): bool
  23328. {
  23329. return class_exists('ZipArchive');
  23330. }
  23331. }
  23332. <?php declare(strict_types=1);
  23333. namespace Composer\Package;
  23334. use Composer\Repository\RepositoryInterface;
  23335. use Composer\Repository\PlatformRepository;
  23336. abstract class BasePackage implements PackageInterface
  23337. {
  23338. public static $supportedLinkTypes = [
  23339. 'require' => ['description' => 'requires', 'method' => Link::TYPE_REQUIRE],
  23340. 'conflict' => ['description' => 'conflicts', 'method' => Link::TYPE_CONFLICT],
  23341. 'provide' => ['description' => 'provides', 'method' => Link::TYPE_PROVIDE],
  23342. 'replace' => ['description' => 'replaces', 'method' => Link::TYPE_REPLACE],
  23343. 'require-dev' => ['description' => 'requires (for development)', 'method' => Link::TYPE_DEV_REQUIRE],
  23344. ];
  23345. public const STABILITY_STABLE = 0;
  23346. public const STABILITY_RC = 5;
  23347. public const STABILITY_BETA = 10;
  23348. public const STABILITY_ALPHA = 15;
  23349. public const STABILITY_DEV = 20;
  23350. public static $stabilities = [
  23351. 'stable' => self::STABILITY_STABLE,
  23352. 'RC' => self::STABILITY_RC,
  23353. 'beta' => self::STABILITY_BETA,
  23354. 'alpha' => self::STABILITY_ALPHA,
  23355. 'dev' => self::STABILITY_DEV,
  23356. ];
  23357. public $id;
  23358. protected $name;
  23359. protected $prettyName;
  23360. protected $repository = null;
  23361. public function __construct(string $name)
  23362. {
  23363. $this->prettyName = $name;
  23364. $this->name = strtolower($name);
  23365. $this->id = -1;
  23366. }
  23367. public function getName(): string
  23368. {
  23369. return $this->name;
  23370. }
  23371. public function getPrettyName(): string
  23372. {
  23373. return $this->prettyName;
  23374. }
  23375. public function getNames($provides = true): array
  23376. {
  23377. $names = [
  23378. $this->getName() => true,
  23379. ];
  23380. if ($provides) {
  23381. foreach ($this->getProvides() as $link) {
  23382. $names[$link->getTarget()] = true;
  23383. }
  23384. }
  23385. foreach ($this->getReplaces() as $link) {
  23386. $names[$link->getTarget()] = true;
  23387. }
  23388. return array_keys($names);
  23389. }
  23390. public function setId(int $id): void
  23391. {
  23392. $this->id = $id;
  23393. }
  23394. public function getId(): int
  23395. {
  23396. return $this->id;
  23397. }
  23398. public function setRepository(RepositoryInterface $repository): void
  23399. {
  23400. if ($this->repository && $repository !== $this->repository) {
  23401. throw new \LogicException(sprintf(
  23402. 'Package "%s" cannot be added to repository "%s" as it is already in repository "%s".',
  23403. $this->getPrettyName(),
  23404. $repository->getRepoName(),
  23405. $this->repository->getRepoName()
  23406. ));
  23407. }
  23408. $this->repository = $repository;
  23409. }
  23410. public function getRepository(): ?RepositoryInterface
  23411. {
  23412. return $this->repository;
  23413. }
  23414. public function isPlatform(): bool
  23415. {
  23416. return $this->getRepository() instanceof PlatformRepository;
  23417. }
  23418. public function getUniqueName(): string
  23419. {
  23420. return $this->getName().'-'.$this->getVersion();
  23421. }
  23422. public function equals(PackageInterface $package): bool
  23423. {
  23424. $self = $this;
  23425. if ($this instanceof AliasPackage) {
  23426. $self = $this->getAliasOf();
  23427. }
  23428. if ($package instanceof AliasPackage) {
  23429. $package = $package->getAliasOf();
  23430. }
  23431. return $package === $self;
  23432. }
  23433. public function __toString(): string
  23434. {
  23435. return $this->getUniqueName();
  23436. }
  23437. public function getPrettyString(): string
  23438. {
  23439. return $this->getPrettyName().' '.$this->getPrettyVersion();
  23440. }
  23441. public function getFullPrettyVersion(bool $truncate = true, int $displayMode = PackageInterface::DISPLAY_SOURCE_REF_IF_DEV): string
  23442. {
  23443. if ($displayMode === PackageInterface::DISPLAY_SOURCE_REF_IF_DEV &&
  23444. (!$this->isDev() || !\in_array($this->getSourceType(), ['hg', 'git']))
  23445. ) {
  23446. return $this->getPrettyVersion();
  23447. }
  23448. switch ($displayMode) {
  23449. case PackageInterface::DISPLAY_SOURCE_REF_IF_DEV:
  23450. case PackageInterface::DISPLAY_SOURCE_REF:
  23451. $reference = $this->getSourceReference();
  23452. break;
  23453. case PackageInterface::DISPLAY_DIST_REF:
  23454. $reference = $this->getDistReference();
  23455. break;
  23456. default:
  23457. throw new \UnexpectedValueException('Display mode '.$displayMode.' is not supported');
  23458. }
  23459. if (null === $reference) {
  23460. return $this->getPrettyVersion();
  23461. }
  23462. if ($truncate && \strlen($reference) === 40 && $this->getSourceType() !== 'svn') {
  23463. return $this->getPrettyVersion() . ' ' . substr($reference, 0, 7);
  23464. }
  23465. return $this->getPrettyVersion() . ' ' . $reference;
  23466. }
  23467. public function getStabilityPriority(): int
  23468. {
  23469. return self::$stabilities[$this->getStability()];
  23470. }
  23471. public function __clone()
  23472. {
  23473. $this->repository = null;
  23474. $this->id = -1;
  23475. }
  23476. public static function packageNameToRegexp(string $allowPattern, string $wrap = '{^%s$}i'): string
  23477. {
  23478. $cleanedAllowPattern = str_replace('\\*', '.*', preg_quote($allowPattern));
  23479. return sprintf($wrap, $cleanedAllowPattern);
  23480. }
  23481. public static function packageNamesToRegexp(array $packageNames, string $wrap = '{^(?:%s)$}iD'): string
  23482. {
  23483. $packageNames = array_map(
  23484. static function ($packageName): string {
  23485. return BasePackage::packageNameToRegexp($packageName, '%s');
  23486. },
  23487. $packageNames
  23488. );
  23489. return sprintf($wrap, implode('|', $packageNames));
  23490. }
  23491. }
  23492. <?php declare(strict_types=1);
  23493. namespace Composer\Package\Comparer;
  23494. use Composer\Util\Platform;
  23495. class Comparer
  23496. {
  23497. private $source;
  23498. private $update;
  23499. private $changed;
  23500. public function setSource(string $source): void
  23501. {
  23502. $this->source = $source;
  23503. }
  23504. public function setUpdate(string $update): void
  23505. {
  23506. $this->update = $update;
  23507. }
  23508. public function getChanged(bool $explicated = false)
  23509. {
  23510. $changed = $this->changed;
  23511. if (!count($changed)) {
  23512. return false;
  23513. }
  23514. if ($explicated) {
  23515. foreach ($changed as $sectionKey => $itemSection) {
  23516. foreach ($itemSection as $itemKey => $item) {
  23517. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  23518. }
  23519. }
  23520. }
  23521. return $changed;
  23522. }
  23523. public function getChangedAsString(bool $toString = false, bool $explicated = false): string
  23524. {
  23525. $changed = $this->getChanged($explicated);
  23526. if (false === $changed) {
  23527. return '';
  23528. }
  23529. $strings = [];
  23530. foreach ($changed as $sectionKey => $itemSection) {
  23531. foreach ($itemSection as $itemKey => $item) {
  23532. $strings[] = $item."\r\n";
  23533. }
  23534. }
  23535. return trim(implode("\r\n", $strings));
  23536. }
  23537. public function doCompare(): void
  23538. {
  23539. $source = [];
  23540. $destination = [];
  23541. $this->changed = [];
  23542. $currentDirectory = Platform::getCwd();
  23543. chdir($this->source);
  23544. $source = $this->doTree('.', $source);
  23545. if (!is_array($source)) {
  23546. return;
  23547. }
  23548. chdir($currentDirectory);
  23549. chdir($this->update);
  23550. $destination = $this->doTree('.', $destination);
  23551. if (!is_array($destination)) {
  23552. exit;
  23553. }
  23554. chdir($currentDirectory);
  23555. foreach ($source as $dir => $value) {
  23556. foreach ($value as $file => $hash) {
  23557. if (isset($destination[$dir][$file])) {
  23558. if ($hash !== $destination[$dir][$file]) {
  23559. $this->changed['changed'][] = $dir.'/'.$file;
  23560. }
  23561. } else {
  23562. $this->changed['removed'][] = $dir.'/'.$file;
  23563. }
  23564. }
  23565. }
  23566. foreach ($destination as $dir => $value) {
  23567. foreach ($value as $file => $hash) {
  23568. if (!isset($source[$dir][$file])) {
  23569. $this->changed['added'][] = $dir.'/'.$file;
  23570. }
  23571. }
  23572. }
  23573. }
  23574. private function doTree(string $dir, array &$array)
  23575. {
  23576. if ($dh = opendir($dir)) {
  23577. while ($file = readdir($dh)) {
  23578. if ($file !== '.' && $file !== '..') {
  23579. if (is_link($dir.'/'.$file)) {
  23580. $array[$dir][$file] = readlink($dir.'/'.$file);
  23581. } elseif (is_dir($dir.'/'.$file)) {
  23582. if (!count($array)) {
  23583. $array[0] = 'Temp';
  23584. }
  23585. if (!$this->doTree($dir.'/'.$file, $array)) {
  23586. return false;
  23587. }
  23588. } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
  23589. $array[$dir][$file] = md5_file($dir.'/'.$file);
  23590. }
  23591. }
  23592. }
  23593. if (count($array) > 1 && isset($array['0'])) {
  23594. unset($array['0']);
  23595. }
  23596. return $array;
  23597. }
  23598. return false;
  23599. }
  23600. }
  23601. <?php declare(strict_types=1);
  23602. namespace Composer\Package;
  23603. class CompleteAliasPackage extends AliasPackage implements CompletePackageInterface
  23604. {
  23605. protected $aliasOf;
  23606. public function __construct(CompletePackage $aliasOf, string $version, string $prettyVersion)
  23607. {
  23608. parent::__construct($aliasOf, $version, $prettyVersion);
  23609. }
  23610. public function getAliasOf()
  23611. {
  23612. return $this->aliasOf;
  23613. }
  23614. public function getScripts(): array
  23615. {
  23616. return $this->aliasOf->getScripts();
  23617. }
  23618. public function setScripts(array $scripts): void
  23619. {
  23620. $this->aliasOf->setScripts($scripts);
  23621. }
  23622. public function getRepositories(): array
  23623. {
  23624. return $this->aliasOf->getRepositories();
  23625. }
  23626. public function setRepositories(array $repositories): void
  23627. {
  23628. $this->aliasOf->setRepositories($repositories);
  23629. }
  23630. public function getLicense(): array
  23631. {
  23632. return $this->aliasOf->getLicense();
  23633. }
  23634. public function setLicense(array $license): void
  23635. {
  23636. $this->aliasOf->setLicense($license);
  23637. }
  23638. public function getKeywords(): array
  23639. {
  23640. return $this->aliasOf->getKeywords();
  23641. }
  23642. public function setKeywords(array $keywords): void
  23643. {
  23644. $this->aliasOf->setKeywords($keywords);
  23645. }
  23646. public function getDescription(): ?string
  23647. {
  23648. return $this->aliasOf->getDescription();
  23649. }
  23650. public function setDescription(?string $description): void
  23651. {
  23652. $this->aliasOf->setDescription($description);
  23653. }
  23654. public function getHomepage(): ?string
  23655. {
  23656. return $this->aliasOf->getHomepage();
  23657. }
  23658. public function setHomepage(?string $homepage): void
  23659. {
  23660. $this->aliasOf->setHomepage($homepage);
  23661. }
  23662. public function getAuthors(): array
  23663. {
  23664. return $this->aliasOf->getAuthors();
  23665. }
  23666. public function setAuthors(array $authors): void
  23667. {
  23668. $this->aliasOf->setAuthors($authors);
  23669. }
  23670. public function getSupport(): array
  23671. {
  23672. return $this->aliasOf->getSupport();
  23673. }
  23674. public function setSupport(array $support): void
  23675. {
  23676. $this->aliasOf->setSupport($support);
  23677. }
  23678. public function getFunding(): array
  23679. {
  23680. return $this->aliasOf->getFunding();
  23681. }
  23682. public function setFunding(array $funding): void
  23683. {
  23684. $this->aliasOf->setFunding($funding);
  23685. }
  23686. public function isAbandoned(): bool
  23687. {
  23688. return $this->aliasOf->isAbandoned();
  23689. }
  23690. public function getReplacementPackage(): ?string
  23691. {
  23692. return $this->aliasOf->getReplacementPackage();
  23693. }
  23694. public function setAbandoned($abandoned): void
  23695. {
  23696. $this->aliasOf->setAbandoned($abandoned);
  23697. }
  23698. public function getArchiveName(): ?string
  23699. {
  23700. return $this->aliasOf->getArchiveName();
  23701. }
  23702. public function setArchiveName(?string $name): void
  23703. {
  23704. $this->aliasOf->setArchiveName($name);
  23705. }
  23706. public function getArchiveExcludes(): array
  23707. {
  23708. return $this->aliasOf->getArchiveExcludes();
  23709. }
  23710. public function setArchiveExcludes(array $excludes): void
  23711. {
  23712. $this->aliasOf->setArchiveExcludes($excludes);
  23713. }
  23714. }
  23715. <?php declare(strict_types=1);
  23716. namespace Composer\Package;
  23717. class CompletePackage extends Package implements CompletePackageInterface
  23718. {
  23719. protected $repositories = [];
  23720. protected $license = [];
  23721. protected $keywords = [];
  23722. protected $authors = [];
  23723. protected $description = null;
  23724. protected $homepage = null;
  23725. protected $scripts = [];
  23726. protected $support = [];
  23727. protected $funding = [];
  23728. protected $abandoned = false;
  23729. protected $archiveName = null;
  23730. protected $archiveExcludes = [];
  23731. public function setScripts(array $scripts): void
  23732. {
  23733. $this->scripts = $scripts;
  23734. }
  23735. public function getScripts(): array
  23736. {
  23737. return $this->scripts;
  23738. }
  23739. public function setRepositories(array $repositories): void
  23740. {
  23741. $this->repositories = $repositories;
  23742. }
  23743. public function getRepositories(): array
  23744. {
  23745. return $this->repositories;
  23746. }
  23747. public function setLicense(array $license): void
  23748. {
  23749. $this->license = $license;
  23750. }
  23751. public function getLicense(): array
  23752. {
  23753. return $this->license;
  23754. }
  23755. public function setKeywords(array $keywords): void
  23756. {
  23757. $this->keywords = $keywords;
  23758. }
  23759. public function getKeywords(): array
  23760. {
  23761. return $this->keywords;
  23762. }
  23763. public function setAuthors(array $authors): void
  23764. {
  23765. $this->authors = $authors;
  23766. }
  23767. public function getAuthors(): array
  23768. {
  23769. return $this->authors;
  23770. }
  23771. public function setDescription(?string $description): void
  23772. {
  23773. $this->description = $description;
  23774. }
  23775. public function getDescription(): ?string
  23776. {
  23777. return $this->description;
  23778. }
  23779. public function setHomepage(?string $homepage): void
  23780. {
  23781. $this->homepage = $homepage;
  23782. }
  23783. public function getHomepage(): ?string
  23784. {
  23785. return $this->homepage;
  23786. }
  23787. public function setSupport(array $support): void
  23788. {
  23789. $this->support = $support;
  23790. }
  23791. public function getSupport(): array
  23792. {
  23793. return $this->support;
  23794. }
  23795. public function setFunding(array $funding): void
  23796. {
  23797. $this->funding = $funding;
  23798. }
  23799. public function getFunding(): array
  23800. {
  23801. return $this->funding;
  23802. }
  23803. public function isAbandoned(): bool
  23804. {
  23805. return (bool) $this->abandoned;
  23806. }
  23807. public function setAbandoned($abandoned): void
  23808. {
  23809. $this->abandoned = $abandoned;
  23810. }
  23811. public function getReplacementPackage(): ?string
  23812. {
  23813. return \is_string($this->abandoned) ? $this->abandoned : null;
  23814. }
  23815. public function setArchiveName(?string $name): void
  23816. {
  23817. $this->archiveName = $name;
  23818. }
  23819. public function getArchiveName(): ?string
  23820. {
  23821. return $this->archiveName;
  23822. }
  23823. public function setArchiveExcludes(array $excludes): void
  23824. {
  23825. $this->archiveExcludes = $excludes;
  23826. }
  23827. public function getArchiveExcludes(): array
  23828. {
  23829. return $this->archiveExcludes;
  23830. }
  23831. }
  23832. <?php declare(strict_types=1);
  23833. namespace Composer\Package;
  23834. interface CompletePackageInterface extends PackageInterface
  23835. {
  23836. public function getScripts(): array;
  23837. public function setScripts(array $scripts): void;
  23838. public function getRepositories(): array;
  23839. public function setRepositories(array $repositories): void;
  23840. public function getLicense(): array;
  23841. public function setLicense(array $license): void;
  23842. public function getKeywords(): array;
  23843. public function setKeywords(array $keywords): void;
  23844. public function getDescription(): ?string;
  23845. public function setDescription(string $description): void;
  23846. public function getHomepage(): ?string;
  23847. public function setHomepage(string $homepage): void;
  23848. public function getAuthors(): array;
  23849. public function setAuthors(array $authors): void;
  23850. public function getSupport(): array;
  23851. public function setSupport(array $support): void;
  23852. public function getFunding(): array;
  23853. public function setFunding(array $funding): void;
  23854. public function isAbandoned(): bool;
  23855. public function getReplacementPackage(): ?string;
  23856. public function setAbandoned($abandoned): void;
  23857. public function getArchiveName(): ?string;
  23858. public function setArchiveName(string $name): void;
  23859. public function getArchiveExcludes(): array;
  23860. public function setArchiveExcludes(array $excludes): void;
  23861. }
  23862. <?php declare(strict_types=1);
  23863. namespace Composer\Package\Dumper;
  23864. use Composer\Package\BasePackage;
  23865. use Composer\Package\PackageInterface;
  23866. use Composer\Package\CompletePackageInterface;
  23867. use Composer\Package\RootPackageInterface;
  23868. class ArrayDumper
  23869. {
  23870. public function dump(PackageInterface $package): array
  23871. {
  23872. $keys = [
  23873. 'binaries' => 'bin',
  23874. 'type',
  23875. 'extra',
  23876. 'installationSource' => 'installation-source',
  23877. 'autoload',
  23878. 'devAutoload' => 'autoload-dev',
  23879. 'notificationUrl' => 'notification-url',
  23880. 'includePaths' => 'include-path',
  23881. ];
  23882. $data = [];
  23883. $data['name'] = $package->getPrettyName();
  23884. $data['version'] = $package->getPrettyVersion();
  23885. $data['version_normalized'] = $package->getVersion();
  23886. if ($package->getTargetDir()) {
  23887. $data['target-dir'] = $package->getTargetDir();
  23888. }
  23889. if ($package->getSourceType()) {
  23890. $data['source']['type'] = $package->getSourceType();
  23891. $data['source']['url'] = $package->getSourceUrl();
  23892. if (null !== ($value = $package->getSourceReference())) {
  23893. $data['source']['reference'] = $value;
  23894. }
  23895. if ($mirrors = $package->getSourceMirrors()) {
  23896. $data['source']['mirrors'] = $mirrors;
  23897. }
  23898. }
  23899. if ($package->getDistType()) {
  23900. $data['dist']['type'] = $package->getDistType();
  23901. $data['dist']['url'] = $package->getDistUrl();
  23902. if (null !== ($value = $package->getDistReference())) {
  23903. $data['dist']['reference'] = $value;
  23904. }
  23905. if (null !== ($value = $package->getDistSha1Checksum())) {
  23906. $data['dist']['shasum'] = $value;
  23907. }
  23908. if ($mirrors = $package->getDistMirrors()) {
  23909. $data['dist']['mirrors'] = $mirrors;
  23910. }
  23911. }
  23912. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  23913. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  23914. foreach ($links as $link) {
  23915. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  23916. }
  23917. ksort($data[$type]);
  23918. }
  23919. }
  23920. if ($packages = $package->getSuggests()) {
  23921. ksort($packages);
  23922. $data['suggest'] = $packages;
  23923. }
  23924. if ($package->getReleaseDate() instanceof \DateTimeInterface) {
  23925. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  23926. }
  23927. if ($package->isDefaultBranch()) {
  23928. $data['default-branch'] = true;
  23929. }
  23930. $data = $this->dumpValues($package, $keys, $data);
  23931. if ($package instanceof CompletePackageInterface) {
  23932. if ($package->getArchiveName()) {
  23933. $data['archive']['name'] = $package->getArchiveName();
  23934. }
  23935. if ($package->getArchiveExcludes()) {
  23936. $data['archive']['exclude'] = $package->getArchiveExcludes();
  23937. }
  23938. $keys = [
  23939. 'scripts',
  23940. 'license',
  23941. 'authors',
  23942. 'description',
  23943. 'homepage',
  23944. 'keywords',
  23945. 'repositories',
  23946. 'support',
  23947. 'funding',
  23948. ];
  23949. $data = $this->dumpValues($package, $keys, $data);
  23950. if (isset($data['keywords']) && \is_array($data['keywords'])) {
  23951. sort($data['keywords']);
  23952. }
  23953. if ($package->isAbandoned()) {
  23954. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  23955. }
  23956. }
  23957. if ($package instanceof RootPackageInterface) {
  23958. $minimumStability = $package->getMinimumStability();
  23959. if ($minimumStability) {
  23960. $data['minimum-stability'] = $minimumStability;
  23961. }
  23962. }
  23963. if (\count($package->getTransportOptions()) > 0) {
  23964. $data['transport-options'] = $package->getTransportOptions();
  23965. }
  23966. return $data;
  23967. }
  23968. private function dumpValues(PackageInterface $package, array $keys, array $data): array
  23969. {
  23970. foreach ($keys as $method => $key) {
  23971. if (is_numeric($method)) {
  23972. $method = $key;
  23973. }
  23974. $getter = 'get'.ucfirst($method);
  23975. $value = $package->{$getter}();
  23976. if (null !== $value && !(\is_array($value) && 0 === \count($value))) {
  23977. $data[$key] = $value;
  23978. }
  23979. }
  23980. return $data;
  23981. }
  23982. }
  23983. <?php declare(strict_types=1);
  23984. namespace Composer\Package;
  23985. use Composer\Semver\Constraint\ConstraintInterface;
  23986. class Link
  23987. {
  23988. public const TYPE_REQUIRE = 'requires';
  23989. public const TYPE_DEV_REQUIRE = 'devRequires';
  23990. public const TYPE_PROVIDE = 'provides';
  23991. public const TYPE_CONFLICT = 'conflicts';
  23992. public const TYPE_REPLACE = 'replaces';
  23993. public const TYPE_DOES_NOT_REQUIRE = 'does not require';
  23994. private const TYPE_UNKNOWN = 'relates to';
  23995. public static $TYPES = [
  23996. self::TYPE_REQUIRE,
  23997. self::TYPE_DEV_REQUIRE,
  23998. self::TYPE_PROVIDE,
  23999. self::TYPE_CONFLICT,
  24000. self::TYPE_REPLACE,
  24001. ];
  24002. protected $source;
  24003. protected $target;
  24004. protected $constraint;
  24005. protected $description;
  24006. protected $prettyConstraint;
  24007. public function __construct(
  24008. string $source,
  24009. string $target,
  24010. ConstraintInterface $constraint,
  24011. $description = self::TYPE_UNKNOWN,
  24012. ?string $prettyConstraint = null
  24013. ) {
  24014. $this->source = strtolower($source);
  24015. $this->target = strtolower($target);
  24016. $this->constraint = $constraint;
  24017. $this->description = self::TYPE_DEV_REQUIRE === $description ? 'requires (for development)' : $description;
  24018. $this->prettyConstraint = $prettyConstraint;
  24019. }
  24020. public function getDescription(): string
  24021. {
  24022. return $this->description;
  24023. }
  24024. public function getSource(): string
  24025. {
  24026. return $this->source;
  24027. }
  24028. public function getTarget(): string
  24029. {
  24030. return $this->target;
  24031. }
  24032. public function getConstraint(): ConstraintInterface
  24033. {
  24034. return $this->constraint;
  24035. }
  24036. public function getPrettyConstraint(): string
  24037. {
  24038. if (null === $this->prettyConstraint) {
  24039. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  24040. }
  24041. return $this->prettyConstraint;
  24042. }
  24043. public function __toString(): string
  24044. {
  24045. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  24046. }
  24047. public function getPrettyString(PackageInterface $sourcePackage): string
  24048. {
  24049. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString();
  24050. }
  24051. }
  24052. <?php declare(strict_types=1);
  24053. namespace Composer\Package\Loader;
  24054. use Composer\Package\BasePackage;
  24055. use Composer\Package\CompleteAliasPackage;
  24056. use Composer\Package\CompletePackage;
  24057. use Composer\Package\RootPackage;
  24058. use Composer\Package\PackageInterface;
  24059. use Composer\Package\CompletePackageInterface;
  24060. use Composer\Package\Link;
  24061. use Composer\Package\RootAliasPackage;
  24062. use Composer\Package\Version\VersionParser;
  24063. use Composer\Pcre\Preg;
  24064. class ArrayLoader implements LoaderInterface
  24065. {
  24066. protected $versionParser;
  24067. protected $loadOptions;
  24068. public function __construct(?VersionParser $parser = null, bool $loadOptions = false)
  24069. {
  24070. if (!$parser) {
  24071. $parser = new VersionParser;
  24072. }
  24073. $this->versionParser = $parser;
  24074. $this->loadOptions = $loadOptions;
  24075. }
  24076. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
  24077. {
  24078. if ($class !== 'Composer\Package\CompletePackage' && $class !== 'Composer\Package\RootPackage') {
  24079. trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
  24080. }
  24081. $package = $this->createObject($config, $class);
  24082. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  24083. if (!isset($config[$type]) || !is_array($config[$type])) {
  24084. continue;
  24085. }
  24086. $method = 'set'.ucfirst($opts['method']);
  24087. $package->{$method}(
  24088. $this->parseLinks(
  24089. $package->getName(),
  24090. $package->getPrettyVersion(),
  24091. $opts['method'],
  24092. $config[$type]
  24093. )
  24094. );
  24095. }
  24096. $package = $this->configureObject($package, $config);
  24097. return $package;
  24098. }
  24099. public function loadPackages(array $versions): array
  24100. {
  24101. $packages = [];
  24102. $linkCache = [];
  24103. foreach ($versions as $version) {
  24104. $package = $this->createObject($version, 'Composer\Package\CompletePackage');
  24105. $this->configureCachedLinks($linkCache, $package, $version);
  24106. $package = $this->configureObject($package, $version);
  24107. $packages[] = $package;
  24108. }
  24109. return $packages;
  24110. }
  24111. private function createObject(array $config, string $class): CompletePackage
  24112. {
  24113. if (!isset($config['name'])) {
  24114. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  24115. }
  24116. if (!isset($config['version']) || !is_scalar($config['version'])) {
  24117. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  24118. }
  24119. if (!is_string($config['version'])) {
  24120. $config['version'] = (string) $config['version'];
  24121. }
  24122. if (isset($config['version_normalized']) && is_string($config['version_normalized'])) {
  24123. $version = $config['version_normalized'];
  24124. if ($version === VersionParser::DEFAULT_BRANCH_ALIAS) {
  24125. $version = $this->versionParser->normalize($config['version']);
  24126. }
  24127. } else {
  24128. $version = $this->versionParser->normalize($config['version']);
  24129. }
  24130. return new $class($config['name'], $version, $config['version']);
  24131. }
  24132. private function configureObject(PackageInterface $package, array $config): BasePackage
  24133. {
  24134. if (!$package instanceof CompletePackage) {
  24135. throw new \LogicException('ArrayLoader expects instances of the Composer\Package\CompletePackage class to function correctly');
  24136. }
  24137. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  24138. if (isset($config['target-dir'])) {
  24139. $package->setTargetDir($config['target-dir']);
  24140. }
  24141. if (isset($config['extra']) && \is_array($config['extra'])) {
  24142. $package->setExtra($config['extra']);
  24143. }
  24144. if (isset($config['bin'])) {
  24145. if (!\is_array($config['bin'])) {
  24146. $config['bin'] = [$config['bin']];
  24147. }
  24148. foreach ($config['bin'] as $key => $bin) {
  24149. $config['bin'][$key] = ltrim($bin, '/');
  24150. }
  24151. $package->setBinaries($config['bin']);
  24152. }
  24153. if (isset($config['installation-source'])) {
  24154. $package->setInstallationSource($config['installation-source']);
  24155. }
  24156. if (isset($config['default-branch']) && $config['default-branch'] === true) {
  24157. $package->setIsDefaultBranch(true);
  24158. }
  24159. if (isset($config['source'])) {
  24160. if (!isset($config['source']['type'], $config['source']['url'], $config['source']['reference'])) {
  24161. throw new \UnexpectedValueException(sprintf(
  24162. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  24163. $config['name'],
  24164. json_encode($config['source'])
  24165. ));
  24166. }
  24167. $package->setSourceType($config['source']['type']);
  24168. $package->setSourceUrl($config['source']['url']);
  24169. $package->setSourceReference(isset($config['source']['reference']) ? (string) $config['source']['reference'] : null);
  24170. if (isset($config['source']['mirrors'])) {
  24171. $package->setSourceMirrors($config['source']['mirrors']);
  24172. }
  24173. }
  24174. if (isset($config['dist'])) {
  24175. if (!isset($config['dist']['type'], $config['dist']['url'])) {
  24176. throw new \UnexpectedValueException(sprintf(
  24177. "Package %s's dist key should be specified as ".
  24178. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  24179. $config['name'],
  24180. json_encode($config['dist'])
  24181. ));
  24182. }
  24183. $package->setDistType($config['dist']['type']);
  24184. $package->setDistUrl($config['dist']['url']);
  24185. $package->setDistReference(isset($config['dist']['reference']) ? (string) $config['dist']['reference'] : null);
  24186. $package->setDistSha1Checksum($config['dist']['shasum'] ?? null);
  24187. if (isset($config['dist']['mirrors'])) {
  24188. $package->setDistMirrors($config['dist']['mirrors']);
  24189. }
  24190. }
  24191. if (isset($config['suggest']) && \is_array($config['suggest'])) {
  24192. foreach ($config['suggest'] as $target => $reason) {
  24193. if ('self.version' === trim($reason)) {
  24194. $config['suggest'][$target] = $package->getPrettyVersion();
  24195. }
  24196. }
  24197. $package->setSuggests($config['suggest']);
  24198. }
  24199. if (isset($config['autoload'])) {
  24200. $package->setAutoload($config['autoload']);
  24201. }
  24202. if (isset($config['autoload-dev'])) {
  24203. $package->setDevAutoload($config['autoload-dev']);
  24204. }
  24205. if (isset($config['include-path'])) {
  24206. $package->setIncludePaths($config['include-path']);
  24207. }
  24208. if (!empty($config['time'])) {
  24209. $time = Preg::isMatch('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  24210. try {
  24211. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  24212. $package->setReleaseDate($date);
  24213. } catch (\Exception $e) {
  24214. }
  24215. }
  24216. if (!empty($config['notification-url'])) {
  24217. $package->setNotificationUrl($config['notification-url']);
  24218. }
  24219. if ($package instanceof CompletePackageInterface) {
  24220. if (!empty($config['archive']['name'])) {
  24221. $package->setArchiveName($config['archive']['name']);
  24222. }
  24223. if (!empty($config['archive']['exclude'])) {
  24224. $package->setArchiveExcludes($config['archive']['exclude']);
  24225. }
  24226. if (isset($config['scripts']) && \is_array($config['scripts'])) {
  24227. foreach ($config['scripts'] as $event => $listeners) {
  24228. $config['scripts'][$event] = (array) $listeners;
  24229. }
  24230. foreach (['composer', 'php', 'putenv'] as $reserved) {
  24231. if (isset($config['scripts'][$reserved])) {
  24232. trigger_error('The `'.$reserved.'` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  24233. }
  24234. }
  24235. $package->setScripts($config['scripts']);
  24236. }
  24237. if (!empty($config['description']) && \is_string($config['description'])) {
  24238. $package->setDescription($config['description']);
  24239. }
  24240. if (!empty($config['homepage']) && \is_string($config['homepage'])) {
  24241. $package->setHomepage($config['homepage']);
  24242. }
  24243. if (!empty($config['keywords']) && \is_array($config['keywords'])) {
  24244. $package->setKeywords(array_map('strval', $config['keywords']));
  24245. }
  24246. if (!empty($config['license'])) {
  24247. $package->setLicense(\is_array($config['license']) ? $config['license'] : [$config['license']]);
  24248. }
  24249. if (!empty($config['authors']) && \is_array($config['authors'])) {
  24250. $package->setAuthors($config['authors']);
  24251. }
  24252. if (isset($config['support']) && \is_array($config['support'])) {
  24253. $package->setSupport($config['support']);
  24254. }
  24255. if (!empty($config['funding']) && \is_array($config['funding'])) {
  24256. $package->setFunding($config['funding']);
  24257. }
  24258. if (isset($config['abandoned'])) {
  24259. $package->setAbandoned($config['abandoned']);
  24260. }
  24261. }
  24262. if ($this->loadOptions && isset($config['transport-options'])) {
  24263. $package->setTransportOptions($config['transport-options']);
  24264. }
  24265. if ($aliasNormalized = $this->getBranchAlias($config)) {
  24266. $prettyAlias = Preg::replace('{(\.9{7})+}', '.x', $aliasNormalized);
  24267. if ($package instanceof RootPackage) {
  24268. return new RootAliasPackage($package, $aliasNormalized, $prettyAlias);
  24269. }
  24270. return new CompleteAliasPackage($package, $aliasNormalized, $prettyAlias);
  24271. }
  24272. return $package;
  24273. }
  24274. private function configureCachedLinks(array &$linkCache, PackageInterface $package, array $config): void
  24275. {
  24276. $name = $package->getName();
  24277. $prettyVersion = $package->getPrettyVersion();
  24278. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  24279. if (isset($config[$type])) {
  24280. $method = 'set'.ucfirst($opts['method']);
  24281. $links = [];
  24282. foreach ($config[$type] as $prettyTarget => $constraint) {
  24283. $target = strtolower($prettyTarget);
  24284. if ($target === $name) {
  24285. continue;
  24286. }
  24287. if ($constraint === 'self.version') {
  24288. $links[$target] = $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint);
  24289. } else {
  24290. if (!isset($linkCache[$name][$type][$target][$constraint])) {
  24291. $linkCache[$name][$type][$target][$constraint] = [$target, $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint)];
  24292. }
  24293. [$target, $link] = $linkCache[$name][$type][$target][$constraint];
  24294. $links[$target] = $link;
  24295. }
  24296. }
  24297. $package->{$method}($links);
  24298. }
  24299. }
  24300. }
  24301. public function parseLinks(string $source, string $sourceVersion, string $description, array $links): array
  24302. {
  24303. $res = [];
  24304. foreach ($links as $target => $constraint) {
  24305. if (!is_string($constraint)) {
  24306. continue;
  24307. }
  24308. $target = strtolower((string) $target);
  24309. $res[$target] = $this->createLink($source, $sourceVersion, $description, $target, $constraint);
  24310. }
  24311. return $res;
  24312. }
  24313. private function createLink(string $source, string $sourceVersion, string $description, string $target, string $prettyConstraint): Link
  24314. {
  24315. if (!\is_string($prettyConstraint)) {
  24316. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')');
  24317. }
  24318. if ('self.version' === $prettyConstraint) {
  24319. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  24320. } else {
  24321. $parsedConstraint = $this->versionParser->parseConstraints($prettyConstraint);
  24322. }
  24323. return new Link($source, $target, $parsedConstraint, $description, $prettyConstraint);
  24324. }
  24325. public function getBranchAlias(array $config): ?string
  24326. {
  24327. if (!isset($config['version']) || !is_scalar($config['version'])) {
  24328. throw new \UnexpectedValueException('no/invalid version defined');
  24329. }
  24330. if (!is_string($config['version'])) {
  24331. $config['version'] = (string) $config['version'];
  24332. }
  24333. if (strpos($config['version'], 'dev-') !== 0 && '-dev' !== substr($config['version'], -4)) {
  24334. return null;
  24335. }
  24336. if (isset($config['extra']['branch-alias']) && \is_array($config['extra']['branch-alias'])) {
  24337. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  24338. $sourceBranch = (string) $sourceBranch;
  24339. if ('-dev' !== substr($targetBranch, -4)) {
  24340. continue;
  24341. }
  24342. if ($targetBranch === VersionParser::DEFAULT_BRANCH_ALIAS) {
  24343. $validatedTargetBranch = VersionParser::DEFAULT_BRANCH_ALIAS;
  24344. } else {
  24345. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  24346. }
  24347. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  24348. continue;
  24349. }
  24350. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  24351. continue;
  24352. }
  24353. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  24354. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  24355. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  24356. ) {
  24357. continue;
  24358. }
  24359. return $validatedTargetBranch;
  24360. }
  24361. }
  24362. if (
  24363. isset($config['default-branch'])
  24364. && $config['default-branch'] === true
  24365. && false === $this->versionParser->parseNumericAliasPrefix(Preg::replace('{^v}', '', $config['version']))
  24366. ) {
  24367. return VersionParser::DEFAULT_BRANCH_ALIAS;
  24368. }
  24369. return null;
  24370. }
  24371. }
  24372. <?php declare(strict_types=1);
  24373. namespace Composer\Package\Loader;
  24374. class InvalidPackageException extends \Exception
  24375. {
  24376. private $errors;
  24377. private $warnings;
  24378. private $data;
  24379. public function __construct(array $errors, array $warnings, array $data)
  24380. {
  24381. $this->errors = $errors;
  24382. $this->warnings = $warnings;
  24383. $this->data = $data;
  24384. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  24385. }
  24386. public function getData(): array
  24387. {
  24388. return $this->data;
  24389. }
  24390. public function getErrors(): array
  24391. {
  24392. return $this->errors;
  24393. }
  24394. public function getWarnings(): array
  24395. {
  24396. return $this->warnings;
  24397. }
  24398. }
  24399. <?php declare(strict_types=1);
  24400. namespace Composer\Package\Loader;
  24401. use Composer\Json\JsonFile;
  24402. use Composer\Package\BasePackage;
  24403. use Composer\Package\CompletePackage;
  24404. use Composer\Package\CompleteAliasPackage;
  24405. use Composer\Package\RootPackage;
  24406. use Composer\Package\RootAliasPackage;
  24407. class JsonLoader
  24408. {
  24409. private $loader;
  24410. public function __construct(LoaderInterface $loader)
  24411. {
  24412. $this->loader = $loader;
  24413. }
  24414. public function load($json): BasePackage
  24415. {
  24416. if ($json instanceof JsonFile) {
  24417. $config = $json->read();
  24418. } elseif (file_exists($json)) {
  24419. $config = JsonFile::parseJson(file_get_contents($json), $json);
  24420. } elseif (is_string($json)) {
  24421. $config = JsonFile::parseJson($json);
  24422. } else {
  24423. throw new \InvalidArgumentException(sprintf(
  24424. "JsonLoader: Unknown \$json parameter %s. Please report at https://github.com/composer/composer/issues/new.",
  24425. gettype($json)
  24426. ));
  24427. }
  24428. return $this->loader->load($config);
  24429. }
  24430. }
  24431. <?php declare(strict_types=1);
  24432. namespace Composer\Package\Loader;
  24433. use Composer\Package\CompletePackage;
  24434. use Composer\Package\CompleteAliasPackage;
  24435. use Composer\Package\RootAliasPackage;
  24436. use Composer\Package\RootPackage;
  24437. use Composer\Package\BasePackage;
  24438. interface LoaderInterface
  24439. {
  24440. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage;
  24441. }
  24442. <?php declare(strict_types=1);
  24443. namespace Composer\Package\Loader;
  24444. use Composer\Package\BasePackage;
  24445. use Composer\Config;
  24446. use Composer\IO\IOInterface;
  24447. use Composer\Package\RootAliasPackage;
  24448. use Composer\Pcre\Preg;
  24449. use Composer\Repository\RepositoryFactory;
  24450. use Composer\Package\Version\VersionGuesser;
  24451. use Composer\Package\Version\VersionParser;
  24452. use Composer\Package\RootPackage;
  24453. use Composer\Repository\RepositoryManager;
  24454. use Composer\Util\Platform;
  24455. use Composer\Util\ProcessExecutor;
  24456. class RootPackageLoader extends ArrayLoader
  24457. {
  24458. private $manager;
  24459. private $config;
  24460. private $versionGuesser;
  24461. public function __construct(RepositoryManager $manager, Config $config, ?VersionParser $parser = null, ?VersionGuesser $versionGuesser = null, ?IOInterface $io = null)
  24462. {
  24463. parent::__construct($parser);
  24464. $this->manager = $manager;
  24465. $this->config = $config;
  24466. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor($io), $this->versionParser);
  24467. }
  24468. public function load(array $config, string $class = 'Composer\Package\RootPackage', ?string $cwd = null): BasePackage
  24469. {
  24470. if ($class !== 'Composer\Package\RootPackage') {
  24471. trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
  24472. }
  24473. if (!isset($config['name'])) {
  24474. $config['name'] = '__root__';
  24475. } elseif ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  24476. throw new \RuntimeException('Your package name '.$err);
  24477. }
  24478. $autoVersioned = false;
  24479. if (!isset($config['version'])) {
  24480. $commit = null;
  24481. if (Platform::getEnv('COMPOSER_ROOT_VERSION')) {
  24482. $config['version'] = Platform::getEnv('COMPOSER_ROOT_VERSION');
  24483. } else {
  24484. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?? Platform::getCwd(true));
  24485. if ($versionData) {
  24486. $config['version'] = $versionData['pretty_version'];
  24487. $config['version_normalized'] = $versionData['version'];
  24488. $commit = $versionData['commit'];
  24489. }
  24490. }
  24491. if (!isset($config['version'])) {
  24492. $config['version'] = '1.0.0';
  24493. $autoVersioned = true;
  24494. }
  24495. if ($commit) {
  24496. $config['source'] = [
  24497. 'type' => '',
  24498. 'url' => '',
  24499. 'reference' => $commit,
  24500. ];
  24501. $config['dist'] = [
  24502. 'type' => '',
  24503. 'url' => '',
  24504. 'reference' => $commit,
  24505. ];
  24506. }
  24507. }
  24508. $package = parent::load($config, $class);
  24509. if ($package instanceof RootAliasPackage) {
  24510. $realPackage = $package->getAliasOf();
  24511. } else {
  24512. $realPackage = $package;
  24513. }
  24514. if (!$realPackage instanceof RootPackage) {
  24515. throw new \LogicException('Expecting a Composer\Package\RootPackage at this point');
  24516. }
  24517. if ($autoVersioned) {
  24518. $realPackage->replaceVersion($realPackage->getVersion(), RootPackage::DEFAULT_PRETTY_VERSION);
  24519. }
  24520. if (isset($config['minimum-stability'])) {
  24521. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  24522. }
  24523. $aliases = [];
  24524. $stabilityFlags = [];
  24525. $references = [];
  24526. foreach (['require', 'require-dev'] as $linkType) {
  24527. if (isset($config[$linkType])) {
  24528. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  24529. $method = 'get'.ucfirst($linkInfo['method']);
  24530. $links = [];
  24531. foreach ($realPackage->{$method}() as $link) {
  24532. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  24533. }
  24534. $aliases = $this->extractAliases($links, $aliases);
  24535. $stabilityFlags = self::extractStabilityFlags($links, $realPackage->getMinimumStability(), $stabilityFlags);
  24536. $references = self::extractReferences($links, $references);
  24537. if (isset($links[$config['name']])) {
  24538. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  24539. 'Did you accidentally name your root package after an external package?', $config['name']));
  24540. }
  24541. }
  24542. }
  24543. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  24544. if (isset($config[$linkType])) {
  24545. foreach ($config[$linkType] as $linkName => $constraint) {
  24546. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  24547. throw new \RuntimeException($linkType.'.'.$err);
  24548. }
  24549. }
  24550. }
  24551. }
  24552. $realPackage->setAliases($aliases);
  24553. $realPackage->setStabilityFlags($stabilityFlags);
  24554. $realPackage->setReferences($references);
  24555. if (isset($config['prefer-stable'])) {
  24556. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  24557. }
  24558. if (isset($config['config'])) {
  24559. $realPackage->setConfig($config['config']);
  24560. }
  24561. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  24562. foreach ($repos as $repo) {
  24563. $this->manager->addRepository($repo);
  24564. }
  24565. $realPackage->setRepositories($this->config->getRepositories());
  24566. return $package;
  24567. }
  24568. private function extractAliases(array $requires, array $aliases): array
  24569. {
  24570. foreach ($requires as $reqName => $reqVersion) {
  24571. if (Preg::isMatchStrictGroups('{(?:^|\| *|, *)([^,\s#|]+)(?:#[^ ]+)? +as +([^,\s|]+)(?:$| *\|| *,)}', $reqVersion, $match)) {
  24572. $aliases[] = [
  24573. 'package' => strtolower($reqName),
  24574. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  24575. 'alias' => $match[2],
  24576. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  24577. ];
  24578. } elseif (strpos($reqVersion, ' as ') !== false) {
  24579. throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".');
  24580. }
  24581. }
  24582. return $aliases;
  24583. }
  24584. public static function extractStabilityFlags(array $requires, string $minimumStability, array $stabilityFlags): array
  24585. {
  24586. $stabilities = BasePackage::$stabilities;
  24587. $minimumStability = $stabilities[$minimumStability];
  24588. foreach ($requires as $reqName => $reqVersion) {
  24589. $constraints = [];
  24590. $orSplit = Preg::split('{\s*\|\|?\s*}', trim($reqVersion));
  24591. foreach ($orSplit as $orConstraint) {
  24592. $andSplit = Preg::split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  24593. foreach ($andSplit as $andConstraint) {
  24594. $constraints[] = $andConstraint;
  24595. }
  24596. }
  24597. $matched = false;
  24598. foreach ($constraints as $constraint) {
  24599. if (Preg::isMatchStrictGroups('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  24600. $name = strtolower($reqName);
  24601. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  24602. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  24603. continue;
  24604. }
  24605. $stabilityFlags[$name] = $stability;
  24606. $matched = true;
  24607. }
  24608. }
  24609. if ($matched) {
  24610. continue;
  24611. }
  24612. foreach ($constraints as $constraint) {
  24613. $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  24614. if (Preg::isMatch('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  24615. $name = strtolower($reqName);
  24616. $stability = $stabilities[$stabilityName];
  24617. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  24618. continue;
  24619. }
  24620. $stabilityFlags[$name] = $stability;
  24621. }
  24622. }
  24623. }
  24624. return $stabilityFlags;
  24625. }
  24626. public static function extractReferences(array $requires, array $references): array
  24627. {
  24628. foreach ($requires as $reqName => $reqVersion) {
  24629. $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  24630. if (Preg::isMatchStrictGroups('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  24631. $name = strtolower($reqName);
  24632. $references[$name] = $match[1];
  24633. }
  24634. }
  24635. return $references;
  24636. }
  24637. }
  24638. <?php declare(strict_types=1);
  24639. namespace Composer\Package\Loader;
  24640. use Composer\Package\BasePackage;
  24641. use Composer\Pcre\Preg;
  24642. use Composer\Semver\Constraint\Constraint;
  24643. use Composer\Package\Version\VersionParser;
  24644. use Composer\Repository\PlatformRepository;
  24645. use Composer\Semver\Constraint\MatchNoneConstraint;
  24646. use Composer\Semver\Intervals;
  24647. use Composer\Spdx\SpdxLicenses;
  24648. class ValidatingArrayLoader implements LoaderInterface
  24649. {
  24650. public const CHECK_ALL = 3;
  24651. public const CHECK_UNBOUND_CONSTRAINTS = 1;
  24652. public const CHECK_STRICT_CONSTRAINTS = 2;
  24653. private $loader;
  24654. private $versionParser;
  24655. private $errors;
  24656. private $warnings;
  24657. private $config;
  24658. private $flags;
  24659. public function __construct(LoaderInterface $loader, bool $strictName = true, ?VersionParser $parser = null, int $flags = 0)
  24660. {
  24661. $this->loader = $loader;
  24662. $this->versionParser = $parser ?? new VersionParser();
  24663. $this->flags = $flags;
  24664. if ($strictName !== true) {
  24665. trigger_error('$strictName must be set to true in ValidatingArrayLoader\'s constructor as of 2.2, and it will be removed in 3.0', E_USER_DEPRECATED);
  24666. }
  24667. }
  24668. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
  24669. {
  24670. $this->errors = [];
  24671. $this->warnings = [];
  24672. $this->config = $config;
  24673. $this->validateString('name', true);
  24674. if (isset($config['name']) && null !== ($err = self::hasPackageNamingError($config['name']))) {
  24675. $this->errors[] = 'name : '.$err;
  24676. }
  24677. if (isset($this->config['version'])) {
  24678. if (!is_scalar($this->config['version'])) {
  24679. $this->validateString('version');
  24680. } else {
  24681. if (!is_string($this->config['version'])) {
  24682. $this->config['version'] = (string) $this->config['version'];
  24683. }
  24684. try {
  24685. $this->versionParser->normalize($this->config['version']);
  24686. } catch (\Exception $e) {
  24687. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  24688. unset($this->config['version']);
  24689. }
  24690. }
  24691. }
  24692. if (isset($this->config['config']['platform'])) {
  24693. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  24694. if (false === $platform) {
  24695. continue;
  24696. }
  24697. if (!is_string($platform)) {
  24698. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.gettype($platform).' '.var_export($platform, true).'): expected string or false';
  24699. continue;
  24700. }
  24701. try {
  24702. $this->versionParser->normalize($platform);
  24703. } catch (\Exception $e) {
  24704. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  24705. }
  24706. }
  24707. }
  24708. $this->validateRegex('type', '[A-Za-z0-9-]+');
  24709. $this->validateString('target-dir');
  24710. $this->validateArray('extra');
  24711. if (isset($this->config['bin'])) {
  24712. if (is_string($this->config['bin'])) {
  24713. $this->validateString('bin');
  24714. } else {
  24715. $this->validateFlatArray('bin');
  24716. }
  24717. }
  24718. $this->validateArray('scripts');
  24719. $this->validateString('description');
  24720. $this->validateUrl('homepage');
  24721. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  24722. $releaseDate = null;
  24723. $this->validateString('time');
  24724. if (isset($this->config['time'])) {
  24725. try {
  24726. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  24727. } catch (\Exception $e) {
  24728. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  24729. unset($this->config['time']);
  24730. }
  24731. }
  24732. if (isset($this->config['license']) && (null === $releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  24733. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  24734. $licenses = (array) $this->config['license'];
  24735. $licenseValidator = new SpdxLicenses();
  24736. foreach ($licenses as $license) {
  24737. if ('proprietary' === $license) {
  24738. continue;
  24739. }
  24740. $licenseToValidate = str_replace('proprietary', 'MIT', $license);
  24741. if (!$licenseValidator->validate($licenseToValidate)) {
  24742. if ($licenseValidator->validate(trim($licenseToValidate))) {
  24743. $this->warnings[] = sprintf(
  24744. 'License %s must not contain extra spaces, make sure to trim it.',
  24745. json_encode($license)
  24746. );
  24747. } else {
  24748. $this->warnings[] = sprintf(
  24749. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  24750. 'If the software is closed-source, you may use "proprietary" as license.',
  24751. json_encode($license)
  24752. );
  24753. }
  24754. }
  24755. }
  24756. }
  24757. }
  24758. if ($this->validateArray('authors')) {
  24759. foreach ($this->config['authors'] as $key => $author) {
  24760. if (!is_array($author)) {
  24761. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  24762. unset($this->config['authors'][$key]);
  24763. continue;
  24764. }
  24765. foreach (['homepage', 'email', 'name', 'role'] as $authorData) {
  24766. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  24767. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  24768. unset($this->config['authors'][$key][$authorData]);
  24769. }
  24770. }
  24771. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  24772. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  24773. unset($this->config['authors'][$key]['homepage']);
  24774. }
  24775. if (isset($author['email']) && false === filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  24776. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  24777. unset($this->config['authors'][$key]['email']);
  24778. }
  24779. if (\count($this->config['authors'][$key]) === 0) {
  24780. unset($this->config['authors'][$key]);
  24781. }
  24782. }
  24783. if (\count($this->config['authors']) === 0) {
  24784. unset($this->config['authors']);
  24785. }
  24786. }
  24787. if ($this->validateArray('support') && !empty($this->config['support'])) {
  24788. foreach (['issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat', 'security'] as $key) {
  24789. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  24790. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  24791. unset($this->config['support'][$key]);
  24792. }
  24793. }
  24794. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  24795. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  24796. unset($this->config['support']['email']);
  24797. }
  24798. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], ['irc', 'ircs'])) {
  24799. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> or ircs:// URL';
  24800. unset($this->config['support']['irc']);
  24801. }
  24802. foreach (['issues', 'forum', 'wiki', 'source', 'docs', 'chat', 'security'] as $key) {
  24803. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  24804. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  24805. unset($this->config['support'][$key]);
  24806. }
  24807. }
  24808. if (empty($this->config['support'])) {
  24809. unset($this->config['support']);
  24810. }
  24811. }
  24812. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  24813. foreach ($this->config['funding'] as $key => $fundingOption) {
  24814. if (!is_array($fundingOption)) {
  24815. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  24816. unset($this->config['funding'][$key]);
  24817. continue;
  24818. }
  24819. foreach (['type', 'url'] as $fundingData) {
  24820. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  24821. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  24822. unset($this->config['funding'][$key][$fundingData]);
  24823. }
  24824. }
  24825. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  24826. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  24827. unset($this->config['funding'][$key]['url']);
  24828. }
  24829. if (empty($this->config['funding'][$key])) {
  24830. unset($this->config['funding'][$key]);
  24831. }
  24832. }
  24833. if (empty($this->config['funding'])) {
  24834. unset($this->config['funding']);
  24835. }
  24836. }
  24837. $unboundConstraint = new Constraint('=', '10000000-dev');
  24838. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  24839. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  24840. foreach ($this->config[$linkType] as $package => $constraint) {
  24841. $package = (string) $package;
  24842. if (isset($this->config['name']) && 0 === strcasecmp($package, $this->config['name'])) {
  24843. $this->errors[] = $linkType.'.'.$package.' : a package cannot set a '.$linkType.' on itself';
  24844. unset($this->config[$linkType][$package]);
  24845. continue;
  24846. }
  24847. if ($err = self::hasPackageNamingError($package, true)) {
  24848. $this->warnings[] = $linkType.'.'.$err;
  24849. } elseif (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $package)) {
  24850. $this->errors[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  24851. }
  24852. if (!is_string($constraint)) {
  24853. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  24854. unset($this->config[$linkType][$package]);
  24855. } elseif ('self.version' !== $constraint) {
  24856. try {
  24857. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  24858. } catch (\Exception $e) {
  24859. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  24860. unset($this->config[$linkType][$package]);
  24861. continue;
  24862. }
  24863. if (
  24864. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  24865. && 'require' === $linkType
  24866. && $linkConstraint->matches($unboundConstraint)
  24867. && !PlatformRepository::isPlatformPackage($package)
  24868. ) {
  24869. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  24870. } elseif (
  24871. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  24872. && 'require' === $linkType
  24873. && $linkConstraint instanceof Constraint && in_array($linkConstraint->getOperator(), ['==', '='], true)
  24874. && (new Constraint('>=', '1.0.0.0-dev'))->matches($linkConstraint)
  24875. ) {
  24876. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  24877. }
  24878. $compacted = Intervals::compactConstraint($linkConstraint);
  24879. if ($compacted instanceof MatchNoneConstraint) {
  24880. $this->warnings[] = $linkType.'.'.$package.' : this version constraint cannot possibly match anything ('.$constraint.')';
  24881. }
  24882. }
  24883. if ($linkType === 'conflict' && isset($this->config['replace']) && $keys = array_intersect_key($this->config['replace'], $this->config['conflict'])) {
  24884. $this->errors[] = $linkType.'.'.$package.' : you cannot conflict with a package that is also replaced, as replace already creates an implicit conflict rule';
  24885. unset($this->config[$linkType][$package]);
  24886. }
  24887. }
  24888. }
  24889. }
  24890. if ($this->validateArray('suggest') && isset($this->config['suggest'])) {
  24891. foreach ($this->config['suggest'] as $package => $description) {
  24892. if (!is_string($description)) {
  24893. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  24894. unset($this->config['suggest'][$package]);
  24895. }
  24896. }
  24897. }
  24898. if ($this->validateString('minimum-stability') && isset($this->config['minimum-stability'])) {
  24899. if (!isset(BasePackage::$stabilities[strtolower($this->config['minimum-stability'])]) && $this->config['minimum-stability'] !== 'RC') {
  24900. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  24901. unset($this->config['minimum-stability']);
  24902. }
  24903. }
  24904. if ($this->validateArray('autoload') && isset($this->config['autoload'])) {
  24905. $types = ['psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap'];
  24906. foreach ($this->config['autoload'] as $type => $typeConfig) {
  24907. if (!in_array($type, $types)) {
  24908. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  24909. unset($this->config['autoload'][$type]);
  24910. }
  24911. if ($type === 'psr-4') {
  24912. foreach ($typeConfig as $namespace => $dirs) {
  24913. if ($namespace !== '' && '\\' !== substr((string) $namespace, -1)) {
  24914. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  24915. }
  24916. }
  24917. }
  24918. }
  24919. }
  24920. if (isset($this->config['autoload']['psr-4']) && isset($this->config['target-dir'])) {
  24921. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  24922. unset($this->config['autoload']['psr-4']);
  24923. }
  24924. foreach (['source', 'dist'] as $srcType) {
  24925. if ($this->validateArray($srcType) && !empty($this->config[$srcType])) {
  24926. if (!isset($this->config[$srcType]['type'])) {
  24927. $this->errors[] = $srcType . '.type : must be present';
  24928. }
  24929. if (!isset($this->config[$srcType]['url'])) {
  24930. $this->errors[] = $srcType . '.url : must be present';
  24931. }
  24932. if ($srcType === 'source' && !isset($this->config[$srcType]['reference'])) {
  24933. $this->errors[] = $srcType . '.reference : must be present';
  24934. }
  24935. if (isset($this->config[$srcType]['type']) && !is_string($this->config[$srcType]['type'])) {
  24936. $this->errors[] = $srcType . '.type : should be a string, '.gettype($this->config[$srcType]['type']).' given';
  24937. }
  24938. if (isset($this->config[$srcType]['url']) && !is_string($this->config[$srcType]['url'])) {
  24939. $this->errors[] = $srcType . '.url : should be a string, '.gettype($this->config[$srcType]['url']).' given';
  24940. }
  24941. if (isset($this->config[$srcType]['reference']) && !is_string($this->config[$srcType]['reference']) && !is_int($this->config[$srcType]['reference'])) {
  24942. $this->errors[] = $srcType . '.reference : should be a string or int, '.gettype($this->config[$srcType]['reference']).' given';
  24943. }
  24944. if (isset($this->config[$srcType]['reference']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['reference'])) {
  24945. $this->errors[] = $srcType . '.reference : must not start with a "-", "'.$this->config[$srcType]['reference'].'" given';
  24946. }
  24947. if (isset($this->config[$srcType]['url']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['url'])) {
  24948. $this->errors[] = $srcType . '.url : must not start with a "-", "'.$this->config[$srcType]['url'].'" given';
  24949. }
  24950. }
  24951. }
  24952. $this->validateFlatArray('include-path');
  24953. $this->validateArray('transport-options');
  24954. if (isset($this->config['extra']['branch-alias'])) {
  24955. if (!is_array($this->config['extra']['branch-alias'])) {
  24956. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  24957. } else {
  24958. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  24959. if (!is_string($targetBranch)) {
  24960. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.json_encode($targetBranch).') must be a string, "'.gettype($targetBranch).'" received.';
  24961. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  24962. continue;
  24963. }
  24964. if ('-dev' !== substr($targetBranch, -4)) {
  24965. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  24966. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  24967. continue;
  24968. }
  24969. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  24970. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  24971. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  24972. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  24973. continue;
  24974. }
  24975. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  24976. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  24977. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  24978. ) {
  24979. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  24980. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  24981. }
  24982. }
  24983. }
  24984. }
  24985. if ($this->errors) {
  24986. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  24987. }
  24988. $package = $this->loader->load($this->config, $class);
  24989. $this->config = [];
  24990. return $package;
  24991. }
  24992. public function getWarnings(): array
  24993. {
  24994. return $this->warnings;
  24995. }
  24996. public function getErrors(): array
  24997. {
  24998. return $this->errors;
  24999. }
  25000. public static function hasPackageNamingError(string $name, bool $isLink = false): ?string
  25001. {
  25002. if (PlatformRepository::isPlatformPackage($name)) {
  25003. return null;
  25004. }
  25005. if (!Preg::isMatch('{^[a-z0-9](?:[_.-]?[a-z0-9]++)*+/[a-z0-9](?:(?:[_.]|-{1,2})?[a-z0-9]++)*+$}iD', $name)) {
  25006. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".';
  25007. }
  25008. $reservedNames = ['nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9'];
  25009. $bits = explode('/', strtolower($name));
  25010. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  25011. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  25012. }
  25013. if (Preg::isMatch('{\.json$}', $name)) {
  25014. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  25015. }
  25016. if (Preg::isMatch('{[A-Z]}', $name)) {
  25017. if ($isLink) {
  25018. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  25019. }
  25020. $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  25021. $suggestName = strtolower($suggestName);
  25022. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  25023. }
  25024. return null;
  25025. }
  25026. private function validateRegex(string $property, string $regex, bool $mandatory = false): bool
  25027. {
  25028. if (!$this->validateString($property, $mandatory)) {
  25029. return false;
  25030. }
  25031. if (!Preg::isMatch('{^'.$regex.'$}u', $this->config[$property])) {
  25032. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  25033. if ($mandatory) {
  25034. $this->errors[] = $message;
  25035. } else {
  25036. $this->warnings[] = $message;
  25037. }
  25038. unset($this->config[$property]);
  25039. return false;
  25040. }
  25041. return true;
  25042. }
  25043. private function validateString(string $property, bool $mandatory = false): bool
  25044. {
  25045. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  25046. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  25047. unset($this->config[$property]);
  25048. return false;
  25049. }
  25050. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  25051. if ($mandatory) {
  25052. $this->errors[] = $property.' : must be present';
  25053. }
  25054. unset($this->config[$property]);
  25055. return false;
  25056. }
  25057. return true;
  25058. }
  25059. private function validateArray(string $property, bool $mandatory = false): bool
  25060. {
  25061. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  25062. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  25063. unset($this->config[$property]);
  25064. return false;
  25065. }
  25066. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  25067. if ($mandatory) {
  25068. $this->errors[] = $property.' : must be present and contain at least one element';
  25069. }
  25070. unset($this->config[$property]);
  25071. return false;
  25072. }
  25073. return true;
  25074. }
  25075. private function validateFlatArray(string $property, ?string $regex = null, bool $mandatory = false): bool
  25076. {
  25077. if (!$this->validateArray($property, $mandatory)) {
  25078. return false;
  25079. }
  25080. $pass = true;
  25081. foreach ($this->config[$property] as $key => $value) {
  25082. if (!is_string($value) && !is_numeric($value)) {
  25083. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  25084. unset($this->config[$property][$key]);
  25085. $pass = false;
  25086. continue;
  25087. }
  25088. if ($regex && !Preg::isMatch('{^'.$regex.'$}u', (string) $value)) {
  25089. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  25090. unset($this->config[$property][$key]);
  25091. $pass = false;
  25092. }
  25093. }
  25094. return $pass;
  25095. }
  25096. private function validateUrl(string $property, bool $mandatory = false): bool
  25097. {
  25098. if (!$this->validateString($property, $mandatory)) {
  25099. return false;
  25100. }
  25101. if (!$this->filterUrl($this->config[$property])) {
  25102. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  25103. unset($this->config[$property]);
  25104. return false;
  25105. }
  25106. return true;
  25107. }
  25108. private function filterUrl($value, array $schemes = ['http', 'https']): bool
  25109. {
  25110. if ($value === '') {
  25111. return true;
  25112. }
  25113. $bits = parse_url($value);
  25114. if (empty($bits['scheme']) || empty($bits['host'])) {
  25115. return false;
  25116. }
  25117. if (!in_array($bits['scheme'], $schemes, true)) {
  25118. return false;
  25119. }
  25120. return true;
  25121. }
  25122. }
  25123. <?php declare(strict_types=1);
  25124. namespace Composer\Package;
  25125. use Composer\Json\JsonFile;
  25126. use Composer\Installer\InstallationManager;
  25127. use Composer\Pcre\Preg;
  25128. use Composer\Repository\InstalledRepository;
  25129. use Composer\Repository\LockArrayRepository;
  25130. use Composer\Repository\PlatformRepository;
  25131. use Composer\Repository\RootPackageRepository;
  25132. use Composer\Util\ProcessExecutor;
  25133. use Composer\Package\Dumper\ArrayDumper;
  25134. use Composer\Package\Loader\ArrayLoader;
  25135. use Composer\Package\Version\VersionParser;
  25136. use Composer\Plugin\PluginInterface;
  25137. use Composer\Util\Git as GitUtil;
  25138. use Composer\IO\IOInterface;
  25139. use Seld\JsonLint\ParsingException;
  25140. class Locker
  25141. {
  25142. private $lockFile;
  25143. private $installationManager;
  25144. private $hash;
  25145. private $contentHash;
  25146. private $loader;
  25147. private $dumper;
  25148. private $process;
  25149. private $lockDataCache = null;
  25150. private $virtualFileWritten = false;
  25151. public function __construct(IOInterface $io, JsonFile $lockFile, InstallationManager $installationManager, string $composerFileContents, ?ProcessExecutor $process = null)
  25152. {
  25153. $this->lockFile = $lockFile;
  25154. $this->installationManager = $installationManager;
  25155. $this->hash = md5($composerFileContents);
  25156. $this->contentHash = self::getContentHash($composerFileContents);
  25157. $this->loader = new ArrayLoader(null, true);
  25158. $this->dumper = new ArrayDumper();
  25159. $this->process = $process ?? new ProcessExecutor($io);
  25160. }
  25161. public static function getContentHash(string $composerFileContents): string
  25162. {
  25163. $content = JsonFile::parseJson($composerFileContents, 'composer.json');
  25164. $relevantKeys = [
  25165. 'name',
  25166. 'version',
  25167. 'require',
  25168. 'require-dev',
  25169. 'conflict',
  25170. 'replace',
  25171. 'provide',
  25172. 'minimum-stability',
  25173. 'prefer-stable',
  25174. 'repositories',
  25175. 'extra',
  25176. ];
  25177. $relevantContent = [];
  25178. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  25179. $relevantContent[$key] = $content[$key];
  25180. }
  25181. if (isset($content['config']['platform'])) {
  25182. $relevantContent['config']['platform'] = $content['config']['platform'];
  25183. }
  25184. ksort($relevantContent);
  25185. return md5(JsonFile::encode($relevantContent, 0));
  25186. }
  25187. public function isLocked(): bool
  25188. {
  25189. if (!$this->virtualFileWritten && !$this->lockFile->exists()) {
  25190. return false;
  25191. }
  25192. $data = $this->getLockData();
  25193. return isset($data['packages']);
  25194. }
  25195. public function isFresh(): bool
  25196. {
  25197. $lock = $this->lockFile->read();
  25198. if (!empty($lock['content-hash'])) {
  25199. return $this->contentHash === $lock['content-hash'];
  25200. }
  25201. if (!empty($lock['hash'])) {
  25202. return $this->hash === $lock['hash'];
  25203. }
  25204. return false;
  25205. }
  25206. public function getLockedRepository(bool $withDevReqs = false): LockArrayRepository
  25207. {
  25208. $lockData = $this->getLockData();
  25209. $packages = new LockArrayRepository();
  25210. $lockedPackages = $lockData['packages'];
  25211. if ($withDevReqs) {
  25212. if (isset($lockData['packages-dev'])) {
  25213. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  25214. } else {
  25215. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or delete it and run composer update to generate a new lock file.');
  25216. }
  25217. }
  25218. if (empty($lockedPackages)) {
  25219. return $packages;
  25220. }
  25221. if (isset($lockedPackages[0]['name'])) {
  25222. $packageByName = [];
  25223. foreach ($lockedPackages as $info) {
  25224. $package = $this->loader->load($info);
  25225. $packages->addPackage($package);
  25226. $packageByName[$package->getName()] = $package;
  25227. if ($package instanceof AliasPackage) {
  25228. $packageByName[$package->getAliasOf()->getName()] = $package->getAliasOf();
  25229. }
  25230. }
  25231. if (isset($lockData['aliases'])) {
  25232. foreach ($lockData['aliases'] as $alias) {
  25233. if (isset($packageByName[$alias['package']])) {
  25234. $aliasPkg = new CompleteAliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias']);
  25235. $aliasPkg->setRootPackageAlias(true);
  25236. $packages->addPackage($aliasPkg);
  25237. }
  25238. }
  25239. }
  25240. return $packages;
  25241. }
  25242. throw new \RuntimeException('Your composer.lock is invalid. Run "composer update" to generate a new one.');
  25243. }
  25244. public function getDevPackageNames(): array
  25245. {
  25246. $names = [];
  25247. $lockData = $this->getLockData();
  25248. if (isset($lockData['packages-dev'])) {
  25249. foreach ($lockData['packages-dev'] as $package) {
  25250. $names[] = strtolower($package['name']);
  25251. }
  25252. }
  25253. return $names;
  25254. }
  25255. public function getPlatformRequirements(bool $withDevReqs = false): array
  25256. {
  25257. $lockData = $this->getLockData();
  25258. $requirements = [];
  25259. if (!empty($lockData['platform'])) {
  25260. $requirements = $this->loader->parseLinks(
  25261. '__root__',
  25262. '1.0.0',
  25263. Link::TYPE_REQUIRE,
  25264. $lockData['platform'] ?? []
  25265. );
  25266. }
  25267. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  25268. $devRequirements = $this->loader->parseLinks(
  25269. '__root__',
  25270. '1.0.0',
  25271. Link::TYPE_REQUIRE,
  25272. $lockData['platform-dev'] ?? []
  25273. );
  25274. $requirements = array_merge($requirements, $devRequirements);
  25275. }
  25276. return $requirements;
  25277. }
  25278. public function getMinimumStability(): string
  25279. {
  25280. $lockData = $this->getLockData();
  25281. return $lockData['minimum-stability'] ?? 'stable';
  25282. }
  25283. public function getStabilityFlags(): array
  25284. {
  25285. $lockData = $this->getLockData();
  25286. return $lockData['stability-flags'] ?? [];
  25287. }
  25288. public function getPreferStable(): ?bool
  25289. {
  25290. $lockData = $this->getLockData();
  25291. return $lockData['prefer-stable'] ?? null;
  25292. }
  25293. public function getPreferLowest(): ?bool
  25294. {
  25295. $lockData = $this->getLockData();
  25296. return $lockData['prefer-lowest'] ?? null;
  25297. }
  25298. public function getPlatformOverrides(): array
  25299. {
  25300. $lockData = $this->getLockData();
  25301. return $lockData['platform-overrides'] ?? [];
  25302. }
  25303. public function getAliases(): array
  25304. {
  25305. $lockData = $this->getLockData();
  25306. return $lockData['aliases'] ?? [];
  25307. }
  25308. public function getPluginApi()
  25309. {
  25310. $lockData = $this->getLockData();
  25311. return $lockData['plugin-api-version'] ?? '1.1.0';
  25312. }
  25313. public function getLockData(): array
  25314. {
  25315. if (null !== $this->lockDataCache) {
  25316. return $this->lockDataCache;
  25317. }
  25318. if (!$this->lockFile->exists()) {
  25319. throw new \LogicException('No lockfile found. Unable to read locked packages');
  25320. }
  25321. return $this->lockDataCache = $this->lockFile->read();
  25322. }
  25323. public function setLockData(array $packages, ?array $devPackages, array $platformReqs, array $platformDevReqs, array $aliases, string $minimumStability, array $stabilityFlags, bool $preferStable, bool $preferLowest, array $platformOverrides, bool $write = true): bool
  25324. {
  25325. $aliases = array_map(static function ($alias): array {
  25326. if (in_array($alias['version'], ['dev-master', 'dev-trunk', 'dev-default'], true)) {
  25327. $alias['version'] = VersionParser::DEFAULT_BRANCH_ALIAS;
  25328. }
  25329. return $alias;
  25330. }, $aliases);
  25331. $lock = [
  25332. '_readme' => ['This file locks the dependencies of your project to a known state',
  25333. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  25334. 'This file is @gener'.'ated automatically', ],
  25335. 'content-hash' => $this->contentHash,
  25336. 'packages' => null,
  25337. 'packages-dev' => null,
  25338. 'aliases' => $aliases,
  25339. 'minimum-stability' => $minimumStability,
  25340. 'stability-flags' => $stabilityFlags,
  25341. 'prefer-stable' => $preferStable,
  25342. 'prefer-lowest' => $preferLowest,
  25343. ];
  25344. $lock['packages'] = $this->lockPackages($packages);
  25345. if (null !== $devPackages) {
  25346. $lock['packages-dev'] = $this->lockPackages($devPackages);
  25347. }
  25348. $lock['platform'] = $platformReqs;
  25349. $lock['platform-dev'] = $platformDevReqs;
  25350. if (\count($platformOverrides) > 0) {
  25351. $lock['platform-overrides'] = $platformOverrides;
  25352. }
  25353. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  25354. try {
  25355. $isLocked = $this->isLocked();
  25356. } catch (ParsingException $e) {
  25357. $isLocked = false;
  25358. }
  25359. if (!$isLocked || $lock !== $this->getLockData()) {
  25360. if ($write) {
  25361. $this->lockFile->write($lock);
  25362. $this->lockDataCache = null;
  25363. $this->virtualFileWritten = false;
  25364. } else {
  25365. $this->virtualFileWritten = true;
  25366. $this->lockDataCache = JsonFile::parseJson(JsonFile::encode($lock));
  25367. }
  25368. return true;
  25369. }
  25370. return false;
  25371. }
  25372. private function lockPackages(array $packages): array
  25373. {
  25374. $locked = [];
  25375. foreach ($packages as $package) {
  25376. if ($package instanceof AliasPackage) {
  25377. continue;
  25378. }
  25379. $name = $package->getPrettyName();
  25380. $version = $package->getPrettyVersion();
  25381. if (!$name || !$version) {
  25382. throw new \LogicException(sprintf(
  25383. 'Package "%s" has no version or name and can not be locked',
  25384. $package
  25385. ));
  25386. }
  25387. $spec = $this->dumper->dump($package);
  25388. unset($spec['version_normalized']);
  25389. $time = $spec['time'] ?? null;
  25390. unset($spec['time']);
  25391. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  25392. $time = $this->getPackageTime($package) ?: $time;
  25393. }
  25394. if (null !== $time) {
  25395. $spec['time'] = $time;
  25396. }
  25397. unset($spec['installation-source']);
  25398. $locked[] = $spec;
  25399. }
  25400. usort($locked, static function ($a, $b) {
  25401. $comparison = strcmp($a['name'], $b['name']);
  25402. if (0 !== $comparison) {
  25403. return $comparison;
  25404. }
  25405. return strcmp($a['version'], $b['version']);
  25406. });
  25407. return $locked;
  25408. }
  25409. private function getPackageTime(PackageInterface $package): ?string
  25410. {
  25411. if (!function_exists('proc_open')) {
  25412. return null;
  25413. }
  25414. $path = $this->installationManager->getInstallPath($package);
  25415. if ($path === null) {
  25416. return null;
  25417. }
  25418. $path = realpath($path);
  25419. $sourceType = $package->getSourceType();
  25420. $datetime = null;
  25421. if ($path && in_array($sourceType, ['git', 'hg'])) {
  25422. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  25423. switch ($sourceType) {
  25424. case 'git':
  25425. GitUtil::cleanEnv();
  25426. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && Preg::isMatch('{^\s*\d+\s*$}', $output)) {
  25427. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  25428. }
  25429. break;
  25430. case 'hg':
  25431. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && Preg::isMatch('{^\s*(\d+)\s*}', $output, $match)) {
  25432. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  25433. }
  25434. break;
  25435. }
  25436. }
  25437. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  25438. }
  25439. public function getMissingRequirementInfo(RootPackageInterface $package, bool $includeDev): array
  25440. {
  25441. $missingRequirementInfo = [];
  25442. $missingRequirements = false;
  25443. $sets = [['repo' => $this->getLockedRepository(false), 'method' => 'getRequires', 'description' => 'Required']];
  25444. if ($includeDev === true) {
  25445. $sets[] = ['repo' => $this->getLockedRepository(true), 'method' => 'getDevRequires', 'description' => 'Required (in require-dev)'];
  25446. }
  25447. $rootRepo = new RootPackageRepository(clone $package);
  25448. foreach ($sets as $set) {
  25449. $installedRepo = new InstalledRepository([$set['repo'], $rootRepo]);
  25450. foreach (call_user_func([$package, $set['method']]) as $link) {
  25451. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  25452. continue;
  25453. }
  25454. if ($link->getPrettyConstraint() === 'self.version') {
  25455. continue;
  25456. }
  25457. if ($installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint()) === []) {
  25458. $results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget());
  25459. if ($results !== []) {
  25460. $provider = reset($results);
  25461. $description = $provider->getPrettyVersion();
  25462. if ($provider->getName() !== $link->getTarget()) {
  25463. foreach (['getReplaces' => 'replaced as %s by %s', 'getProvides' => 'provided as %s by %s'] as $method => $text) {
  25464. foreach (call_user_func([$provider, $method]) as $providerLink) {
  25465. if ($providerLink->getTarget() === $link->getTarget()) {
  25466. $description = sprintf($text, $providerLink->getPrettyConstraint(), $provider->getPrettyName().' '.$provider->getPrettyVersion());
  25467. break 2;
  25468. }
  25469. }
  25470. }
  25471. }
  25472. $missingRequirementInfo[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is in the lock file as "'.$description.'" but that does not satisfy your constraint "'.$link->getPrettyConstraint().'".';
  25473. } else {
  25474. $missingRequirementInfo[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is not present in the lock file.';
  25475. }
  25476. $missingRequirements = true;
  25477. }
  25478. }
  25479. }
  25480. if ($missingRequirements) {
  25481. $missingRequirementInfo[] = 'This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.';
  25482. $missingRequirementInfo[] = 'Read more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md';
  25483. $missingRequirementInfo[] = 'and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r';
  25484. }
  25485. return $missingRequirementInfo;
  25486. }
  25487. }
  25488. <?php declare(strict_types=1);
  25489. namespace Composer\Package;
  25490. use Composer\Package\Version\VersionParser;
  25491. use Composer\Pcre\Preg;
  25492. use Composer\Util\ComposerMirror;
  25493. class Package extends BasePackage
  25494. {
  25495. protected $type;
  25496. protected $targetDir;
  25497. protected $installationSource;
  25498. protected $sourceType;
  25499. protected $sourceUrl;
  25500. protected $sourceReference;
  25501. protected $sourceMirrors;
  25502. protected $distType;
  25503. protected $distUrl;
  25504. protected $distReference;
  25505. protected $distSha1Checksum;
  25506. protected $distMirrors;
  25507. protected $version;
  25508. protected $prettyVersion;
  25509. protected $releaseDate;
  25510. protected $extra = [];
  25511. protected $binaries = [];
  25512. protected $dev;
  25513. protected $stability;
  25514. protected $notificationUrl;
  25515. protected $requires = [];
  25516. protected $conflicts = [];
  25517. protected $provides = [];
  25518. protected $replaces = [];
  25519. protected $devRequires = [];
  25520. protected $suggests = [];
  25521. protected $autoload = [];
  25522. protected $devAutoload = [];
  25523. protected $includePaths = [];
  25524. protected $isDefaultBranch = false;
  25525. protected $transportOptions = [];
  25526. public function __construct(string $name, string $version, string $prettyVersion)
  25527. {
  25528. parent::__construct($name);
  25529. $this->version = $version;
  25530. $this->prettyVersion = $prettyVersion;
  25531. $this->stability = VersionParser::parseStability($version);
  25532. $this->dev = $this->stability === 'dev';
  25533. }
  25534. public function isDev(): bool
  25535. {
  25536. return $this->dev;
  25537. }
  25538. public function setType(string $type): void
  25539. {
  25540. $this->type = $type;
  25541. }
  25542. public function getType(): string
  25543. {
  25544. return $this->type ?: 'library';
  25545. }
  25546. public function getStability(): string
  25547. {
  25548. return $this->stability;
  25549. }
  25550. public function setTargetDir(?string $targetDir): void
  25551. {
  25552. $this->targetDir = $targetDir;
  25553. }
  25554. public function getTargetDir(): ?string
  25555. {
  25556. if (null === $this->targetDir) {
  25557. return null;
  25558. }
  25559. return ltrim(Preg::replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  25560. }
  25561. public function setExtra(array $extra): void
  25562. {
  25563. $this->extra = $extra;
  25564. }
  25565. public function getExtra(): array
  25566. {
  25567. return $this->extra;
  25568. }
  25569. public function setBinaries(array $binaries): void
  25570. {
  25571. $this->binaries = $binaries;
  25572. }
  25573. public function getBinaries(): array
  25574. {
  25575. return $this->binaries;
  25576. }
  25577. public function setInstallationSource(?string $type): void
  25578. {
  25579. $this->installationSource = $type;
  25580. }
  25581. public function getInstallationSource(): ?string
  25582. {
  25583. return $this->installationSource;
  25584. }
  25585. public function setSourceType(?string $type): void
  25586. {
  25587. $this->sourceType = $type;
  25588. }
  25589. public function getSourceType(): ?string
  25590. {
  25591. return $this->sourceType;
  25592. }
  25593. public function setSourceUrl(?string $url): void
  25594. {
  25595. $this->sourceUrl = $url;
  25596. }
  25597. public function getSourceUrl(): ?string
  25598. {
  25599. return $this->sourceUrl;
  25600. }
  25601. public function setSourceReference(?string $reference): void
  25602. {
  25603. $this->sourceReference = $reference;
  25604. }
  25605. public function getSourceReference(): ?string
  25606. {
  25607. return $this->sourceReference;
  25608. }
  25609. public function setSourceMirrors(?array $mirrors): void
  25610. {
  25611. $this->sourceMirrors = $mirrors;
  25612. }
  25613. public function getSourceMirrors(): ?array
  25614. {
  25615. return $this->sourceMirrors;
  25616. }
  25617. public function getSourceUrls(): array
  25618. {
  25619. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  25620. }
  25621. public function setDistType(?string $type): void
  25622. {
  25623. $this->distType = $type === '' ? null : $type;
  25624. }
  25625. public function getDistType(): ?string
  25626. {
  25627. return $this->distType;
  25628. }
  25629. public function setDistUrl(?string $url): void
  25630. {
  25631. $this->distUrl = $url === '' ? null : $url;
  25632. }
  25633. public function getDistUrl(): ?string
  25634. {
  25635. return $this->distUrl;
  25636. }
  25637. public function setDistReference(?string $reference): void
  25638. {
  25639. $this->distReference = $reference;
  25640. }
  25641. public function getDistReference(): ?string
  25642. {
  25643. return $this->distReference;
  25644. }
  25645. public function setDistSha1Checksum(?string $sha1checksum): void
  25646. {
  25647. $this->distSha1Checksum = $sha1checksum;
  25648. }
  25649. public function getDistSha1Checksum(): ?string
  25650. {
  25651. return $this->distSha1Checksum;
  25652. }
  25653. public function setDistMirrors(?array $mirrors): void
  25654. {
  25655. $this->distMirrors = $mirrors;
  25656. }
  25657. public function getDistMirrors(): ?array
  25658. {
  25659. return $this->distMirrors;
  25660. }
  25661. public function getDistUrls(): array
  25662. {
  25663. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  25664. }
  25665. public function getTransportOptions(): array
  25666. {
  25667. return $this->transportOptions;
  25668. }
  25669. public function setTransportOptions(array $options): void
  25670. {
  25671. $this->transportOptions = $options;
  25672. }
  25673. public function getVersion(): string
  25674. {
  25675. return $this->version;
  25676. }
  25677. public function getPrettyVersion(): string
  25678. {
  25679. return $this->prettyVersion;
  25680. }
  25681. public function setReleaseDate(?\DateTimeInterface $releaseDate): void
  25682. {
  25683. $this->releaseDate = $releaseDate;
  25684. }
  25685. public function getReleaseDate(): ?\DateTimeInterface
  25686. {
  25687. return $this->releaseDate;
  25688. }
  25689. public function setRequires(array $requires): void
  25690. {
  25691. if (isset($requires[0])) {
  25692. $requires = $this->convertLinksToMap($requires, 'setRequires');
  25693. }
  25694. $this->requires = $requires;
  25695. }
  25696. public function getRequires(): array
  25697. {
  25698. return $this->requires;
  25699. }
  25700. public function setConflicts(array $conflicts): void
  25701. {
  25702. if (isset($conflicts[0])) {
  25703. $conflicts = $this->convertLinksToMap($conflicts, 'setConflicts');
  25704. }
  25705. $this->conflicts = $conflicts;
  25706. }
  25707. public function getConflicts(): array
  25708. {
  25709. return $this->conflicts;
  25710. }
  25711. public function setProvides(array $provides): void
  25712. {
  25713. if (isset($provides[0])) {
  25714. $provides = $this->convertLinksToMap($provides, 'setProvides');
  25715. }
  25716. $this->provides = $provides;
  25717. }
  25718. public function getProvides(): array
  25719. {
  25720. return $this->provides;
  25721. }
  25722. public function setReplaces(array $replaces): void
  25723. {
  25724. if (isset($replaces[0])) {
  25725. $replaces = $this->convertLinksToMap($replaces, 'setReplaces');
  25726. }
  25727. $this->replaces = $replaces;
  25728. }
  25729. public function getReplaces(): array
  25730. {
  25731. return $this->replaces;
  25732. }
  25733. public function setDevRequires(array $devRequires): void
  25734. {
  25735. if (isset($devRequires[0])) {
  25736. $devRequires = $this->convertLinksToMap($devRequires, 'setDevRequires');
  25737. }
  25738. $this->devRequires = $devRequires;
  25739. }
  25740. public function getDevRequires(): array
  25741. {
  25742. return $this->devRequires;
  25743. }
  25744. public function setSuggests(array $suggests): void
  25745. {
  25746. $this->suggests = $suggests;
  25747. }
  25748. public function getSuggests(): array
  25749. {
  25750. return $this->suggests;
  25751. }
  25752. public function setAutoload(array $autoload): void
  25753. {
  25754. $this->autoload = $autoload;
  25755. }
  25756. public function getAutoload(): array
  25757. {
  25758. return $this->autoload;
  25759. }
  25760. public function setDevAutoload(array $devAutoload): void
  25761. {
  25762. $this->devAutoload = $devAutoload;
  25763. }
  25764. public function getDevAutoload(): array
  25765. {
  25766. return $this->devAutoload;
  25767. }
  25768. public function setIncludePaths(array $includePaths): void
  25769. {
  25770. $this->includePaths = $includePaths;
  25771. }
  25772. public function getIncludePaths(): array
  25773. {
  25774. return $this->includePaths;
  25775. }
  25776. public function setNotificationUrl(string $notificationUrl): void
  25777. {
  25778. $this->notificationUrl = $notificationUrl;
  25779. }
  25780. public function getNotificationUrl(): ?string
  25781. {
  25782. return $this->notificationUrl;
  25783. }
  25784. public function setIsDefaultBranch(bool $defaultBranch): void
  25785. {
  25786. $this->isDefaultBranch = $defaultBranch;
  25787. }
  25788. public function isDefaultBranch(): bool
  25789. {
  25790. return $this->isDefaultBranch;
  25791. }
  25792. public function setSourceDistReferences(string $reference): void
  25793. {
  25794. $this->setSourceReference($reference);
  25795. if (
  25796. $this->getDistUrl() !== null
  25797. && Preg::isMatch('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $this->getDistUrl())
  25798. ) {
  25799. $this->setDistReference($reference);
  25800. $this->setDistUrl(Preg::replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $this->getDistUrl()));
  25801. } elseif ($this->getDistReference()) {
  25802. $this->setDistReference($reference);
  25803. }
  25804. }
  25805. public function replaceVersion(string $version, string $prettyVersion): void
  25806. {
  25807. $this->version = $version;
  25808. $this->prettyVersion = $prettyVersion;
  25809. $this->stability = VersionParser::parseStability($version);
  25810. $this->dev = $this->stability === 'dev';
  25811. }
  25812. protected function getUrls(?string $url, ?array $mirrors, ?string $ref, ?string $type, string $urlType): array
  25813. {
  25814. if (!$url) {
  25815. return [];
  25816. }
  25817. if ($urlType === 'dist' && false !== strpos($url, '%')) {
  25818. $url = ComposerMirror::processUrl($url, $this->name, $this->version, $ref, $type, $this->prettyVersion);
  25819. }
  25820. $urls = [$url];
  25821. if ($mirrors) {
  25822. foreach ($mirrors as $mirror) {
  25823. if ($urlType === 'dist') {
  25824. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type, $this->prettyVersion);
  25825. } elseif ($urlType === 'source' && $type === 'git') {
  25826. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  25827. } elseif ($urlType === 'source' && $type === 'hg') {
  25828. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  25829. } else {
  25830. continue;
  25831. }
  25832. if (!\in_array($mirrorUrl, $urls)) {
  25833. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  25834. $func($urls, $mirrorUrl);
  25835. }
  25836. }
  25837. }
  25838. return $urls;
  25839. }
  25840. private function convertLinksToMap(array $links, string $source): array
  25841. {
  25842. trigger_error('Package::'.$source.' must be called with a map of lowercased package name => Link object, got a indexed array, this is deprecated and you should fix your usage.');
  25843. $newLinks = [];
  25844. foreach ($links as $link) {
  25845. $newLinks[$link->getTarget()] = $link;
  25846. }
  25847. return $newLinks;
  25848. }
  25849. }
  25850. <?php declare(strict_types=1);
  25851. namespace Composer\Package;
  25852. use Composer\Repository\RepositoryInterface;
  25853. interface PackageInterface
  25854. {
  25855. public const DISPLAY_SOURCE_REF_IF_DEV = 0;
  25856. public const DISPLAY_SOURCE_REF = 1;
  25857. public const DISPLAY_DIST_REF = 2;
  25858. public function getName(): string;
  25859. public function getPrettyName(): string;
  25860. public function getNames(bool $provides = true): array;
  25861. public function setId(int $id): void;
  25862. public function getId(): int;
  25863. public function isDev(): bool;
  25864. public function getType(): string;
  25865. public function getTargetDir(): ?string;
  25866. public function getExtra(): array;
  25867. public function setInstallationSource(?string $type): void;
  25868. public function getInstallationSource(): ?string;
  25869. public function getSourceType(): ?string;
  25870. public function getSourceUrl(): ?string;
  25871. public function getSourceUrls(): array;
  25872. public function getSourceReference(): ?string;
  25873. public function getSourceMirrors(): ?array;
  25874. public function setSourceMirrors(?array $mirrors): void;
  25875. public function getDistType(): ?string;
  25876. public function getDistUrl(): ?string;
  25877. public function getDistUrls(): array;
  25878. public function getDistReference(): ?string;
  25879. public function getDistSha1Checksum(): ?string;
  25880. public function getDistMirrors(): ?array;
  25881. public function setDistMirrors(?array $mirrors): void;
  25882. public function getVersion(): string;
  25883. public function getPrettyVersion(): string;
  25884. public function getFullPrettyVersion(bool $truncate = true, int $displayMode = self::DISPLAY_SOURCE_REF_IF_DEV): string;
  25885. public function getReleaseDate(): ?\DateTimeInterface;
  25886. public function getStability(): string;
  25887. public function getRequires(): array;
  25888. public function getConflicts(): array;
  25889. public function getProvides(): array;
  25890. public function getReplaces(): array;
  25891. public function getDevRequires(): array;
  25892. public function getSuggests(): array;
  25893. public function getAutoload(): array;
  25894. public function getDevAutoload(): array;
  25895. public function getIncludePaths(): array;
  25896. public function setRepository(RepositoryInterface $repository): void;
  25897. public function getRepository(): ?RepositoryInterface;
  25898. public function getBinaries(): array;
  25899. public function getUniqueName(): string;
  25900. public function getNotificationUrl(): ?string;
  25901. public function __toString(): string;
  25902. public function getPrettyString(): string;
  25903. public function isDefaultBranch(): bool;
  25904. public function getTransportOptions(): array;
  25905. public function setTransportOptions(array $options): void;
  25906. public function setSourceReference(?string $reference): void;
  25907. public function setDistUrl(?string $url): void;
  25908. public function setDistType(?string $type): void;
  25909. public function setDistReference(?string $reference): void;
  25910. public function setSourceDistReferences(string $reference): void;
  25911. }
  25912. <?php declare(strict_types=1);
  25913. namespace Composer\Package;
  25914. class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterface
  25915. {
  25916. protected $aliasOf;
  25917. public function __construct(RootPackage $aliasOf, string $version, string $prettyVersion)
  25918. {
  25919. parent::__construct($aliasOf, $version, $prettyVersion);
  25920. }
  25921. public function getAliasOf()
  25922. {
  25923. return $this->aliasOf;
  25924. }
  25925. public function getAliases(): array
  25926. {
  25927. return $this->aliasOf->getAliases();
  25928. }
  25929. public function getMinimumStability(): string
  25930. {
  25931. return $this->aliasOf->getMinimumStability();
  25932. }
  25933. public function getStabilityFlags(): array
  25934. {
  25935. return $this->aliasOf->getStabilityFlags();
  25936. }
  25937. public function getReferences(): array
  25938. {
  25939. return $this->aliasOf->getReferences();
  25940. }
  25941. public function getPreferStable(): bool
  25942. {
  25943. return $this->aliasOf->getPreferStable();
  25944. }
  25945. public function getConfig(): array
  25946. {
  25947. return $this->aliasOf->getConfig();
  25948. }
  25949. public function setRequires(array $requires): void
  25950. {
  25951. $this->requires = $this->replaceSelfVersionDependencies($requires, Link::TYPE_REQUIRE);
  25952. $this->aliasOf->setRequires($requires);
  25953. }
  25954. public function setDevRequires(array $devRequires): void
  25955. {
  25956. $this->devRequires = $this->replaceSelfVersionDependencies($devRequires, Link::TYPE_DEV_REQUIRE);
  25957. $this->aliasOf->setDevRequires($devRequires);
  25958. }
  25959. public function setConflicts(array $conflicts): void
  25960. {
  25961. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT);
  25962. $this->aliasOf->setConflicts($conflicts);
  25963. }
  25964. public function setProvides(array $provides): void
  25965. {
  25966. $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE);
  25967. $this->aliasOf->setProvides($provides);
  25968. }
  25969. public function setReplaces(array $replaces): void
  25970. {
  25971. $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE);
  25972. $this->aliasOf->setReplaces($replaces);
  25973. }
  25974. public function setAutoload(array $autoload): void
  25975. {
  25976. $this->aliasOf->setAutoload($autoload);
  25977. }
  25978. public function setDevAutoload(array $devAutoload): void
  25979. {
  25980. $this->aliasOf->setDevAutoload($devAutoload);
  25981. }
  25982. public function setStabilityFlags(array $stabilityFlags): void
  25983. {
  25984. $this->aliasOf->setStabilityFlags($stabilityFlags);
  25985. }
  25986. public function setMinimumStability(string $minimumStability): void
  25987. {
  25988. $this->aliasOf->setMinimumStability($minimumStability);
  25989. }
  25990. public function setPreferStable(bool $preferStable): void
  25991. {
  25992. $this->aliasOf->setPreferStable($preferStable);
  25993. }
  25994. public function setConfig(array $config): void
  25995. {
  25996. $this->aliasOf->setConfig($config);
  25997. }
  25998. public function setReferences(array $references): void
  25999. {
  26000. $this->aliasOf->setReferences($references);
  26001. }
  26002. public function setAliases(array $aliases): void
  26003. {
  26004. $this->aliasOf->setAliases($aliases);
  26005. }
  26006. public function setSuggests(array $suggests): void
  26007. {
  26008. $this->aliasOf->setSuggests($suggests);
  26009. }
  26010. public function setExtra(array $extra): void
  26011. {
  26012. $this->aliasOf->setExtra($extra);
  26013. }
  26014. public function __clone()
  26015. {
  26016. parent::__clone();
  26017. $this->aliasOf = clone $this->aliasOf;
  26018. }
  26019. }
  26020. <?php declare(strict_types=1);
  26021. namespace Composer\Package;
  26022. class RootPackage extends CompletePackage implements RootPackageInterface
  26023. {
  26024. public const DEFAULT_PRETTY_VERSION = '1.0.0+no-version-set';
  26025. protected $minimumStability = 'stable';
  26026. protected $preferStable = false;
  26027. protected $stabilityFlags = [];
  26028. protected $config = [];
  26029. protected $references = [];
  26030. protected $aliases = [];
  26031. public function setMinimumStability(string $minimumStability): void
  26032. {
  26033. $this->minimumStability = $minimumStability;
  26034. }
  26035. public function getMinimumStability(): string
  26036. {
  26037. return $this->minimumStability;
  26038. }
  26039. public function setStabilityFlags(array $stabilityFlags): void
  26040. {
  26041. $this->stabilityFlags = $stabilityFlags;
  26042. }
  26043. public function getStabilityFlags(): array
  26044. {
  26045. return $this->stabilityFlags;
  26046. }
  26047. public function setPreferStable(bool $preferStable): void
  26048. {
  26049. $this->preferStable = $preferStable;
  26050. }
  26051. public function getPreferStable(): bool
  26052. {
  26053. return $this->preferStable;
  26054. }
  26055. public function setConfig(array $config): void
  26056. {
  26057. $this->config = $config;
  26058. }
  26059. public function getConfig(): array
  26060. {
  26061. return $this->config;
  26062. }
  26063. public function setReferences(array $references): void
  26064. {
  26065. $this->references = $references;
  26066. }
  26067. public function getReferences(): array
  26068. {
  26069. return $this->references;
  26070. }
  26071. public function setAliases(array $aliases): void
  26072. {
  26073. $this->aliases = $aliases;
  26074. }
  26075. public function getAliases(): array
  26076. {
  26077. return $this->aliases;
  26078. }
  26079. }
  26080. <?php declare(strict_types=1);
  26081. namespace Composer\Package;
  26082. interface RootPackageInterface extends CompletePackageInterface
  26083. {
  26084. public function getAliases(): array;
  26085. public function getMinimumStability(): string;
  26086. public function getStabilityFlags(): array;
  26087. public function getReferences(): array;
  26088. public function getPreferStable(): bool;
  26089. public function getConfig(): array;
  26090. public function setRequires(array $requires): void;
  26091. public function setDevRequires(array $devRequires): void;
  26092. public function setConflicts(array $conflicts): void;
  26093. public function setProvides(array $provides): void;
  26094. public function setReplaces(array $replaces): void;
  26095. public function setAutoload(array $autoload): void;
  26096. public function setDevAutoload(array $devAutoload): void;
  26097. public function setStabilityFlags(array $stabilityFlags): void;
  26098. public function setMinimumStability(string $minimumStability): void;
  26099. public function setPreferStable(bool $preferStable): void;
  26100. public function setConfig(array $config): void;
  26101. public function setReferences(array $references): void;
  26102. public function setAliases(array $aliases): void;
  26103. public function setSuggests(array $suggests): void;
  26104. public function setExtra(array $extra): void;
  26105. }
  26106. <?php declare(strict_types=1);
  26107. namespace Composer\Package\Version;
  26108. use Composer\Package\BasePackage;
  26109. class StabilityFilter
  26110. {
  26111. public static function isPackageAcceptable(array $acceptableStabilities, array $stabilityFlags, array $names, string $stability): bool
  26112. {
  26113. foreach ($names as $name) {
  26114. if (isset($stabilityFlags[$name])) {
  26115. if (BasePackage::$stabilities[$stability] <= $stabilityFlags[$name]) {
  26116. return true;
  26117. }
  26118. } elseif (isset($acceptableStabilities[$stability])) {
  26119. return true;
  26120. }
  26121. }
  26122. return false;
  26123. }
  26124. }
  26125. <?php declare(strict_types=1);
  26126. namespace Composer\Package\Version;
  26127. use Composer\Package\PackageInterface;
  26128. use Composer\Package\Loader\ArrayLoader;
  26129. use Composer\Package\Dumper\ArrayDumper;
  26130. use Composer\Pcre\Preg;
  26131. use Composer\Semver\Constraint\Constraint;
  26132. use Composer\Semver\Constraint\ConstraintInterface;
  26133. use Composer\Semver\Intervals;
  26134. use Composer\Util\Platform;
  26135. class VersionBumper
  26136. {
  26137. public function bumpRequirement(ConstraintInterface $constraint, PackageInterface $package): string
  26138. {
  26139. $parser = new VersionParser();
  26140. $prettyConstraint = $constraint->getPrettyString();
  26141. if (str_starts_with($constraint->getPrettyString(), 'dev-')) {
  26142. return $prettyConstraint;
  26143. }
  26144. $version = $package->getVersion();
  26145. if (str_starts_with($package->getVersion(), 'dev-')) {
  26146. $loader = new ArrayLoader($parser);
  26147. $dumper = new ArrayDumper();
  26148. $extra = $loader->getBranchAlias($dumper->dump($package));
  26149. if (null === $extra || $extra === VersionParser::DEFAULT_BRANCH_ALIAS) {
  26150. return $prettyConstraint;
  26151. }
  26152. $version = $extra;
  26153. }
  26154. $intervals = Intervals::get($constraint);
  26155. if (\count($intervals['branches']['names']) > 0) {
  26156. return $prettyConstraint;
  26157. }
  26158. $major = Preg::replace('{^(\d+).*}', '$1', $version);
  26159. $versionWithoutSuffix = Preg::replace('{(?:\.(?:0|9999999))+(-dev)?$}', '', $version);
  26160. $newPrettyConstraint = '^'.$versionWithoutSuffix;
  26161. if (!Preg::isMatch('{^\^\d+(\.\d+)*$}', $newPrettyConstraint)) {
  26162. return $prettyConstraint;
  26163. }
  26164. $pattern = '{
  26165. (?<=,|\ |\||^) # leading separator
  26166. (?P<constraint>
  26167. \^v?'.$major.'(?:\.\d+)* # e.g. ^2.anything
  26168. | ~v?'.$major.'(?:\.\d+){0,2} # e.g. ~2 or ~2.2 or ~2.2.2 but no more
  26169. | v?'.$major.'(?:\.[*x])+ # e.g. 2.* or 2.*.* or 2.x.x.x etc
  26170. | >=v?\d(?:\.\d+)* # e.g. >=2 or >=1.2 etc
  26171. | \* # full wildcard
  26172. )
  26173. (?=,|$|\ |\||@) # trailing separator
  26174. }x';
  26175. if (Preg::isMatchAllWithOffsets($pattern, $prettyConstraint, $matches)) {
  26176. $modified = $prettyConstraint;
  26177. foreach (array_reverse($matches['constraint']) as $match) {
  26178. assert(is_string($match[0]));
  26179. $suffix = '';
  26180. if (substr_count($match[0], '.') === 2 && substr_count($versionWithoutSuffix, '.') === 1) {
  26181. $suffix = '.0';
  26182. }
  26183. if (str_starts_with($match[0], '~') && substr_count($match[0], '.') === 2) {
  26184. $replacement = '~'.$versionWithoutSuffix.$suffix;
  26185. } elseif ($match[0] === '*' || str_starts_with($match[0], '>=')) {
  26186. $replacement = '>='.$versionWithoutSuffix.$suffix;
  26187. } else {
  26188. $replacement = $newPrettyConstraint.$suffix;
  26189. }
  26190. $modified = substr_replace($modified, $replacement, $match[1], Platform::strlen($match[0]));
  26191. }
  26192. $newConstraint = $parser->parseConstraints($modified);
  26193. if (Intervals::isSubsetOf($newConstraint, $constraint) && Intervals::isSubsetOf($constraint, $newConstraint)) {
  26194. return $prettyConstraint;
  26195. }
  26196. return $modified;
  26197. }
  26198. return $prettyConstraint;
  26199. }
  26200. }
  26201. <?php declare(strict_types=1);
  26202. namespace Composer\Package\Version;
  26203. use Composer\Config;
  26204. use Composer\Pcre\Preg;
  26205. use Composer\Repository\Vcs\HgDriver;
  26206. use Composer\IO\NullIO;
  26207. use Composer\Semver\VersionParser as SemverVersionParser;
  26208. use Composer\Util\Git as GitUtil;
  26209. use Composer\Util\HttpDownloader;
  26210. use Composer\Util\Platform;
  26211. use Composer\Util\ProcessExecutor;
  26212. use Composer\Util\Svn as SvnUtil;
  26213. use React\Promise\CancellablePromiseInterface;
  26214. use Symfony\Component\Process\Process;
  26215. class VersionGuesser
  26216. {
  26217. private $config;
  26218. private $process;
  26219. private $versionParser;
  26220. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  26221. {
  26222. $this->config = $config;
  26223. $this->process = $process;
  26224. $this->versionParser = $versionParser;
  26225. }
  26226. public function guessVersion(array $packageConfig, string $path): ?array
  26227. {
  26228. if (!function_exists('proc_open')) {
  26229. return null;
  26230. }
  26231. if (Platform::isInputCompletionProcess()) {
  26232. return null;
  26233. }
  26234. $versionData = $this->guessGitVersion($packageConfig, $path);
  26235. if (null !== $versionData['version']) {
  26236. return $this->postprocess($versionData);
  26237. }
  26238. $versionData = $this->guessHgVersion($packageConfig, $path);
  26239. if (null !== $versionData && null !== $versionData['version']) {
  26240. return $this->postprocess($versionData);
  26241. }
  26242. $versionData = $this->guessFossilVersion($path);
  26243. if (null !== $versionData['version']) {
  26244. return $this->postprocess($versionData);
  26245. }
  26246. $versionData = $this->guessSvnVersion($packageConfig, $path);
  26247. if (null !== $versionData && null !== $versionData['version']) {
  26248. return $this->postprocess($versionData);
  26249. }
  26250. return null;
  26251. }
  26252. private function postprocess(array $versionData): array
  26253. {
  26254. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) {
  26255. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  26256. }
  26257. if ('-dev' === substr($versionData['version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['version'])) {
  26258. $versionData['pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['version']);
  26259. }
  26260. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['feature_version'])) {
  26261. $versionData['feature_pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  26262. }
  26263. return $versionData;
  26264. }
  26265. private function guessGitVersion(array $packageConfig, string $path): array
  26266. {
  26267. GitUtil::cleanEnv();
  26268. $commit = null;
  26269. $version = null;
  26270. $prettyVersion = null;
  26271. $featureVersion = null;
  26272. $featurePrettyVersion = null;
  26273. $isDetached = false;
  26274. if (0 === $this->process->execute(['git', 'branch', '-a', '--no-color', '--no-abbrev', '-v'], $output, $path)) {
  26275. $branches = [];
  26276. $isFeatureBranch = false;
  26277. foreach ($this->process->splitLines($output) as $branch) {
  26278. if ($branch && Preg::isMatchStrictGroups('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  26279. if (
  26280. $match[1] === '(no branch)'
  26281. || strpos($match[1], '(detached ') === 0
  26282. || strpos($match[1], '(HEAD detached at') === 0
  26283. ) {
  26284. $version = 'dev-' . $match[2];
  26285. $prettyVersion = $version;
  26286. $isFeatureBranch = true;
  26287. $isDetached = true;
  26288. } else {
  26289. $version = $this->versionParser->normalizeBranch($match[1]);
  26290. $prettyVersion = 'dev-' . $match[1];
  26291. $isFeatureBranch = $this->isFeatureBranch($packageConfig, $match[1]);
  26292. }
  26293. $commit = $match[2];
  26294. }
  26295. if ($branch && !Preg::isMatchStrictGroups('{^ *.+/HEAD }', $branch)) {
  26296. if (Preg::isMatchStrictGroups('{^(?:\* )? *((?:remotes/(?:origin|upstream)/)?[^\s/]+) *([a-f0-9]+) .*$}', $branch, $match)) {
  26297. $branches[] = $match[1];
  26298. }
  26299. }
  26300. }
  26301. if ($isFeatureBranch) {
  26302. $featureVersion = $version;
  26303. $featurePrettyVersion = $prettyVersion;
  26304. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  26305. $version = $result['version'];
  26306. $prettyVersion = $result['pretty_version'];
  26307. }
  26308. }
  26309. if (!$version || $isDetached) {
  26310. $result = $this->versionFromGitTags($path);
  26311. if ($result) {
  26312. $version = $result['version'];
  26313. $prettyVersion = $result['pretty_version'];
  26314. $featureVersion = null;
  26315. $featurePrettyVersion = null;
  26316. }
  26317. }
  26318. if (null === $commit) {
  26319. $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
  26320. if (0 === $this->process->execute($command, $output, $path)) {
  26321. $commit = trim($output) ?: null;
  26322. }
  26323. }
  26324. if ($featureVersion) {
  26325. return ['version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion];
  26326. }
  26327. return ['version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion];
  26328. }
  26329. private function versionFromGitTags(string $path): ?array
  26330. {
  26331. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  26332. try {
  26333. $version = $this->versionParser->normalize(trim($output));
  26334. return ['version' => $version, 'pretty_version' => trim($output)];
  26335. } catch (\Exception $e) {
  26336. }
  26337. }
  26338. return null;
  26339. }
  26340. private function guessHgVersion(array $packageConfig, string $path): ?array
  26341. {
  26342. if (0 === $this->process->execute('hg branch', $output, $path)) {
  26343. $branch = trim($output);
  26344. $version = $this->versionParser->normalizeBranch($branch);
  26345. $isFeatureBranch = 0 === strpos($version, 'dev-');
  26346. if (VersionParser::DEFAULT_BRANCH_ALIAS === $version) {
  26347. return ['version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch];
  26348. }
  26349. if (!$isFeatureBranch) {
  26350. return ['version' => $version, 'commit' => null, 'pretty_version' => $version];
  26351. }
  26352. $io = new NullIO();
  26353. $driver = new HgDriver(['url' => $path], $io, $this->config, new HttpDownloader($io, $this->config), $this->process);
  26354. $branches = array_map('strval', array_keys($driver->getBranches()));
  26355. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  26356. $result['commit'] = '';
  26357. $result['feature_version'] = $version;
  26358. $result['feature_pretty_version'] = $version;
  26359. return $result;
  26360. }
  26361. return null;
  26362. }
  26363. private function guessFeatureVersion(array $packageConfig, ?string $version, array $branches, string $scmCmdline, string $path): array
  26364. {
  26365. $prettyVersion = $version;
  26366. if (!isset($packageConfig['extra']['branch-alias'][$version])
  26367. || strpos(json_encode($packageConfig), '"self.version"')
  26368. ) {
  26369. $branch = Preg::replace('{^dev-}', '', $version);
  26370. $length = PHP_INT_MAX;
  26371. if (!$this->isFeatureBranch($packageConfig, $branch)) {
  26372. return ['version' => $version, 'pretty_version' => $prettyVersion];
  26373. }
  26374. usort($branches, static function ($a, $b): int {
  26375. $aRemote = 0 === strpos($a, 'remotes/');
  26376. $bRemote = 0 === strpos($b, 'remotes/');
  26377. if ($aRemote !== $bRemote) {
  26378. return $aRemote ? 1 : -1;
  26379. }
  26380. return strnatcasecmp($b, $a);
  26381. });
  26382. $promises = [];
  26383. $this->process->setMaxJobs(30);
  26384. try {
  26385. foreach ($branches as $candidate) {
  26386. $candidateVersion = Preg::replace('{^remotes/\S+/}', '', $candidate);
  26387. if ($candidate === $branch || $this->isFeatureBranch($packageConfig, $candidateVersion)) {
  26388. continue;
  26389. }
  26390. $cmdLine = str_replace(['%candidate%', '%branch%'], [$candidate, $branch], $scmCmdline);
  26391. $promises[] = $this->process->executeAsync($cmdLine, $path)->then(function (Process $process) use (&$length, &$version, &$prettyVersion, $candidateVersion, &$promises): void {
  26392. if (!$process->isSuccessful()) {
  26393. return;
  26394. }
  26395. $output = $process->getOutput();
  26396. if (strlen($output) < $length) {
  26397. $length = strlen($output);
  26398. $version = $this->versionParser->normalizeBranch($candidateVersion);
  26399. $prettyVersion = 'dev-' . $candidateVersion;
  26400. if ($length === 0) {
  26401. foreach ($promises as $promise) {
  26402. \React\Promise\resolve($promise)->cancel();
  26403. }
  26404. }
  26405. }
  26406. });
  26407. }
  26408. $this->process->wait();
  26409. } finally {
  26410. $this->process->resetMaxJobs();
  26411. }
  26412. }
  26413. return ['version' => $version, 'pretty_version' => $prettyVersion];
  26414. }
  26415. private function isFeatureBranch(array $packageConfig, ?string $branchName): bool
  26416. {
  26417. $nonFeatureBranches = '';
  26418. if (!empty($packageConfig['non-feature-branches'])) {
  26419. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  26420. }
  26421. return !Preg::isMatch('{^(' . $nonFeatureBranches . '|master|main|latest|next|current|support|tip|trunk|default|develop|\d+\..+)$}', $branchName, $match);
  26422. }
  26423. private function guessFossilVersion(string $path): array
  26424. {
  26425. $version = null;
  26426. $prettyVersion = null;
  26427. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  26428. $branch = trim($output);
  26429. $version = $this->versionParser->normalizeBranch($branch);
  26430. $prettyVersion = 'dev-' . $branch;
  26431. }
  26432. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  26433. try {
  26434. $version = $this->versionParser->normalize(trim($output));
  26435. $prettyVersion = trim($output);
  26436. } catch (\Exception $e) {
  26437. }
  26438. }
  26439. return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
  26440. }
  26441. private function guessSvnVersion(array $packageConfig, string $path): ?array
  26442. {
  26443. SvnUtil::cleanEnv();
  26444. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  26445. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  26446. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  26447. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  26448. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  26449. if (Preg::isMatch($urlPattern, $output, $matches)) {
  26450. if (isset($matches[2], $matches[3]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  26451. $version = $this->versionParser->normalizeBranch($matches[3]);
  26452. $prettyVersion = 'dev-' . $matches[3];
  26453. return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
  26454. }
  26455. assert(is_string($matches[1]));
  26456. $prettyVersion = trim($matches[1]);
  26457. if ($prettyVersion === 'trunk') {
  26458. $version = 'dev-trunk';
  26459. } else {
  26460. $version = $this->versionParser->normalize($prettyVersion);
  26461. }
  26462. return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
  26463. }
  26464. }
  26465. return null;
  26466. }
  26467. }
  26468. <?php declare(strict_types=1);
  26469. namespace Composer\Package\Version;
  26470. use Composer\Pcre\Preg;
  26471. use Composer\Repository\PlatformRepository;
  26472. use Composer\Semver\VersionParser as SemverVersionParser;
  26473. use Composer\Semver\Semver;
  26474. use Composer\Semver\Constraint\ConstraintInterface;
  26475. class VersionParser extends SemverVersionParser
  26476. {
  26477. public const DEFAULT_BRANCH_ALIAS = '9999999-dev';
  26478. private static $constraints = [];
  26479. public function parseConstraints($constraints): ConstraintInterface
  26480. {
  26481. if (!isset(self::$constraints[$constraints])) {
  26482. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  26483. }
  26484. return self::$constraints[$constraints];
  26485. }
  26486. public function parseNameVersionPairs(array $pairs): array
  26487. {
  26488. $pairs = array_values($pairs);
  26489. $result = [];
  26490. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  26491. $pair = Preg::replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  26492. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !Preg::isMatch('{(?<=[a-z0-9_/-])\*|\*(?=[a-z0-9_/-])}i', $pairs[$i + 1]) && !PlatformRepository::isPlatformPackage($pairs[$i + 1])) {
  26493. $pair .= ' '.$pairs[$i + 1];
  26494. $i++;
  26495. }
  26496. if (strpos($pair, ' ')) {
  26497. [$name, $version] = explode(' ', $pair, 2);
  26498. $result[] = ['name' => $name, 'version' => $version];
  26499. } else {
  26500. $result[] = ['name' => $pair];
  26501. }
  26502. }
  26503. return $result;
  26504. }
  26505. public static function isUpgrade(string $normalizedFrom, string $normalizedTo): bool
  26506. {
  26507. if ($normalizedFrom === $normalizedTo) {
  26508. return true;
  26509. }
  26510. if (in_array($normalizedFrom, ['dev-master', 'dev-trunk', 'dev-default'], true)) {
  26511. $normalizedFrom = VersionParser::DEFAULT_BRANCH_ALIAS;
  26512. }
  26513. if (in_array($normalizedTo, ['dev-master', 'dev-trunk', 'dev-default'], true)) {
  26514. $normalizedTo = VersionParser::DEFAULT_BRANCH_ALIAS;
  26515. }
  26516. if (strpos($normalizedFrom, 'dev-') === 0 || strpos($normalizedTo, 'dev-') === 0) {
  26517. return true;
  26518. }
  26519. $sorted = Semver::sort([$normalizedTo, $normalizedFrom]);
  26520. return $sorted[0] === $normalizedFrom;
  26521. }
  26522. }
  26523. <?php declare(strict_types=1);
  26524. namespace Composer\Package\Version;
  26525. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  26526. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  26527. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  26528. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  26529. use Composer\IO\IOInterface;
  26530. use Composer\Package\BasePackage;
  26531. use Composer\Package\AliasPackage;
  26532. use Composer\Package\PackageInterface;
  26533. use Composer\Composer;
  26534. use Composer\Package\Loader\ArrayLoader;
  26535. use Composer\Package\Dumper\ArrayDumper;
  26536. use Composer\Pcre\Preg;
  26537. use Composer\Repository\RepositorySet;
  26538. use Composer\Repository\PlatformRepository;
  26539. use Composer\Semver\Constraint\Constraint;
  26540. use Composer\Semver\Constraint\ConstraintInterface;
  26541. class VersionSelector
  26542. {
  26543. private $repositorySet;
  26544. private $platformConstraints = [];
  26545. private $parser;
  26546. public function __construct(RepositorySet $repositorySet, ?PlatformRepository $platformRepo = null)
  26547. {
  26548. $this->repositorySet = $repositorySet;
  26549. if ($platformRepo) {
  26550. foreach ($platformRepo->getPackages() as $package) {
  26551. $this->platformConstraints[$package->getName()][] = new Constraint('==', $package->getVersion());
  26552. }
  26553. }
  26554. }
  26555. public function findBestCandidate(string $packageName, ?string $targetPackageVersion = null, string $preferredStability = 'stable', $platformRequirementFilter = null, int $repoSetFlags = 0, ?IOInterface $io = null, $showWarnings = true)
  26556. {
  26557. if (!isset(BasePackage::$stabilities[$preferredStability])) {
  26558. throw new \UnexpectedValueException('Expected a valid stability name as 3rd argument, got '.$preferredStability);
  26559. }
  26560. if (null === $platformRequirementFilter) {
  26561. $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  26562. } elseif (!($platformRequirementFilter instanceof PlatformRequirementFilterInterface)) {
  26563. trigger_error('VersionSelector::findBestCandidate with ignored platform reqs as bool|array is deprecated since Composer 2.2, use an instance of PlatformRequirementFilterInterface instead.', E_USER_DEPRECATED);
  26564. $platformRequirementFilter = PlatformRequirementFilterFactory::fromBoolOrList($platformRequirementFilter);
  26565. }
  26566. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  26567. $candidates = $this->repositorySet->findPackages(strtolower($packageName), $constraint, $repoSetFlags);
  26568. $minPriority = BasePackage::$stabilities[$preferredStability];
  26569. usort($candidates, static function (PackageInterface $a, PackageInterface $b) use ($minPriority) {
  26570. $aPriority = $a->getStabilityPriority();
  26571. $bPriority = $b->getStabilityPriority();
  26572. if ($minPriority < $aPriority && $bPriority < $aPriority) {
  26573. return 1;
  26574. }
  26575. if ($minPriority < $aPriority && $aPriority < $bPriority) {
  26576. return -1;
  26577. }
  26578. if ($minPriority >= $aPriority && $minPriority < $bPriority) {
  26579. return -1;
  26580. }
  26581. return version_compare($b->getVersion(), $a->getVersion());
  26582. });
  26583. if (count($this->platformConstraints) > 0 && !($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter)) {
  26584. $alreadyWarnedNames = [];
  26585. $alreadySeenNames = [];
  26586. foreach ($candidates as $pkg) {
  26587. $reqs = $pkg->getRequires();
  26588. foreach ($reqs as $name => $link) {
  26589. if (!PlatformRepository::isPlatformPackage($name) || $platformRequirementFilter->isIgnored($name)) {
  26590. continue;
  26591. }
  26592. if (isset($this->platformConstraints[$name])) {
  26593. foreach ($this->platformConstraints[$name] as $providedConstraint) {
  26594. if ($link->getConstraint()->matches($providedConstraint)) {
  26595. continue 2;
  26596. }
  26597. if ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter && $platformRequirementFilter->isUpperBoundIgnored($name)) {
  26598. $filteredConstraint = $platformRequirementFilter->filterConstraint($name, $link->getConstraint());
  26599. if ($filteredConstraint->matches($providedConstraint)) {
  26600. continue 2;
  26601. }
  26602. }
  26603. }
  26604. $reason = 'is not satisfied by your platform';
  26605. } else {
  26606. $reason = 'is missing from your platform';
  26607. }
  26608. $isLatestVersion = !isset($alreadySeenNames[$pkg->getName()]);
  26609. $alreadySeenNames[$pkg->getName()] = true;
  26610. if ($io !== null && ($showWarnings === true || (is_callable($showWarnings) && $showWarnings($pkg)))) {
  26611. $isFirstWarning = !isset($alreadyWarnedNames[$pkg->getName()]);
  26612. $alreadyWarnedNames[$pkg->getName()] = true;
  26613. $latest = $isLatestVersion ? "'s latest version" : '';
  26614. $io->writeError(
  26615. '<warning>Cannot use '.$pkg->getPrettyName().$latest.' '.$pkg->getPrettyVersion().' as it '.$link->getDescription().' '.$link->getTarget().' '.$link->getPrettyConstraint().' which '.$reason.'.</>',
  26616. true,
  26617. $isFirstWarning ? IOInterface::NORMAL : IOInterface::VERBOSE
  26618. );
  26619. }
  26620. continue 2;
  26621. }
  26622. $package = $pkg;
  26623. break;
  26624. }
  26625. } else {
  26626. $package = count($candidates) > 0 ? $candidates[0] : null;
  26627. }
  26628. if (!isset($package)) {
  26629. return false;
  26630. }
  26631. if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  26632. $package = $package->getAliasOf();
  26633. }
  26634. return $package;
  26635. }
  26636. public function findRecommendedRequireVersion(PackageInterface $package): string
  26637. {
  26638. if (0 === strpos($package->getName(), 'ext-')) {
  26639. $phpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  26640. $extVersion = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
  26641. if ($phpVersion === $extVersion) {
  26642. return '*';
  26643. }
  26644. }
  26645. $version = $package->getVersion();
  26646. if (!$package->isDev()) {
  26647. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  26648. }
  26649. $loader = new ArrayLoader($this->getParser());
  26650. $dumper = new ArrayDumper();
  26651. $extra = $loader->getBranchAlias($dumper->dump($package));
  26652. if ($extra && $extra !== VersionParser::DEFAULT_BRANCH_ALIAS) {
  26653. $extra = Preg::replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  26654. if ($count > 0) {
  26655. $extra = str_replace('.9999999', '.0', $extra);
  26656. return $this->transformVersion($extra, $extra, 'dev');
  26657. }
  26658. }
  26659. return $package->getPrettyVersion();
  26660. }
  26661. private function transformVersion(string $version, string $prettyVersion, string $stability): string
  26662. {
  26663. $semanticVersionParts = explode('.', $version);
  26664. if (count($semanticVersionParts) === 4 && Preg::isMatch('{^\d+\D?}', $semanticVersionParts[3])) {
  26665. if ($semanticVersionParts[0] === '0') {
  26666. unset($semanticVersionParts[3]);
  26667. } else {
  26668. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  26669. }
  26670. $version = implode('.', $semanticVersionParts);
  26671. } else {
  26672. return $prettyVersion;
  26673. }
  26674. if ($stability !== 'stable') {
  26675. $version .= '@'.$stability;
  26676. }
  26677. return '^' . $version;
  26678. }
  26679. private function getParser(): VersionParser
  26680. {
  26681. if ($this->parser === null) {
  26682. $this->parser = new VersionParser();
  26683. }
  26684. return $this->parser;
  26685. }
  26686. }
  26687. <?php declare(strict_types=1);
  26688. namespace Composer;
  26689. use Composer\Package\RootPackageInterface;
  26690. use Composer\Util\Loop;
  26691. use Composer\Repository\RepositoryManager;
  26692. use Composer\Installer\InstallationManager;
  26693. use Composer\EventDispatcher\EventDispatcher;
  26694. class PartialComposer
  26695. {
  26696. private $package;
  26697. private $loop;
  26698. private $repositoryManager;
  26699. private $installationManager;
  26700. private $config;
  26701. private $eventDispatcher;
  26702. public function setPackage(RootPackageInterface $package): void
  26703. {
  26704. $this->package = $package;
  26705. }
  26706. public function getPackage(): RootPackageInterface
  26707. {
  26708. return $this->package;
  26709. }
  26710. public function setConfig(Config $config): void
  26711. {
  26712. $this->config = $config;
  26713. }
  26714. public function getConfig(): Config
  26715. {
  26716. return $this->config;
  26717. }
  26718. public function setLoop(Loop $loop): void
  26719. {
  26720. $this->loop = $loop;
  26721. }
  26722. public function getLoop(): Loop
  26723. {
  26724. return $this->loop;
  26725. }
  26726. public function setRepositoryManager(RepositoryManager $manager): void
  26727. {
  26728. $this->repositoryManager = $manager;
  26729. }
  26730. public function getRepositoryManager(): RepositoryManager
  26731. {
  26732. return $this->repositoryManager;
  26733. }
  26734. public function setInstallationManager(InstallationManager $manager): void
  26735. {
  26736. $this->installationManager = $manager;
  26737. }
  26738. public function getInstallationManager(): InstallationManager
  26739. {
  26740. return $this->installationManager;
  26741. }
  26742. public function setEventDispatcher(EventDispatcher $eventDispatcher): void
  26743. {
  26744. $this->eventDispatcher = $eventDispatcher;
  26745. }
  26746. public function getEventDispatcher(): EventDispatcher
  26747. {
  26748. return $this->eventDispatcher;
  26749. }
  26750. }
  26751. <?php declare(strict_types=1);
  26752. namespace Composer\Platform;
  26753. use Composer\Util\Platform;
  26754. use Composer\Util\ProcessExecutor;
  26755. use Symfony\Component\Process\ExecutableFinder;
  26756. class HhvmDetector
  26757. {
  26758. private static $hhvmVersion = null;
  26759. private $executableFinder;
  26760. private $processExecutor;
  26761. public function __construct(?ExecutableFinder $executableFinder = null, ?ProcessExecutor $processExecutor = null)
  26762. {
  26763. $this->executableFinder = $executableFinder;
  26764. $this->processExecutor = $processExecutor;
  26765. }
  26766. public function reset(): void
  26767. {
  26768. self::$hhvmVersion = null;
  26769. }
  26770. public function getVersion(): ?string
  26771. {
  26772. if (null !== self::$hhvmVersion) {
  26773. return self::$hhvmVersion ?: null;
  26774. }
  26775. self::$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  26776. if (self::$hhvmVersion === null && !Platform::isWindows()) {
  26777. self::$hhvmVersion = false;
  26778. $this->executableFinder = $this->executableFinder ?: new ExecutableFinder();
  26779. $hhvmPath = $this->executableFinder->find('hhvm');
  26780. if ($hhvmPath !== null) {
  26781. $this->processExecutor = $this->processExecutor ?? new ProcessExecutor();
  26782. $exitCode = $this->processExecutor->execute(
  26783. ProcessExecutor::escape($hhvmPath).
  26784. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  26785. self::$hhvmVersion
  26786. );
  26787. if ($exitCode !== 0) {
  26788. self::$hhvmVersion = false;
  26789. }
  26790. }
  26791. }
  26792. return self::$hhvmVersion ?: null;
  26793. }
  26794. }
  26795. <?php declare(strict_types=1);
  26796. namespace Composer\Platform;
  26797. class Runtime
  26798. {
  26799. public function hasConstant(string $constant, ?string $class = null): bool
  26800. {
  26801. return defined(ltrim($class.'::'.$constant, ':'));
  26802. }
  26803. public function getConstant(string $constant, ?string $class = null)
  26804. {
  26805. return constant(ltrim($class.'::'.$constant, ':'));
  26806. }
  26807. public function hasFunction(string $fn): bool
  26808. {
  26809. return function_exists($fn);
  26810. }
  26811. public function invoke(callable $callable, array $arguments = [])
  26812. {
  26813. return $callable(...$arguments);
  26814. }
  26815. public function hasClass(string $class): bool
  26816. {
  26817. return class_exists($class, false);
  26818. }
  26819. public function construct(string $class, array $arguments = []): object
  26820. {
  26821. if (empty($arguments)) {
  26822. return new $class;
  26823. }
  26824. $refl = new \ReflectionClass($class);
  26825. return $refl->newInstanceArgs($arguments);
  26826. }
  26827. public function getExtensions(): array
  26828. {
  26829. return get_loaded_extensions();
  26830. }
  26831. public function getExtensionVersion(string $extension): string
  26832. {
  26833. $version = phpversion($extension);
  26834. if ($version === false) {
  26835. $version = '0';
  26836. }
  26837. return $version;
  26838. }
  26839. public function getExtensionInfo(string $extension): string
  26840. {
  26841. $reflector = new \ReflectionExtension($extension);
  26842. ob_start();
  26843. $reflector->info();
  26844. return ob_get_clean();
  26845. }
  26846. }
  26847. <?php declare(strict_types=1);
  26848. namespace Composer\Platform;
  26849. use Composer\Pcre\Preg;
  26850. class Version
  26851. {
  26852. public static function parseOpenssl(string $opensslVersion, ?bool &$isFips): ?string
  26853. {
  26854. $isFips = false;
  26855. if (!Preg::isMatchStrictGroups('/^(?<version>[0-9.]+)(?<patch>[a-z]{0,2})(?<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)(?:-\w+)?(?: \(.+?\))?$/', $opensslVersion, $matches)) {
  26856. return null;
  26857. }
  26858. $patch = '';
  26859. if (version_compare($matches['version'], '3.0.0', '<')) {
  26860. $patch = '.'.self::convertAlphaVersionToIntVersion($matches['patch']);
  26861. }
  26862. $isFips = strpos($matches['suffix'], 'fips') !== false;
  26863. $suffix = strtr('-'.ltrim($matches['suffix'], '-'), ['-fips' => '', '-pre' => '-alpha']);
  26864. return rtrim($matches['version'].$patch.$suffix, '-');
  26865. }
  26866. public static function parseLibjpeg(string $libjpegVersion): ?string
  26867. {
  26868. if (!Preg::isMatchStrictGroups('/^(?<major>\d+)(?<minor>[a-z]*)$/', $libjpegVersion, $matches)) {
  26869. return null;
  26870. }
  26871. return $matches['major'].'.'.self::convertAlphaVersionToIntVersion($matches['minor']);
  26872. }
  26873. public static function parseZoneinfoVersion(string $zoneinfoVersion): ?string
  26874. {
  26875. if (!Preg::isMatchStrictGroups('/^(?<year>\d{4})(?<revision>[a-z]*)$/', $zoneinfoVersion, $matches)) {
  26876. return null;
  26877. }
  26878. return $matches['year'].'.'.self::convertAlphaVersionToIntVersion($matches['revision']);
  26879. }
  26880. private static function convertAlphaVersionToIntVersion(string $alpha): int
  26881. {
  26882. return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
  26883. }
  26884. public static function convertLibxpmVersionId(int $versionId): string
  26885. {
  26886. return self::convertVersionId($versionId, 100);
  26887. }
  26888. public static function convertOpenldapVersionId(int $versionId): string
  26889. {
  26890. return self::convertVersionId($versionId, 100);
  26891. }
  26892. private static function convertVersionId(int $versionId, int $base): string
  26893. {
  26894. return sprintf(
  26895. '%d.%d.%d',
  26896. $versionId / ($base * $base),
  26897. (int) ($versionId / $base) % $base,
  26898. $versionId % $base
  26899. );
  26900. }
  26901. }
  26902. <?php declare(strict_types=1);
  26903. namespace Composer\Plugin\Capability;
  26904. interface Capability
  26905. {
  26906. }
  26907. <?php declare(strict_types=1);
  26908. namespace Composer\Plugin\Capability;
  26909. interface CommandProvider extends Capability
  26910. {
  26911. public function getCommands();
  26912. }
  26913. <?php declare(strict_types=1);
  26914. namespace Composer\Plugin;
  26915. interface Capable
  26916. {
  26917. public function getCapabilities();
  26918. }
  26919. <?php declare(strict_types=1);
  26920. namespace Composer\Plugin;
  26921. use Composer\EventDispatcher\Event;
  26922. use Symfony\Component\Console\Input\InputInterface;
  26923. use Symfony\Component\Console\Output\OutputInterface;
  26924. class CommandEvent extends Event
  26925. {
  26926. private $commandName;
  26927. private $input;
  26928. private $output;
  26929. public function __construct(string $name, string $commandName, InputInterface $input, OutputInterface $output, array $args = [], array $flags = [])
  26930. {
  26931. parent::__construct($name, $args, $flags);
  26932. $this->commandName = $commandName;
  26933. $this->input = $input;
  26934. $this->output = $output;
  26935. }
  26936. public function getInput(): InputInterface
  26937. {
  26938. return $this->input;
  26939. }
  26940. public function getOutput(): OutputInterface
  26941. {
  26942. return $this->output;
  26943. }
  26944. public function getCommandName(): string
  26945. {
  26946. return $this->commandName;
  26947. }
  26948. }
  26949. <?php declare(strict_types=1);
  26950. namespace Composer\Plugin;
  26951. use UnexpectedValueException;
  26952. class PluginBlockedException extends UnexpectedValueException
  26953. {
  26954. }
  26955. <?php declare(strict_types=1);
  26956. namespace Composer\Plugin;
  26957. class PluginEvents
  26958. {
  26959. public const INIT = 'init';
  26960. public const COMMAND = 'command';
  26961. public const PRE_FILE_DOWNLOAD = 'pre-file-download';
  26962. public const POST_FILE_DOWNLOAD = 'post-file-download';
  26963. public const PRE_COMMAND_RUN = 'pre-command-run';
  26964. public const PRE_POOL_CREATE = 'pre-pool-create';
  26965. }
  26966. <?php declare(strict_types=1);
  26967. namespace Composer\Plugin;
  26968. use Composer\Composer;
  26969. use Composer\IO\IOInterface;
  26970. interface PluginInterface
  26971. {
  26972. public const PLUGIN_API_VERSION = '2.6.0';
  26973. public function activate(Composer $composer, IOInterface $io);
  26974. public function deactivate(Composer $composer, IOInterface $io);
  26975. public function uninstall(Composer $composer, IOInterface $io);
  26976. }
  26977. <?php declare(strict_types=1);
  26978. namespace Composer\Plugin;
  26979. use Composer\Composer;
  26980. use Composer\EventDispatcher\EventSubscriberInterface;
  26981. use Composer\Installer\InstallerInterface;
  26982. use Composer\IO\IOInterface;
  26983. use Composer\Package\BasePackage;
  26984. use Composer\Package\CompletePackage;
  26985. use Composer\Package\Locker;
  26986. use Composer\Package\Package;
  26987. use Composer\Package\Version\VersionParser;
  26988. use Composer\PartialComposer;
  26989. use Composer\Pcre\Preg;
  26990. use Composer\Repository\RepositoryInterface;
  26991. use Composer\Repository\InstalledRepository;
  26992. use Composer\Repository\RootPackageRepository;
  26993. use Composer\Package\PackageInterface;
  26994. use Composer\Package\Link;
  26995. use Composer\Semver\Constraint\Constraint;
  26996. use Composer\Plugin\Capability\Capability;
  26997. use Composer\Util\PackageSorter;
  26998. class PluginManager
  26999. {
  27000. protected $composer;
  27001. protected $io;
  27002. protected $globalComposer;
  27003. protected $versionParser;
  27004. protected $disablePlugins = false;
  27005. protected $plugins = [];
  27006. protected $registeredPlugins = [];
  27007. private $allowPluginRules;
  27008. private $allowGlobalPluginRules;
  27009. private $runningInGlobalDir = false;
  27010. private static $classCounter = 0;
  27011. public function __construct(IOInterface $io, Composer $composer, ?PartialComposer $globalComposer = null, $disablePlugins = false)
  27012. {
  27013. $this->io = $io;
  27014. $this->composer = $composer;
  27015. $this->globalComposer = $globalComposer;
  27016. $this->versionParser = new VersionParser();
  27017. $this->disablePlugins = $disablePlugins;
  27018. $this->allowPluginRules = $this->parseAllowedPlugins($composer->getConfig()->get('allow-plugins'), $composer->getLocker());
  27019. $this->allowGlobalPluginRules = $this->parseAllowedPlugins($globalComposer !== null ? $globalComposer->getConfig()->get('allow-plugins') : false);
  27020. }
  27021. public function setRunningInGlobalDir(bool $runningInGlobalDir): void
  27022. {
  27023. $this->runningInGlobalDir = $runningInGlobalDir;
  27024. }
  27025. public function loadInstalledPlugins(): void
  27026. {
  27027. if (!$this->arePluginsDisabled('local')) {
  27028. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  27029. $this->loadRepository($repo, false);
  27030. }
  27031. if ($this->globalComposer !== null && !$this->arePluginsDisabled('global')) {
  27032. $this->loadRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
  27033. }
  27034. }
  27035. public function deactivateInstalledPlugins(): void
  27036. {
  27037. if (!$this->arePluginsDisabled('local')) {
  27038. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  27039. $this->deactivateRepository($repo, false);
  27040. }
  27041. if ($this->globalComposer !== null && !$this->arePluginsDisabled('global')) {
  27042. $this->deactivateRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
  27043. }
  27044. }
  27045. public function getPlugins(): array
  27046. {
  27047. return $this->plugins;
  27048. }
  27049. public function getGlobalComposer(): ?PartialComposer
  27050. {
  27051. return $this->globalComposer;
  27052. }
  27053. public function registerPackage(PackageInterface $package, bool $failOnMissingClasses = false, bool $isGlobalPlugin = false): void
  27054. {
  27055. if ($this->arePluginsDisabled($isGlobalPlugin ? 'global' : 'local')) {
  27056. $this->io->writeError('<warning>The "'.$package->getName().'" plugin was not loaded as plugins are disabled.</warning>');
  27057. return;
  27058. }
  27059. if ($package->getType() === 'composer-plugin') {
  27060. $requiresComposer = null;
  27061. foreach ($package->getRequires() as $link) {
  27062. if ('composer-plugin-api' === $link->getTarget()) {
  27063. $requiresComposer = $link->getConstraint();
  27064. break;
  27065. }
  27066. }
  27067. if (!$requiresComposer) {
  27068. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  27069. }
  27070. $currentPluginApiVersion = $this->getPluginApiVersion();
  27071. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  27072. if ($requiresComposer->getPrettyString() === $this->getPluginApiVersion()) {
  27073. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api '.$this->getPluginApiVersion().', this *WILL* break in the future and it should be fixed ASAP (require ^'.$this->getPluginApiVersion().' instead for example).</warning>');
  27074. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  27075. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  27076. return;
  27077. }
  27078. if ($package->getName() === 'symfony/flex' && Preg::isMatch('{^[0-9.]+$}', $package->getVersion()) && version_compare($package->getVersion(), '1.9.8', '<')) {
  27079. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.</warning>');
  27080. return;
  27081. }
  27082. }
  27083. if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin, true === ($package->getExtra()['plugin-optional'] ?? false))) {
  27084. $this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG);
  27085. return;
  27086. }
  27087. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  27088. if (isset($this->registeredPlugins[$package->getName()])) {
  27089. return;
  27090. }
  27091. $extra = $package->getExtra();
  27092. if (empty($extra['class'])) {
  27093. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  27094. }
  27095. $classes = is_array($extra['class']) ? $extra['class'] : [$extra['class']];
  27096. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  27097. $globalRepo = $this->globalComposer !== null ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  27098. $rootPackage = clone $this->composer->getPackage();
  27099. $rootPackageAutoloads = $rootPackage->getAutoload();
  27100. $rootPackageAutoloads['files'] = [];
  27101. $rootPackage->setAutoload($rootPackageAutoloads);
  27102. $rootPackageAutoloads = $rootPackage->getDevAutoload();
  27103. $rootPackageAutoloads['files'] = [];
  27104. $rootPackage->setDevAutoload($rootPackageAutoloads);
  27105. unset($rootPackageAutoloads);
  27106. $rootPackageRepo = new RootPackageRepository($rootPackage);
  27107. $installedRepo = new InstalledRepository([$localRepo, $rootPackageRepo]);
  27108. if ($globalRepo) {
  27109. $installedRepo->addRepository($globalRepo);
  27110. }
  27111. $autoloadPackages = [$package->getName() => $package];
  27112. $autoloadPackages = $this->collectDependencies($installedRepo, $autoloadPackages, $package);
  27113. $generator = $this->composer->getAutoloadGenerator();
  27114. $autoloads = [[$rootPackage, '']];
  27115. foreach ($autoloadPackages as $autoloadPackage) {
  27116. if ($autoloadPackage === $rootPackage) {
  27117. continue;
  27118. }
  27119. $installPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  27120. if ($installPath === null) {
  27121. continue;
  27122. }
  27123. $autoloads[] = [$autoloadPackage, $installPath];
  27124. }
  27125. $map = $generator->parseAutoloads($autoloads, $rootPackage);
  27126. $classLoader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
  27127. $classLoader->register(false);
  27128. foreach ($map['files'] as $fileIdentifier => $file) {
  27129. if ($fileIdentifier === '7e9bd612cc444b3eed788ebbe46263a0') {
  27130. continue;
  27131. }
  27132. \Composer\Autoload\composerRequire($fileIdentifier, $file);
  27133. }
  27134. foreach ($classes as $class) {
  27135. if (class_exists($class, false)) {
  27136. $class = trim($class, '\\');
  27137. $path = $classLoader->findFile($class);
  27138. $code = file_get_contents($path);
  27139. $separatorPos = strrpos($class, '\\');
  27140. $className = $class;
  27141. if ($separatorPos) {
  27142. $className = substr($class, $separatorPos + 1);
  27143. }
  27144. $code = Preg::replace('{^((?:(?:final|readonly)\s+)*(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  27145. $code = strtr($code, [
  27146. '__FILE__' => var_export($path, true),
  27147. '__DIR__' => var_export(dirname($path), true),
  27148. '__CLASS__' => var_export($class, true),
  27149. ]);
  27150. $code = Preg::replace('/^\s*<\?(php)?/i', '', $code, 1);
  27151. eval($code);
  27152. $class .= '_composer_tmp'.self::$classCounter;
  27153. self::$classCounter++;
  27154. }
  27155. if ($oldInstallerPlugin) {
  27156. if (!is_a($class, 'Composer\Installer\InstallerInterface', true)) {
  27157. throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Installer\InstallerInterface');
  27158. }
  27159. $this->io->writeError('<warning>Loading "'.$package->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'which is a legacy composer-installer built for Composer 1.x, it is likely to cause issues as you are running Composer 2.x.</warning>');
  27160. $installer = new $class($this->io, $this->composer);
  27161. $this->composer->getInstallationManager()->addInstaller($installer);
  27162. $this->registeredPlugins[$package->getName()] = $installer;
  27163. } elseif (class_exists($class)) {
  27164. if (!is_a($class, 'Composer\Plugin\PluginInterface', true)) {
  27165. throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Plugin\PluginInterface');
  27166. }
  27167. $plugin = new $class();
  27168. $this->addPlugin($plugin, $isGlobalPlugin, $package);
  27169. $this->registeredPlugins[$package->getName()] = $plugin;
  27170. } elseif ($failOnMissingClasses) {
  27171. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  27172. }
  27173. }
  27174. }
  27175. public function deactivatePackage(PackageInterface $package): void
  27176. {
  27177. if (!isset($this->registeredPlugins[$package->getName()])) {
  27178. return;
  27179. }
  27180. $plugin = $this->registeredPlugins[$package->getName()];
  27181. unset($this->registeredPlugins[$package->getName()]);
  27182. if ($plugin instanceof InstallerInterface) {
  27183. $this->composer->getInstallationManager()->removeInstaller($plugin);
  27184. } else {
  27185. $this->removePlugin($plugin);
  27186. }
  27187. }
  27188. public function uninstallPackage(PackageInterface $package): void
  27189. {
  27190. if (!isset($this->registeredPlugins[$package->getName()])) {
  27191. return;
  27192. }
  27193. $plugin = $this->registeredPlugins[$package->getName()];
  27194. if ($plugin instanceof InstallerInterface) {
  27195. $this->deactivatePackage($package);
  27196. } else {
  27197. unset($this->registeredPlugins[$package->getName()]);
  27198. $this->removePlugin($plugin);
  27199. $this->uninstallPlugin($plugin);
  27200. }
  27201. }
  27202. protected function getPluginApiVersion(): string
  27203. {
  27204. return PluginInterface::PLUGIN_API_VERSION;
  27205. }
  27206. public function addPlugin(PluginInterface $plugin, bool $isGlobalPlugin = false, ?PackageInterface $sourcePackage = null): void
  27207. {
  27208. if ($this->arePluginsDisabled($isGlobalPlugin ? 'global' : 'local')) {
  27209. return;
  27210. }
  27211. if ($sourcePackage === null) {
  27212. trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED);
  27213. } elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin, true === ($sourcePackage->getExtra()['plugin-optional'] ?? false))) {
  27214. $this->io->writeError('Skipped loading "'.get_class($plugin).' from '.$sourcePackage->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').' as it is not in config.allow-plugins', true, IOInterface::DEBUG);
  27215. return;
  27216. }
  27217. $details = [];
  27218. if ($sourcePackage) {
  27219. $details[] = 'from '.$sourcePackage->getName();
  27220. }
  27221. if ($isGlobalPlugin || $this->runningInGlobalDir) {
  27222. $details[] = 'installed globally';
  27223. }
  27224. $this->io->writeError('Loading plugin '.get_class($plugin).($details ? ' ('.implode(', ', $details).')' : ''), true, IOInterface::DEBUG);
  27225. $this->plugins[] = $plugin;
  27226. $plugin->activate($this->composer, $this->io);
  27227. if ($plugin instanceof EventSubscriberInterface) {
  27228. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  27229. }
  27230. }
  27231. public function removePlugin(PluginInterface $plugin): void
  27232. {
  27233. $index = array_search($plugin, $this->plugins, true);
  27234. if ($index === false) {
  27235. return;
  27236. }
  27237. $this->io->writeError('Unloading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  27238. unset($this->plugins[$index]);
  27239. $plugin->deactivate($this->composer, $this->io);
  27240. $this->composer->getEventDispatcher()->removeListener($plugin);
  27241. }
  27242. public function uninstallPlugin(PluginInterface $plugin): void
  27243. {
  27244. $this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG);
  27245. $plugin->uninstall($this->composer, $this->io);
  27246. }
  27247. private function loadRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
  27248. {
  27249. $packages = $repo->getPackages();
  27250. $weights = [];
  27251. foreach ($packages as $package) {
  27252. if ($package->getType() === 'composer-plugin') {
  27253. $extra = $package->getExtra();
  27254. if ($package->getName() === 'composer/installers' || true === ($extra['plugin-modifies-install-path'] ?? false)) {
  27255. $weights[$package->getName()] = -10000;
  27256. }
  27257. }
  27258. }
  27259. $sortedPackages = PackageSorter::sortPackages($packages, $weights);
  27260. foreach ($sortedPackages as $package) {
  27261. if (!($package instanceof CompletePackage)) {
  27262. continue;
  27263. }
  27264. if ('composer-plugin' === $package->getType()) {
  27265. $this->registerPackage($package, false, $isGlobalRepo);
  27266. } elseif ('composer-installer' === $package->getType()) {
  27267. $this->registerPackage($package, false, $isGlobalRepo);
  27268. }
  27269. }
  27270. }
  27271. private function deactivateRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
  27272. {
  27273. $packages = $repo->getPackages();
  27274. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  27275. foreach ($sortedPackages as $package) {
  27276. if (!($package instanceof CompletePackage)) {
  27277. continue;
  27278. }
  27279. if ('composer-plugin' === $package->getType()) {
  27280. $this->deactivatePackage($package);
  27281. } elseif ('composer-installer' === $package->getType()) {
  27282. $this->deactivatePackage($package);
  27283. }
  27284. }
  27285. }
  27286. private function collectDependencies(InstalledRepository $installedRepo, array $collected, PackageInterface $package): array
  27287. {
  27288. foreach ($package->getRequires() as $requireLink) {
  27289. foreach ($installedRepo->findPackagesWithReplacersAndProviders($requireLink->getTarget()) as $requiredPackage) {
  27290. if (!isset($collected[$requiredPackage->getName()])) {
  27291. $collected[$requiredPackage->getName()] = $requiredPackage;
  27292. $collected = $this->collectDependencies($installedRepo, $collected, $requiredPackage);
  27293. }
  27294. }
  27295. }
  27296. return $collected;
  27297. }
  27298. private function getInstallPath(PackageInterface $package, bool $global = false): ?string
  27299. {
  27300. if (!$global) {
  27301. return $this->composer->getInstallationManager()->getInstallPath($package);
  27302. }
  27303. assert(null !== $this->globalComposer);
  27304. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  27305. }
  27306. protected function getCapabilityImplementationClassName(PluginInterface $plugin, string $capability): ?string
  27307. {
  27308. if (!($plugin instanceof Capable)) {
  27309. return null;
  27310. }
  27311. $capabilities = (array) $plugin->getCapabilities();
  27312. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  27313. return trim($capabilities[$capability]);
  27314. }
  27315. if (
  27316. array_key_exists($capability, $capabilities)
  27317. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  27318. ) {
  27319. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], true));
  27320. }
  27321. return null;
  27322. }
  27323. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = []): ?Capability
  27324. {
  27325. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  27326. if (!class_exists($capabilityClass)) {
  27327. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  27328. }
  27329. $ctorArgs['plugin'] = $plugin;
  27330. $capabilityObj = new $capabilityClass($ctorArgs);
  27331. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  27332. throw new \RuntimeException(
  27333. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  27334. );
  27335. }
  27336. return $capabilityObj;
  27337. }
  27338. return null;
  27339. }
  27340. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = []): array
  27341. {
  27342. $capabilities = [];
  27343. foreach ($this->getPlugins() as $plugin) {
  27344. $capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs);
  27345. if (null !== $capability) {
  27346. $capabilities[] = $capability;
  27347. }
  27348. }
  27349. return $capabilities;
  27350. }
  27351. private function parseAllowedPlugins($allowPluginsConfig, ?Locker $locker = null): ?array
  27352. {
  27353. if ([] === $allowPluginsConfig && $locker !== null && $locker->isLocked() && version_compare($locker->getPluginApi(), '2.2.0', '<')) {
  27354. return null;
  27355. }
  27356. if (true === $allowPluginsConfig) {
  27357. return ['{}' => true];
  27358. }
  27359. if (false === $allowPluginsConfig) {
  27360. return ['{}' => false];
  27361. }
  27362. $rules = [];
  27363. foreach ($allowPluginsConfig as $pattern => $allow) {
  27364. $rules[BasePackage::packageNameToRegexp($pattern)] = $allow;
  27365. }
  27366. return $rules;
  27367. }
  27368. public function arePluginsDisabled($type)
  27369. {
  27370. return $this->disablePlugins === true || $this->disablePlugins === $type;
  27371. }
  27372. public function disablePlugins(): void
  27373. {
  27374. $this->disablePlugins = true;
  27375. }
  27376. public function isPluginAllowed(string $package, bool $isGlobalPlugin, bool $optional = false): bool
  27377. {
  27378. if ($isGlobalPlugin) {
  27379. $rules = &$this->allowGlobalPluginRules;
  27380. } else {
  27381. $rules = &$this->allowPluginRules;
  27382. }
  27383. if ($rules === null) {
  27384. if (!$this->io->isInteractive()) {
  27385. $this->io->writeError('<warning>For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins</warning>');
  27386. $this->io->writeError('<warning>This warning will become an exception once you run composer update!</warning>');
  27387. $rules = ['{}' => true];
  27388. return true;
  27389. }
  27390. $rules = [];
  27391. }
  27392. foreach ($rules as $pattern => $allow) {
  27393. if (Preg::isMatch($pattern, $package)) {
  27394. return $allow === true;
  27395. }
  27396. }
  27397. if ($package === 'composer/package-versions-deprecated') {
  27398. return false;
  27399. }
  27400. if ($this->io->isInteractive()) {
  27401. $composer = $isGlobalPlugin && $this->globalComposer !== null ? $this->globalComposer : $this->composer;
  27402. $this->io->writeError('<warning>'.$package.($isGlobalPlugin || $this->runningInGlobalDir ? ' (installed globally)' : '').' contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins</warning>');
  27403. $attempts = 0;
  27404. while (true) {
  27405. $default = '?';
  27406. if ($attempts > 5) {
  27407. $this->io->writeError('Too many failed prompts, aborting.');
  27408. break;
  27409. }
  27410. switch ($answer = $this->io->ask('Do you trust "<fg=green;options=bold>'.$package.'</>" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [<comment>y,n,d,?</comment>] ', $default)) {
  27411. case 'y':
  27412. case 'n':
  27413. case 'd':
  27414. $allow = $answer === 'y';
  27415. $rules[BasePackage::packageNameToRegexp($package)] = $allow;
  27416. if ($answer === 'y' || $answer === 'n') {
  27417. $composer->getConfig()->getConfigSource()->addConfigSetting('allow-plugins.'.$package, $allow);
  27418. }
  27419. return $allow;
  27420. case '?':
  27421. default:
  27422. $attempts++;
  27423. $this->io->writeError([
  27424. 'y - add package to allow-plugins in composer.json and let it run immediately',
  27425. 'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts',
  27426. 'd - discard this, do not change composer.json and do not allow the plugin to run',
  27427. '? - print help',
  27428. ]);
  27429. break;
  27430. }
  27431. }
  27432. } elseif ($optional) {
  27433. return false;
  27434. }
  27435. throw new PluginBlockedException(
  27436. $package.($isGlobalPlugin || $this->runningInGlobalDir ? ' (installed globally)' : '').' contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.'.PHP_EOL.
  27437. 'You can run "composer '.($isGlobalPlugin || $this->runningInGlobalDir ? 'global ' : '').'config --no-plugins allow-plugins.'.$package.' [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)'.PHP_EOL.
  27438. 'See https://getcomposer.org/allow-plugins'
  27439. );
  27440. }
  27441. }
  27442. <?php declare(strict_types=1);
  27443. namespace Composer\Plugin;
  27444. use Composer\EventDispatcher\Event;
  27445. use Composer\Package\PackageInterface;
  27446. class PostFileDownloadEvent extends Event
  27447. {
  27448. private $fileName;
  27449. private $checksum;
  27450. private $url;
  27451. private $context;
  27452. private $type;
  27453. public function __construct(string $name, ?string $fileName, ?string $checksum, string $url, string $type, $context = null)
  27454. {
  27455. if ($context === null && $type instanceof PackageInterface) {
  27456. $context = $type;
  27457. $type = 'package';
  27458. trigger_error('PostFileDownloadEvent::__construct should receive a $type=package and the package object in $context since Composer 2.1.', E_USER_DEPRECATED);
  27459. }
  27460. parent::__construct($name);
  27461. $this->fileName = $fileName;
  27462. $this->checksum = $checksum;
  27463. $this->url = $url;
  27464. $this->context = $context;
  27465. $this->type = $type;
  27466. }
  27467. public function getFileName(): ?string
  27468. {
  27469. return $this->fileName;
  27470. }
  27471. public function getChecksum(): ?string
  27472. {
  27473. return $this->checksum;
  27474. }
  27475. public function getUrl(): string
  27476. {
  27477. return $this->url;
  27478. }
  27479. public function getContext()
  27480. {
  27481. return $this->context;
  27482. }
  27483. public function getPackage(): ?PackageInterface
  27484. {
  27485. trigger_error('PostFileDownloadEvent::getPackage is deprecated since Composer 2.1, use getContext instead.', E_USER_DEPRECATED);
  27486. $context = $this->getContext();
  27487. return $context instanceof PackageInterface ? $context : null;
  27488. }
  27489. public function getType(): string
  27490. {
  27491. return $this->type;
  27492. }
  27493. }
  27494. <?php declare(strict_types=1);
  27495. namespace Composer\Plugin;
  27496. use Composer\EventDispatcher\Event;
  27497. use Symfony\Component\Console\Input\InputInterface;
  27498. class PreCommandRunEvent extends Event
  27499. {
  27500. private $input;
  27501. private $command;
  27502. public function __construct(string $name, InputInterface $input, string $command)
  27503. {
  27504. parent::__construct($name);
  27505. $this->input = $input;
  27506. $this->command = $command;
  27507. }
  27508. public function getInput(): InputInterface
  27509. {
  27510. return $this->input;
  27511. }
  27512. public function getCommand(): string
  27513. {
  27514. return $this->command;
  27515. }
  27516. }
  27517. <?php declare(strict_types=1);
  27518. namespace Composer\Plugin;
  27519. use Composer\EventDispatcher\Event;
  27520. use Composer\Util\HttpDownloader;
  27521. class PreFileDownloadEvent extends Event
  27522. {
  27523. private $httpDownloader;
  27524. private $processedUrl;
  27525. private $customCacheKey;
  27526. private $type;
  27527. private $context;
  27528. private $transportOptions = [];
  27529. public function __construct(string $name, HttpDownloader $httpDownloader, string $processedUrl, string $type, $context = null)
  27530. {
  27531. parent::__construct($name);
  27532. $this->httpDownloader = $httpDownloader;
  27533. $this->processedUrl = $processedUrl;
  27534. $this->type = $type;
  27535. $this->context = $context;
  27536. }
  27537. public function getHttpDownloader(): HttpDownloader
  27538. {
  27539. return $this->httpDownloader;
  27540. }
  27541. public function getProcessedUrl(): string
  27542. {
  27543. return $this->processedUrl;
  27544. }
  27545. public function setProcessedUrl(string $processedUrl): void
  27546. {
  27547. $this->processedUrl = $processedUrl;
  27548. }
  27549. public function getCustomCacheKey(): ?string
  27550. {
  27551. return $this->customCacheKey;
  27552. }
  27553. public function setCustomCacheKey(?string $customCacheKey): void
  27554. {
  27555. $this->customCacheKey = $customCacheKey;
  27556. }
  27557. public function getType(): string
  27558. {
  27559. return $this->type;
  27560. }
  27561. public function getContext()
  27562. {
  27563. return $this->context;
  27564. }
  27565. public function getTransportOptions(): array
  27566. {
  27567. return $this->transportOptions;
  27568. }
  27569. public function setTransportOptions(array $options): void
  27570. {
  27571. $this->transportOptions = $options;
  27572. }
  27573. }
  27574. <?php declare(strict_types=1);
  27575. namespace Composer\Plugin;
  27576. use Composer\EventDispatcher\Event;
  27577. use Composer\Repository\RepositoryInterface;
  27578. use Composer\DependencyResolver\Request;
  27579. use Composer\Package\BasePackage;
  27580. class PrePoolCreateEvent extends Event
  27581. {
  27582. private $repositories;
  27583. private $request;
  27584. private $acceptableStabilities;
  27585. private $stabilityFlags;
  27586. private $rootAliases;
  27587. private $rootReferences;
  27588. private $packages;
  27589. private $unacceptableFixedPackages;
  27590. public function __construct(string $name, array $repositories, Request $request, array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, array $packages, array $unacceptableFixedPackages)
  27591. {
  27592. parent::__construct($name);
  27593. $this->repositories = $repositories;
  27594. $this->request = $request;
  27595. $this->acceptableStabilities = $acceptableStabilities;
  27596. $this->stabilityFlags = $stabilityFlags;
  27597. $this->rootAliases = $rootAliases;
  27598. $this->rootReferences = $rootReferences;
  27599. $this->packages = $packages;
  27600. $this->unacceptableFixedPackages = $unacceptableFixedPackages;
  27601. }
  27602. public function getRepositories(): array
  27603. {
  27604. return $this->repositories;
  27605. }
  27606. public function getRequest(): Request
  27607. {
  27608. return $this->request;
  27609. }
  27610. public function getAcceptableStabilities(): array
  27611. {
  27612. return $this->acceptableStabilities;
  27613. }
  27614. public function getStabilityFlags(): array
  27615. {
  27616. return $this->stabilityFlags;
  27617. }
  27618. public function getRootAliases(): array
  27619. {
  27620. return $this->rootAliases;
  27621. }
  27622. public function getRootReferences(): array
  27623. {
  27624. return $this->rootReferences;
  27625. }
  27626. public function getPackages(): array
  27627. {
  27628. return $this->packages;
  27629. }
  27630. public function getUnacceptableFixedPackages(): array
  27631. {
  27632. return $this->unacceptableFixedPackages;
  27633. }
  27634. public function setPackages(array $packages): void
  27635. {
  27636. $this->packages = $packages;
  27637. }
  27638. public function setUnacceptableFixedPackages(array $packages): void
  27639. {
  27640. $this->unacceptableFixedPackages = $packages;
  27641. }
  27642. }
  27643. <?php declare(strict_types=1);
  27644. namespace Composer\Question;
  27645. use Composer\Pcre\Preg;
  27646. use Symfony\Component\Console\Exception\InvalidArgumentException;
  27647. use Symfony\Component\Console\Question\Question;
  27648. class StrictConfirmationQuestion extends Question
  27649. {
  27650. private $trueAnswerRegex;
  27651. private $falseAnswerRegex;
  27652. public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y(?:es)?$/i', string $falseAnswerRegex = '/^no?$/i')
  27653. {
  27654. parent::__construct($question, (bool) $default);
  27655. $this->trueAnswerRegex = $trueAnswerRegex;
  27656. $this->falseAnswerRegex = $falseAnswerRegex;
  27657. $this->setNormalizer($this->getDefaultNormalizer());
  27658. $this->setValidator($this->getDefaultValidator());
  27659. }
  27660. private function getDefaultNormalizer(): callable
  27661. {
  27662. $default = $this->getDefault();
  27663. $trueRegex = $this->trueAnswerRegex;
  27664. $falseRegex = $this->falseAnswerRegex;
  27665. return static function ($answer) use ($default, $trueRegex, $falseRegex) {
  27666. if (is_bool($answer)) {
  27667. return $answer;
  27668. }
  27669. if (empty($answer) && !empty($default)) {
  27670. return $default;
  27671. }
  27672. if (Preg::isMatch($trueRegex, $answer)) {
  27673. return true;
  27674. }
  27675. if (Preg::isMatch($falseRegex, $answer)) {
  27676. return false;
  27677. }
  27678. return null;
  27679. };
  27680. }
  27681. private function getDefaultValidator(): callable
  27682. {
  27683. return static function ($answer): bool {
  27684. if (!is_bool($answer)) {
  27685. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  27686. }
  27687. return $answer;
  27688. };
  27689. }
  27690. }
  27691. <?php declare(strict_types=1);
  27692. namespace Composer\Repository;
  27693. use Composer\Semver\Constraint\ConstraintInterface;
  27694. use Composer\Advisory\PartialSecurityAdvisory;
  27695. use Composer\Advisory\SecurityAdvisory;
  27696. interface AdvisoryProviderInterface
  27697. {
  27698. public function hasSecurityAdvisories(): bool;
  27699. public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array;
  27700. }
  27701. <?php declare(strict_types=1);
  27702. namespace Composer\Repository;
  27703. use Composer\Package\AliasPackage;
  27704. use Composer\Package\BasePackage;
  27705. use Composer\Package\CompleteAliasPackage;
  27706. use Composer\Package\CompletePackage;
  27707. use Composer\Package\PackageInterface;
  27708. use Composer\Package\CompletePackageInterface;
  27709. use Composer\Package\Version\VersionParser;
  27710. use Composer\Package\Version\StabilityFilter;
  27711. use Composer\Pcre\Preg;
  27712. use Composer\Semver\Constraint\ConstraintInterface;
  27713. use Composer\Semver\Constraint\Constraint;
  27714. class ArrayRepository implements RepositoryInterface
  27715. {
  27716. protected $packages = null;
  27717. protected $packageMap = null;
  27718. public function __construct(array $packages = [])
  27719. {
  27720. foreach ($packages as $package) {
  27721. $this->addPackage($package);
  27722. }
  27723. }
  27724. public function getRepoName()
  27725. {
  27726. return 'array repo (defining '.$this->count().' package'.($this->count() > 1 ? 's' : '').')';
  27727. }
  27728. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = [])
  27729. {
  27730. $packages = $this->getPackages();
  27731. $result = [];
  27732. $namesFound = [];
  27733. foreach ($packages as $package) {
  27734. if (array_key_exists($package->getName(), $packageNameMap)) {
  27735. if (
  27736. (!$packageNameMap[$package->getName()] || $packageNameMap[$package->getName()]->matches(new Constraint('==', $package->getVersion())))
  27737. && StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, $package->getNames(), $package->getStability())
  27738. && !isset($alreadyLoaded[$package->getName()][$package->getVersion()])
  27739. ) {
  27740. $result[spl_object_hash($package)] = $package;
  27741. if ($package instanceof AliasPackage && !isset($result[spl_object_hash($package->getAliasOf())])) {
  27742. $result[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
  27743. }
  27744. }
  27745. $namesFound[$package->getName()] = true;
  27746. }
  27747. }
  27748. foreach ($packages as $package) {
  27749. if ($package instanceof AliasPackage) {
  27750. if (isset($result[spl_object_hash($package->getAliasOf())])) {
  27751. $result[spl_object_hash($package)] = $package;
  27752. }
  27753. }
  27754. }
  27755. return ['namesFound' => array_keys($namesFound), 'packages' => $result];
  27756. }
  27757. public function findPackage(string $name, $constraint)
  27758. {
  27759. $name = strtolower($name);
  27760. if (!$constraint instanceof ConstraintInterface) {
  27761. $versionParser = new VersionParser();
  27762. $constraint = $versionParser->parseConstraints($constraint);
  27763. }
  27764. foreach ($this->getPackages() as $package) {
  27765. if ($name === $package->getName()) {
  27766. $pkgConstraint = new Constraint('==', $package->getVersion());
  27767. if ($constraint->matches($pkgConstraint)) {
  27768. return $package;
  27769. }
  27770. }
  27771. }
  27772. return null;
  27773. }
  27774. public function findPackages(string $name, $constraint = null)
  27775. {
  27776. $name = strtolower($name);
  27777. $packages = [];
  27778. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  27779. $versionParser = new VersionParser();
  27780. $constraint = $versionParser->parseConstraints($constraint);
  27781. }
  27782. foreach ($this->getPackages() as $package) {
  27783. if ($name === $package->getName()) {
  27784. if (null === $constraint || $constraint->matches(new Constraint('==', $package->getVersion()))) {
  27785. $packages[] = $package;
  27786. }
  27787. }
  27788. }
  27789. return $packages;
  27790. }
  27791. public function search(string $query, int $mode = 0, ?string $type = null)
  27792. {
  27793. if ($mode === self::SEARCH_FULLTEXT) {
  27794. $regex = '{(?:'.implode('|', Preg::split('{\s+}', preg_quote($query))).')}i';
  27795. } else {
  27796. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  27797. }
  27798. $matches = [];
  27799. foreach ($this->getPackages() as $package) {
  27800. $name = $package->getName();
  27801. if ($mode === self::SEARCH_VENDOR) {
  27802. [$name] = explode('/', $name);
  27803. }
  27804. if (isset($matches[$name])) {
  27805. continue;
  27806. }
  27807. if (null !== $type && $package->getType() !== $type) {
  27808. continue;
  27809. }
  27810. if (Preg::isMatch($regex, $name)
  27811. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && Preg::isMatch($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  27812. ) {
  27813. if ($mode === self::SEARCH_VENDOR) {
  27814. $matches[$name] = [
  27815. 'name' => $name,
  27816. 'description' => null,
  27817. ];
  27818. } else {
  27819. $matches[$name] = [
  27820. 'name' => $package->getPrettyName(),
  27821. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  27822. ];
  27823. if ($package instanceof CompletePackageInterface && $package->isAbandoned()) {
  27824. $matches[$name]['abandoned'] = $package->getReplacementPackage() ?: true;
  27825. }
  27826. }
  27827. }
  27828. }
  27829. return array_values($matches);
  27830. }
  27831. public function hasPackage(PackageInterface $package)
  27832. {
  27833. if ($this->packageMap === null) {
  27834. $this->packageMap = [];
  27835. foreach ($this->getPackages() as $repoPackage) {
  27836. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  27837. }
  27838. }
  27839. return isset($this->packageMap[$package->getUniqueName()]);
  27840. }
  27841. public function addPackage(PackageInterface $package)
  27842. {
  27843. if (!$package instanceof BasePackage) {
  27844. throw new \InvalidArgumentException('Only subclasses of BasePackage are supported');
  27845. }
  27846. if (null === $this->packages) {
  27847. $this->initialize();
  27848. }
  27849. $package->setRepository($this);
  27850. $this->packages[] = $package;
  27851. if ($package instanceof AliasPackage) {
  27852. $aliasedPackage = $package->getAliasOf();
  27853. if (null === $aliasedPackage->getRepository()) {
  27854. $this->addPackage($aliasedPackage);
  27855. }
  27856. }
  27857. $this->packageMap = null;
  27858. }
  27859. public function getProviders(string $packageName)
  27860. {
  27861. $result = [];
  27862. foreach ($this->getPackages() as $candidate) {
  27863. if (isset($result[$candidate->getName()])) {
  27864. continue;
  27865. }
  27866. foreach ($candidate->getProvides() as $link) {
  27867. if ($packageName === $link->getTarget()) {
  27868. $result[$candidate->getName()] = [
  27869. 'name' => $candidate->getName(),
  27870. 'description' => $candidate instanceof CompletePackageInterface ? $candidate->getDescription() : null,
  27871. 'type' => $candidate->getType(),
  27872. ];
  27873. continue 2;
  27874. }
  27875. }
  27876. }
  27877. return $result;
  27878. }
  27879. protected function createAliasPackage(BasePackage $package, string $alias, string $prettyAlias)
  27880. {
  27881. while ($package instanceof AliasPackage) {
  27882. $package = $package->getAliasOf();
  27883. }
  27884. if ($package instanceof CompletePackage) {
  27885. return new CompleteAliasPackage($package, $alias, $prettyAlias);
  27886. }
  27887. return new AliasPackage($package, $alias, $prettyAlias);
  27888. }
  27889. public function removePackage(PackageInterface $package)
  27890. {
  27891. $packageId = $package->getUniqueName();
  27892. foreach ($this->getPackages() as $key => $repoPackage) {
  27893. if ($packageId === $repoPackage->getUniqueName()) {
  27894. array_splice($this->packages, $key, 1);
  27895. $this->packageMap = null;
  27896. return;
  27897. }
  27898. }
  27899. }
  27900. public function getPackages()
  27901. {
  27902. if (null === $this->packages) {
  27903. $this->initialize();
  27904. }
  27905. if (null === $this->packages) {
  27906. throw new \LogicException('initialize failed to initialize the packages array');
  27907. }
  27908. return $this->packages;
  27909. }
  27910. public function count(): int
  27911. {
  27912. if (null === $this->packages) {
  27913. $this->initialize();
  27914. }
  27915. return count($this->packages);
  27916. }
  27917. protected function initialize()
  27918. {
  27919. $this->packages = [];
  27920. }
  27921. }
  27922. <?php declare(strict_types=1);
  27923. namespace Composer\Repository;
  27924. use Composer\IO\IOInterface;
  27925. use Composer\Json\JsonFile;
  27926. use Composer\Package\BasePackage;
  27927. use Composer\Package\Loader\ArrayLoader;
  27928. use Composer\Package\Loader\LoaderInterface;
  27929. use Composer\Util\Platform;
  27930. use Composer\Util\Tar;
  27931. use Composer\Util\Zip;
  27932. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  27933. {
  27934. protected $loader;
  27935. protected $lookup;
  27936. protected $repoConfig;
  27937. private $io;
  27938. public function __construct(array $repoConfig, IOInterface $io)
  27939. {
  27940. parent::__construct();
  27941. if (!extension_loaded('zip')) {
  27942. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  27943. }
  27944. $this->loader = new ArrayLoader();
  27945. $this->lookup = Platform::expandPath($repoConfig['url']);
  27946. $this->io = $io;
  27947. $this->repoConfig = $repoConfig;
  27948. }
  27949. public function getRepoName()
  27950. {
  27951. return 'artifact repo ('.$this->lookup.')';
  27952. }
  27953. public function getRepoConfig()
  27954. {
  27955. return $this->repoConfig;
  27956. }
  27957. protected function initialize()
  27958. {
  27959. parent::initialize();
  27960. $this->scanDirectory($this->lookup);
  27961. }
  27962. private function scanDirectory(string $path): void
  27963. {
  27964. $io = $this->io;
  27965. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  27966. $iterator = new \RecursiveIteratorIterator($directory);
  27967. $regex = new \RegexIterator($iterator, '/^.+\.(zip|tar|gz|tgz)$/i');
  27968. foreach ($regex as $file) {
  27969. if (!$file->isFile()) {
  27970. continue;
  27971. }
  27972. $package = $this->getComposerInformation($file);
  27973. if (!$package) {
  27974. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  27975. continue;
  27976. }
  27977. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  27978. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  27979. $this->addPackage($package);
  27980. }
  27981. }
  27982. private function getComposerInformation(\SplFileInfo $file): ?BasePackage
  27983. {
  27984. $json = null;
  27985. $fileType = null;
  27986. $fileExtension = pathinfo($file->getPathname(), PATHINFO_EXTENSION);
  27987. if (in_array($fileExtension, ['gz', 'tar', 'tgz'], true)) {
  27988. $fileType = 'tar';
  27989. } elseif ($fileExtension === 'zip') {
  27990. $fileType = 'zip';
  27991. } else {
  27992. throw new \RuntimeException('Files with "'.$fileExtension.'" extensions aren\'t supported. Only ZIP and TAR/TAR.GZ/TGZ archives are supported.');
  27993. }
  27994. try {
  27995. if ($fileType === 'tar') {
  27996. $json = Tar::getComposerJson($file->getPathname());
  27997. } else {
  27998. $json = Zip::getComposerJson($file->getPathname());
  27999. }
  28000. } catch (\Exception $exception) {
  28001. $this->io->write('Failed loading package '.$file->getPathname().': '.$exception->getMessage(), false, IOInterface::VERBOSE);
  28002. }
  28003. if (null === $json) {
  28004. return null;
  28005. }
  28006. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  28007. $package['dist'] = [
  28008. 'type' => $fileType,
  28009. 'url' => strtr($file->getPathname(), '\\', '/'),
  28010. 'shasum' => sha1_file($file->getRealPath()),
  28011. ];
  28012. try {
  28013. $package = $this->loader->load($package);
  28014. } catch (\UnexpectedValueException $e) {
  28015. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  28016. }
  28017. return $package;
  28018. }
  28019. }
  28020. <?php declare(strict_types=1);
  28021. namespace Composer\Repository;
  28022. use Composer\Package\AliasPackage;
  28023. use Composer\Package\PackageInterface;
  28024. trait CanonicalPackagesTrait
  28025. {
  28026. public function getCanonicalPackages()
  28027. {
  28028. $packages = $this->getPackages();
  28029. $packagesByName = [];
  28030. foreach ($packages as $package) {
  28031. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  28032. $packagesByName[$package->getName()] = $package;
  28033. }
  28034. }
  28035. $canonicalPackages = [];
  28036. foreach ($packagesByName as $package) {
  28037. while ($package instanceof AliasPackage) {
  28038. $package = $package->getAliasOf();
  28039. }
  28040. $canonicalPackages[] = $package;
  28041. }
  28042. return $canonicalPackages;
  28043. }
  28044. }
  28045. <?php declare(strict_types=1);
  28046. namespace Composer\Repository;
  28047. use Composer\Advisory\PartialSecurityAdvisory;
  28048. use Composer\Advisory\SecurityAdvisory;
  28049. use Composer\Package\BasePackage;
  28050. use Composer\Package\Loader\ArrayLoader;
  28051. use Composer\Package\PackageInterface;
  28052. use Composer\Package\AliasPackage;
  28053. use Composer\Package\CompletePackage;
  28054. use Composer\Package\CompleteAliasPackage;
  28055. use Composer\Package\Version\VersionParser;
  28056. use Composer\Package\Version\StabilityFilter;
  28057. use Composer\Json\JsonFile;
  28058. use Composer\Cache;
  28059. use Composer\Config;
  28060. use Composer\IO\IOInterface;
  28061. use Composer\Pcre\Preg;
  28062. use Composer\Plugin\PostFileDownloadEvent;
  28063. use Composer\Semver\CompilingMatcher;
  28064. use Composer\Util\HttpDownloader;
  28065. use Composer\Util\Loop;
  28066. use Composer\Plugin\PluginEvents;
  28067. use Composer\Plugin\PreFileDownloadEvent;
  28068. use Composer\EventDispatcher\EventDispatcher;
  28069. use Composer\Downloader\TransportException;
  28070. use Composer\Semver\Constraint\ConstraintInterface;
  28071. use Composer\Semver\Constraint\Constraint;
  28072. use Composer\Semver\Constraint\MatchAllConstraint;
  28073. use Composer\Util\Http\Response;
  28074. use Composer\MetadataMinifier\MetadataMinifier;
  28075. use Composer\Util\Url;
  28076. use React\Promise\PromiseInterface;
  28077. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface, AdvisoryProviderInterface
  28078. {
  28079. private $repoConfig;
  28080. private $options;
  28081. private $url;
  28082. private $baseUrl;
  28083. private $io;
  28084. private $httpDownloader;
  28085. private $loop;
  28086. protected $cache;
  28087. protected $notifyUrl = null;
  28088. protected $searchUrl = null;
  28089. protected $providersApiUrl = null;
  28090. protected $hasProviders = false;
  28091. protected $providersUrl = null;
  28092. protected $listUrl = null;
  28093. protected $hasAvailablePackageList = false;
  28094. protected $availablePackages = null;
  28095. protected $availablePackagePatterns = null;
  28096. protected $lazyProvidersUrl = null;
  28097. protected $providerListing;
  28098. protected $loader;
  28099. private $allowSslDowngrade = false;
  28100. private $eventDispatcher;
  28101. private $sourceMirrors;
  28102. private $distMirrors;
  28103. private $degradedMode = false;
  28104. private $rootData;
  28105. private $hasPartialPackages = false;
  28106. private $partialPackagesByName = null;
  28107. private $displayedWarningAboutNonMatchingPackageIndex = false;
  28108. private $securityAdvisoryConfig = null;
  28109. private $freshMetadataUrls = [];
  28110. private $packagesNotFoundCache = [];
  28111. private $versionParser;
  28112. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null)
  28113. {
  28114. parent::__construct();
  28115. if (!Preg::isMatch('{^[\w.]+\??://}', $repoConfig['url'])) {
  28116. if (($localFilePath = realpath($repoConfig['url'])) !== false) {
  28117. $repoConfig['url'] = 'file://'.$localFilePath;
  28118. } else {
  28119. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  28120. }
  28121. }
  28122. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  28123. if ($repoConfig['url'] === '') {
  28124. throw new \InvalidArgumentException('The repository url must not be an empty string');
  28125. }
  28126. if (str_starts_with($repoConfig['url'], 'https?')) {
  28127. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  28128. }
  28129. $urlBits = parse_url(strtr($repoConfig['url'], '\\', '/'));
  28130. if ($urlBits === false || empty($urlBits['scheme'])) {
  28131. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  28132. }
  28133. if (!isset($repoConfig['options'])) {
  28134. $repoConfig['options'] = [];
  28135. }
  28136. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  28137. $this->allowSslDowngrade = true;
  28138. }
  28139. $this->options = $repoConfig['options'];
  28140. $this->url = $repoConfig['url'];
  28141. if (Preg::isMatch('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  28142. $this->url = $match['proto'].'://repo.packagist.org';
  28143. }
  28144. $baseUrl = rtrim(Preg::replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  28145. assert($baseUrl !== '');
  28146. $this->baseUrl = $baseUrl;
  28147. $this->io = $io;
  28148. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)), 'a-z0-9.$~_');
  28149. $this->cache->setReadOnly($config->get('cache-read-only'));
  28150. $this->versionParser = new VersionParser();
  28151. $this->loader = new ArrayLoader($this->versionParser);
  28152. $this->httpDownloader = $httpDownloader;
  28153. $this->eventDispatcher = $eventDispatcher;
  28154. $this->repoConfig = $repoConfig;
  28155. $this->loop = new Loop($this->httpDownloader);
  28156. }
  28157. public function getRepoName()
  28158. {
  28159. return 'composer repo ('.Url::sanitize($this->url).')';
  28160. }
  28161. public function getRepoConfig()
  28162. {
  28163. return $this->repoConfig;
  28164. }
  28165. public function findPackage(string $name, $constraint)
  28166. {
  28167. $hasProviders = $this->hasProviders();
  28168. $name = strtolower($name);
  28169. if (!$constraint instanceof ConstraintInterface) {
  28170. $constraint = $this->versionParser->parseConstraints($constraint);
  28171. }
  28172. if ($this->lazyProvidersUrl) {
  28173. if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
  28174. return $this->filterPackages($this->whatProvides($name), $constraint, true);
  28175. }
  28176. if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
  28177. return null;
  28178. }
  28179. $packages = $this->loadAsyncPackages([$name => $constraint]);
  28180. if (count($packages['packages']) > 0) {
  28181. return reset($packages['packages']);
  28182. }
  28183. return null;
  28184. }
  28185. if ($hasProviders) {
  28186. foreach ($this->getProviderNames() as $providerName) {
  28187. if ($name === $providerName) {
  28188. return $this->filterPackages($this->whatProvides($providerName), $constraint, true);
  28189. }
  28190. }
  28191. return null;
  28192. }
  28193. return parent::findPackage($name, $constraint);
  28194. }
  28195. public function findPackages(string $name, $constraint = null)
  28196. {
  28197. $hasProviders = $this->hasProviders();
  28198. $name = strtolower($name);
  28199. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  28200. $constraint = $this->versionParser->parseConstraints($constraint);
  28201. }
  28202. if ($this->lazyProvidersUrl) {
  28203. if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
  28204. return $this->filterPackages($this->whatProvides($name), $constraint);
  28205. }
  28206. if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
  28207. return [];
  28208. }
  28209. $result = $this->loadAsyncPackages([$name => $constraint]);
  28210. return $result['packages'];
  28211. }
  28212. if ($hasProviders) {
  28213. foreach ($this->getProviderNames() as $providerName) {
  28214. if ($name === $providerName) {
  28215. return $this->filterPackages($this->whatProvides($providerName), $constraint);
  28216. }
  28217. }
  28218. return [];
  28219. }
  28220. return parent::findPackages($name, $constraint);
  28221. }
  28222. private function filterPackages(array $packages, ?ConstraintInterface $constraint = null, bool $returnFirstMatch = false)
  28223. {
  28224. if (null === $constraint) {
  28225. if ($returnFirstMatch) {
  28226. return reset($packages);
  28227. }
  28228. return $packages;
  28229. }
  28230. $filteredPackages = [];
  28231. foreach ($packages as $package) {
  28232. $pkgConstraint = new Constraint('==', $package->getVersion());
  28233. if ($constraint->matches($pkgConstraint)) {
  28234. if ($returnFirstMatch) {
  28235. return $package;
  28236. }
  28237. $filteredPackages[] = $package;
  28238. }
  28239. }
  28240. if ($returnFirstMatch) {
  28241. return null;
  28242. }
  28243. return $filteredPackages;
  28244. }
  28245. public function getPackages()
  28246. {
  28247. $hasProviders = $this->hasProviders();
  28248. if ($this->lazyProvidersUrl) {
  28249. if (is_array($this->availablePackages) && !$this->availablePackagePatterns) {
  28250. $packageMap = [];
  28251. foreach ($this->availablePackages as $name) {
  28252. $packageMap[$name] = new MatchAllConstraint();
  28253. }
  28254. $result = $this->loadAsyncPackages($packageMap);
  28255. return array_values($result['packages']);
  28256. }
  28257. if ($this->hasPartialPackages()) {
  28258. if (!is_array($this->partialPackagesByName)) {
  28259. throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
  28260. }
  28261. return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages');
  28262. }
  28263. throw new \LogicException('Composer repositories that have lazy providers and no available-packages list can not load the complete list of packages, use getPackageNames instead.');
  28264. }
  28265. if ($hasProviders) {
  28266. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getPackageNames instead.');
  28267. }
  28268. return parent::getPackages();
  28269. }
  28270. public function getPackageNames(?string $packageFilter = null)
  28271. {
  28272. $hasProviders = $this->hasProviders();
  28273. $filterResults =
  28274. static function (array $results): array {
  28275. return $results;
  28276. }
  28277. ;
  28278. if (null !== $packageFilter && '' !== $packageFilter) {
  28279. $packageFilterRegex = BasePackage::packageNameToRegexp($packageFilter);
  28280. $filterResults =
  28281. static function (array $results) use ($packageFilterRegex): array {
  28282. return Preg::grep($packageFilterRegex, $results);
  28283. }
  28284. ;
  28285. }
  28286. if ($this->lazyProvidersUrl) {
  28287. if (is_array($this->availablePackages)) {
  28288. return $filterResults(array_keys($this->availablePackages));
  28289. }
  28290. if ($this->listUrl) {
  28291. return $this->loadPackageList($packageFilter);
  28292. }
  28293. if ($this->hasPartialPackages() && $this->partialPackagesByName !== null) {
  28294. return $filterResults(array_keys($this->partialPackagesByName));
  28295. }
  28296. return [];
  28297. }
  28298. if ($hasProviders) {
  28299. return $filterResults($this->getProviderNames());
  28300. }
  28301. $names = [];
  28302. foreach ($this->getPackages() as $package) {
  28303. $names[] = $package->getPrettyName();
  28304. }
  28305. return $filterResults($names);
  28306. }
  28307. private function getVendorNames(): array
  28308. {
  28309. $cacheKey = 'vendor-list.txt';
  28310. $cacheAge = $this->cache->getAge($cacheKey);
  28311. if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
  28312. $cachedData = explode("\n", $cachedData);
  28313. return $cachedData;
  28314. }
  28315. $names = $this->getPackageNames();
  28316. $uniques = [];
  28317. foreach ($names as $name) {
  28318. $uniques[substr($name, 0, strpos($name, '/'))] = true;
  28319. }
  28320. $vendors = array_keys($uniques);
  28321. if (!$this->cache->isReadOnly()) {
  28322. $this->cache->write($cacheKey, implode("\n", $vendors));
  28323. }
  28324. return $vendors;
  28325. }
  28326. private function loadPackageList(?string $packageFilter = null): array
  28327. {
  28328. if (null === $this->listUrl) {
  28329. throw new \LogicException('Make sure to call loadRootServerFile before loadPackageList');
  28330. }
  28331. $url = $this->listUrl;
  28332. if (is_string($packageFilter) && $packageFilter !== '') {
  28333. $url .= '?filter='.urlencode($packageFilter);
  28334. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  28335. return $result['packageNames'];
  28336. }
  28337. $cacheKey = 'package-list.txt';
  28338. $cacheAge = $this->cache->getAge($cacheKey);
  28339. if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
  28340. $cachedData = explode("\n", $cachedData);
  28341. return $cachedData;
  28342. }
  28343. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  28344. if (!$this->cache->isReadOnly()) {
  28345. $this->cache->write($cacheKey, implode("\n", $result['packageNames']));
  28346. }
  28347. return $result['packageNames'];
  28348. }
  28349. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = [])
  28350. {
  28351. $hasProviders = $this->hasProviders();
  28352. if (!$hasProviders && !$this->hasPartialPackages() && null === $this->lazyProvidersUrl) {
  28353. return parent::loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  28354. }
  28355. $packages = [];
  28356. $namesFound = [];
  28357. if ($hasProviders || $this->hasPartialPackages()) {
  28358. foreach ($packageNameMap as $name => $constraint) {
  28359. $matches = [];
  28360. if (!$hasProviders && !isset($this->partialPackagesByName[$name])) {
  28361. continue;
  28362. }
  28363. $candidates = $this->whatProvides($name, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  28364. foreach ($candidates as $candidate) {
  28365. if ($candidate->getName() !== $name) {
  28366. throw new \LogicException('whatProvides should never return a package with a different name than the requested one');
  28367. }
  28368. $namesFound[$name] = true;
  28369. if (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
  28370. $matches[spl_object_hash($candidate)] = $candidate;
  28371. if ($candidate instanceof AliasPackage && !isset($matches[spl_object_hash($candidate->getAliasOf())])) {
  28372. $matches[spl_object_hash($candidate->getAliasOf())] = $candidate->getAliasOf();
  28373. }
  28374. }
  28375. }
  28376. foreach ($candidates as $candidate) {
  28377. if ($candidate instanceof AliasPackage) {
  28378. if (isset($matches[spl_object_hash($candidate->getAliasOf())])) {
  28379. $matches[spl_object_hash($candidate)] = $candidate;
  28380. }
  28381. }
  28382. }
  28383. $packages = array_merge($packages, $matches);
  28384. unset($packageNameMap[$name]);
  28385. }
  28386. }
  28387. if ($this->lazyProvidersUrl && count($packageNameMap)) {
  28388. if ($this->hasAvailablePackageList) {
  28389. foreach ($packageNameMap as $name => $constraint) {
  28390. if (!$this->lazyProvidersRepoContains(strtolower($name))) {
  28391. unset($packageNameMap[$name]);
  28392. }
  28393. }
  28394. }
  28395. $result = $this->loadAsyncPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  28396. $packages = array_merge($packages, $result['packages']);
  28397. $namesFound = array_merge($namesFound, $result['namesFound']);
  28398. }
  28399. return ['namesFound' => array_keys($namesFound), 'packages' => $packages];
  28400. }
  28401. public function search(string $query, int $mode = 0, ?string $type = null)
  28402. {
  28403. $this->loadRootServerFile(600);
  28404. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  28405. $url = str_replace(['%query%', '%type%'], [urlencode($query), $type], $this->searchUrl);
  28406. $search = $this->httpDownloader->get($url, $this->options)->decodeJson();
  28407. if (empty($search['results'])) {
  28408. return [];
  28409. }
  28410. $results = [];
  28411. foreach ($search['results'] as $result) {
  28412. if (!empty($result['virtual'])) {
  28413. continue;
  28414. }
  28415. $results[] = $result;
  28416. }
  28417. return $results;
  28418. }
  28419. if ($mode === self::SEARCH_VENDOR) {
  28420. $results = [];
  28421. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  28422. $vendorNames = $this->getVendorNames();
  28423. foreach (Preg::grep($regex, $vendorNames) as $name) {
  28424. $results[] = ['name' => $name, 'description' => ''];
  28425. }
  28426. return $results;
  28427. }
  28428. if ($this->hasProviders() || $this->lazyProvidersUrl) {
  28429. if (Preg::isMatchStrictGroups('{^\^(?P<query>(?P<vendor>[a-z0-9_.-]+)/[a-z0-9_.-]*)\*?$}i', $query, $match) && $this->listUrl !== null) {
  28430. $url = $this->listUrl . '?vendor='.urlencode($match['vendor']).'&filter='.urlencode($match['query'].'*');
  28431. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  28432. $results = [];
  28433. foreach ($result['packageNames'] as $name) {
  28434. $results[] = ['name' => $name, 'description' => ''];
  28435. }
  28436. return $results;
  28437. }
  28438. $results = [];
  28439. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  28440. $packageNames = $this->getPackageNames();
  28441. foreach (Preg::grep($regex, $packageNames) as $name) {
  28442. $results[] = ['name' => $name, 'description' => ''];
  28443. }
  28444. return $results;
  28445. }
  28446. return parent::search($query, $mode);
  28447. }
  28448. public function hasSecurityAdvisories(): bool
  28449. {
  28450. $this->loadRootServerFile(600);
  28451. return $this->securityAdvisoryConfig !== null && ($this->securityAdvisoryConfig['metadata'] || $this->securityAdvisoryConfig['api-url'] !== null);
  28452. }
  28453. public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array
  28454. {
  28455. $this->loadRootServerFile(600);
  28456. if (null === $this->securityAdvisoryConfig) {
  28457. return ['namesFound' => [], 'advisories' => []];
  28458. }
  28459. $advisories = [];
  28460. $namesFound = [];
  28461. $apiUrl = $this->securityAdvisoryConfig['api-url'];
  28462. if ($this->hasAvailablePackageList) {
  28463. foreach ($packageConstraintMap as $name => $constraint) {
  28464. if (!$this->lazyProvidersRepoContains(strtolower($name))) {
  28465. unset($packageConstraintMap[$name]);
  28466. }
  28467. }
  28468. }
  28469. $parser = new VersionParser();
  28470. $create = function (array $data, string $name) use ($parser, $allowPartialAdvisories, &$packageConstraintMap): ?PartialSecurityAdvisory {
  28471. $advisory = PartialSecurityAdvisory::create($name, $data, $parser);
  28472. if (!$allowPartialAdvisories && !$advisory instanceof SecurityAdvisory) {
  28473. throw new \RuntimeException('Advisory for '.$name.' could not be loaded as a full advisory from '.$this->getRepoName() . PHP_EOL . var_export($data, true));
  28474. }
  28475. if (!$advisory->affectedVersions->matches($packageConstraintMap[$name])) {
  28476. return null;
  28477. }
  28478. return $advisory;
  28479. };
  28480. if ($this->securityAdvisoryConfig['metadata'] && ($allowPartialAdvisories || $apiUrl === null)) {
  28481. $promises = [];
  28482. foreach ($packageConstraintMap as $name => $constraint) {
  28483. $name = strtolower($name);
  28484. if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
  28485. continue;
  28486. }
  28487. $promises[] = $this->startCachedAsyncDownload($name, $name)
  28488. ->then(static function (array $spec) use (&$advisories, &$namesFound, &$packageConstraintMap, $name, $create): void {
  28489. [$response, ] = $spec;
  28490. if (!isset($response['security-advisories']) || !is_array($response['security-advisories'])) {
  28491. return;
  28492. }
  28493. $namesFound[$name] = true;
  28494. if (count($response['security-advisories']) > 0) {
  28495. $advisories[$name] = array_filter(array_map(
  28496. static function ($data) use ($name, $create) {
  28497. return $create($data, $name);
  28498. },
  28499. $response['security-advisories']
  28500. ));
  28501. }
  28502. unset($packageConstraintMap[$name]);
  28503. });
  28504. }
  28505. $this->loop->wait($promises);
  28506. }
  28507. if ($apiUrl !== null && count($packageConstraintMap) > 0) {
  28508. $options = $this->options;
  28509. $options['http']['method'] = 'POST';
  28510. if (isset($options['http']['header'])) {
  28511. $options['http']['header'] = (array) $options['http']['header'];
  28512. }
  28513. $options['http']['header'][] = 'Content-type: application/x-www-form-urlencoded';
  28514. $options['http']['timeout'] = 10;
  28515. $options['http']['content'] = http_build_query(['packages' => array_keys($packageConstraintMap)]);
  28516. $response = $this->httpDownloader->get($apiUrl, $options);
  28517. $warned = false;
  28518. foreach ($response->decodeJson()['advisories'] as $name => $list) {
  28519. if (!isset($packageConstraintMap[$name])) {
  28520. if (!$warned) {
  28521. $this->io->writeError('<warning>'.$this->getRepoName().' returned names which were not requested in response to the security-advisories API. '.$name.' was not requested but is present in the response. Requested names were: '.implode(', ', array_keys($packageConstraintMap)).'</warning>');
  28522. $warned = true;
  28523. }
  28524. continue;
  28525. }
  28526. if (count($list) > 0) {
  28527. $advisories[$name] = array_filter(array_map(
  28528. static function ($data) use ($name, $create) {
  28529. return $create($data, $name);
  28530. },
  28531. $list
  28532. ));
  28533. }
  28534. $namesFound[$name] = true;
  28535. }
  28536. }
  28537. return ['namesFound' => array_keys($namesFound), 'advisories' => array_filter($advisories)];
  28538. }
  28539. public function getProviders(string $packageName)
  28540. {
  28541. $this->loadRootServerFile();
  28542. $result = [];
  28543. if ($this->providersApiUrl) {
  28544. try {
  28545. $apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
  28546. } catch (TransportException $e) {
  28547. if ($e->getStatusCode() === 404) {
  28548. return $result;
  28549. }
  28550. throw $e;
  28551. }
  28552. foreach ($apiResult['providers'] as $provider) {
  28553. $result[$provider['name']] = $provider;
  28554. }
  28555. return $result;
  28556. }
  28557. if ($this->hasPartialPackages()) {
  28558. if (!is_array($this->partialPackagesByName)) {
  28559. throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
  28560. }
  28561. foreach ($this->partialPackagesByName as $versions) {
  28562. foreach ($versions as $candidate) {
  28563. if (isset($result[$candidate['name']]) || !isset($candidate['provide'][$packageName])) {
  28564. continue;
  28565. }
  28566. $result[$candidate['name']] = [
  28567. 'name' => $candidate['name'],
  28568. 'description' => $candidate['description'] ?? '',
  28569. 'type' => $candidate['type'] ?? '',
  28570. ];
  28571. }
  28572. }
  28573. }
  28574. if ($this->packages) {
  28575. $result = array_merge($result, parent::getProviders($packageName));
  28576. }
  28577. return $result;
  28578. }
  28579. private function getProviderNames(): array
  28580. {
  28581. $this->loadRootServerFile();
  28582. if (null === $this->providerListing) {
  28583. $data = $this->loadRootServerFile();
  28584. if (is_array($data)) {
  28585. $this->loadProviderListings($data);
  28586. }
  28587. }
  28588. if ($this->lazyProvidersUrl) {
  28589. return [];
  28590. }
  28591. if (null !== $this->providersUrl && null !== $this->providerListing) {
  28592. return array_keys($this->providerListing);
  28593. }
  28594. return [];
  28595. }
  28596. protected function configurePackageTransportOptions(PackageInterface $package): void
  28597. {
  28598. foreach ($package->getDistUrls() as $url) {
  28599. if (strpos($url, $this->baseUrl) === 0) {
  28600. $package->setTransportOptions($this->options);
  28601. return;
  28602. }
  28603. }
  28604. }
  28605. private function hasProviders(): bool
  28606. {
  28607. $this->loadRootServerFile();
  28608. return $this->hasProviders;
  28609. }
  28610. private function whatProvides(string $name, ?array $acceptableStabilities = null, ?array $stabilityFlags = null, array $alreadyLoaded = []): array
  28611. {
  28612. $packagesSource = null;
  28613. if (!$this->hasPartialPackages() || !isset($this->partialPackagesByName[$name])) {
  28614. if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
  28615. return [];
  28616. }
  28617. if (null === $this->providerListing) {
  28618. $data = $this->loadRootServerFile();
  28619. if (is_array($data)) {
  28620. $this->loadProviderListings($data);
  28621. }
  28622. }
  28623. $useLastModifiedCheck = false;
  28624. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  28625. $hash = null;
  28626. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  28627. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  28628. $useLastModifiedCheck = true;
  28629. } elseif ($this->providersUrl) {
  28630. if (!isset($this->providerListing[$name])) {
  28631. return [];
  28632. }
  28633. $hash = $this->providerListing[$name]['sha256'];
  28634. $url = str_replace(['%package%', '%hash%'], [$name, $hash], $this->providersUrl);
  28635. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  28636. } else {
  28637. return [];
  28638. }
  28639. $packages = null;
  28640. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  28641. $packages = json_decode($this->cache->read($cacheKey), true);
  28642. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  28643. } elseif ($useLastModifiedCheck) {
  28644. if ($contents = $this->cache->read($cacheKey)) {
  28645. $contents = json_decode($contents, true);
  28646. if (isset($alreadyLoaded[$name])) {
  28647. $packages = $contents;
  28648. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  28649. } elseif (isset($contents['last-modified'])) {
  28650. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  28651. $packages = true === $response ? $contents : $response;
  28652. $packagesSource = true === $response ? 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')' : 'downloaded file ('.Url::sanitize($url).')';
  28653. }
  28654. }
  28655. }
  28656. if (!$packages) {
  28657. try {
  28658. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  28659. $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
  28660. } catch (TransportException $e) {
  28661. if ($this->lazyProvidersUrl && in_array($e->getStatusCode(), [404, 499], true)) {
  28662. $packages = ['packages' => []];
  28663. $packagesSource = 'not-found file ('.Url::sanitize($url).')';
  28664. if ($e->getStatusCode() === 499) {
  28665. $this->io->error('<warning>' . $e->getMessage() . '</warning>');
  28666. }
  28667. } else {
  28668. throw $e;
  28669. }
  28670. }
  28671. }
  28672. $loadingPartialPackage = false;
  28673. } else {
  28674. $packages = ['packages' => ['versions' => $this->partialPackagesByName[$name]]];
  28675. $packagesSource = 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')';
  28676. $loadingPartialPackage = true;
  28677. }
  28678. $result = [];
  28679. $versionsToLoad = [];
  28680. foreach ($packages['packages'] as $versions) {
  28681. foreach ($versions as $version) {
  28682. $normalizedName = strtolower($version['name']);
  28683. if ($normalizedName !== $name) {
  28684. continue;
  28685. }
  28686. if (!$loadingPartialPackage && $this->hasPartialPackages() && isset($this->partialPackagesByName[$normalizedName])) {
  28687. continue;
  28688. }
  28689. if (!isset($versionsToLoad[$version['uid']])) {
  28690. if (!isset($version['version_normalized'])) {
  28691. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  28692. } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
  28693. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  28694. }
  28695. if (isset($alreadyLoaded[$name][$version['version_normalized']])) {
  28696. continue;
  28697. }
  28698. if ($this->isVersionAcceptable(null, $normalizedName, $version, $acceptableStabilities, $stabilityFlags)) {
  28699. $versionsToLoad[$version['uid']] = $version;
  28700. }
  28701. }
  28702. }
  28703. }
  28704. $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
  28705. $uids = array_keys($versionsToLoad);
  28706. foreach ($loadedPackages as $index => $package) {
  28707. $package->setRepository($this);
  28708. $uid = $uids[$index];
  28709. if ($package instanceof AliasPackage) {
  28710. $aliased = $package->getAliasOf();
  28711. $aliased->setRepository($this);
  28712. $result[$uid] = $aliased;
  28713. $result[$uid.'-alias'] = $package;
  28714. } else {
  28715. $result[$uid] = $package;
  28716. }
  28717. }
  28718. return $result;
  28719. }
  28720. protected function initialize()
  28721. {
  28722. parent::initialize();
  28723. $repoData = $this->loadDataFromServer();
  28724. foreach ($this->createPackages($repoData, 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')') as $package) {
  28725. $this->addPackage($package);
  28726. }
  28727. }
  28728. public function addPackage(PackageInterface $package)
  28729. {
  28730. parent::addPackage($package);
  28731. $this->configurePackageTransportOptions($package);
  28732. }
  28733. private function loadAsyncPackages(array $packageNames, ?array $acceptableStabilities = null, ?array $stabilityFlags = null, array $alreadyLoaded = []): array
  28734. {
  28735. $this->loadRootServerFile();
  28736. $packages = [];
  28737. $namesFound = [];
  28738. $promises = [];
  28739. if (null === $this->lazyProvidersUrl) {
  28740. throw new \LogicException('loadAsyncPackages only supports v2 protocol composer repos with a metadata-url');
  28741. }
  28742. foreach ($packageNames as $name => $constraint) {
  28743. if ($acceptableStabilities === null || $stabilityFlags === null || StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, [$name], 'dev')) {
  28744. $packageNames[$name.'~dev'] = $constraint;
  28745. }
  28746. if (isset($acceptableStabilities['dev']) && count($acceptableStabilities) === 1 && count($stabilityFlags) === 0) {
  28747. unset($packageNames[$name]);
  28748. }
  28749. }
  28750. foreach ($packageNames as $name => $constraint) {
  28751. $name = strtolower($name);
  28752. $realName = Preg::replace('{~dev$}', '', $name);
  28753. if (PlatformRepository::isPlatformPackage($realName) || '__root__' === $realName) {
  28754. continue;
  28755. }
  28756. $promises[] = $this->startCachedAsyncDownload($name, $realName)
  28757. ->then(function (array $spec) use (&$packages, &$namesFound, $realName, $constraint, $acceptableStabilities, $stabilityFlags, $alreadyLoaded): void {
  28758. [$response, $packagesSource] = $spec;
  28759. if (null === $response || !isset($response['packages'][$realName])) {
  28760. return;
  28761. }
  28762. $versions = $response['packages'][$realName];
  28763. if (isset($response['minified']) && $response['minified'] === 'composer/2.0') {
  28764. $versions = MetadataMinifier::expand($versions);
  28765. }
  28766. $namesFound[$realName] = true;
  28767. $versionsToLoad = [];
  28768. foreach ($versions as $version) {
  28769. if (!isset($version['version_normalized'])) {
  28770. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  28771. } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
  28772. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  28773. }
  28774. if (isset($alreadyLoaded[$realName][$version['version_normalized']])) {
  28775. continue;
  28776. }
  28777. if ($this->isVersionAcceptable($constraint, $realName, $version, $acceptableStabilities, $stabilityFlags)) {
  28778. $versionsToLoad[] = $version;
  28779. }
  28780. }
  28781. $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
  28782. foreach ($loadedPackages as $package) {
  28783. $package->setRepository($this);
  28784. $packages[spl_object_hash($package)] = $package;
  28785. if ($package instanceof AliasPackage && !isset($packages[spl_object_hash($package->getAliasOf())])) {
  28786. $package->getAliasOf()->setRepository($this);
  28787. $packages[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
  28788. }
  28789. }
  28790. });
  28791. }
  28792. $this->loop->wait($promises);
  28793. return ['namesFound' => $namesFound, 'packages' => $packages];
  28794. }
  28795. private function startCachedAsyncDownload(string $fileName, ?string $packageName = null): PromiseInterface
  28796. {
  28797. if (null === $this->lazyProvidersUrl) {
  28798. throw new \LogicException('startCachedAsyncDownload only supports v2 protocol composer repos with a metadata-url');
  28799. }
  28800. $name = strtolower($fileName);
  28801. $packageName = $packageName ?? $name;
  28802. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  28803. $cacheKey = 'provider-'.strtr($name, '/', '~').'.json';
  28804. $lastModified = null;
  28805. if ($contents = $this->cache->read($cacheKey)) {
  28806. $contents = json_decode($contents, true);
  28807. $lastModified = $contents['last-modified'] ?? null;
  28808. }
  28809. return $this->asyncFetchFile($url, $cacheKey, $lastModified)
  28810. ->then(static function ($response) use ($url, $cacheKey, $contents, $packageName): array {
  28811. $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
  28812. if (true === $response) {
  28813. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  28814. $response = $contents;
  28815. }
  28816. if (!isset($response['packages'][$packageName]) && !isset($response['security-advisories'])) {
  28817. return [null, $packagesSource];
  28818. }
  28819. return [$response, $packagesSource];
  28820. });
  28821. }
  28822. private function isVersionAcceptable(?ConstraintInterface $constraint, string $name, array $versionData, ?array $acceptableStabilities = null, ?array $stabilityFlags = null): bool
  28823. {
  28824. $versions = [$versionData['version_normalized']];
  28825. if ($alias = $this->loader->getBranchAlias($versionData)) {
  28826. $versions[] = $alias;
  28827. }
  28828. foreach ($versions as $version) {
  28829. if (null !== $acceptableStabilities && null !== $stabilityFlags && !StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, [$name], VersionParser::parseStability($version))) {
  28830. continue;
  28831. }
  28832. if ($constraint && !CompilingMatcher::match($constraint, Constraint::OP_EQ, $version)) {
  28833. continue;
  28834. }
  28835. return true;
  28836. }
  28837. return false;
  28838. }
  28839. private function getPackagesJsonUrl(): string
  28840. {
  28841. $jsonUrlParts = parse_url(strtr($this->url, '\\', '/'));
  28842. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  28843. return $this->url;
  28844. }
  28845. return $this->url . '/packages.json';
  28846. }
  28847. protected function loadRootServerFile(?int $rootMaxAge = null)
  28848. {
  28849. if (null !== $this->rootData) {
  28850. return $this->rootData;
  28851. }
  28852. if (!extension_loaded('openssl') && strpos($this->url, 'https') === 0) {
  28853. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  28854. }
  28855. if ($cachedData = $this->cache->read('packages.json')) {
  28856. $cachedData = json_decode($cachedData, true);
  28857. if ($rootMaxAge !== null && ($age = $this->cache->getAge('packages.json')) !== false && $age <= $rootMaxAge) {
  28858. $data = $cachedData;
  28859. } elseif (isset($cachedData['last-modified'])) {
  28860. $response = $this->fetchFileIfLastModified($this->getPackagesJsonUrl(), 'packages.json', $cachedData['last-modified']);
  28861. $data = true === $response ? $cachedData : $response;
  28862. }
  28863. }
  28864. if (!isset($data)) {
  28865. $data = $this->fetchFile($this->getPackagesJsonUrl(), 'packages.json', null, true);
  28866. }
  28867. if (!empty($data['notify-batch'])) {
  28868. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  28869. } elseif (!empty($data['notify'])) {
  28870. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  28871. }
  28872. if (!empty($data['search'])) {
  28873. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  28874. }
  28875. if (!empty($data['mirrors'])) {
  28876. foreach ($data['mirrors'] as $mirror) {
  28877. if (!empty($mirror['git-url'])) {
  28878. $this->sourceMirrors['git'][] = ['url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred'])];
  28879. }
  28880. if (!empty($mirror['hg-url'])) {
  28881. $this->sourceMirrors['hg'][] = ['url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred'])];
  28882. }
  28883. if (!empty($mirror['dist-url'])) {
  28884. $this->distMirrors[] = [
  28885. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  28886. 'preferred' => !empty($mirror['preferred']),
  28887. ];
  28888. }
  28889. }
  28890. }
  28891. if (!empty($data['providers-lazy-url'])) {
  28892. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  28893. $this->hasProviders = true;
  28894. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  28895. }
  28896. if (!empty($data['metadata-url'])) {
  28897. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['metadata-url']);
  28898. $this->providersUrl = null;
  28899. $this->hasProviders = false;
  28900. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  28901. $this->allowSslDowngrade = false;
  28902. if (!empty($data['available-packages'])) {
  28903. $availPackages = array_map('strtolower', $data['available-packages']);
  28904. $this->availablePackages = array_combine($availPackages, $availPackages);
  28905. $this->hasAvailablePackageList = true;
  28906. }
  28907. if (!empty($data['available-package-patterns'])) {
  28908. $this->availablePackagePatterns = array_map(static function ($pattern): string {
  28909. return BasePackage::packageNameToRegexp($pattern);
  28910. }, $data['available-package-patterns']);
  28911. $this->hasAvailablePackageList = true;
  28912. }
  28913. unset($data['providers-url'], $data['providers'], $data['providers-includes']);
  28914. if (isset($data['security-advisories']) && is_array($data['security-advisories'])) {
  28915. $this->securityAdvisoryConfig = [
  28916. 'metadata' => $data['security-advisories']['metadata'] ?? false,
  28917. 'api-url' => isset($data['security-advisories']['api-url']) && is_string($data['security-advisories']['api-url']) ? $this->canonicalizeUrl($data['security-advisories']['api-url']) : null,
  28918. ];
  28919. if ($this->securityAdvisoryConfig['api-url'] === null && !$this->hasAvailablePackageList) {
  28920. throw new \UnexpectedValueException('Invalid security advisory configuration on '.$this->getRepoName().': If the repository does not provide a security-advisories.api-url then available-packages or available-package-patterns are required to be provided for performance reason.');
  28921. }
  28922. }
  28923. }
  28924. if ($this->allowSslDowngrade) {
  28925. $this->url = str_replace('https://', 'http://', $this->url);
  28926. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  28927. }
  28928. if (!empty($data['providers-url'])) {
  28929. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  28930. $this->hasProviders = true;
  28931. }
  28932. if (!empty($data['list'])) {
  28933. $this->listUrl = $this->canonicalizeUrl($data['list']);
  28934. }
  28935. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  28936. $this->hasProviders = true;
  28937. }
  28938. if (!empty($data['providers-api'])) {
  28939. $this->providersApiUrl = $this->canonicalizeUrl($data['providers-api']);
  28940. }
  28941. return $this->rootData = $data;
  28942. }
  28943. private function canonicalizeUrl(string $url): string
  28944. {
  28945. if (strlen($url) === 0) {
  28946. throw new \InvalidArgumentException('Expected a string with a value and not an empty string');
  28947. }
  28948. if (str_starts_with($url, '/')) {
  28949. if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  28950. return $matches[0] . $url;
  28951. }
  28952. return $this->url;
  28953. }
  28954. return $url;
  28955. }
  28956. private function loadDataFromServer(): array
  28957. {
  28958. $data = $this->loadRootServerFile();
  28959. if (true === $data) {
  28960. throw new \LogicException('loadRootServerFile should not return true during initialization');
  28961. }
  28962. return $this->loadIncludes($data);
  28963. }
  28964. private function hasPartialPackages(): bool
  28965. {
  28966. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  28967. $this->initializePartialPackages();
  28968. }
  28969. return $this->hasPartialPackages;
  28970. }
  28971. private function loadProviderListings($data): void
  28972. {
  28973. if (isset($data['providers'])) {
  28974. if (!is_array($this->providerListing)) {
  28975. $this->providerListing = [];
  28976. }
  28977. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  28978. }
  28979. if ($this->providersUrl && isset($data['provider-includes'])) {
  28980. $includes = $data['provider-includes'];
  28981. foreach ($includes as $include => $metadata) {
  28982. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  28983. $cacheKey = str_replace(['%hash%','$'], '', $include);
  28984. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  28985. $includedData = json_decode($this->cache->read($cacheKey), true);
  28986. } else {
  28987. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  28988. }
  28989. $this->loadProviderListings($includedData);
  28990. }
  28991. }
  28992. }
  28993. private function loadIncludes(array $data): array
  28994. {
  28995. $packages = [];
  28996. if (!isset($data['packages']) && !isset($data['includes'])) {
  28997. foreach ($data as $pkg) {
  28998. if (isset($pkg['versions']) && is_array($pkg['versions'])) {
  28999. foreach ($pkg['versions'] as $metadata) {
  29000. $packages[] = $metadata;
  29001. }
  29002. }
  29003. }
  29004. return $packages;
  29005. }
  29006. if (isset($data['packages'])) {
  29007. foreach ($data['packages'] as $package => $versions) {
  29008. $packageName = strtolower((string) $package);
  29009. foreach ($versions as $version => $metadata) {
  29010. $packages[] = $metadata;
  29011. if (!$this->displayedWarningAboutNonMatchingPackageIndex && $packageName !== strtolower((string) ($metadata['name'] ?? ''))) {
  29012. $this->displayedWarningAboutNonMatchingPackageIndex = true;
  29013. $this->io->writeError(sprintf("<warning>Warning: the packages key '%s' doesn't match the name defined in the package metadata '%s' in repository %s</warning>", $package, $metadata['name'] ?? '', $this->baseUrl));
  29014. }
  29015. }
  29016. }
  29017. }
  29018. if (isset($data['includes'])) {
  29019. foreach ($data['includes'] as $include => $metadata) {
  29020. if (isset($metadata['sha1']) && $this->cache->sha1((string) $include) === $metadata['sha1']) {
  29021. $includedData = json_decode($this->cache->read((string) $include), true);
  29022. } else {
  29023. $includedData = $this->fetchFile($include);
  29024. }
  29025. $packages = array_merge($packages, $this->loadIncludes($includedData));
  29026. }
  29027. }
  29028. return $packages;
  29029. }
  29030. private function createPackages(array $packages, ?string $source = null): array
  29031. {
  29032. if (!$packages) {
  29033. return [];
  29034. }
  29035. try {
  29036. foreach ($packages as &$data) {
  29037. if (!isset($data['notification-url'])) {
  29038. $data['notification-url'] = $this->notifyUrl;
  29039. }
  29040. }
  29041. $packageInstances = $this->loader->loadPackages($packages);
  29042. foreach ($packageInstances as $package) {
  29043. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  29044. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  29045. }
  29046. $package->setDistMirrors($this->distMirrors);
  29047. $this->configurePackageTransportOptions($package);
  29048. }
  29049. return $packageInstances;
  29050. } catch (\Exception $e) {
  29051. throw new \RuntimeException('Could not load packages '.($packages[0]['name'] ?? json_encode($packages)).' in '.$this->getRepoName().($source ? ' from '.$source : '').': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  29052. }
  29053. }
  29054. protected function fetchFile(string $filename, ?string $cacheKey = null, ?string $sha256 = null, bool $storeLastModifiedTime = false)
  29055. {
  29056. if ('' === $filename) {
  29057. throw new \InvalidArgumentException('$filename should not be an empty string');
  29058. }
  29059. if (null === $cacheKey) {
  29060. $cacheKey = $filename;
  29061. $filename = $this->baseUrl.'/'.$filename;
  29062. }
  29063. if (($pos = strpos($filename, '$')) && Preg::isMatch('{^https?://}i', $filename)) {
  29064. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  29065. }
  29066. $retries = 3;
  29067. while ($retries--) {
  29068. try {
  29069. $options = $this->options;
  29070. if ($this->eventDispatcher) {
  29071. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
  29072. $preFileDownloadEvent->setTransportOptions($this->options);
  29073. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  29074. $filename = $preFileDownloadEvent->getProcessedUrl();
  29075. $options = $preFileDownloadEvent->getTransportOptions();
  29076. }
  29077. $response = $this->httpDownloader->get($filename, $options);
  29078. $json = (string) $response->getBody();
  29079. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  29080. if ($this->allowSslDowngrade) {
  29081. $this->url = str_replace('http://', 'https://', $this->url);
  29082. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  29083. $filename = str_replace('http://', 'https://', $filename);
  29084. }
  29085. if ($retries > 0) {
  29086. usleep(100000);
  29087. continue;
  29088. }
  29089. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  29090. }
  29091. if ($this->eventDispatcher) {
  29092. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, $sha256, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
  29093. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  29094. }
  29095. $data = $response->decodeJson();
  29096. HttpDownloader::outputWarnings($this->io, $this->url, $data);
  29097. if ($cacheKey && !$this->cache->isReadOnly()) {
  29098. if ($storeLastModifiedTime) {
  29099. $lastModifiedDate = $response->getHeader('last-modified');
  29100. if ($lastModifiedDate) {
  29101. $data['last-modified'] = $lastModifiedDate;
  29102. $json = JsonFile::encode($data, 0);
  29103. }
  29104. }
  29105. $this->cache->write($cacheKey, $json);
  29106. }
  29107. $response->collect();
  29108. break;
  29109. } catch (\Exception $e) {
  29110. if ($e instanceof \LogicException) {
  29111. throw $e;
  29112. }
  29113. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  29114. throw $e;
  29115. }
  29116. if ($e instanceof RepositorySecurityException) {
  29117. throw $e;
  29118. }
  29119. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  29120. if (!$this->degradedMode) {
  29121. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  29122. }
  29123. $this->degradedMode = true;
  29124. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  29125. break;
  29126. }
  29127. throw $e;
  29128. }
  29129. }
  29130. if (!isset($data)) {
  29131. throw new \LogicException("ComposerRepository: Undefined \$data. Please report at https://github.com/composer/composer/issues/new.");
  29132. }
  29133. return $data;
  29134. }
  29135. private function fetchFileIfLastModified(string $filename, string $cacheKey, string $lastModifiedTime)
  29136. {
  29137. if ('' === $filename) {
  29138. throw new \InvalidArgumentException('$filename should not be an empty string');
  29139. }
  29140. try {
  29141. $options = $this->options;
  29142. if ($this->eventDispatcher) {
  29143. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
  29144. $preFileDownloadEvent->setTransportOptions($this->options);
  29145. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  29146. $filename = $preFileDownloadEvent->getProcessedUrl();
  29147. $options = $preFileDownloadEvent->getTransportOptions();
  29148. }
  29149. if (isset($options['http']['header'])) {
  29150. $options['http']['header'] = (array) $options['http']['header'];
  29151. }
  29152. $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
  29153. $response = $this->httpDownloader->get($filename, $options);
  29154. $json = (string) $response->getBody();
  29155. if ($json === '' && $response->getStatusCode() === 304) {
  29156. return true;
  29157. }
  29158. if ($this->eventDispatcher) {
  29159. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
  29160. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  29161. }
  29162. $data = $response->decodeJson();
  29163. HttpDownloader::outputWarnings($this->io, $this->url, $data);
  29164. $lastModifiedDate = $response->getHeader('last-modified');
  29165. $response->collect();
  29166. if ($lastModifiedDate) {
  29167. $data['last-modified'] = $lastModifiedDate;
  29168. $json = JsonFile::encode($data, 0);
  29169. }
  29170. if (!$this->cache->isReadOnly()) {
  29171. $this->cache->write($cacheKey, $json);
  29172. }
  29173. return $data;
  29174. } catch (\Exception $e) {
  29175. if ($e instanceof \LogicException) {
  29176. throw $e;
  29177. }
  29178. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  29179. throw $e;
  29180. }
  29181. if (!$this->degradedMode) {
  29182. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  29183. }
  29184. $this->degradedMode = true;
  29185. return true;
  29186. }
  29187. }
  29188. private function asyncFetchFile(string $filename, string $cacheKey, ?string $lastModifiedTime = null): PromiseInterface
  29189. {
  29190. if ('' === $filename) {
  29191. throw new \InvalidArgumentException('$filename should not be an empty string');
  29192. }
  29193. if (isset($this->packagesNotFoundCache[$filename])) {
  29194. return \React\Promise\resolve(['packages' => []]);
  29195. }
  29196. if (isset($this->freshMetadataUrls[$filename]) && $lastModifiedTime) {
  29197. $promise = \React\Promise\resolve(true);
  29198. return $promise;
  29199. }
  29200. $httpDownloader = $this->httpDownloader;
  29201. $options = $this->options;
  29202. if ($this->eventDispatcher) {
  29203. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
  29204. $preFileDownloadEvent->setTransportOptions($this->options);
  29205. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  29206. $filename = $preFileDownloadEvent->getProcessedUrl();
  29207. $options = $preFileDownloadEvent->getTransportOptions();
  29208. }
  29209. if ($lastModifiedTime) {
  29210. if (isset($options['http']['header'])) {
  29211. $options['http']['header'] = (array) $options['http']['header'];
  29212. }
  29213. $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
  29214. }
  29215. $io = $this->io;
  29216. $url = $this->url;
  29217. $cache = $this->cache;
  29218. $degradedMode = &$this->degradedMode;
  29219. $eventDispatcher = $this->eventDispatcher;
  29220. $accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $eventDispatcher) {
  29221. if ($response->getStatusCode() === 404) {
  29222. $this->packagesNotFoundCache[$filename] = true;
  29223. return ['packages' => []];
  29224. }
  29225. $json = (string) $response->getBody();
  29226. if ($json === '' && $response->getStatusCode() === 304) {
  29227. $this->freshMetadataUrls[$filename] = true;
  29228. return true;
  29229. }
  29230. if ($eventDispatcher) {
  29231. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
  29232. $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  29233. }
  29234. $data = $response->decodeJson();
  29235. HttpDownloader::outputWarnings($io, $url, $data);
  29236. $lastModifiedDate = $response->getHeader('last-modified');
  29237. $response->collect();
  29238. if ($lastModifiedDate) {
  29239. $data['last-modified'] = $lastModifiedDate;
  29240. $json = JsonFile::encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  29241. }
  29242. if (!$cache->isReadOnly()) {
  29243. $cache->write($cacheKey, $json);
  29244. }
  29245. $this->freshMetadataUrls[$filename] = true;
  29246. return $data;
  29247. };
  29248. $reject = function ($e) use ($filename, $accept, $io, $url, &$degradedMode, $lastModifiedTime) {
  29249. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  29250. $this->packagesNotFoundCache[$filename] = true;
  29251. return false;
  29252. }
  29253. if (!$degradedMode) {
  29254. $io->writeError('<warning>'.$url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  29255. }
  29256. $degradedMode = true;
  29257. if ($lastModifiedTime) {
  29258. return $accept(new Response(['url' => $url], 304, [], ''));
  29259. }
  29260. if ($e instanceof TransportException && $e->getStatusCode() === 499) {
  29261. return $accept(new Response(['url' => $url], 404, [], ''));
  29262. }
  29263. throw $e;
  29264. };
  29265. return $httpDownloader->add($filename, $options)->then($accept, $reject);
  29266. }
  29267. private function initializePartialPackages(): void
  29268. {
  29269. $rootData = $this->loadRootServerFile();
  29270. if ($rootData === true) {
  29271. return;
  29272. }
  29273. $this->partialPackagesByName = [];
  29274. foreach ($rootData['packages'] as $package => $versions) {
  29275. foreach ($versions as $version) {
  29276. $versionPackageName = strtolower((string) ($version['name'] ?? ''));
  29277. $this->partialPackagesByName[$versionPackageName][] = $version;
  29278. if (!$this->displayedWarningAboutNonMatchingPackageIndex && $versionPackageName !== strtolower($package)) {
  29279. $this->io->writeError(sprintf("<warning>Warning: the packages key '%s' doesn't match the name defined in the package metadata '%s' in repository %s</warning>", $package, $version['name'] ?? '', $this->baseUrl));
  29280. $this->displayedWarningAboutNonMatchingPackageIndex = true;
  29281. }
  29282. }
  29283. }
  29284. $this->rootData = true;
  29285. }
  29286. protected function lazyProvidersRepoContains(string $name)
  29287. {
  29288. if (!$this->hasAvailablePackageList) {
  29289. throw new \LogicException('lazyProvidersRepoContains should not be called unless hasAvailablePackageList is true');
  29290. }
  29291. if (is_array($this->availablePackages) && isset($this->availablePackages[$name])) {
  29292. return true;
  29293. }
  29294. if (is_array($this->availablePackagePatterns)) {
  29295. foreach ($this->availablePackagePatterns as $providerRegex) {
  29296. if (Preg::isMatch($providerRegex, $name)) {
  29297. return true;
  29298. }
  29299. }
  29300. }
  29301. return false;
  29302. }
  29303. }
  29304. <?php declare(strict_types=1);
  29305. namespace Composer\Repository;
  29306. use Composer\Package\BasePackage;
  29307. use Composer\Package\PackageInterface;
  29308. class CompositeRepository implements RepositoryInterface
  29309. {
  29310. private $repositories;
  29311. public function __construct(array $repositories)
  29312. {
  29313. $this->repositories = [];
  29314. foreach ($repositories as $repo) {
  29315. $this->addRepository($repo);
  29316. }
  29317. }
  29318. public function getRepoName(): string
  29319. {
  29320. return 'composite repo ('.implode(', ', array_map(static function ($repo): string {
  29321. return $repo->getRepoName();
  29322. }, $this->repositories)).')';
  29323. }
  29324. public function getRepositories(): array
  29325. {
  29326. return $this->repositories;
  29327. }
  29328. public function hasPackage(PackageInterface $package): bool
  29329. {
  29330. foreach ($this->repositories as $repository) {
  29331. if ($repository->hasPackage($package)) {
  29332. return true;
  29333. }
  29334. }
  29335. return false;
  29336. }
  29337. public function findPackage($name, $constraint): ?BasePackage
  29338. {
  29339. foreach ($this->repositories as $repository) {
  29340. $package = $repository->findPackage($name, $constraint);
  29341. if (null !== $package) {
  29342. return $package;
  29343. }
  29344. }
  29345. return null;
  29346. }
  29347. public function findPackages($name, $constraint = null): array
  29348. {
  29349. $packages = [];
  29350. foreach ($this->repositories as $repository) {
  29351. $packages[] = $repository->findPackages($name, $constraint);
  29352. }
  29353. return $packages ? array_merge(...$packages) : [];
  29354. }
  29355. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []): array
  29356. {
  29357. $packages = [];
  29358. $namesFound = [];
  29359. foreach ($this->repositories as $repository) {
  29360. $result = $repository->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  29361. $packages[] = $result['packages'];
  29362. $namesFound[] = $result['namesFound'];
  29363. }
  29364. return [
  29365. 'packages' => $packages ? array_merge(...$packages) : [],
  29366. 'namesFound' => $namesFound ? array_unique(array_merge(...$namesFound)) : [],
  29367. ];
  29368. }
  29369. public function search(string $query, int $mode = 0, ?string $type = null): array
  29370. {
  29371. $matches = [];
  29372. foreach ($this->repositories as $repository) {
  29373. $matches[] = $repository->search($query, $mode, $type);
  29374. }
  29375. return \count($matches) > 0 ? array_merge(...$matches) : [];
  29376. }
  29377. public function getPackages(): array
  29378. {
  29379. $packages = [];
  29380. foreach ($this->repositories as $repository) {
  29381. $packages[] = $repository->getPackages();
  29382. }
  29383. return $packages ? array_merge(...$packages) : [];
  29384. }
  29385. public function getProviders($packageName): array
  29386. {
  29387. $results = [];
  29388. foreach ($this->repositories as $repository) {
  29389. $results[] = $repository->getProviders($packageName);
  29390. }
  29391. return $results ? array_merge(...$results) : [];
  29392. }
  29393. public function removePackage(PackageInterface $package): void
  29394. {
  29395. foreach ($this->repositories as $repository) {
  29396. if ($repository instanceof WritableRepositoryInterface) {
  29397. $repository->removePackage($package);
  29398. }
  29399. }
  29400. }
  29401. public function count(): int
  29402. {
  29403. $total = 0;
  29404. foreach ($this->repositories as $repository) {
  29405. $total += $repository->count();
  29406. }
  29407. return $total;
  29408. }
  29409. public function addRepository(RepositoryInterface $repository): void
  29410. {
  29411. if ($repository instanceof self) {
  29412. foreach ($repository->getRepositories() as $repo) {
  29413. $this->addRepository($repo);
  29414. }
  29415. } else {
  29416. $this->repositories[] = $repository;
  29417. }
  29418. }
  29419. }
  29420. <?php declare(strict_types=1);
  29421. namespace Composer\Repository;
  29422. interface ConfigurableRepositoryInterface
  29423. {
  29424. public function getRepoConfig();
  29425. }
  29426. <?php declare(strict_types=1);
  29427. namespace Composer\Repository;
  29428. use Composer\Json\JsonFile;
  29429. use Composer\Package\Loader\ArrayLoader;
  29430. use Composer\Package\PackageInterface;
  29431. use Composer\Package\RootAliasPackage;
  29432. use Composer\Package\RootPackageInterface;
  29433. use Composer\Package\AliasPackage;
  29434. use Composer\Package\Dumper\ArrayDumper;
  29435. use Composer\Installer\InstallationManager;
  29436. use Composer\Pcre\Preg;
  29437. use Composer\Util\Filesystem;
  29438. use Composer\Util\Platform;
  29439. class FilesystemRepository extends WritableArrayRepository
  29440. {
  29441. protected $file;
  29442. private $dumpVersions;
  29443. private $rootPackage;
  29444. private $filesystem;
  29445. private $devMode = null;
  29446. public function __construct(JsonFile $repositoryFile, bool $dumpVersions = false, ?RootPackageInterface $rootPackage = null, ?Filesystem $filesystem = null)
  29447. {
  29448. parent::__construct();
  29449. $this->file = $repositoryFile;
  29450. $this->dumpVersions = $dumpVersions;
  29451. $this->rootPackage = $rootPackage;
  29452. $this->filesystem = $filesystem ?: new Filesystem;
  29453. if ($dumpVersions && !$rootPackage) {
  29454. throw new \InvalidArgumentException('Expected a root package instance if $dumpVersions is true');
  29455. }
  29456. }
  29457. public function getDevMode()
  29458. {
  29459. return $this->devMode;
  29460. }
  29461. protected function initialize()
  29462. {
  29463. parent::initialize();
  29464. if (!$this->file->exists()) {
  29465. return;
  29466. }
  29467. try {
  29468. $data = $this->file->read();
  29469. if (isset($data['packages'])) {
  29470. $packages = $data['packages'];
  29471. } else {
  29472. $packages = $data;
  29473. }
  29474. if (isset($data['dev-package-names'])) {
  29475. $this->setDevPackageNames($data['dev-package-names']);
  29476. }
  29477. if (isset($data['dev'])) {
  29478. $this->devMode = $data['dev'];
  29479. }
  29480. if (!is_array($packages)) {
  29481. throw new \UnexpectedValueException('Could not parse package list from the repository');
  29482. }
  29483. } catch (\Exception $e) {
  29484. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  29485. }
  29486. $loader = new ArrayLoader(null, true);
  29487. foreach ($packages as $packageData) {
  29488. $package = $loader->load($packageData);
  29489. $this->addPackage($package);
  29490. }
  29491. }
  29492. public function reload()
  29493. {
  29494. $this->packages = null;
  29495. $this->initialize();
  29496. }
  29497. public function write(bool $devMode, InstallationManager $installationManager)
  29498. {
  29499. $data = ['packages' => [], 'dev' => $devMode, 'dev-package-names' => []];
  29500. $dumper = new ArrayDumper();
  29501. $repoDir = dirname($this->file->getPath());
  29502. $this->filesystem->ensureDirectoryExists($repoDir);
  29503. $repoDir = $this->filesystem->normalizePath(realpath($repoDir));
  29504. $installPaths = [];
  29505. foreach ($this->getCanonicalPackages() as $package) {
  29506. $pkgArray = $dumper->dump($package);
  29507. $path = $installationManager->getInstallPath($package);
  29508. $installPath = null;
  29509. if ('' !== $path && null !== $path) {
  29510. $normalizedPath = $this->filesystem->normalizePath($this->filesystem->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path);
  29511. $installPath = $this->filesystem->findShortestPath($repoDir, $normalizedPath, true);
  29512. }
  29513. $installPaths[$package->getName()] = $installPath;
  29514. $pkgArray['install-path'] = $installPath;
  29515. $data['packages'][] = $pkgArray;
  29516. if (in_array($package->getName(), $this->devPackageNames, true)) {
  29517. $data['dev-package-names'][] = $package->getName();
  29518. }
  29519. }
  29520. sort($data['dev-package-names']);
  29521. usort($data['packages'], static function ($a, $b): int {
  29522. return strcmp($a['name'], $b['name']);
  29523. });
  29524. $this->file->write($data);
  29525. if ($this->dumpVersions) {
  29526. $versions = $this->generateInstalledVersions($installationManager, $installPaths, $devMode, $repoDir);
  29527. $this->filesystem->filePutContentsIfModified($repoDir.'/installed.php', '<?php return ' . $this->dumpToPhpCode($versions) . ';'."\n");
  29528. $installedVersionsClass = file_get_contents(__DIR__.'/../InstalledVersions.php');
  29529. if ($installedVersionsClass !== false) {
  29530. $this->filesystem->filePutContentsIfModified($repoDir.'/InstalledVersions.php', $installedVersionsClass);
  29531. \Composer\InstalledVersions::reload($versions);
  29532. }
  29533. }
  29534. }
  29535. public static function safelyLoadInstalledVersions(string $path): bool
  29536. {
  29537. $installedVersionsData = @file_get_contents($path);
  29538. $pattern = <<<'REGEX'
  29539. {(?(DEFINE)
  29540. (?<number> -? \s*+ \d++ (?:\.\d++)? )
  29541. (?<boolean> true | false | null )
  29542. (?<strings> (?&string) (?: \s*+ \. \s*+ (?&string))*+ )
  29543. (?<string> (?: " (?:[^"\\$]*+ | \\ ["\\0] )* " | ' (?:[^'\\]*+ | \\ ['\\] )* ' ) )
  29544. (?<array> array\( \s*+ (?: (?:(?&number)|(?&strings)) \s*+ => \s*+ (?: (?:__DIR__ \s*+ \. \s*+)? (?&strings) | (?&value) ) \s*+, \s*+ )*+ \s*+ \) )
  29545. (?<value> (?: (?&number) | (?&boolean) | (?&strings) | (?&array) ) )
  29546. )
  29547. ^<\?php\s++return\s++(?&array)\s*+;$}ix
  29548. REGEX;
  29549. if (is_string($installedVersionsData) && Preg::isMatch($pattern, trim($installedVersionsData))) {
  29550. \Composer\InstalledVersions::reload(eval('?>'.Preg::replace('{=>\s*+__DIR__\s*+\.\s*+([\'"])}', '=> '.var_export(dirname($path), true).' . $1', $installedVersionsData)));
  29551. return true;
  29552. }
  29553. return false;
  29554. }
  29555. private function dumpToPhpCode(array $array = [], int $level = 0): string
  29556. {
  29557. $lines = "array(\n";
  29558. $level++;
  29559. foreach ($array as $key => $value) {
  29560. $lines .= str_repeat(' ', $level);
  29561. $lines .= is_int($key) ? $key . ' => ' : var_export($key, true) . ' => ';
  29562. if (is_array($value)) {
  29563. if (!empty($value)) {
  29564. $lines .= $this->dumpToPhpCode($value, $level);
  29565. } else {
  29566. $lines .= "array(),\n";
  29567. }
  29568. } elseif ($key === 'install_path' && is_string($value)) {
  29569. if ($this->filesystem->isAbsolutePath($value)) {
  29570. $lines .= var_export($value, true) . ",\n";
  29571. } else {
  29572. $lines .= "__DIR__ . " . var_export('/' . $value, true) . ",\n";
  29573. }
  29574. } elseif (is_string($value)) {
  29575. $lines .= var_export($value, true) . ",\n";
  29576. } elseif (is_bool($value)) {
  29577. $lines .= ($value ? 'true' : 'false') . ",\n";
  29578. } elseif (is_null($value)) {
  29579. $lines .= "null,\n";
  29580. } else {
  29581. throw new \UnexpectedValueException('Unexpected type '.gettype($value));
  29582. }
  29583. }
  29584. $lines .= str_repeat(' ', $level - 1) . ')' . ($level - 1 === 0 ? '' : ",\n");
  29585. return $lines;
  29586. }
  29587. private function generateInstalledVersions(InstallationManager $installationManager, array $installPaths, bool $devMode, string $repoDir): array
  29588. {
  29589. $devPackages = array_flip($this->devPackageNames);
  29590. $packages = $this->getPackages();
  29591. if (null === $this->rootPackage) {
  29592. throw new \LogicException('It should not be possible to dump packages if no root package is given');
  29593. }
  29594. $packages[] = $rootPackage = $this->rootPackage;
  29595. while ($rootPackage instanceof RootAliasPackage) {
  29596. $rootPackage = $rootPackage->getAliasOf();
  29597. $packages[] = $rootPackage;
  29598. }
  29599. $versions = [
  29600. 'root' => $this->dumpRootPackage($rootPackage, $installPaths, $devMode, $repoDir, $devPackages),
  29601. 'versions' => [],
  29602. ];
  29603. foreach ($packages as $package) {
  29604. if ($package instanceof AliasPackage) {
  29605. continue;
  29606. }
  29607. $versions['versions'][$package->getName()] = $this->dumpInstalledPackage($package, $installPaths, $repoDir, $devPackages);
  29608. }
  29609. foreach ($packages as $package) {
  29610. $isDevPackage = isset($devPackages[$package->getName()]);
  29611. foreach ($package->getReplaces() as $replace) {
  29612. if (PlatformRepository::isPlatformPackage($replace->getTarget())) {
  29613. continue;
  29614. }
  29615. if (!isset($versions['versions'][$replace->getTarget()]['dev_requirement'])) {
  29616. $versions['versions'][$replace->getTarget()]['dev_requirement'] = $isDevPackage;
  29617. } elseif (!$isDevPackage) {
  29618. $versions['versions'][$replace->getTarget()]['dev_requirement'] = false;
  29619. }
  29620. $replaced = $replace->getPrettyConstraint();
  29621. if ($replaced === 'self.version') {
  29622. $replaced = $package->getPrettyVersion();
  29623. }
  29624. if (!isset($versions['versions'][$replace->getTarget()]['replaced']) || !in_array($replaced, $versions['versions'][$replace->getTarget()]['replaced'], true)) {
  29625. $versions['versions'][$replace->getTarget()]['replaced'][] = $replaced;
  29626. }
  29627. }
  29628. foreach ($package->getProvides() as $provide) {
  29629. if (PlatformRepository::isPlatformPackage($provide->getTarget())) {
  29630. continue;
  29631. }
  29632. if (!isset($versions['versions'][$provide->getTarget()]['dev_requirement'])) {
  29633. $versions['versions'][$provide->getTarget()]['dev_requirement'] = $isDevPackage;
  29634. } elseif (!$isDevPackage) {
  29635. $versions['versions'][$provide->getTarget()]['dev_requirement'] = false;
  29636. }
  29637. $provided = $provide->getPrettyConstraint();
  29638. if ($provided === 'self.version') {
  29639. $provided = $package->getPrettyVersion();
  29640. }
  29641. if (!isset($versions['versions'][$provide->getTarget()]['provided']) || !in_array($provided, $versions['versions'][$provide->getTarget()]['provided'], true)) {
  29642. $versions['versions'][$provide->getTarget()]['provided'][] = $provided;
  29643. }
  29644. }
  29645. }
  29646. foreach ($packages as $package) {
  29647. if (!$package instanceof AliasPackage) {
  29648. continue;
  29649. }
  29650. $versions['versions'][$package->getName()]['aliases'][] = $package->getPrettyVersion();
  29651. if ($package instanceof RootPackageInterface) {
  29652. $versions['root']['aliases'][] = $package->getPrettyVersion();
  29653. }
  29654. }
  29655. ksort($versions['versions']);
  29656. ksort($versions);
  29657. return $versions;
  29658. }
  29659. private function dumpInstalledPackage(PackageInterface $package, array $installPaths, string $repoDir, array $devPackages): array
  29660. {
  29661. $reference = null;
  29662. if ($package->getInstallationSource()) {
  29663. $reference = $package->getInstallationSource() === 'source' ? $package->getSourceReference() : $package->getDistReference();
  29664. }
  29665. if (null === $reference) {
  29666. $reference = ($package->getSourceReference() ?: $package->getDistReference()) ?: null;
  29667. }
  29668. if ($package instanceof RootPackageInterface) {
  29669. $to = $this->filesystem->normalizePath(realpath(Platform::getCwd()));
  29670. $installPath = $this->filesystem->findShortestPath($repoDir, $to, true);
  29671. } else {
  29672. $installPath = $installPaths[$package->getName()];
  29673. }
  29674. $data = [
  29675. 'pretty_version' => $package->getPrettyVersion(),
  29676. 'version' => $package->getVersion(),
  29677. 'reference' => $reference,
  29678. 'type' => $package->getType(),
  29679. 'install_path' => $installPath,
  29680. 'aliases' => [],
  29681. 'dev_requirement' => isset($devPackages[$package->getName()]),
  29682. ];
  29683. return $data;
  29684. }
  29685. private function dumpRootPackage(RootPackageInterface $package, array $installPaths, bool $devMode, string $repoDir, array $devPackages)
  29686. {
  29687. $data = $this->dumpInstalledPackage($package, $installPaths, $repoDir, $devPackages);
  29688. return [
  29689. 'name' => $package->getName(),
  29690. 'pretty_version' => $data['pretty_version'],
  29691. 'version' => $data['version'],
  29692. 'reference' => $data['reference'],
  29693. 'type' => $data['type'],
  29694. 'install_path' => $data['install_path'],
  29695. 'aliases' => $data['aliases'],
  29696. 'dev' => $devMode,
  29697. ];
  29698. }
  29699. }
  29700. <?php declare(strict_types=1);
  29701. namespace Composer\Repository;
  29702. use Composer\Package\PackageInterface;
  29703. use Composer\Package\BasePackage;
  29704. use Composer\Pcre\Preg;
  29705. class FilterRepository implements RepositoryInterface, AdvisoryProviderInterface
  29706. {
  29707. private $only = null;
  29708. private $exclude = null;
  29709. private $canonical = true;
  29710. private $repo;
  29711. public function __construct(RepositoryInterface $repo, array $options)
  29712. {
  29713. if (isset($options['only'])) {
  29714. if (!is_array($options['only'])) {
  29715. throw new \InvalidArgumentException('"only" key for repository '.$repo->getRepoName().' should be an array');
  29716. }
  29717. $this->only = BasePackage::packageNamesToRegexp($options['only']);
  29718. }
  29719. if (isset($options['exclude'])) {
  29720. if (!is_array($options['exclude'])) {
  29721. throw new \InvalidArgumentException('"exclude" key for repository '.$repo->getRepoName().' should be an array');
  29722. }
  29723. $this->exclude = BasePackage::packageNamesToRegexp($options['exclude']);
  29724. }
  29725. if ($this->exclude && $this->only) {
  29726. throw new \InvalidArgumentException('Only one of "only" and "exclude" can be specified for repository '.$repo->getRepoName());
  29727. }
  29728. if (isset($options['canonical'])) {
  29729. if (!is_bool($options['canonical'])) {
  29730. throw new \InvalidArgumentException('"canonical" key for repository '.$repo->getRepoName().' should be a boolean');
  29731. }
  29732. $this->canonical = $options['canonical'];
  29733. }
  29734. $this->repo = $repo;
  29735. }
  29736. public function getRepoName(): string
  29737. {
  29738. return $this->repo->getRepoName();
  29739. }
  29740. public function getRepository(): RepositoryInterface
  29741. {
  29742. return $this->repo;
  29743. }
  29744. public function hasPackage(PackageInterface $package): bool
  29745. {
  29746. return $this->repo->hasPackage($package);
  29747. }
  29748. public function findPackage($name, $constraint): ?BasePackage
  29749. {
  29750. if (!$this->isAllowed($name)) {
  29751. return null;
  29752. }
  29753. return $this->repo->findPackage($name, $constraint);
  29754. }
  29755. public function findPackages($name, $constraint = null): array
  29756. {
  29757. if (!$this->isAllowed($name)) {
  29758. return [];
  29759. }
  29760. return $this->repo->findPackages($name, $constraint);
  29761. }
  29762. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []): array
  29763. {
  29764. foreach ($packageNameMap as $name => $constraint) {
  29765. if (!$this->isAllowed($name)) {
  29766. unset($packageNameMap[$name]);
  29767. }
  29768. }
  29769. if (!$packageNameMap) {
  29770. return ['namesFound' => [], 'packages' => []];
  29771. }
  29772. $result = $this->repo->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  29773. if (!$this->canonical) {
  29774. $result['namesFound'] = [];
  29775. }
  29776. return $result;
  29777. }
  29778. public function search(string $query, int $mode = 0, ?string $type = null): array
  29779. {
  29780. $result = [];
  29781. foreach ($this->repo->search($query, $mode, $type) as $package) {
  29782. if ($this->isAllowed($package['name'])) {
  29783. $result[] = $package;
  29784. }
  29785. }
  29786. return $result;
  29787. }
  29788. public function getPackages(): array
  29789. {
  29790. $result = [];
  29791. foreach ($this->repo->getPackages() as $package) {
  29792. if ($this->isAllowed($package->getName())) {
  29793. $result[] = $package;
  29794. }
  29795. }
  29796. return $result;
  29797. }
  29798. public function getProviders($packageName): array
  29799. {
  29800. $result = [];
  29801. foreach ($this->repo->getProviders($packageName) as $name => $provider) {
  29802. if ($this->isAllowed($provider['name'])) {
  29803. $result[$name] = $provider;
  29804. }
  29805. }
  29806. return $result;
  29807. }
  29808. public function count(): int
  29809. {
  29810. if ($this->repo->count() > 0) {
  29811. return count($this->getPackages());
  29812. }
  29813. return 0;
  29814. }
  29815. public function hasSecurityAdvisories(): bool
  29816. {
  29817. if (!$this->repo instanceof AdvisoryProviderInterface) {
  29818. return false;
  29819. }
  29820. return $this->repo->hasSecurityAdvisories();
  29821. }
  29822. public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array
  29823. {
  29824. if (!$this->repo instanceof AdvisoryProviderInterface) {
  29825. return ['namesFound' => [], 'advisories' => []];
  29826. }
  29827. foreach ($packageConstraintMap as $name => $constraint) {
  29828. if (!$this->isAllowed($name)) {
  29829. unset($packageConstraintMap[$name]);
  29830. }
  29831. }
  29832. return $this->repo->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories);
  29833. }
  29834. private function isAllowed(string $name): bool
  29835. {
  29836. if (!$this->only && !$this->exclude) {
  29837. return true;
  29838. }
  29839. if ($this->only) {
  29840. return Preg::isMatch($this->only, $name);
  29841. }
  29842. if ($this->exclude === null) {
  29843. return true;
  29844. }
  29845. return !Preg::isMatch($this->exclude, $name);
  29846. }
  29847. }
  29848. <?php declare(strict_types=1);
  29849. namespace Composer\Repository;
  29850. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  29851. {
  29852. public function getRepoName(): string
  29853. {
  29854. return 'installed '.parent::getRepoName();
  29855. }
  29856. public function isFresh(): bool
  29857. {
  29858. return $this->count() === 0;
  29859. }
  29860. }
  29861. <?php declare(strict_types=1);
  29862. namespace Composer\Repository;
  29863. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  29864. {
  29865. public function getRepoName()
  29866. {
  29867. return 'installed '.parent::getRepoName();
  29868. }
  29869. public function isFresh()
  29870. {
  29871. return !$this->file->exists();
  29872. }
  29873. }
  29874. <?php declare(strict_types=1);
  29875. namespace Composer\Repository;
  29876. use Composer\Package\BasePackage;
  29877. use Composer\Package\PackageInterface;
  29878. use Composer\Package\Version\VersionParser;
  29879. use Composer\Semver\Constraint\ConstraintInterface;
  29880. use Composer\Semver\Constraint\Constraint;
  29881. use Composer\Semver\Constraint\MatchAllConstraint;
  29882. use Composer\Package\RootPackageInterface;
  29883. use Composer\Package\Link;
  29884. class InstalledRepository extends CompositeRepository
  29885. {
  29886. public function findPackagesWithReplacersAndProviders(string $name, $constraint = null): array
  29887. {
  29888. $name = strtolower($name);
  29889. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  29890. $versionParser = new VersionParser();
  29891. $constraint = $versionParser->parseConstraints($constraint);
  29892. }
  29893. $matches = [];
  29894. foreach ($this->getRepositories() as $repo) {
  29895. foreach ($repo->getPackages() as $candidate) {
  29896. if ($name === $candidate->getName()) {
  29897. if (null === $constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
  29898. $matches[] = $candidate;
  29899. }
  29900. continue;
  29901. }
  29902. foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
  29903. if (
  29904. $name === $link->getTarget()
  29905. && ($constraint === null || $constraint->matches($link->getConstraint()))
  29906. ) {
  29907. $matches[] = $candidate;
  29908. continue 2;
  29909. }
  29910. }
  29911. }
  29912. }
  29913. return $matches;
  29914. }
  29915. public function getDependents($needle, ?ConstraintInterface $constraint = null, bool $invert = false, bool $recurse = true, ?array $packagesFound = null): array
  29916. {
  29917. $needles = array_map('strtolower', (array) $needle);
  29918. $results = [];
  29919. if (null === $packagesFound) {
  29920. $packagesFound = $needles;
  29921. }
  29922. $rootPackage = null;
  29923. foreach ($this->getPackages() as $package) {
  29924. if ($package instanceof RootPackageInterface) {
  29925. $rootPackage = $package;
  29926. break;
  29927. }
  29928. }
  29929. foreach ($this->getPackages() as $package) {
  29930. $links = $package->getRequires();
  29931. $packagesInTree = $packagesFound;
  29932. if (!$invert) {
  29933. $links += $package->getReplaces();
  29934. foreach ($package->getReplaces() as $link) {
  29935. foreach ($needles as $needle) {
  29936. if ($link->getSource() === $needle) {
  29937. if ($constraint === null || ($link->getConstraint()->matches($constraint) === true)) {
  29938. if (in_array($link->getTarget(), $packagesInTree)) {
  29939. $results[] = [$package, $link, false];
  29940. continue;
  29941. }
  29942. $packagesInTree[] = $link->getTarget();
  29943. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : [];
  29944. $results[] = [$package, $link, $dependents];
  29945. $needles[] = $link->getTarget();
  29946. }
  29947. }
  29948. }
  29949. }
  29950. }
  29951. if ($package instanceof RootPackageInterface) {
  29952. $links += $package->getDevRequires();
  29953. }
  29954. foreach ($links as $link) {
  29955. foreach ($needles as $needle) {
  29956. if ($link->getTarget() === $needle) {
  29957. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  29958. if (in_array($link->getSource(), $packagesInTree)) {
  29959. $results[] = [$package, $link, false];
  29960. continue;
  29961. }
  29962. $packagesInTree[] = $link->getSource();
  29963. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : [];
  29964. $results[] = [$package, $link, $dependents];
  29965. }
  29966. }
  29967. }
  29968. }
  29969. if ($invert && in_array($package->getName(), $needles)) {
  29970. foreach ($package->getConflicts() as $link) {
  29971. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  29972. $version = new Constraint('=', $pkg->getVersion());
  29973. if ($link->getConstraint()->matches($version) === $invert) {
  29974. $results[] = [$package, $link, false];
  29975. }
  29976. }
  29977. }
  29978. }
  29979. foreach ($package->getConflicts() as $link) {
  29980. if (in_array($link->getTarget(), $needles)) {
  29981. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  29982. $version = new Constraint('=', $pkg->getVersion());
  29983. if ($link->getConstraint()->matches($version) === $invert) {
  29984. $results[] = [$package, $link, false];
  29985. }
  29986. }
  29987. }
  29988. }
  29989. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  29990. foreach ($package->getRequires() as $link) {
  29991. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  29992. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  29993. continue;
  29994. }
  29995. $platformPkg = $this->findPackage($link->getTarget(), '*');
  29996. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  29997. $results[] = [$package, new Link($package->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_REQUIRE, $link->getPrettyConstraint().' '.$description), false];
  29998. continue;
  29999. }
  30000. foreach ($this->getPackages() as $pkg) {
  30001. if (!in_array($link->getTarget(), $pkg->getNames())) {
  30002. continue;
  30003. }
  30004. $version = new Constraint('=', $pkg->getVersion());
  30005. if ($link->getTarget() !== $pkg->getName()) {
  30006. foreach (array_merge($pkg->getReplaces(), $pkg->getProvides()) as $prov) {
  30007. if ($link->getTarget() === $prov->getTarget()) {
  30008. $version = $prov->getConstraint();
  30009. break;
  30010. }
  30011. }
  30012. }
  30013. if (!$link->getConstraint()->matches($version)) {
  30014. if ($rootPackage) {
  30015. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  30016. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  30017. $results[] = [$package, $link, false];
  30018. $results[] = [$rootPackage, $rootReq, false];
  30019. continue 3;
  30020. }
  30021. }
  30022. $results[] = [$package, $link, false];
  30023. $results[] = [$rootPackage, new Link($rootPackage->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_DOES_NOT_REQUIRE, 'but ' . $pkg->getPrettyVersion() . ' is installed'), false];
  30024. } else {
  30025. $results[] = [$package, $link, false];
  30026. }
  30027. }
  30028. continue 2;
  30029. }
  30030. }
  30031. }
  30032. }
  30033. ksort($results);
  30034. return $results;
  30035. }
  30036. public function getRepoName(): string
  30037. {
  30038. return 'installed repo ('.implode(', ', array_map(static function ($repo): string {
  30039. return $repo->getRepoName();
  30040. }, $this->getRepositories())).')';
  30041. }
  30042. public function addRepository(RepositoryInterface $repository): void
  30043. {
  30044. if (
  30045. $repository instanceof LockArrayRepository
  30046. || $repository instanceof InstalledRepositoryInterface
  30047. || $repository instanceof RootPackageRepository
  30048. || $repository instanceof PlatformRepository
  30049. ) {
  30050. parent::addRepository($repository);
  30051. return;
  30052. }
  30053. throw new \LogicException('An InstalledRepository can not contain a repository of type '.get_class($repository).' ('.$repository->getRepoName().')');
  30054. }
  30055. }
  30056. <?php declare(strict_types=1);
  30057. namespace Composer\Repository;
  30058. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  30059. {
  30060. public function getDevMode();
  30061. public function isFresh();
  30062. }
  30063. <?php declare(strict_types=1);
  30064. namespace Composer\Repository;
  30065. class InvalidRepositoryException extends \Exception
  30066. {
  30067. }
  30068. <?php declare(strict_types=1);
  30069. namespace Composer\Repository;
  30070. class LockArrayRepository extends ArrayRepository
  30071. {
  30072. use CanonicalPackagesTrait;
  30073. public function getRepoName(): string
  30074. {
  30075. return 'lock repo';
  30076. }
  30077. }
  30078. <?php declare(strict_types=1);
  30079. namespace Composer\Repository;
  30080. use Composer\Package\Loader\ArrayLoader;
  30081. use Composer\Package\Loader\ValidatingArrayLoader;
  30082. use Composer\Pcre\Preg;
  30083. class PackageRepository extends ArrayRepository
  30084. {
  30085. private $config;
  30086. public function __construct(array $config)
  30087. {
  30088. parent::__construct();
  30089. $this->config = $config['package'];
  30090. if (!is_numeric(key($this->config))) {
  30091. $this->config = [$this->config];
  30092. }
  30093. }
  30094. protected function initialize(): void
  30095. {
  30096. parent::initialize();
  30097. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), true);
  30098. foreach ($this->config as $package) {
  30099. try {
  30100. $package = $loader->load($package);
  30101. } catch (\Exception $e) {
  30102. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  30103. }
  30104. $this->addPackage($package);
  30105. }
  30106. }
  30107. public function getRepoName(): string
  30108. {
  30109. return Preg::replace('{^array }', 'package ', parent::getRepoName());
  30110. }
  30111. }
  30112. <?php declare(strict_types=1);
  30113. namespace Composer\Repository;
  30114. use Composer\Config;
  30115. use Composer\EventDispatcher\EventDispatcher;
  30116. use Composer\IO\IOInterface;
  30117. use Composer\Json\JsonFile;
  30118. use Composer\Package\Loader\ArrayLoader;
  30119. use Composer\Package\Version\VersionGuesser;
  30120. use Composer\Package\Version\VersionParser;
  30121. use Composer\Pcre\Preg;
  30122. use Composer\Util\HttpDownloader;
  30123. use Composer\Util\Platform;
  30124. use Composer\Util\ProcessExecutor;
  30125. use Composer\Util\Filesystem;
  30126. use Composer\Util\Url;
  30127. use Composer\Util\Git as GitUtil;
  30128. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  30129. {
  30130. private $loader;
  30131. private $versionGuesser;
  30132. private $url;
  30133. private $repoConfig;
  30134. private $process;
  30135. private $options;
  30136. public function __construct(array $repoConfig, IOInterface $io, Config $config, ?HttpDownloader $httpDownloader = null, ?EventDispatcher $dispatcher = null, ?ProcessExecutor $process = null)
  30137. {
  30138. if (!isset($repoConfig['url'])) {
  30139. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  30140. }
  30141. $this->loader = new ArrayLoader(null, true);
  30142. $this->url = Platform::expandPath($repoConfig['url']);
  30143. $this->process = $process ?? new ProcessExecutor($io);
  30144. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  30145. $this->repoConfig = $repoConfig;
  30146. $this->options = $repoConfig['options'] ?? [];
  30147. if (!isset($this->options['relative'])) {
  30148. $filesystem = new Filesystem();
  30149. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  30150. }
  30151. parent::__construct();
  30152. }
  30153. public function getRepoName(): string
  30154. {
  30155. return 'path repo ('.Url::sanitize($this->repoConfig['url']).')';
  30156. }
  30157. public function getRepoConfig(): array
  30158. {
  30159. return $this->repoConfig;
  30160. }
  30161. protected function initialize(): void
  30162. {
  30163. parent::initialize();
  30164. $urlMatches = $this->getUrlMatches();
  30165. if (empty($urlMatches)) {
  30166. if (Preg::isMatch('{[*{}]}', $this->url)) {
  30167. $url = $this->url;
  30168. while (Preg::isMatch('{[*{}]}', $url)) {
  30169. $url = dirname($url);
  30170. }
  30171. if (is_dir($url)) {
  30172. return;
  30173. }
  30174. }
  30175. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  30176. }
  30177. foreach ($urlMatches as $url) {
  30178. $path = realpath($url) . DIRECTORY_SEPARATOR;
  30179. $composerFilePath = $path.'composer.json';
  30180. if (!file_exists($composerFilePath)) {
  30181. continue;
  30182. }
  30183. $json = file_get_contents($composerFilePath);
  30184. $package = JsonFile::parseJson($json, $composerFilePath);
  30185. $package['dist'] = [
  30186. 'type' => 'path',
  30187. 'url' => $url,
  30188. ];
  30189. $reference = $this->options['reference'] ?? 'auto';
  30190. if ('none' === $reference) {
  30191. $package['dist']['reference'] = null;
  30192. } elseif ('config' === $reference || 'auto' === $reference) {
  30193. $package['dist']['reference'] = sha1($json . serialize($this->options));
  30194. }
  30195. $package['transport-options'] = array_intersect_key($this->options, ['symlink' => true, 'relative' => true]);
  30196. if (isset($package['name'], $this->options['versions'][$package['name']])) {
  30197. $package['version'] = $this->options['versions'][$package['name']];
  30198. }
  30199. if (!isset($package['version']) && ($rootVersion = Platform::getEnv('COMPOSER_ROOT_VERSION'))) {
  30200. if (
  30201. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  30202. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  30203. && $ref1 === $ref2
  30204. ) {
  30205. $package['version'] = $rootVersion;
  30206. }
  30207. }
  30208. $output = '';
  30209. if ('auto' === $reference && is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
  30210. $package['dist']['reference'] = trim($output);
  30211. }
  30212. if (!isset($package['version'])) {
  30213. $versionData = $this->versionGuesser->guessVersion($package, $path);
  30214. if (is_array($versionData) && $versionData['pretty_version']) {
  30215. if (!empty($versionData['feature_pretty_version'])) {
  30216. $package['version'] = $versionData['feature_pretty_version'];
  30217. $this->addPackage($this->loader->load($package));
  30218. }
  30219. $package['version'] = $versionData['pretty_version'];
  30220. } else {
  30221. $package['version'] = 'dev-main';
  30222. }
  30223. }
  30224. try {
  30225. $this->addPackage($this->loader->load($package));
  30226. } catch (\Exception $e) {
  30227. throw new \RuntimeException('Failed loading the package in '.$composerFilePath, 0, $e);
  30228. }
  30229. }
  30230. }
  30231. private function getUrlMatches(): array
  30232. {
  30233. $flags = GLOB_MARK | GLOB_ONLYDIR;
  30234. if (defined('GLOB_BRACE')) {
  30235. $flags |= GLOB_BRACE;
  30236. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  30237. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  30238. }
  30239. return array_map(static function ($val): string {
  30240. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  30241. }, glob($this->url, $flags));
  30242. }
  30243. }
  30244. <?php declare(strict_types=1);
  30245. namespace Composer\Repository;
  30246. class PearRepository extends ArrayRepository
  30247. {
  30248. public function __construct()
  30249. {
  30250. throw new \InvalidArgumentException('The PEAR repository has been removed from Composer 2.x');
  30251. }
  30252. }
  30253. <?php declare(strict_types=1);
  30254. namespace Composer\Repository;
  30255. use Composer\Composer;
  30256. use Composer\Package\CompletePackage;
  30257. use Composer\Package\CompletePackageInterface;
  30258. use Composer\Package\Link;
  30259. use Composer\Package\PackageInterface;
  30260. use Composer\Package\Version\VersionParser;
  30261. use Composer\Pcre\Preg;
  30262. use Composer\Platform\HhvmDetector;
  30263. use Composer\Platform\Runtime;
  30264. use Composer\Platform\Version;
  30265. use Composer\Plugin\PluginInterface;
  30266. use Composer\Semver\Constraint\Constraint;
  30267. use Composer\Util\Silencer;
  30268. use Composer\XdebugHandler\XdebugHandler;
  30269. class PlatformRepository extends ArrayRepository
  30270. {
  30271. public const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer(?:-(?:plugin|runtime)-api)?)$}iD';
  30272. private static $lastSeenPlatformPhp = null;
  30273. private $versionParser;
  30274. private $overrides = [];
  30275. private $disabledPackages = [];
  30276. private $runtime;
  30277. private $hhvmDetector;
  30278. public function __construct(array $packages = [], array $overrides = [], ?Runtime $runtime = null, ?HhvmDetector $hhvmDetector = null)
  30279. {
  30280. $this->runtime = $runtime ?: new Runtime();
  30281. $this->hhvmDetector = $hhvmDetector ?: new HhvmDetector();
  30282. foreach ($overrides as $name => $version) {
  30283. if (!is_string($version) && false !== $version) {
  30284. throw new \UnexpectedValueException('config.platform.'.$name.' should be a string or false, but got '.gettype($version).' '.var_export($version, true));
  30285. }
  30286. if ($name === 'php' && $version === false) {
  30287. throw new \UnexpectedValueException('config.platform.'.$name.' cannot be set to false as you cannot disable php entirely.');
  30288. }
  30289. $this->overrides[strtolower($name)] = ['name' => $name, 'version' => $version];
  30290. }
  30291. parent::__construct($packages);
  30292. }
  30293. public function getRepoName(): string
  30294. {
  30295. return 'platform repo';
  30296. }
  30297. public function isPlatformPackageDisabled(string $name): bool
  30298. {
  30299. return isset($this->disabledPackages[$name]);
  30300. }
  30301. public function getDisabledPackages(): array
  30302. {
  30303. return $this->disabledPackages;
  30304. }
  30305. protected function initialize(): void
  30306. {
  30307. parent::initialize();
  30308. $this->versionParser = new VersionParser();
  30309. foreach ($this->overrides as $override) {
  30310. if (!self::isPlatformPackage($override['name'])) {
  30311. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  30312. }
  30313. if ($override['version'] !== false) {
  30314. $this->addOverriddenPackage($override);
  30315. }
  30316. }
  30317. $prettyVersion = Composer::getVersion();
  30318. $version = $this->versionParser->normalize($prettyVersion);
  30319. $composer = new CompletePackage('composer', $version, $prettyVersion);
  30320. $composer->setDescription('Composer package');
  30321. $this->addPackage($composer);
  30322. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  30323. $version = $this->versionParser->normalize($prettyVersion);
  30324. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  30325. $composerPluginApi->setDescription('The Composer Plugin API');
  30326. $this->addPackage($composerPluginApi);
  30327. $prettyVersion = Composer::RUNTIME_API_VERSION;
  30328. $version = $this->versionParser->normalize($prettyVersion);
  30329. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  30330. $composerRuntimeApi->setDescription('The Composer Runtime API');
  30331. $this->addPackage($composerRuntimeApi);
  30332. try {
  30333. $prettyVersion = $this->runtime->getConstant('PHP_VERSION');
  30334. $version = $this->versionParser->normalize($prettyVersion);
  30335. } catch (\UnexpectedValueException $e) {
  30336. $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $this->runtime->getConstant('PHP_VERSION'));
  30337. $version = $this->versionParser->normalize($prettyVersion);
  30338. }
  30339. $php = new CompletePackage('php', $version, $prettyVersion);
  30340. $php->setDescription('The PHP interpreter');
  30341. $this->addPackage($php);
  30342. if ($this->runtime->getConstant('PHP_DEBUG')) {
  30343. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  30344. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  30345. $this->addPackage($phpdebug);
  30346. }
  30347. if ($this->runtime->hasConstant('PHP_ZTS') && $this->runtime->getConstant('PHP_ZTS')) {
  30348. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  30349. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  30350. $this->addPackage($phpzts);
  30351. }
  30352. if ($this->runtime->getConstant('PHP_INT_SIZE') === 8) {
  30353. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  30354. $php64->setDescription('The PHP interpreter, 64bit');
  30355. $this->addPackage($php64);
  30356. }
  30357. if ($this->runtime->hasConstant('AF_INET6') || Silencer::call([$this->runtime, 'invoke'], 'inet_pton', ['::']) !== false) {
  30358. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  30359. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  30360. $this->addPackage($phpIpv6);
  30361. }
  30362. $loadedExtensions = $this->runtime->getExtensions();
  30363. foreach ($loadedExtensions as $name) {
  30364. if (in_array($name, ['standard', 'Core'])) {
  30365. continue;
  30366. }
  30367. $this->addExtension($name, $this->runtime->getExtensionVersion($name));
  30368. }
  30369. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  30370. $this->addExtension('xdebug', $prettyVersion);
  30371. }
  30372. foreach ($loadedExtensions as $name) {
  30373. switch ($name) {
  30374. case 'amqp':
  30375. $info = $this->runtime->getExtensionInfo($name);
  30376. if (Preg::isMatch('/^librabbitmq version => (?<version>.+)$/im', $info, $librabbitmqMatches)) {
  30377. $this->addLibrary($name.'-librabbitmq', $librabbitmqMatches['version'], 'AMQP librabbitmq version');
  30378. }
  30379. if (Preg::isMatchStrictGroups('/^AMQP protocol version => (?<version>.+)$/im', $info, $protocolMatches)) {
  30380. $this->addLibrary($name.'-protocol', str_replace('-', '.', $protocolMatches['version']), 'AMQP protocol version');
  30381. }
  30382. break;
  30383. case 'bz2':
  30384. $info = $this->runtime->getExtensionInfo($name);
  30385. if (Preg::isMatch('/^BZip2 Version => (?<version>.*),/im', $info, $matches)) {
  30386. $this->addLibrary($name, $matches['version']);
  30387. }
  30388. break;
  30389. case 'curl':
  30390. $curlVersion = $this->runtime->invoke('curl_version');
  30391. $this->addLibrary($name, $curlVersion['version']);
  30392. $info = $this->runtime->getExtensionInfo($name);
  30393. if (Preg::isMatchStrictGroups('{^SSL Version => (?<library>[^/]+)/(?<version>.+)$}im', $info, $sslMatches)) {
  30394. $library = strtolower($sslMatches['library']);
  30395. if ($library === 'openssl') {
  30396. $parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips);
  30397. $this->addLibrary($name.'-openssl'.($isFips ? '-fips' : ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', [], $isFips ? ['curl-openssl'] : []);
  30398. } else {
  30399. if ($library === '(securetransport) openssl') {
  30400. $shortlib = 'securetransport';
  30401. } else {
  30402. $shortlib = $library;
  30403. }
  30404. $this->addLibrary($name.'-'.$shortlib, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', ['curl-openssl']);
  30405. }
  30406. }
  30407. if (Preg::isMatchStrictGroups('{^libSSH Version => (?<library>[^/]+)/(?<version>.+?)(?:/.*)?$}im', $info, $sshMatches)) {
  30408. $this->addLibrary($name.'-'.strtolower($sshMatches['library']), $sshMatches['version'], 'curl '.$sshMatches['library'].' version');
  30409. }
  30410. if (Preg::isMatchStrictGroups('{^ZLib Version => (?<version>.+)$}im', $info, $zlibMatches)) {
  30411. $this->addLibrary($name.'-zlib', $zlibMatches['version'], 'curl zlib version');
  30412. }
  30413. break;
  30414. case 'date':
  30415. $info = $this->runtime->getExtensionInfo($name);
  30416. if (Preg::isMatchStrictGroups('/^timelib version => (?<version>.+)$/im', $info, $timelibMatches)) {
  30417. $this->addLibrary($name.'-timelib', $timelibMatches['version'], 'date timelib version');
  30418. }
  30419. if (Preg::isMatchStrictGroups('/^Timezone Database => (?<source>internal|external)$/im', $info, $zoneinfoSourceMatches)) {
  30420. $external = $zoneinfoSourceMatches['source'] === 'external';
  30421. if (Preg::isMatchStrictGroups('/^"Olson" Timezone Database Version => (?<version>.+?)(?:\.system)?$/im', $info, $zoneinfoMatches)) {
  30422. if ($external && in_array('timezonedb', $loadedExtensions, true)) {
  30423. $this->addLibrary('timezonedb-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date (replaced by timezonedb)', [$name.'-zoneinfo']);
  30424. } else {
  30425. $this->addLibrary($name.'-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date');
  30426. }
  30427. }
  30428. }
  30429. break;
  30430. case 'fileinfo':
  30431. $info = $this->runtime->getExtensionInfo($name);
  30432. if (Preg::isMatch('/^libmagic => (?<version>.+)$/im', $info, $magicMatches)) {
  30433. $this->addLibrary($name.'-libmagic', $magicMatches['version'], 'fileinfo libmagic version');
  30434. }
  30435. break;
  30436. case 'gd':
  30437. $this->addLibrary($name, $this->runtime->getConstant('GD_VERSION'));
  30438. $info = $this->runtime->getExtensionInfo($name);
  30439. if (Preg::isMatchStrictGroups('/^libJPEG Version => (?<version>.+?)(?: compatible)?$/im', $info, $libjpegMatches)) {
  30440. $this->addLibrary($name.'-libjpeg', Version::parseLibjpeg($libjpegMatches['version']), 'libjpeg version for gd');
  30441. }
  30442. if (Preg::isMatchStrictGroups('/^libPNG Version => (?<version>.+)$/im', $info, $libpngMatches)) {
  30443. $this->addLibrary($name.'-libpng', $libpngMatches['version'], 'libpng version for gd');
  30444. }
  30445. if (Preg::isMatchStrictGroups('/^FreeType Version => (?<version>.+)$/im', $info, $freetypeMatches)) {
  30446. $this->addLibrary($name.'-freetype', $freetypeMatches['version'], 'freetype version for gd');
  30447. }
  30448. if (Preg::isMatchStrictGroups('/^libXpm Version => (?<versionId>\d+)$/im', $info, $libxpmMatches)) {
  30449. $this->addLibrary($name.'-libxpm', Version::convertLibxpmVersionId((int) $libxpmMatches['versionId']), 'libxpm version for gd');
  30450. }
  30451. break;
  30452. case 'gmp':
  30453. $this->addLibrary($name, $this->runtime->getConstant('GMP_VERSION'));
  30454. break;
  30455. case 'iconv':
  30456. $this->addLibrary($name, $this->runtime->getConstant('ICONV_VERSION'));
  30457. break;
  30458. case 'intl':
  30459. $info = $this->runtime->getExtensionInfo($name);
  30460. $description = 'The ICU unicode and globalization support library';
  30461. if ($this->runtime->hasConstant('INTL_ICU_VERSION')) {
  30462. $this->addLibrary('icu', $this->runtime->getConstant('INTL_ICU_VERSION'), $description);
  30463. } elseif (Preg::isMatch('/^ICU version => (?<version>.+)$/im', $info, $matches)) {
  30464. $this->addLibrary('icu', $matches['version'], $description);
  30465. }
  30466. if (Preg::isMatchStrictGroups('/^ICU TZData version => (?<version>.*)$/im', $info, $zoneinfoMatches) && null !== ($version = Version::parseZoneinfoVersion($zoneinfoMatches['version']))) {
  30467. $this->addLibrary('icu-zoneinfo', $version, 'zoneinfo ("Olson") database for icu');
  30468. }
  30469. if ($this->runtime->hasClass('ResourceBundle')) {
  30470. $resourceBundle = $this->runtime->invoke(['ResourceBundle', 'create'], ['root', 'ICUDATA', false]);
  30471. if ($resourceBundle !== null) {
  30472. $this->addLibrary('icu-cldr', $resourceBundle->get('Version'), 'ICU CLDR project version');
  30473. }
  30474. }
  30475. if ($this->runtime->hasClass('IntlChar')) {
  30476. $this->addLibrary('icu-unicode', implode('.', array_slice($this->runtime->invoke(['IntlChar', 'getUnicodeVersion']), 0, 3)), 'ICU unicode version');
  30477. }
  30478. break;
  30479. case 'imagick':
  30480. $imageMagickVersion = $this->runtime->construct('Imagick')->getVersion();
  30481. Preg::match('/^ImageMagick (?<version>[\d.]+)(?:-(?<patch>\d+))?/', $imageMagickVersion['versionString'], $matches);
  30482. $version = $matches['version'];
  30483. if (isset($matches['patch'])) {
  30484. $version .= '.'.$matches['patch'];
  30485. }
  30486. $this->addLibrary($name.'-imagemagick', $version, null, ['imagick']);
  30487. break;
  30488. case 'ldap':
  30489. $info = $this->runtime->getExtensionInfo($name);
  30490. if (Preg::isMatchStrictGroups('/^Vendor Version => (?<versionId>\d+)$/im', $info, $matches) && Preg::isMatchStrictGroups('/^Vendor Name => (?<vendor>.+)$/im', $info, $vendorMatches)) {
  30491. $this->addLibrary($name.'-'.strtolower($vendorMatches['vendor']), Version::convertOpenldapVersionId((int) $matches['versionId']), $vendorMatches['vendor'].' version of ldap');
  30492. }
  30493. break;
  30494. case 'libxml':
  30495. $libxmlProvides = array_map(static function ($extension): string {
  30496. return $extension . '-libxml';
  30497. }, array_intersect($loadedExtensions, ['dom', 'simplexml', 'xml', 'xmlreader', 'xmlwriter']));
  30498. $this->addLibrary($name, $this->runtime->getConstant('LIBXML_DOTTED_VERSION'), 'libxml library version', [], $libxmlProvides);
  30499. break;
  30500. case 'mbstring':
  30501. $info = $this->runtime->getExtensionInfo($name);
  30502. if (Preg::isMatch('/^libmbfl version => (?<version>.+)$/im', $info, $libmbflMatches)) {
  30503. $this->addLibrary($name.'-libmbfl', $libmbflMatches['version'], 'mbstring libmbfl version');
  30504. }
  30505. if ($this->runtime->hasConstant('MB_ONIGURUMA_VERSION')) {
  30506. $this->addLibrary($name.'-oniguruma', $this->runtime->getConstant('MB_ONIGURUMA_VERSION'), 'mbstring oniguruma version');
  30507. } elseif (Preg::isMatch('/^(?:oniguruma|Multibyte regex \(oniguruma\)) version => (?<version>.+)$/im', $info, $onigurumaMatches)) {
  30508. $this->addLibrary($name.'-oniguruma', $onigurumaMatches['version'], 'mbstring oniguruma version');
  30509. }
  30510. break;
  30511. case 'memcached':
  30512. $info = $this->runtime->getExtensionInfo($name);
  30513. if (Preg::isMatch('/^libmemcached version => (?<version>.+)$/im', $info, $matches)) {
  30514. $this->addLibrary($name.'-libmemcached', $matches['version'], 'libmemcached version');
  30515. }
  30516. break;
  30517. case 'openssl':
  30518. if (Preg::isMatchStrictGroups('{^(?:OpenSSL|LibreSSL)?\s*(?<version>\S+)}i', $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), $matches)) {
  30519. $parsedVersion = Version::parseOpenssl($matches['version'], $isFips);
  30520. $this->addLibrary($name.($isFips ? '-fips' : ''), $parsedVersion, $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), [], $isFips ? [$name] : []);
  30521. }
  30522. break;
  30523. case 'pcre':
  30524. $this->addLibrary($name, Preg::replace('{^(\S+).*}', '$1', $this->runtime->getConstant('PCRE_VERSION')));
  30525. $info = $this->runtime->getExtensionInfo($name);
  30526. if (Preg::isMatchStrictGroups('/^PCRE Unicode Version => (?<version>.+)$/im', $info, $pcreUnicodeMatches)) {
  30527. $this->addLibrary($name.'-unicode', $pcreUnicodeMatches['version'], 'PCRE Unicode version support');
  30528. }
  30529. break;
  30530. case 'mysqlnd':
  30531. case 'pdo_mysql':
  30532. $info = $this->runtime->getExtensionInfo($name);
  30533. if (Preg::isMatchStrictGroups('/^(?:Client API version|Version) => mysqlnd (?<version>.+?) /mi', $info, $matches)) {
  30534. $this->addLibrary($name.'-mysqlnd', $matches['version'], 'mysqlnd library version for '.$name);
  30535. }
  30536. break;
  30537. case 'mongodb':
  30538. $info = $this->runtime->getExtensionInfo($name);
  30539. if (Preg::isMatchStrictGroups('/^libmongoc bundled version => (?<version>.+)$/im', $info, $libmongocMatches)) {
  30540. $this->addLibrary($name.'-libmongoc', $libmongocMatches['version'], 'libmongoc version of mongodb');
  30541. }
  30542. if (Preg::isMatchStrictGroups('/^libbson bundled version => (?<version>.+)$/im', $info, $libbsonMatches)) {
  30543. $this->addLibrary($name.'-libbson', $libbsonMatches['version'], 'libbson version of mongodb');
  30544. }
  30545. break;
  30546. case 'pgsql':
  30547. if ($this->runtime->hasConstant('PGSQL_LIBPQ_VERSION')) {
  30548. $this->addLibrary('pgsql-libpq', $this->runtime->getConstant('PGSQL_LIBPQ_VERSION'), 'libpq for pgsql');
  30549. break;
  30550. }
  30551. case 'pdo_pgsql':
  30552. $info = $this->runtime->getExtensionInfo($name);
  30553. if (Preg::isMatch('/^PostgreSQL\(libpq\) Version => (?<version>.*)$/im', $info, $matches)) {
  30554. $this->addLibrary($name.'-libpq', $matches['version'], 'libpq for '.$name);
  30555. }
  30556. break;
  30557. case 'pq':
  30558. $info = $this->runtime->getExtensionInfo($name);
  30559. if (Preg::isMatch('/^libpq => (?<compiled>.+) => (?<linked>.+)$/im', $info, $matches)) {
  30560. $this->addLibrary($name.'-libpq', $matches['linked'], 'libpq for '.$name);
  30561. }
  30562. break;
  30563. case 'rdkafka':
  30564. if ($this->runtime->hasConstant('RD_KAFKA_VERSION')) {
  30565. $libRdKafkaVersionInt = $this->runtime->getConstant('RD_KAFKA_VERSION');
  30566. $this->addLibrary($name.'-librdkafka', sprintf('%d.%d.%d', ($libRdKafkaVersionInt & 0xFF000000) >> 24, ($libRdKafkaVersionInt & 0x00FF0000) >> 16, ($libRdKafkaVersionInt & 0x0000FF00) >> 8), 'librdkafka for '.$name);
  30567. }
  30568. break;
  30569. case 'libsodium':
  30570. case 'sodium':
  30571. if ($this->runtime->hasConstant('SODIUM_LIBRARY_VERSION')) {
  30572. $this->addLibrary('libsodium', $this->runtime->getConstant('SODIUM_LIBRARY_VERSION'));
  30573. }
  30574. break;
  30575. case 'sqlite3':
  30576. case 'pdo_sqlite':
  30577. $info = $this->runtime->getExtensionInfo($name);
  30578. if (Preg::isMatch('/^SQLite Library => (?<version>.+)$/im', $info, $matches)) {
  30579. $this->addLibrary($name.'-sqlite', $matches['version']);
  30580. }
  30581. break;
  30582. case 'ssh2':
  30583. $info = $this->runtime->getExtensionInfo($name);
  30584. if (Preg::isMatch('/^libssh2 version => (?<version>.+)$/im', $info, $matches)) {
  30585. $this->addLibrary($name.'-libssh2', $matches['version']);
  30586. }
  30587. break;
  30588. case 'xsl':
  30589. $this->addLibrary('libxslt', $this->runtime->getConstant('LIBXSLT_DOTTED_VERSION'), null, ['xsl']);
  30590. $info = $this->runtime->getExtensionInfo('xsl');
  30591. if (Preg::isMatch('/^libxslt compiled against libxml Version => (?<version>.+)$/im', $info, $matches)) {
  30592. $this->addLibrary('libxslt-libxml', $matches['version'], 'libxml version libxslt is compiled against');
  30593. }
  30594. break;
  30595. case 'yaml':
  30596. $info = $this->runtime->getExtensionInfo('yaml');
  30597. if (Preg::isMatch('/^LibYAML Version => (?<version>.+)$/im', $info, $matches)) {
  30598. $this->addLibrary($name.'-libyaml', $matches['version'], 'libyaml version of yaml');
  30599. }
  30600. break;
  30601. case 'zip':
  30602. if ($this->runtime->hasConstant('LIBZIP_VERSION', 'ZipArchive')) {
  30603. $this->addLibrary($name.'-libzip', $this->runtime->getConstant('LIBZIP_VERSION', 'ZipArchive'), null, ['zip']);
  30604. }
  30605. break;
  30606. case 'zlib':
  30607. if ($this->runtime->hasConstant('ZLIB_VERSION')) {
  30608. $this->addLibrary($name, $this->runtime->getConstant('ZLIB_VERSION'));
  30609. } elseif (Preg::isMatch('/^Linked Version => (?<version>.+)$/im', $this->runtime->getExtensionInfo($name), $matches)) {
  30610. $this->addLibrary($name, $matches['version']);
  30611. }
  30612. break;
  30613. default:
  30614. break;
  30615. }
  30616. }
  30617. $hhvmVersion = $this->hhvmDetector->getVersion();
  30618. if ($hhvmVersion) {
  30619. try {
  30620. $prettyVersion = $hhvmVersion;
  30621. $version = $this->versionParser->normalize($prettyVersion);
  30622. } catch (\UnexpectedValueException $e) {
  30623. $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  30624. $version = $this->versionParser->normalize($prettyVersion);
  30625. }
  30626. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  30627. $hhvm->setDescription('The HHVM Runtime (64bit)');
  30628. $this->addPackage($hhvm);
  30629. }
  30630. }
  30631. public function addPackage(PackageInterface $package): void
  30632. {
  30633. if (!$package instanceof CompletePackage) {
  30634. throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package));
  30635. }
  30636. if (isset($this->overrides[$package->getName()])) {
  30637. if ($this->overrides[$package->getName()]['version'] === false) {
  30638. $this->addDisabledPackage($package);
  30639. return;
  30640. }
  30641. $overrider = $this->findPackage($package->getName(), '*');
  30642. if ($package->getVersion() === $overrider->getVersion()) {
  30643. $actualText = 'same as actual';
  30644. } else {
  30645. $actualText = 'actual: '.$package->getPrettyVersion();
  30646. }
  30647. if ($overrider instanceof CompletePackageInterface) {
  30648. $overrider->setDescription($overrider->getDescription().', '.$actualText);
  30649. }
  30650. return;
  30651. }
  30652. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  30653. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  30654. if ($package->getVersion() === $overrider->getVersion()) {
  30655. $actualText = 'same as actual';
  30656. } else {
  30657. $actualText = 'actual: '.$package->getPrettyVersion();
  30658. }
  30659. $overrider->setDescription($overrider->getDescription().', '.$actualText);
  30660. return;
  30661. }
  30662. parent::addPackage($package);
  30663. }
  30664. private function addOverriddenPackage(array $override, ?string $name = null): CompletePackage
  30665. {
  30666. $version = $this->versionParser->normalize($override['version']);
  30667. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  30668. $package->setDescription('Package overridden via config.platform');
  30669. $package->setExtra(['config.platform' => true]);
  30670. parent::addPackage($package);
  30671. if ($package->getName() === 'php') {
  30672. self::$lastSeenPlatformPhp = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
  30673. }
  30674. return $package;
  30675. }
  30676. private function addDisabledPackage(CompletePackage $package): void
  30677. {
  30678. $package->setDescription($package->getDescription().'. <warning>Package disabled via config.platform</warning>');
  30679. $package->setExtra(['config.platform' => true]);
  30680. $this->disabledPackages[$package->getName()] = $package;
  30681. }
  30682. private function addExtension(string $name, string $prettyVersion): void
  30683. {
  30684. $extraDescription = null;
  30685. try {
  30686. $version = $this->versionParser->normalize($prettyVersion);
  30687. } catch (\UnexpectedValueException $e) {
  30688. $extraDescription = ' (actual version: '.$prettyVersion.')';
  30689. if (Preg::isMatchStrictGroups('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  30690. $prettyVersion = $match[1];
  30691. } else {
  30692. $prettyVersion = '0';
  30693. }
  30694. $version = $this->versionParser->normalize($prettyVersion);
  30695. }
  30696. $packageName = $this->buildPackageName($name);
  30697. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  30698. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  30699. if ($name === 'uuid') {
  30700. $ext->setReplaces([
  30701. 'lib-uuid' => new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion()),
  30702. ]);
  30703. }
  30704. $this->addPackage($ext);
  30705. }
  30706. private function buildPackageName(string $name): string
  30707. {
  30708. return 'ext-' . str_replace(' ', '-', strtolower($name));
  30709. }
  30710. private function addLibrary(string $name, ?string $prettyVersion, ?string $description = null, array $replaces = [], array $provides = []): void
  30711. {
  30712. if (null === $prettyVersion) {
  30713. return;
  30714. }
  30715. try {
  30716. $version = $this->versionParser->normalize($prettyVersion);
  30717. } catch (\UnexpectedValueException $e) {
  30718. return;
  30719. }
  30720. if ($description === null) {
  30721. $description = 'The '.$name.' library';
  30722. }
  30723. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  30724. $lib->setDescription($description);
  30725. $replaceLinks = [];
  30726. foreach ($replaces as $replace) {
  30727. $replace = strtolower($replace);
  30728. $replaceLinks[$replace] = new Link('lib-'.$name, 'lib-'.$replace, new Constraint('=', $version), Link::TYPE_REPLACE, $lib->getPrettyVersion());
  30729. }
  30730. $provideLinks = [];
  30731. foreach ($provides as $provide) {
  30732. $provide = strtolower($provide);
  30733. $provideLinks[$provide] = new Link('lib-'.$name, 'lib-'.$provide, new Constraint('=', $version), Link::TYPE_PROVIDE, $lib->getPrettyVersion());
  30734. }
  30735. $lib->setReplaces($replaceLinks);
  30736. $lib->setProvides($provideLinks);
  30737. $this->addPackage($lib);
  30738. }
  30739. public static function isPlatformPackage(string $name): bool
  30740. {
  30741. static $cache = [];
  30742. if (isset($cache[$name])) {
  30743. return $cache[$name];
  30744. }
  30745. return $cache[$name] = Preg::isMatch(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name);
  30746. }
  30747. public static function getPlatformPhpVersion(): ?string
  30748. {
  30749. return self::$lastSeenPlatformPhp;
  30750. }
  30751. public function search(string $query, int $mode = 0, ?string $type = null): array
  30752. {
  30753. if ($mode === self::SEARCH_VENDOR) {
  30754. return [];
  30755. }
  30756. return parent::search($query, $mode, $type);
  30757. }
  30758. }
  30759. <?php declare(strict_types=1);
  30760. namespace Composer\Repository;
  30761. use Composer\Factory;
  30762. use Composer\IO\IOInterface;
  30763. use Composer\Config;
  30764. use Composer\EventDispatcher\EventDispatcher;
  30765. use Composer\Pcre\Preg;
  30766. use Composer\Util\HttpDownloader;
  30767. use Composer\Util\ProcessExecutor;
  30768. use Composer\Json\JsonFile;
  30769. class RepositoryFactory
  30770. {
  30771. public static function configFromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false)
  30772. {
  30773. if (0 === strpos($repository, 'http')) {
  30774. $repoConfig = ['type' => 'composer', 'url' => $repository];
  30775. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  30776. $json = new JsonFile($repository, Factory::createHttpDownloader($io, $config));
  30777. $data = $json->read();
  30778. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  30779. $repoConfig = ['type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/')];
  30780. } elseif ($allowFilesystem) {
  30781. $repoConfig = ['type' => 'filesystem', 'json' => $json];
  30782. } else {
  30783. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  30784. }
  30785. } elseif (strpos($repository, '{') === 0) {
  30786. $repoConfig = JsonFile::parseJson($repository);
  30787. } else {
  30788. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  30789. }
  30790. return $repoConfig;
  30791. }
  30792. public static function fromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false, ?RepositoryManager $rm = null): RepositoryInterface
  30793. {
  30794. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  30795. return static::createRepo($io, $config, $repoConfig, $rm);
  30796. }
  30797. public static function createRepo(IOInterface $io, Config $config, array $repoConfig, ?RepositoryManager $rm = null): RepositoryInterface
  30798. {
  30799. if (!$rm) {
  30800. @trigger_error('Not passing a repository manager when calling createRepo is deprecated since Composer 2.3.6', E_USER_DEPRECATED);
  30801. $rm = static::manager($io, $config);
  30802. }
  30803. $repos = self::createRepos($rm, [$repoConfig]);
  30804. return reset($repos);
  30805. }
  30806. public static function defaultRepos(?IOInterface $io = null, ?Config $config = null, ?RepositoryManager $rm = null): array
  30807. {
  30808. if (null === $rm) {
  30809. @trigger_error('Not passing a repository manager when calling defaultRepos is deprecated since Composer 2.3.6, use defaultReposWithDefaultManager() instead if you cannot get a manager.', E_USER_DEPRECATED);
  30810. }
  30811. if (null === $config) {
  30812. $config = Factory::createConfig($io);
  30813. }
  30814. if (null !== $io) {
  30815. $io->loadConfiguration($config);
  30816. }
  30817. if (null === $rm) {
  30818. if (null === $io) {
  30819. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  30820. }
  30821. $rm = static::manager($io, $config, Factory::createHttpDownloader($io, $config));
  30822. }
  30823. return self::createRepos($rm, $config->getRepositories());
  30824. }
  30825. public static function manager(IOInterface $io, Config $config, ?HttpDownloader $httpDownloader = null, ?EventDispatcher $eventDispatcher = null, ?ProcessExecutor $process = null): RepositoryManager
  30826. {
  30827. if ($httpDownloader === null) {
  30828. $httpDownloader = Factory::createHttpDownloader($io, $config);
  30829. }
  30830. if ($process === null) {
  30831. $process = new ProcessExecutor($io);
  30832. $process->enableAsync();
  30833. }
  30834. $rm = new RepositoryManager($io, $config, $httpDownloader, $eventDispatcher, $process);
  30835. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  30836. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  30837. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  30838. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  30839. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  30840. $rm->setRepositoryClass('bitbucket', 'Composer\Repository\VcsRepository');
  30841. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  30842. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  30843. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  30844. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  30845. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  30846. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  30847. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  30848. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  30849. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  30850. return $rm;
  30851. }
  30852. public static function defaultReposWithDefaultManager(IOInterface $io): array
  30853. {
  30854. $manager = RepositoryFactory::manager($io, $config = Factory::createConfig($io));
  30855. $io->loadConfiguration($config);
  30856. return RepositoryFactory::defaultRepos($io, $config, $manager);
  30857. }
  30858. private static function createRepos(RepositoryManager $rm, array $repoConfigs): array
  30859. {
  30860. $repos = [];
  30861. foreach ($repoConfigs as $index => $repo) {
  30862. if (is_string($repo)) {
  30863. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  30864. }
  30865. if (!is_array($repo)) {
  30866. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  30867. }
  30868. if (!isset($repo['type'])) {
  30869. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  30870. }
  30871. $name = self::generateRepositoryName($index, $repo, $repos);
  30872. if ($repo['type'] === 'filesystem') {
  30873. $repos[$name] = new FilesystemRepository($repo['json']);
  30874. } else {
  30875. $repos[$name] = $rm->createRepository($repo['type'], $repo, (string) $index);
  30876. }
  30877. }
  30878. return $repos;
  30879. }
  30880. public static function generateRepositoryName($index, array $repo, array $existingRepos): string
  30881. {
  30882. $name = is_int($index) && isset($repo['url']) ? Preg::replace('{^https?://}i', '', $repo['url']) : (string) $index;
  30883. while (isset($existingRepos[$name])) {
  30884. $name .= '2';
  30885. }
  30886. return $name;
  30887. }
  30888. }
  30889. <?php declare(strict_types=1);
  30890. namespace Composer\Repository;
  30891. use Composer\Package\PackageInterface;
  30892. use Composer\Package\BasePackage;
  30893. use Composer\Semver\Constraint\ConstraintInterface;
  30894. interface RepositoryInterface extends \Countable
  30895. {
  30896. public const SEARCH_FULLTEXT = 0;
  30897. public const SEARCH_NAME = 1;
  30898. public const SEARCH_VENDOR = 2;
  30899. public function hasPackage(PackageInterface $package);
  30900. public function findPackage(string $name, $constraint);
  30901. public function findPackages(string $name, $constraint = null);
  30902. public function getPackages();
  30903. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []);
  30904. public function search(string $query, int $mode = 0, ?string $type = null);
  30905. public function getProviders(string $packageName);
  30906. public function getRepoName();
  30907. }
  30908. <?php declare(strict_types=1);
  30909. namespace Composer\Repository;
  30910. use Composer\IO\IOInterface;
  30911. use Composer\Config;
  30912. use Composer\EventDispatcher\EventDispatcher;
  30913. use Composer\Package\PackageInterface;
  30914. use Composer\Util\HttpDownloader;
  30915. use Composer\Util\ProcessExecutor;
  30916. class RepositoryManager
  30917. {
  30918. private $localRepository;
  30919. private $repositories = [];
  30920. private $repositoryClasses = [];
  30921. private $io;
  30922. private $config;
  30923. private $httpDownloader;
  30924. private $eventDispatcher;
  30925. private $process;
  30926. public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null, ?ProcessExecutor $process = null)
  30927. {
  30928. $this->io = $io;
  30929. $this->config = $config;
  30930. $this->httpDownloader = $httpDownloader;
  30931. $this->eventDispatcher = $eventDispatcher;
  30932. $this->process = $process ?? new ProcessExecutor($io);
  30933. }
  30934. public function findPackage(string $name, $constraint): ?PackageInterface
  30935. {
  30936. foreach ($this->repositories as $repository) {
  30937. if ($package = $repository->findPackage($name, $constraint)) {
  30938. return $package;
  30939. }
  30940. }
  30941. return null;
  30942. }
  30943. public function findPackages(string $name, $constraint): array
  30944. {
  30945. $packages = [];
  30946. foreach ($this->getRepositories() as $repository) {
  30947. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  30948. }
  30949. return $packages;
  30950. }
  30951. public function addRepository(RepositoryInterface $repository): void
  30952. {
  30953. $this->repositories[] = $repository;
  30954. }
  30955. public function prependRepository(RepositoryInterface $repository): void
  30956. {
  30957. array_unshift($this->repositories, $repository);
  30958. }
  30959. public function createRepository(string $type, array $config, ?string $name = null): RepositoryInterface
  30960. {
  30961. if (!isset($this->repositoryClasses[$type])) {
  30962. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  30963. }
  30964. if (isset($config['packagist']) && false === $config['packagist']) {
  30965. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  30966. }
  30967. $class = $this->repositoryClasses[$type];
  30968. if (isset($config['only']) || isset($config['exclude']) || isset($config['canonical'])) {
  30969. $filterConfig = $config;
  30970. unset($config['only'], $config['exclude'], $config['canonical']);
  30971. }
  30972. $repository = new $class($config, $this->io, $this->config, $this->httpDownloader, $this->eventDispatcher, $this->process);
  30973. if (isset($filterConfig)) {
  30974. $repository = new FilterRepository($repository, $filterConfig);
  30975. }
  30976. return $repository;
  30977. }
  30978. public function setRepositoryClass(string $type, $class): void
  30979. {
  30980. $this->repositoryClasses[$type] = $class;
  30981. }
  30982. public function getRepositories(): array
  30983. {
  30984. return $this->repositories;
  30985. }
  30986. public function setLocalRepository(InstalledRepositoryInterface $repository): void
  30987. {
  30988. $this->localRepository = $repository;
  30989. }
  30990. public function getLocalRepository(): InstalledRepositoryInterface
  30991. {
  30992. return $this->localRepository;
  30993. }
  30994. }
  30995. <?php declare(strict_types=1);
  30996. namespace Composer\Repository;
  30997. class RepositorySecurityException extends \Exception
  30998. {
  30999. }
  31000. <?php declare(strict_types=1);
  31001. namespace Composer\Repository;
  31002. use Composer\DependencyResolver\PoolOptimizer;
  31003. use Composer\DependencyResolver\Pool;
  31004. use Composer\DependencyResolver\PoolBuilder;
  31005. use Composer\DependencyResolver\Request;
  31006. use Composer\EventDispatcher\EventDispatcher;
  31007. use Composer\Advisory\SecurityAdvisory;
  31008. use Composer\Advisory\PartialSecurityAdvisory;
  31009. use Composer\IO\IOInterface;
  31010. use Composer\IO\NullIO;
  31011. use Composer\Package\BasePackage;
  31012. use Composer\Package\AliasPackage;
  31013. use Composer\Package\CompleteAliasPackage;
  31014. use Composer\Package\CompletePackage;
  31015. use Composer\Package\PackageInterface;
  31016. use Composer\Semver\Constraint\Constraint;
  31017. use Composer\Semver\Constraint\ConstraintInterface;
  31018. use Composer\Package\Version\StabilityFilter;
  31019. use Composer\Semver\Constraint\MatchAllConstraint;
  31020. use Composer\Semver\Constraint\MultiConstraint;
  31021. class RepositorySet
  31022. {
  31023. public const ALLOW_UNACCEPTABLE_STABILITIES = 1;
  31024. public const ALLOW_SHADOWED_REPOSITORIES = 2;
  31025. private $rootAliases;
  31026. private $rootReferences;
  31027. private $repositories = [];
  31028. private $acceptableStabilities;
  31029. private $stabilityFlags;
  31030. private $rootRequires;
  31031. private $temporaryConstraints;
  31032. private $locked = false;
  31033. private $allowInstalledRepositories = false;
  31034. public function __construct(string $minimumStability = 'stable', array $stabilityFlags = [], array $rootAliases = [], array $rootReferences = [], array $rootRequires = [], array $temporaryConstraints = [])
  31035. {
  31036. $this->rootAliases = self::getRootAliasesPerPackage($rootAliases);
  31037. $this->rootReferences = $rootReferences;
  31038. $this->acceptableStabilities = [];
  31039. foreach (BasePackage::$stabilities as $stability => $value) {
  31040. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  31041. $this->acceptableStabilities[$stability] = $value;
  31042. }
  31043. }
  31044. $this->stabilityFlags = $stabilityFlags;
  31045. $this->rootRequires = $rootRequires;
  31046. foreach ($rootRequires as $name => $constraint) {
  31047. if (PlatformRepository::isPlatformPackage($name)) {
  31048. unset($this->rootRequires[$name]);
  31049. }
  31050. }
  31051. $this->temporaryConstraints = $temporaryConstraints;
  31052. }
  31053. public function allowInstalledRepositories(bool $allow = true): void
  31054. {
  31055. $this->allowInstalledRepositories = $allow;
  31056. }
  31057. public function getRootRequires(): array
  31058. {
  31059. return $this->rootRequires;
  31060. }
  31061. public function getTemporaryConstraints(): array
  31062. {
  31063. return $this->temporaryConstraints;
  31064. }
  31065. public function addRepository(RepositoryInterface $repo): void
  31066. {
  31067. if ($this->locked) {
  31068. throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore.");
  31069. }
  31070. if ($repo instanceof CompositeRepository) {
  31071. $repos = $repo->getRepositories();
  31072. } else {
  31073. $repos = [$repo];
  31074. }
  31075. foreach ($repos as $repo) {
  31076. $this->repositories[] = $repo;
  31077. }
  31078. }
  31079. public function findPackages(string $name, ?ConstraintInterface $constraint = null, int $flags = 0): array
  31080. {
  31081. $ignoreStability = ($flags & self::ALLOW_UNACCEPTABLE_STABILITIES) !== 0;
  31082. $loadFromAllRepos = ($flags & self::ALLOW_SHADOWED_REPOSITORIES) !== 0;
  31083. $packages = [];
  31084. if ($loadFromAllRepos) {
  31085. foreach ($this->repositories as $repository) {
  31086. $packages[] = $repository->findPackages($name, $constraint) ?: [];
  31087. }
  31088. } else {
  31089. foreach ($this->repositories as $repository) {
  31090. $result = $repository->loadPackages([$name => $constraint], $ignoreStability ? BasePackage::$stabilities : $this->acceptableStabilities, $ignoreStability ? [] : $this->stabilityFlags);
  31091. $packages[] = $result['packages'];
  31092. foreach ($result['namesFound'] as $nameFound) {
  31093. if ($name === $nameFound) {
  31094. break 2;
  31095. }
  31096. }
  31097. }
  31098. }
  31099. $candidates = $packages ? array_merge(...$packages) : [];
  31100. if ($ignoreStability || !$loadFromAllRepos) {
  31101. return $candidates;
  31102. }
  31103. $result = [];
  31104. foreach ($candidates as $candidate) {
  31105. if ($this->isPackageAcceptable($candidate->getNames(), $candidate->getStability())) {
  31106. $result[] = $candidate;
  31107. }
  31108. }
  31109. return $result;
  31110. }
  31111. public function getSecurityAdvisories(array $packageNames, bool $allowPartialAdvisories = false): array
  31112. {
  31113. $map = [];
  31114. foreach ($packageNames as $name) {
  31115. $map[$name] = new MatchAllConstraint();
  31116. }
  31117. return $this->getSecurityAdvisoriesForConstraints($map, $allowPartialAdvisories);
  31118. }
  31119. public function getMatchingSecurityAdvisories(array $packages, bool $allowPartialAdvisories = false): array
  31120. {
  31121. $map = [];
  31122. foreach ($packages as $package) {
  31123. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  31124. continue;
  31125. }
  31126. if (isset($map[$package->getName()])) {
  31127. $map[$package->getName()] = new MultiConstraint([new Constraint('=', $package->getVersion()), $map[$package->getName()]], false);
  31128. } else {
  31129. $map[$package->getName()] = new Constraint('=', $package->getVersion());
  31130. }
  31131. }
  31132. return $this->getSecurityAdvisoriesForConstraints($map, $allowPartialAdvisories);
  31133. }
  31134. private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array
  31135. {
  31136. $repoAdvisories = [];
  31137. foreach ($this->repositories as $repository) {
  31138. if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) {
  31139. continue;
  31140. }
  31141. $repoAdvisories[] = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories)['advisories'];
  31142. }
  31143. $advisories = array_merge_recursive([], ...$repoAdvisories);
  31144. ksort($advisories);
  31145. return $advisories;
  31146. }
  31147. public function getProviders(string $packageName): array
  31148. {
  31149. $providers = [];
  31150. foreach ($this->repositories as $repository) {
  31151. if ($repoProviders = $repository->getProviders($packageName)) {
  31152. $providers = array_merge($providers, $repoProviders);
  31153. }
  31154. }
  31155. return $providers;
  31156. }
  31157. public function isPackageAcceptable(array $names, string $stability): bool
  31158. {
  31159. return StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $names, $stability);
  31160. }
  31161. public function createPool(Request $request, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null): Pool
  31162. {
  31163. $poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $io, $eventDispatcher, $poolOptimizer, $this->temporaryConstraints);
  31164. foreach ($this->repositories as $repo) {
  31165. if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
  31166. throw new \LogicException('The pool can not accept packages from an installed repository');
  31167. }
  31168. }
  31169. $this->locked = true;
  31170. return $poolBuilder->buildPool($this->repositories, $request);
  31171. }
  31172. public function createPoolWithAllPackages(): Pool
  31173. {
  31174. foreach ($this->repositories as $repo) {
  31175. if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
  31176. throw new \LogicException('The pool can not accept packages from an installed repository');
  31177. }
  31178. }
  31179. $this->locked = true;
  31180. $packages = [];
  31181. foreach ($this->repositories as $repository) {
  31182. foreach ($repository->getPackages() as $package) {
  31183. $packages[] = $package;
  31184. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  31185. $alias = $this->rootAliases[$package->getName()][$package->getVersion()];
  31186. while ($package instanceof AliasPackage) {
  31187. $package = $package->getAliasOf();
  31188. }
  31189. if ($package instanceof CompletePackage) {
  31190. $aliasPackage = new CompleteAliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  31191. } else {
  31192. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  31193. }
  31194. $aliasPackage->setRootPackageAlias(true);
  31195. $packages[] = $aliasPackage;
  31196. }
  31197. }
  31198. }
  31199. return new Pool($packages);
  31200. }
  31201. public function createPoolForPackage(string $packageName, ?LockArrayRepository $lockedRepo = null): Pool
  31202. {
  31203. return $this->createPoolForPackages([$packageName], $lockedRepo);
  31204. }
  31205. public function createPoolForPackages(array $packageNames, ?LockArrayRepository $lockedRepo = null): Pool
  31206. {
  31207. $request = new Request($lockedRepo);
  31208. $allowedPackages = [];
  31209. foreach ($packageNames as $packageName) {
  31210. if (PlatformRepository::isPlatformPackage($packageName)) {
  31211. throw new \LogicException('createPoolForPackage(s) can not be used for platform packages, as they are never loaded by the PoolBuilder which expects them to be fixed. Use createPoolWithAllPackages or pass in a proper request with the platform packages you need fixed in it.');
  31212. }
  31213. $request->requireName($packageName);
  31214. $allowedPackages[] = strtolower($packageName);
  31215. }
  31216. if (count($allowedPackages) > 0) {
  31217. $request->restrictPackages($allowedPackages);
  31218. }
  31219. return $this->createPool($request, new NullIO());
  31220. }
  31221. private static function getRootAliasesPerPackage(array $aliases): array
  31222. {
  31223. $normalizedAliases = [];
  31224. foreach ($aliases as $alias) {
  31225. $normalizedAliases[$alias['package']][$alias['version']] = [
  31226. 'alias' => $alias['alias'],
  31227. 'alias_normalized' => $alias['alias_normalized'],
  31228. ];
  31229. }
  31230. return $normalizedAliases;
  31231. }
  31232. }
  31233. <?php declare(strict_types=1);
  31234. namespace Composer\Repository;
  31235. use Composer\Package\PackageInterface;
  31236. class RepositoryUtils
  31237. {
  31238. public static function filterRequiredPackages(array $packages, PackageInterface $requirer, array $bucket = []): array
  31239. {
  31240. $requires = $requirer->getRequires();
  31241. foreach ($packages as $candidate) {
  31242. foreach ($candidate->getNames() as $name) {
  31243. if (isset($requires[$name])) {
  31244. if (!in_array($candidate, $bucket, true)) {
  31245. $bucket[] = $candidate;
  31246. $bucket = self::filterRequiredPackages($packages, $candidate, $bucket);
  31247. }
  31248. break;
  31249. }
  31250. }
  31251. }
  31252. return $bucket;
  31253. }
  31254. public static function flattenRepositories(RepositoryInterface $repo, bool $unwrapFilterRepos = true): array
  31255. {
  31256. if ($unwrapFilterRepos && $repo instanceof FilterRepository) {
  31257. $repo = $repo->getRepository();
  31258. }
  31259. if (!$repo instanceof CompositeRepository) {
  31260. return [$repo];
  31261. }
  31262. $repos = [];
  31263. foreach ($repo->getRepositories() as $r) {
  31264. foreach (self::flattenRepositories($r, $unwrapFilterRepos) as $r2) {
  31265. $repos[] = $r2;
  31266. }
  31267. }
  31268. return $repos;
  31269. }
  31270. }
  31271. <?php declare(strict_types=1);
  31272. namespace Composer\Repository;
  31273. use Composer\Package\RootPackageInterface;
  31274. class RootPackageRepository extends ArrayRepository
  31275. {
  31276. public function __construct(RootPackageInterface $package)
  31277. {
  31278. parent::__construct([$package]);
  31279. }
  31280. public function getRepoName(): string
  31281. {
  31282. return 'root package repo';
  31283. }
  31284. }
  31285. <?php declare(strict_types=1);
  31286. namespace Composer\Repository\Vcs;
  31287. use Composer\Cache;
  31288. use Composer\Config;
  31289. use Composer\Pcre\Preg;
  31290. use Composer\Util\ProcessExecutor;
  31291. use Composer\Util\Filesystem;
  31292. use Composer\IO\IOInterface;
  31293. class FossilDriver extends VcsDriver
  31294. {
  31295. protected $tags;
  31296. protected $branches;
  31297. protected $rootIdentifier = null;
  31298. protected $repoFile = null;
  31299. protected $checkoutDir;
  31300. public function initialize(): void
  31301. {
  31302. $this->checkFossil();
  31303. $this->config->prohibitUrlByConfig($this->url, $this->io);
  31304. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  31305. $this->checkoutDir = $this->url;
  31306. } else {
  31307. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  31308. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  31309. }
  31310. $localName = Preg::replace('{[^a-z0-9]}i', '-', $this->url);
  31311. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  31312. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  31313. $this->updateLocalRepo();
  31314. }
  31315. $this->getTags();
  31316. $this->getBranches();
  31317. }
  31318. protected function checkFossil(): void
  31319. {
  31320. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  31321. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  31322. }
  31323. }
  31324. protected function updateLocalRepo(): void
  31325. {
  31326. $fs = new Filesystem();
  31327. $fs->ensureDirectoryExists($this->checkoutDir);
  31328. if (!is_writable(dirname($this->checkoutDir))) {
  31329. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  31330. }
  31331. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  31332. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  31333. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  31334. }
  31335. } else {
  31336. $fs->removeDirectory($this->checkoutDir);
  31337. $fs->remove($this->repoFile);
  31338. $fs->ensureDirectoryExists($this->checkoutDir);
  31339. if (0 !== $this->process->execute(sprintf('fossil clone -- %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  31340. $output = $this->process->getErrorOutput();
  31341. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  31342. }
  31343. if (0 !== $this->process->execute(sprintf('fossil open --nested -- %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  31344. $output = $this->process->getErrorOutput();
  31345. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  31346. }
  31347. }
  31348. }
  31349. public function getRootIdentifier(): string
  31350. {
  31351. if (null === $this->rootIdentifier) {
  31352. $this->rootIdentifier = 'trunk';
  31353. }
  31354. return $this->rootIdentifier;
  31355. }
  31356. public function getUrl(): string
  31357. {
  31358. return $this->url;
  31359. }
  31360. public function getSource(string $identifier): array
  31361. {
  31362. return ['type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier];
  31363. }
  31364. public function getDist(string $identifier): ?array
  31365. {
  31366. return null;
  31367. }
  31368. public function getFileContent(string $file, string $identifier): ?string
  31369. {
  31370. $command = sprintf('fossil cat -r %s -- %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  31371. $this->process->execute($command, $content, $this->checkoutDir);
  31372. if (!trim($content)) {
  31373. return null;
  31374. }
  31375. return $content;
  31376. }
  31377. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  31378. {
  31379. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  31380. [, $date] = explode(' ', trim($output), 3);
  31381. return new \DateTimeImmutable($date, new \DateTimeZone('UTC'));
  31382. }
  31383. public function getTags(): array
  31384. {
  31385. if (null === $this->tags) {
  31386. $tags = [];
  31387. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  31388. foreach ($this->process->splitLines($output) as $tag) {
  31389. $tags[$tag] = $tag;
  31390. }
  31391. $this->tags = $tags;
  31392. }
  31393. return $this->tags;
  31394. }
  31395. public function getBranches(): array
  31396. {
  31397. if (null === $this->branches) {
  31398. $branches = [];
  31399. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  31400. foreach ($this->process->splitLines($output) as $branch) {
  31401. $branch = trim(Preg::replace('/^\*/', '', trim($branch)));
  31402. $branches[$branch] = $branch;
  31403. }
  31404. $this->branches = $branches;
  31405. }
  31406. return $this->branches;
  31407. }
  31408. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  31409. {
  31410. if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  31411. return true;
  31412. }
  31413. if (Preg::isMatch('!/fossil/|\.fossil!', $url)) {
  31414. return true;
  31415. }
  31416. if (Filesystem::isLocalPath($url)) {
  31417. $url = Filesystem::getPlatformPath($url);
  31418. if (!is_dir($url)) {
  31419. return false;
  31420. }
  31421. $process = new ProcessExecutor($io);
  31422. if ($process->execute('fossil info', $output, $url) === 0) {
  31423. return true;
  31424. }
  31425. }
  31426. return false;
  31427. }
  31428. }
  31429. <?php declare(strict_types=1);
  31430. namespace Composer\Repository\Vcs;
  31431. use Composer\Config;
  31432. use Composer\IO\IOInterface;
  31433. use Composer\Cache;
  31434. use Composer\Downloader\TransportException;
  31435. use Composer\Json\JsonFile;
  31436. use Composer\Pcre\Preg;
  31437. use Composer\Util\Bitbucket;
  31438. use Composer\Util\Http\Response;
  31439. class GitBitbucketDriver extends VcsDriver
  31440. {
  31441. protected $owner;
  31442. protected $repository;
  31443. private $hasIssues = false;
  31444. private $rootIdentifier;
  31445. private $tags;
  31446. private $branches;
  31447. private $branchesUrl = '';
  31448. private $tagsUrl = '';
  31449. private $homeUrl = '';
  31450. private $website = '';
  31451. private $cloneHttpsUrl = '';
  31452. private $repoData;
  31453. protected $fallbackDriver = null;
  31454. private $vcsType;
  31455. public function initialize(): void
  31456. {
  31457. if (!Preg::isMatchStrictGroups('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(?:\.git|/?)?$#i', $this->url, $match)) {
  31458. throw new \InvalidArgumentException(sprintf('The Bitbucket repository URL %s is invalid. It must be the HTTPS URL of a Bitbucket repository.', $this->url));
  31459. }
  31460. $this->owner = $match[1];
  31461. $this->repository = $match[2];
  31462. $this->originUrl = 'bitbucket.org';
  31463. $this->cache = new Cache(
  31464. $this->io,
  31465. implode('/', [
  31466. $this->config->get('cache-repo-dir'),
  31467. $this->originUrl,
  31468. $this->owner,
  31469. $this->repository,
  31470. ])
  31471. );
  31472. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  31473. }
  31474. public function getUrl(): string
  31475. {
  31476. if ($this->fallbackDriver) {
  31477. return $this->fallbackDriver->getUrl();
  31478. }
  31479. return $this->cloneHttpsUrl;
  31480. }
  31481. protected function getRepoData(): bool
  31482. {
  31483. $resource = sprintf(
  31484. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  31485. $this->owner,
  31486. $this->repository,
  31487. http_build_query(
  31488. ['fields' => '-project,-owner'],
  31489. '',
  31490. '&'
  31491. )
  31492. );
  31493. $repoData = $this->fetchWithOAuthCredentials($resource, true)->decodeJson();
  31494. if ($this->fallbackDriver) {
  31495. return false;
  31496. }
  31497. $this->parseCloneUrls($repoData['links']['clone']);
  31498. $this->hasIssues = !empty($repoData['has_issues']);
  31499. $this->branchesUrl = $repoData['links']['branches']['href'];
  31500. $this->tagsUrl = $repoData['links']['tags']['href'];
  31501. $this->homeUrl = $repoData['links']['html']['href'];
  31502. $this->website = $repoData['website'];
  31503. $this->vcsType = $repoData['scm'];
  31504. $this->repoData = $repoData;
  31505. return true;
  31506. }
  31507. public function getComposerInformation(string $identifier): ?array
  31508. {
  31509. if ($this->fallbackDriver) {
  31510. return $this->fallbackDriver->getComposerInformation($identifier);
  31511. }
  31512. if (!isset($this->infoCache[$identifier])) {
  31513. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  31514. $composer = JsonFile::parseJson($res);
  31515. } else {
  31516. $composer = $this->getBaseComposerInformation($identifier);
  31517. if ($this->shouldCache($identifier)) {
  31518. $this->cache->write($identifier, json_encode($composer));
  31519. }
  31520. }
  31521. if ($composer !== null) {
  31522. if (isset($composer['support']) && !is_array($composer['support'])) {
  31523. $composer['support'] = [];
  31524. }
  31525. if (!isset($composer['support']['source'])) {
  31526. $label = array_search(
  31527. $identifier,
  31528. $this->getTags()
  31529. ) ?: array_search(
  31530. $identifier,
  31531. $this->getBranches()
  31532. ) ?: $identifier;
  31533. if (array_key_exists($label, $tags = $this->getTags())) {
  31534. $hash = $tags[$label];
  31535. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  31536. $hash = $branches[$label];
  31537. }
  31538. if (!isset($hash)) {
  31539. $composer['support']['source'] = sprintf(
  31540. 'https://%s/%s/%s/src',
  31541. $this->originUrl,
  31542. $this->owner,
  31543. $this->repository
  31544. );
  31545. } else {
  31546. $composer['support']['source'] = sprintf(
  31547. 'https://%s/%s/%s/src/%s/?at=%s',
  31548. $this->originUrl,
  31549. $this->owner,
  31550. $this->repository,
  31551. $hash,
  31552. $label
  31553. );
  31554. }
  31555. }
  31556. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  31557. $composer['support']['issues'] = sprintf(
  31558. 'https://%s/%s/%s/issues',
  31559. $this->originUrl,
  31560. $this->owner,
  31561. $this->repository
  31562. );
  31563. }
  31564. if (!isset($composer['homepage'])) {
  31565. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  31566. }
  31567. }
  31568. $this->infoCache[$identifier] = $composer;
  31569. }
  31570. return $this->infoCache[$identifier];
  31571. }
  31572. public function getFileContent(string $file, string $identifier): ?string
  31573. {
  31574. if ($this->fallbackDriver) {
  31575. return $this->fallbackDriver->getFileContent($file, $identifier);
  31576. }
  31577. if (strpos($identifier, '/') !== false) {
  31578. $branches = $this->getBranches();
  31579. if (isset($branches[$identifier])) {
  31580. $identifier = $branches[$identifier];
  31581. }
  31582. }
  31583. $resource = sprintf(
  31584. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  31585. $this->owner,
  31586. $this->repository,
  31587. $identifier,
  31588. $file
  31589. );
  31590. return $this->fetchWithOAuthCredentials($resource)->getBody();
  31591. }
  31592. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  31593. {
  31594. if ($this->fallbackDriver) {
  31595. return $this->fallbackDriver->getChangeDate($identifier);
  31596. }
  31597. if (strpos($identifier, '/') !== false) {
  31598. $branches = $this->getBranches();
  31599. if (isset($branches[$identifier])) {
  31600. $identifier = $branches[$identifier];
  31601. }
  31602. }
  31603. $resource = sprintf(
  31604. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  31605. $this->owner,
  31606. $this->repository,
  31607. $identifier
  31608. );
  31609. $commit = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  31610. return new \DateTimeImmutable($commit['date']);
  31611. }
  31612. public function getSource(string $identifier): array
  31613. {
  31614. if ($this->fallbackDriver) {
  31615. return $this->fallbackDriver->getSource($identifier);
  31616. }
  31617. return ['type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier];
  31618. }
  31619. public function getDist(string $identifier): ?array
  31620. {
  31621. if ($this->fallbackDriver) {
  31622. return $this->fallbackDriver->getDist($identifier);
  31623. }
  31624. $url = sprintf(
  31625. 'https://bitbucket.org/%s/%s/get/%s.zip',
  31626. $this->owner,
  31627. $this->repository,
  31628. $identifier
  31629. );
  31630. return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
  31631. }
  31632. public function getTags(): array
  31633. {
  31634. if ($this->fallbackDriver) {
  31635. return $this->fallbackDriver->getTags();
  31636. }
  31637. if (null === $this->tags) {
  31638. $tags = [];
  31639. $resource = sprintf(
  31640. '%s?%s',
  31641. $this->tagsUrl,
  31642. http_build_query(
  31643. [
  31644. 'pagelen' => 100,
  31645. 'fields' => 'values.name,values.target.hash,next',
  31646. 'sort' => '-target.date',
  31647. ],
  31648. '',
  31649. '&'
  31650. )
  31651. );
  31652. $hasNext = true;
  31653. while ($hasNext) {
  31654. $tagsData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  31655. foreach ($tagsData['values'] as $data) {
  31656. $tags[$data['name']] = $data['target']['hash'];
  31657. }
  31658. if (empty($tagsData['next'])) {
  31659. $hasNext = false;
  31660. } else {
  31661. $resource = $tagsData['next'];
  31662. }
  31663. }
  31664. $this->tags = $tags;
  31665. }
  31666. return $this->tags;
  31667. }
  31668. public function getBranches(): array
  31669. {
  31670. if ($this->fallbackDriver) {
  31671. return $this->fallbackDriver->getBranches();
  31672. }
  31673. if (null === $this->branches) {
  31674. $branches = [];
  31675. $resource = sprintf(
  31676. '%s?%s',
  31677. $this->branchesUrl,
  31678. http_build_query(
  31679. [
  31680. 'pagelen' => 100,
  31681. 'fields' => 'values.name,values.target.hash,values.heads,next',
  31682. 'sort' => '-target.date',
  31683. ],
  31684. '',
  31685. '&'
  31686. )
  31687. );
  31688. $hasNext = true;
  31689. while ($hasNext) {
  31690. $branchData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  31691. foreach ($branchData['values'] as $data) {
  31692. $branches[$data['name']] = $data['target']['hash'];
  31693. }
  31694. if (empty($branchData['next'])) {
  31695. $hasNext = false;
  31696. } else {
  31697. $resource = $branchData['next'];
  31698. }
  31699. }
  31700. $this->branches = $branches;
  31701. }
  31702. return $this->branches;
  31703. }
  31704. protected function fetchWithOAuthCredentials(string $url, bool $fetchingRepoData = false): Response
  31705. {
  31706. try {
  31707. return parent::getContents($url);
  31708. } catch (TransportException $e) {
  31709. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->httpDownloader);
  31710. if (in_array($e->getCode(), [403, 404], true) || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  31711. if (!$this->io->hasAuthentication($this->originUrl)
  31712. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  31713. ) {
  31714. return parent::getContents($url);
  31715. }
  31716. if (!$this->io->isInteractive() && $fetchingRepoData) {
  31717. $this->attemptCloneFallback();
  31718. return new Response(['url' => 'dummy'], 200, [], 'null');
  31719. }
  31720. }
  31721. throw $e;
  31722. }
  31723. }
  31724. protected function generateSshUrl(): string
  31725. {
  31726. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  31727. }
  31728. protected function attemptCloneFallback(): bool
  31729. {
  31730. try {
  31731. $this->setupFallbackDriver($this->generateSshUrl());
  31732. return true;
  31733. } catch (\RuntimeException $e) {
  31734. $this->fallbackDriver = null;
  31735. $this->io->writeError(
  31736. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  31737. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  31738. );
  31739. throw $e;
  31740. }
  31741. }
  31742. protected function setupFallbackDriver(string $url): void
  31743. {
  31744. $this->fallbackDriver = new GitDriver(
  31745. ['url' => $url],
  31746. $this->io,
  31747. $this->config,
  31748. $this->httpDownloader,
  31749. $this->process
  31750. );
  31751. $this->fallbackDriver->initialize();
  31752. }
  31753. protected function parseCloneUrls(array $cloneLinks): void
  31754. {
  31755. foreach ($cloneLinks as $cloneLink) {
  31756. if ($cloneLink['name'] === 'https') {
  31757. $this->cloneHttpsUrl = Preg::replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  31758. }
  31759. }
  31760. }
  31761. public function getRootIdentifier(): string
  31762. {
  31763. if ($this->fallbackDriver) {
  31764. return $this->fallbackDriver->getRootIdentifier();
  31765. }
  31766. if (null === $this->rootIdentifier) {
  31767. if (!$this->getRepoData()) {
  31768. if (!$this->fallbackDriver) {
  31769. throw new \LogicException('A fallback driver should be setup if getRepoData returns false');
  31770. }
  31771. return $this->fallbackDriver->getRootIdentifier();
  31772. }
  31773. if ($this->vcsType !== 'git') {
  31774. throw new \RuntimeException(
  31775. $this->url.' does not appear to be a git repository, use '.
  31776. $this->cloneHttpsUrl.' but remember that Bitbucket no longer supports the mercurial repositories. '.
  31777. 'https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'
  31778. );
  31779. }
  31780. $this->rootIdentifier = $this->repoData['mainbranch']['name'] ?? 'master';
  31781. }
  31782. return $this->rootIdentifier;
  31783. }
  31784. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  31785. {
  31786. if (!Preg::isMatch('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $url)) {
  31787. return false;
  31788. }
  31789. if (!extension_loaded('openssl')) {
  31790. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  31791. return false;
  31792. }
  31793. return true;
  31794. }
  31795. }
  31796. <?php declare(strict_types=1);
  31797. namespace Composer\Repository\Vcs;
  31798. use Composer\Pcre\Preg;
  31799. use Composer\Util\ProcessExecutor;
  31800. use Composer\Util\Filesystem;
  31801. use Composer\Util\Url;
  31802. use Composer\Util\Git as GitUtil;
  31803. use Composer\IO\IOInterface;
  31804. use Composer\Cache;
  31805. use Composer\Config;
  31806. class GitDriver extends VcsDriver
  31807. {
  31808. protected $tags;
  31809. protected $branches;
  31810. protected $rootIdentifier;
  31811. protected $repoDir;
  31812. public function initialize(): void
  31813. {
  31814. if (Filesystem::isLocalPath($this->url)) {
  31815. $this->url = Preg::replace('{[\\/]\.git/?$}', '', $this->url);
  31816. if (!is_dir($this->url)) {
  31817. throw new \RuntimeException('Failed to read package information from '.$this->url.' as the path does not exist');
  31818. }
  31819. $this->repoDir = $this->url;
  31820. $cacheUrl = realpath($this->url);
  31821. } else {
  31822. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  31823. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  31824. }
  31825. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . Preg::replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  31826. GitUtil::cleanEnv();
  31827. $fs = new Filesystem();
  31828. $fs->ensureDirectoryExists(dirname($this->repoDir));
  31829. if (!is_writable(dirname($this->repoDir))) {
  31830. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  31831. }
  31832. if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  31833. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  31834. }
  31835. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  31836. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  31837. if (!is_dir($this->repoDir)) {
  31838. throw new \RuntimeException('Failed to clone '.$this->url.' to read package information from it');
  31839. }
  31840. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  31841. }
  31842. $cacheUrl = $this->url;
  31843. }
  31844. $this->getTags();
  31845. $this->getBranches();
  31846. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($cacheUrl)));
  31847. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  31848. }
  31849. public function getRootIdentifier(): string
  31850. {
  31851. if (null === $this->rootIdentifier) {
  31852. $this->rootIdentifier = 'master';
  31853. $gitUtil = new GitUtil($this->io, $this->config, $this->process, new Filesystem());
  31854. if (!Filesystem::isLocalPath($this->url)) {
  31855. $defaultBranch = $gitUtil->getMirrorDefaultBranch($this->url, $this->repoDir, false);
  31856. if ($defaultBranch !== null) {
  31857. return $this->rootIdentifier = $defaultBranch;
  31858. }
  31859. }
  31860. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  31861. $branches = $this->process->splitLines($output);
  31862. if (!in_array('* master', $branches)) {
  31863. foreach ($branches as $branch) {
  31864. if ($branch && Preg::isMatchStrictGroups('{^\* +(\S+)}', $branch, $match)) {
  31865. $this->rootIdentifier = $match[1];
  31866. break;
  31867. }
  31868. }
  31869. }
  31870. }
  31871. return $this->rootIdentifier;
  31872. }
  31873. public function getUrl(): string
  31874. {
  31875. return $this->url;
  31876. }
  31877. public function getSource(string $identifier): array
  31878. {
  31879. return ['type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier];
  31880. }
  31881. public function getDist(string $identifier): ?array
  31882. {
  31883. return null;
  31884. }
  31885. public function getFileContent(string $file, string $identifier): ?string
  31886. {
  31887. if (isset($identifier[0]) && $identifier[0] === '-') {
  31888. throw new \RuntimeException('Invalid git identifier detected. Identifier must not start with a -, given: ' . $identifier);
  31889. }
  31890. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  31891. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  31892. if (!trim($content)) {
  31893. return null;
  31894. }
  31895. return $content;
  31896. }
  31897. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  31898. {
  31899. $this->process->execute(sprintf(
  31900. 'git -c log.showSignature=false log -1 --format=%%at %s',
  31901. ProcessExecutor::escape($identifier)
  31902. ), $output, $this->repoDir);
  31903. return new \DateTimeImmutable('@'.trim($output), new \DateTimeZone('UTC'));
  31904. }
  31905. public function getTags(): array
  31906. {
  31907. if (null === $this->tags) {
  31908. $this->tags = [];
  31909. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  31910. foreach ($output = $this->process->splitLines($output) as $tag) {
  31911. if ($tag && Preg::isMatch('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  31912. $this->tags[$match[2]] = (string) $match[1];
  31913. }
  31914. }
  31915. }
  31916. return $this->tags;
  31917. }
  31918. public function getBranches(): array
  31919. {
  31920. if (null === $this->branches) {
  31921. $branches = [];
  31922. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  31923. foreach ($this->process->splitLines($output) as $branch) {
  31924. if ($branch && !Preg::isMatch('{^ *[^/]+/HEAD }', $branch)) {
  31925. if (Preg::isMatchStrictGroups('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match) && $match[1][0] !== '-') {
  31926. $branches[$match[1]] = $match[2];
  31927. }
  31928. }
  31929. }
  31930. $this->branches = $branches;
  31931. }
  31932. return $this->branches;
  31933. }
  31934. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  31935. {
  31936. if (Preg::isMatch('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  31937. return true;
  31938. }
  31939. if (Filesystem::isLocalPath($url)) {
  31940. $url = Filesystem::getPlatformPath($url);
  31941. if (!is_dir($url)) {
  31942. return false;
  31943. }
  31944. $process = new ProcessExecutor($io);
  31945. if ($process->execute('git tag', $output, $url) === 0) {
  31946. return true;
  31947. }
  31948. }
  31949. if (!$deep) {
  31950. return false;
  31951. }
  31952. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  31953. GitUtil::cleanEnv();
  31954. try {
  31955. $gitUtil->runCommand(static function ($url): string {
  31956. return 'git ls-remote --heads -- ' . ProcessExecutor::escape($url);
  31957. }, $url, sys_get_temp_dir());
  31958. } catch (\RuntimeException $e) {
  31959. return false;
  31960. }
  31961. return true;
  31962. }
  31963. }
  31964. <?php declare(strict_types=1);
  31965. namespace Composer\Repository\Vcs;
  31966. use Composer\Config;
  31967. use Composer\Downloader\TransportException;
  31968. use Composer\Json\JsonFile;
  31969. use Composer\Cache;
  31970. use Composer\IO\IOInterface;
  31971. use Composer\Pcre\Preg;
  31972. use Composer\Util\GitHub;
  31973. use Composer\Util\Http\Response;
  31974. class GitHubDriver extends VcsDriver
  31975. {
  31976. protected $owner;
  31977. protected $repository;
  31978. protected $tags;
  31979. protected $branches;
  31980. protected $rootIdentifier;
  31981. protected $repoData;
  31982. protected $hasIssues = false;
  31983. protected $isPrivate = false;
  31984. private $isArchived = false;
  31985. private $fundingInfo;
  31986. protected $gitDriver = null;
  31987. public function initialize(): void
  31988. {
  31989. if (!Preg::isMatch('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $this->url, $match)) {
  31990. throw new \InvalidArgumentException(sprintf('The GitHub repository URL %s is invalid.', $this->url));
  31991. }
  31992. assert(is_string($match[3]));
  31993. assert(is_string($match[4]));
  31994. $this->owner = $match[3];
  31995. $this->repository = $match[4];
  31996. $this->originUrl = strtolower($match[1] ?? (string) $match[2]);
  31997. if ($this->originUrl === 'www.github.com') {
  31998. $this->originUrl = 'github.com';
  31999. }
  32000. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  32001. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  32002. if ($this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'])) {
  32003. $this->setupGitDriver($this->url);
  32004. return;
  32005. }
  32006. $this->fetchRootIdentifier();
  32007. }
  32008. public function getRepositoryUrl(): string
  32009. {
  32010. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  32011. }
  32012. public function getRootIdentifier(): string
  32013. {
  32014. if ($this->gitDriver) {
  32015. return $this->gitDriver->getRootIdentifier();
  32016. }
  32017. return $this->rootIdentifier;
  32018. }
  32019. public function getUrl(): string
  32020. {
  32021. if ($this->gitDriver) {
  32022. return $this->gitDriver->getUrl();
  32023. }
  32024. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  32025. }
  32026. protected function getApiUrl(): string
  32027. {
  32028. if ('github.com' === $this->originUrl) {
  32029. $apiUrl = 'api.github.com';
  32030. } else {
  32031. $apiUrl = $this->originUrl . '/api/v3';
  32032. }
  32033. return 'https://' . $apiUrl;
  32034. }
  32035. public function getSource(string $identifier): array
  32036. {
  32037. if ($this->gitDriver) {
  32038. return $this->gitDriver->getSource($identifier);
  32039. }
  32040. if ($this->isPrivate) {
  32041. $url = $this->generateSshUrl();
  32042. } else {
  32043. $url = $this->getUrl();
  32044. }
  32045. return ['type' => 'git', 'url' => $url, 'reference' => $identifier];
  32046. }
  32047. public function getDist(string $identifier): ?array
  32048. {
  32049. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  32050. return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
  32051. }
  32052. public function getComposerInformation(string $identifier): ?array
  32053. {
  32054. if ($this->gitDriver) {
  32055. return $this->gitDriver->getComposerInformation($identifier);
  32056. }
  32057. if (!isset($this->infoCache[$identifier])) {
  32058. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  32059. $composer = JsonFile::parseJson($res);
  32060. } else {
  32061. $composer = $this->getBaseComposerInformation($identifier);
  32062. if ($this->shouldCache($identifier)) {
  32063. $this->cache->write($identifier, json_encode($composer));
  32064. }
  32065. }
  32066. if ($composer !== null) {
  32067. if (isset($composer['support']) && !is_array($composer['support'])) {
  32068. $composer['support'] = [];
  32069. }
  32070. if (!isset($composer['support']['source'])) {
  32071. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  32072. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  32073. }
  32074. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  32075. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  32076. }
  32077. if (!isset($composer['abandoned']) && $this->isArchived) {
  32078. $composer['abandoned'] = true;
  32079. }
  32080. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  32081. $composer['funding'] = $funding;
  32082. }
  32083. }
  32084. $this->infoCache[$identifier] = $composer;
  32085. }
  32086. return $this->infoCache[$identifier];
  32087. }
  32088. private function getFundingInfo()
  32089. {
  32090. if (null !== $this->fundingInfo) {
  32091. return $this->fundingInfo;
  32092. }
  32093. if ($this->originUrl !== 'github.com') {
  32094. return $this->fundingInfo = false;
  32095. }
  32096. foreach ([$this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml'] as $file) {
  32097. try {
  32098. $response = $this->httpDownloader->get($file, [
  32099. 'retry-auth-failure' => false,
  32100. ])->decodeJson();
  32101. } catch (TransportException $e) {
  32102. continue;
  32103. }
  32104. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  32105. continue;
  32106. }
  32107. break;
  32108. }
  32109. if (empty($funding)) {
  32110. return $this->fundingInfo = false;
  32111. }
  32112. $result = [];
  32113. $key = null;
  32114. foreach (Preg::split('{\r?\n}', $funding) as $line) {
  32115. $line = trim($line);
  32116. if (Preg::isMatchStrictGroups('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  32117. if ($match[2] === '[') {
  32118. $key = $match[1];
  32119. continue;
  32120. }
  32121. if (Preg::isMatchStrictGroups('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
  32122. foreach (array_map('trim', Preg::split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  32123. $result[] = ['type' => $match[1], 'url' => trim($item, '"\' ')];
  32124. }
  32125. } elseif (Preg::isMatchStrictGroups('{^([^#].*?)(?:\s+#.*)?$}', $match[2], $match2)) {
  32126. $result[] = ['type' => $match[1], 'url' => trim($match2[1], '"\' ')];
  32127. }
  32128. $key = null;
  32129. } elseif (Preg::isMatchStrictGroups('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  32130. $key = $match[1];
  32131. } elseif ($key !== null && (
  32132. Preg::isMatchStrictGroups('{^-\s*(.+)(?:\s+#.*)?$}', $line, $match)
  32133. || Preg::isMatchStrictGroups('{^(.+),(?:\s*#.*)?$}', $line, $match)
  32134. )) {
  32135. $result[] = ['type' => $key, 'url' => trim($match[1], '"\' ')];
  32136. } elseif ($key !== null && $line === ']') {
  32137. $key = null;
  32138. }
  32139. }
  32140. foreach ($result as $key => $item) {
  32141. switch ($item['type']) {
  32142. case 'tidelift':
  32143. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  32144. break;
  32145. case 'github':
  32146. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  32147. break;
  32148. case 'patreon':
  32149. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  32150. break;
  32151. case 'otechie':
  32152. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  32153. break;
  32154. case 'open_collective':
  32155. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  32156. break;
  32157. case 'liberapay':
  32158. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  32159. break;
  32160. case 'ko_fi':
  32161. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  32162. break;
  32163. case 'issuehunt':
  32164. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  32165. break;
  32166. case 'community_bridge':
  32167. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  32168. break;
  32169. }
  32170. }
  32171. return $this->fundingInfo = $result;
  32172. }
  32173. public function getFileContent(string $file, string $identifier): ?string
  32174. {
  32175. if ($this->gitDriver) {
  32176. return $this->gitDriver->getFileContent($file, $identifier);
  32177. }
  32178. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  32179. $resource = $this->getContents($resource)->decodeJson();
  32180. if ((!isset($resource['content']) || $resource['content'] === '') && $resource['encoding'] === 'none' && isset($resource['git_url'])) {
  32181. $resource = $this->getContents($resource['git_url'])->decodeJson();
  32182. }
  32183. if (!isset($resource['content']) || $resource['encoding'] !== 'base64' || false === ($content = base64_decode($resource['content']))) {
  32184. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  32185. }
  32186. return $content;
  32187. }
  32188. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32189. {
  32190. if ($this->gitDriver) {
  32191. return $this->gitDriver->getChangeDate($identifier);
  32192. }
  32193. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  32194. $commit = $this->getContents($resource)->decodeJson();
  32195. return new \DateTimeImmutable($commit['commit']['committer']['date']);
  32196. }
  32197. public function getTags(): array
  32198. {
  32199. if ($this->gitDriver) {
  32200. return $this->gitDriver->getTags();
  32201. }
  32202. if (null === $this->tags) {
  32203. $tags = [];
  32204. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  32205. do {
  32206. $response = $this->getContents($resource);
  32207. $tagsData = $response->decodeJson();
  32208. foreach ($tagsData as $tag) {
  32209. $tags[$tag['name']] = $tag['commit']['sha'];
  32210. }
  32211. $resource = $this->getNextPage($response);
  32212. } while ($resource);
  32213. $this->tags = $tags;
  32214. }
  32215. return $this->tags;
  32216. }
  32217. public function getBranches(): array
  32218. {
  32219. if ($this->gitDriver) {
  32220. return $this->gitDriver->getBranches();
  32221. }
  32222. if (null === $this->branches) {
  32223. $branches = [];
  32224. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  32225. do {
  32226. $response = $this->getContents($resource);
  32227. $branchData = $response->decodeJson();
  32228. foreach ($branchData as $branch) {
  32229. $name = substr($branch['ref'], 11);
  32230. if ($name !== 'gh-pages') {
  32231. $branches[$name] = $branch['object']['sha'];
  32232. }
  32233. }
  32234. $resource = $this->getNextPage($response);
  32235. } while ($resource);
  32236. $this->branches = $branches;
  32237. }
  32238. return $this->branches;
  32239. }
  32240. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  32241. {
  32242. if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $url, $matches)) {
  32243. return false;
  32244. }
  32245. $originUrl = $matches[2] ?? (string) $matches[3];
  32246. if (!in_array(strtolower(Preg::replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  32247. return false;
  32248. }
  32249. if (!extension_loaded('openssl')) {
  32250. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  32251. return false;
  32252. }
  32253. return true;
  32254. }
  32255. public function getRepoData(): ?array
  32256. {
  32257. $this->fetchRootIdentifier();
  32258. return $this->repoData;
  32259. }
  32260. protected function generateSshUrl(): string
  32261. {
  32262. if (false !== strpos($this->originUrl, ':')) {
  32263. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  32264. }
  32265. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  32266. }
  32267. protected function getContents(string $url, bool $fetchingRepoData = false): Response
  32268. {
  32269. try {
  32270. return parent::getContents($url);
  32271. } catch (TransportException $e) {
  32272. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->httpDownloader);
  32273. switch ($e->getCode()) {
  32274. case 401:
  32275. case 404:
  32276. if (!$fetchingRepoData) {
  32277. throw $e;
  32278. }
  32279. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  32280. return parent::getContents($url);
  32281. }
  32282. if (!$this->io->isInteractive()) {
  32283. $this->attemptCloneFallback();
  32284. return new Response(['url' => 'dummy'], 200, [], 'null');
  32285. }
  32286. $scopesIssued = [];
  32287. $scopesNeeded = [];
  32288. if ($headers = $e->getHeaders()) {
  32289. if ($scopes = Response::findHeaderValue($headers, 'X-OAuth-Scopes')) {
  32290. $scopesIssued = explode(' ', $scopes);
  32291. }
  32292. if ($scopes = Response::findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  32293. $scopesNeeded = explode(' ', $scopes);
  32294. }
  32295. }
  32296. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  32297. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  32298. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  32299. }
  32300. return parent::getContents($url);
  32301. case 403:
  32302. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  32303. return parent::getContents($url);
  32304. }
  32305. if (!$this->io->isInteractive() && $fetchingRepoData) {
  32306. $this->attemptCloneFallback();
  32307. return new Response(['url' => 'dummy'], 200, [], 'null');
  32308. }
  32309. $rateLimited = $gitHubUtil->isRateLimited((array) $e->getHeaders());
  32310. if (!$this->io->hasAuthentication($this->originUrl)) {
  32311. if (!$this->io->isInteractive()) {
  32312. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  32313. throw $e;
  32314. }
  32315. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  32316. return parent::getContents($url);
  32317. }
  32318. if ($rateLimited) {
  32319. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  32320. $this->io->writeError(sprintf(
  32321. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  32322. $rateLimit['limit'],
  32323. $rateLimit['reset']
  32324. ));
  32325. }
  32326. throw $e;
  32327. default:
  32328. throw $e;
  32329. }
  32330. }
  32331. }
  32332. protected function fetchRootIdentifier(): void
  32333. {
  32334. if ($this->repoData) {
  32335. return;
  32336. }
  32337. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  32338. try {
  32339. $this->repoData = $this->getContents($repoDataUrl, true)->decodeJson();
  32340. } catch (TransportException $e) {
  32341. if ($e->getCode() === 499) {
  32342. $this->attemptCloneFallback();
  32343. } else {
  32344. throw $e;
  32345. }
  32346. }
  32347. if (null === $this->repoData && null !== $this->gitDriver) {
  32348. return;
  32349. }
  32350. $this->owner = $this->repoData['owner']['login'];
  32351. $this->repository = $this->repoData['name'];
  32352. $this->isPrivate = !empty($this->repoData['private']);
  32353. if (isset($this->repoData['default_branch'])) {
  32354. $this->rootIdentifier = $this->repoData['default_branch'];
  32355. } elseif (isset($this->repoData['master_branch'])) {
  32356. $this->rootIdentifier = $this->repoData['master_branch'];
  32357. } else {
  32358. $this->rootIdentifier = 'master';
  32359. }
  32360. $this->hasIssues = !empty($this->repoData['has_issues']);
  32361. $this->isArchived = !empty($this->repoData['archived']);
  32362. }
  32363. protected function attemptCloneFallback(): bool
  32364. {
  32365. $this->isPrivate = true;
  32366. try {
  32367. $this->setupGitDriver($this->generateSshUrl());
  32368. return true;
  32369. } catch (\RuntimeException $e) {
  32370. $this->gitDriver = null;
  32371. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  32372. throw $e;
  32373. }
  32374. }
  32375. protected function setupGitDriver(string $url): void
  32376. {
  32377. $this->gitDriver = new GitDriver(
  32378. ['url' => $url],
  32379. $this->io,
  32380. $this->config,
  32381. $this->httpDownloader,
  32382. $this->process
  32383. );
  32384. $this->gitDriver->initialize();
  32385. }
  32386. protected function getNextPage(Response $response): ?string
  32387. {
  32388. $header = $response->getHeader('link');
  32389. if (!$header) {
  32390. return null;
  32391. }
  32392. $links = explode(',', $header);
  32393. foreach ($links as $link) {
  32394. if (Preg::isMatch('{<(.+?)>; *rel="next"}', $link, $match)) {
  32395. return $match[1];
  32396. }
  32397. }
  32398. return null;
  32399. }
  32400. }
  32401. <?php declare(strict_types=1);
  32402. namespace Composer\Repository\Vcs;
  32403. use Composer\Config;
  32404. use Composer\Cache;
  32405. use Composer\IO\IOInterface;
  32406. use Composer\Json\JsonFile;
  32407. use Composer\Downloader\TransportException;
  32408. use Composer\Pcre\Preg;
  32409. use Composer\Util\HttpDownloader;
  32410. use Composer\Util\GitLab;
  32411. use Composer\Util\Http\Response;
  32412. class GitLabDriver extends VcsDriver
  32413. {
  32414. private $scheme;
  32415. private $namespace;
  32416. private $repository;
  32417. private $project = null;
  32418. private $commits = [];
  32419. private $tags;
  32420. private $branches;
  32421. protected $gitDriver = null;
  32422. protected $protocol;
  32423. private $isPrivate = true;
  32424. private $hasNonstandardOrigin = false;
  32425. public const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  32426. public function initialize(): void
  32427. {
  32428. if (!Preg::isMatch(self::URL_REGEX, $this->url, $match)) {
  32429. throw new \InvalidArgumentException(sprintf('The GitLab repository URL %s is invalid. It must be the HTTP URL of a GitLab project.', $this->url));
  32430. }
  32431. assert(is_string($match['parts']));
  32432. assert(is_string($match['repo']));
  32433. $guessedDomain = $match['domain'] ?? (string) $match['domain2'];
  32434. $configuredDomains = $this->config->get('gitlab-domains');
  32435. $urlParts = explode('/', $match['parts']);
  32436. $this->scheme = in_array($match['scheme'], ['https', 'http'], true)
  32437. ? $match['scheme']
  32438. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  32439. ;
  32440. $origin = self::determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  32441. if (false === $origin) {
  32442. throw new \LogicException('It should not be possible to create a gitlab driver with an unparseable origin URL ('.$this->url.')');
  32443. }
  32444. $this->originUrl = $origin;
  32445. if (is_string($protocol = $this->config->get('gitlab-protocol'))) {
  32446. if (!in_array($protocol, ['git', 'http', 'https'])) {
  32447. throw new \RuntimeException('gitlab-protocol must be one of git, http.');
  32448. }
  32449. $this->protocol = $protocol === 'git' ? 'ssh' : 'http';
  32450. }
  32451. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  32452. $this->hasNonstandardOrigin = true;
  32453. }
  32454. $this->namespace = implode('/', $urlParts);
  32455. $this->repository = Preg::replace('#(\.git)$#', '', $match['repo']);
  32456. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  32457. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  32458. $this->fetchProject();
  32459. }
  32460. public function setHttpDownloader(HttpDownloader $httpDownloader): void
  32461. {
  32462. $this->httpDownloader = $httpDownloader;
  32463. }
  32464. public function getComposerInformation(string $identifier): ?array
  32465. {
  32466. if ($this->gitDriver) {
  32467. return $this->gitDriver->getComposerInformation($identifier);
  32468. }
  32469. if (!isset($this->infoCache[$identifier])) {
  32470. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  32471. $composer = JsonFile::parseJson($res);
  32472. } else {
  32473. $composer = $this->getBaseComposerInformation($identifier);
  32474. if ($this->shouldCache($identifier)) {
  32475. $this->cache->write($identifier, json_encode($composer));
  32476. }
  32477. }
  32478. if (null !== $composer) {
  32479. if (isset($composer['support']) && !is_array($composer['support'])) {
  32480. $composer['support'] = [];
  32481. }
  32482. if (!isset($composer['support']['source']) && isset($this->project['web_url'])) {
  32483. $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier;
  32484. $composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label);
  32485. }
  32486. if (!isset($composer['support']['issues']) && !empty($this->project['issues_enabled']) && isset($this->project['web_url'])) {
  32487. $composer['support']['issues'] = sprintf('%s/-/issues', $this->project['web_url']);
  32488. }
  32489. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  32490. $composer['abandoned'] = true;
  32491. }
  32492. }
  32493. $this->infoCache[$identifier] = $composer;
  32494. }
  32495. return $this->infoCache[$identifier];
  32496. }
  32497. public function getFileContent(string $file, string $identifier): ?string
  32498. {
  32499. if ($this->gitDriver) {
  32500. return $this->gitDriver->getFileContent($file, $identifier);
  32501. }
  32502. if (!Preg::isMatch('{[a-f0-9]{40}}i', $identifier)) {
  32503. $branches = $this->getBranches();
  32504. if (isset($branches[$identifier])) {
  32505. $identifier = $branches[$identifier];
  32506. }
  32507. }
  32508. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  32509. try {
  32510. $content = $this->getContents($resource)->getBody();
  32511. } catch (TransportException $e) {
  32512. if ($e->getCode() !== 404) {
  32513. throw $e;
  32514. }
  32515. return null;
  32516. }
  32517. return $content;
  32518. }
  32519. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32520. {
  32521. if ($this->gitDriver) {
  32522. return $this->gitDriver->getChangeDate($identifier);
  32523. }
  32524. if (isset($this->commits[$identifier])) {
  32525. return new \DateTimeImmutable($this->commits[$identifier]['committed_date']);
  32526. }
  32527. return null;
  32528. }
  32529. public function getRepositoryUrl(): string
  32530. {
  32531. if ($this->protocol) {
  32532. return $this->project["{$this->protocol}_url_to_repo"];
  32533. }
  32534. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  32535. }
  32536. public function getUrl(): string
  32537. {
  32538. if ($this->gitDriver) {
  32539. return $this->gitDriver->getUrl();
  32540. }
  32541. return $this->project['web_url'];
  32542. }
  32543. public function getDist(string $identifier): ?array
  32544. {
  32545. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  32546. return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
  32547. }
  32548. public function getSource(string $identifier): array
  32549. {
  32550. if ($this->gitDriver) {
  32551. return $this->gitDriver->getSource($identifier);
  32552. }
  32553. return ['type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier];
  32554. }
  32555. public function getRootIdentifier(): string
  32556. {
  32557. if ($this->gitDriver) {
  32558. return $this->gitDriver->getRootIdentifier();
  32559. }
  32560. return $this->project['default_branch'];
  32561. }
  32562. public function getBranches(): array
  32563. {
  32564. if ($this->gitDriver) {
  32565. return $this->gitDriver->getBranches();
  32566. }
  32567. if (null === $this->branches) {
  32568. $this->branches = $this->getReferences('branches');
  32569. }
  32570. return $this->branches;
  32571. }
  32572. public function getTags(): array
  32573. {
  32574. if ($this->gitDriver) {
  32575. return $this->gitDriver->getTags();
  32576. }
  32577. if (null === $this->tags) {
  32578. $this->tags = $this->getReferences('tags');
  32579. }
  32580. return $this->tags;
  32581. }
  32582. public function getApiUrl(): string
  32583. {
  32584. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  32585. }
  32586. private function urlEncodeAll(string $string): string
  32587. {
  32588. $encoded = '';
  32589. for ($i = 0; isset($string[$i]); $i++) {
  32590. $character = $string[$i];
  32591. if (!ctype_alnum($character) && !in_array($character, ['-', '_'], true)) {
  32592. $character = '%' . sprintf('%02X', ord($character));
  32593. }
  32594. $encoded .= $character;
  32595. }
  32596. return $encoded;
  32597. }
  32598. protected function getReferences(string $type): array
  32599. {
  32600. $perPage = 100;
  32601. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  32602. $references = [];
  32603. do {
  32604. $response = $this->getContents($resource);
  32605. $data = $response->decodeJson();
  32606. foreach ($data as $datum) {
  32607. $references[$datum['name']] = $datum['commit']['id'];
  32608. $this->commits[$datum['commit']['id']] = $datum['commit'];
  32609. }
  32610. if (count($data) >= $perPage) {
  32611. $resource = $this->getNextPage($response);
  32612. } else {
  32613. $resource = false;
  32614. }
  32615. } while ($resource);
  32616. return $references;
  32617. }
  32618. protected function fetchProject(): void
  32619. {
  32620. if (!is_null($this->project)) {
  32621. return;
  32622. }
  32623. $resource = $this->getApiUrl();
  32624. $this->project = $this->getContents($resource, true)->decodeJson();
  32625. if (isset($this->project['visibility'])) {
  32626. $this->isPrivate = $this->project['visibility'] !== 'public';
  32627. } else {
  32628. $this->isPrivate = false;
  32629. }
  32630. }
  32631. protected function attemptCloneFallback(): bool
  32632. {
  32633. if ($this->isPrivate === false) {
  32634. $url = $this->generatePublicUrl();
  32635. } else {
  32636. $url = $this->generateSshUrl();
  32637. }
  32638. try {
  32639. $this->setupGitDriver($url);
  32640. return true;
  32641. } catch (\RuntimeException $e) {
  32642. $this->gitDriver = null;
  32643. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  32644. throw $e;
  32645. }
  32646. }
  32647. protected function generateSshUrl(): string
  32648. {
  32649. if ($this->hasNonstandardOrigin) {
  32650. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  32651. }
  32652. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  32653. }
  32654. protected function generatePublicUrl(): string
  32655. {
  32656. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  32657. }
  32658. protected function setupGitDriver(string $url): void
  32659. {
  32660. $this->gitDriver = new GitDriver(
  32661. ['url' => $url],
  32662. $this->io,
  32663. $this->config,
  32664. $this->httpDownloader,
  32665. $this->process
  32666. );
  32667. $this->gitDriver->initialize();
  32668. }
  32669. protected function getContents(string $url, bool $fetchingRepoData = false): Response
  32670. {
  32671. try {
  32672. $response = parent::getContents($url);
  32673. if ($fetchingRepoData) {
  32674. $json = $response->decodeJson();
  32675. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  32676. $this->isPrivate = $json['visibility'] !== 'public';
  32677. $moreThanGuestAccess = false;
  32678. foreach ($json['permissions'] as $permission) {
  32679. if ($permission && $permission['access_level'] > 10) {
  32680. $moreThanGuestAccess = true;
  32681. }
  32682. }
  32683. if (!$moreThanGuestAccess) {
  32684. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  32685. $this->attemptCloneFallback();
  32686. return new Response(['url' => 'dummy'], 200, [], 'null');
  32687. }
  32688. }
  32689. if (!isset($json['default_branch'])) {
  32690. if (isset($json['repository_access_level']) && $json['repository_access_level'] === 'disabled') {
  32691. throw new TransportException('The GitLab repository is disabled in the project', 400);
  32692. }
  32693. if (!empty($json['id'])) {
  32694. $this->isPrivate = false;
  32695. }
  32696. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  32697. }
  32698. }
  32699. return $response;
  32700. } catch (TransportException $e) {
  32701. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->httpDownloader);
  32702. switch ($e->getCode()) {
  32703. case 401:
  32704. case 404:
  32705. if (!$fetchingRepoData) {
  32706. throw $e;
  32707. }
  32708. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  32709. return parent::getContents($url);
  32710. }
  32711. if ($gitLabUtil->isOAuthExpired($this->originUrl) && $gitLabUtil->authorizeOAuthRefresh($this->scheme, $this->originUrl)) {
  32712. return parent::getContents($url);
  32713. }
  32714. if (!$this->io->isInteractive()) {
  32715. $this->attemptCloneFallback();
  32716. return new Response(['url' => 'dummy'], 200, [], 'null');
  32717. }
  32718. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  32719. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  32720. return parent::getContents($url);
  32721. case 403:
  32722. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  32723. return parent::getContents($url);
  32724. }
  32725. if (!$this->io->isInteractive() && $fetchingRepoData) {
  32726. $this->attemptCloneFallback();
  32727. return new Response(['url' => 'dummy'], 200, [], 'null');
  32728. }
  32729. throw $e;
  32730. default:
  32731. throw $e;
  32732. }
  32733. }
  32734. }
  32735. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  32736. {
  32737. if (!Preg::isMatch(self::URL_REGEX, $url, $match)) {
  32738. return false;
  32739. }
  32740. assert(is_string($match['parts']));
  32741. assert(is_string($match['repo']));
  32742. $scheme = $match['scheme'];
  32743. $guessedDomain = $match['domain'] ?? (string) $match['domain2'];
  32744. $urlParts = explode('/', $match['parts']);
  32745. if (false === self::determineOrigin($config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  32746. return false;
  32747. }
  32748. if ('https' === $scheme && !extension_loaded('openssl')) {
  32749. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  32750. return false;
  32751. }
  32752. return true;
  32753. }
  32754. public function getRepoData(): ?array
  32755. {
  32756. $this->fetchProject();
  32757. return $this->project;
  32758. }
  32759. protected function getNextPage(Response $response): ?string
  32760. {
  32761. $header = $response->getHeader('link');
  32762. $links = explode(',', $header);
  32763. foreach ($links as $link) {
  32764. if (Preg::isMatchStrictGroups('{<(.+?)>; *rel="next"}', $link, $match)) {
  32765. return $match[1];
  32766. }
  32767. }
  32768. return null;
  32769. }
  32770. private static function determineOrigin(array $configuredDomains, string $guessedDomain, array &$urlParts, ?string $portNumber)
  32771. {
  32772. $guessedDomain = strtolower($guessedDomain);
  32773. if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  32774. if (null !== $portNumber) {
  32775. return $guessedDomain.':'.$portNumber;
  32776. }
  32777. return $guessedDomain;
  32778. }
  32779. if (null !== $portNumber) {
  32780. $guessedDomain .= ':'.$portNumber;
  32781. }
  32782. while (null !== ($part = array_shift($urlParts))) {
  32783. $guessedDomain .= '/' . $part;
  32784. if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  32785. return $guessedDomain;
  32786. }
  32787. }
  32788. return false;
  32789. }
  32790. }
  32791. <?php declare(strict_types=1);
  32792. namespace Composer\Repository\Vcs;
  32793. use Composer\Config;
  32794. use Composer\Cache;
  32795. use Composer\Pcre\Preg;
  32796. use Composer\Util\Hg as HgUtils;
  32797. use Composer\Util\ProcessExecutor;
  32798. use Composer\Util\Filesystem;
  32799. use Composer\IO\IOInterface;
  32800. class HgDriver extends VcsDriver
  32801. {
  32802. protected $tags;
  32803. protected $branches;
  32804. protected $rootIdentifier;
  32805. protected $repoDir;
  32806. public function initialize(): void
  32807. {
  32808. if (Filesystem::isLocalPath($this->url)) {
  32809. $this->repoDir = $this->url;
  32810. } else {
  32811. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  32812. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  32813. }
  32814. $cacheDir = $this->config->get('cache-vcs-dir');
  32815. $this->repoDir = $cacheDir . '/' . Preg::replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  32816. $fs = new Filesystem();
  32817. $fs->ensureDirectoryExists($cacheDir);
  32818. if (!is_writable(dirname($this->repoDir))) {
  32819. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  32820. }
  32821. $this->config->prohibitUrlByConfig($this->url, $this->io);
  32822. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  32823. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  32824. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  32825. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  32826. }
  32827. } else {
  32828. $fs->removeDirectory($this->repoDir);
  32829. $repoDir = $this->repoDir;
  32830. $command = static function ($url) use ($repoDir): string {
  32831. return sprintf('hg clone --noupdate -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  32832. };
  32833. $hgUtils->runCommand($command, $this->url, null);
  32834. }
  32835. }
  32836. $this->getTags();
  32837. $this->getBranches();
  32838. }
  32839. public function getRootIdentifier(): string
  32840. {
  32841. if (null === $this->rootIdentifier) {
  32842. $this->process->execute('hg tip --template "{node}"', $output, $this->repoDir);
  32843. $output = $this->process->splitLines($output);
  32844. $this->rootIdentifier = $output[0];
  32845. }
  32846. return $this->rootIdentifier;
  32847. }
  32848. public function getUrl(): string
  32849. {
  32850. return $this->url;
  32851. }
  32852. public function getSource(string $identifier): array
  32853. {
  32854. return ['type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier];
  32855. }
  32856. public function getDist(string $identifier): ?array
  32857. {
  32858. return null;
  32859. }
  32860. public function getFileContent(string $file, string $identifier): ?string
  32861. {
  32862. if (isset($identifier[0]) && $identifier[0] === '-') {
  32863. throw new \RuntimeException('Invalid hg identifier detected. Identifier must not start with a -, given: ' . $identifier);
  32864. }
  32865. $resource = sprintf('hg cat -r %s -- %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  32866. $this->process->execute($resource, $content, $this->repoDir);
  32867. if (!trim($content)) {
  32868. return null;
  32869. }
  32870. return $content;
  32871. }
  32872. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32873. {
  32874. $this->process->execute(
  32875. sprintf(
  32876. 'hg log --template "{date|rfc3339date}" -r %s',
  32877. ProcessExecutor::escape($identifier)
  32878. ),
  32879. $output,
  32880. $this->repoDir
  32881. );
  32882. return new \DateTimeImmutable(trim($output), new \DateTimeZone('UTC'));
  32883. }
  32884. public function getTags(): array
  32885. {
  32886. if (null === $this->tags) {
  32887. $tags = [];
  32888. $this->process->execute('hg tags', $output, $this->repoDir);
  32889. foreach ($this->process->splitLines($output) as $tag) {
  32890. if ($tag && Preg::isMatchStrictGroups('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  32891. $tags[$match[1]] = $match[2];
  32892. }
  32893. }
  32894. unset($tags['tip']);
  32895. $this->tags = $tags;
  32896. }
  32897. return $this->tags;
  32898. }
  32899. public function getBranches(): array
  32900. {
  32901. if (null === $this->branches) {
  32902. $branches = [];
  32903. $bookmarks = [];
  32904. $this->process->execute('hg branches', $output, $this->repoDir);
  32905. foreach ($this->process->splitLines($output) as $branch) {
  32906. if ($branch && Preg::isMatchStrictGroups('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match) && $match[1][0] !== '-') {
  32907. $branches[$match[1]] = $match[2];
  32908. }
  32909. }
  32910. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  32911. foreach ($this->process->splitLines($output) as $branch) {
  32912. if ($branch && Preg::isMatchStrictGroups('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match) && $match[1][0] !== '-') {
  32913. $bookmarks[$match[1]] = $match[2];
  32914. }
  32915. }
  32916. $this->branches = array_merge($bookmarks, $branches);
  32917. }
  32918. return $this->branches;
  32919. }
  32920. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  32921. {
  32922. if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  32923. return true;
  32924. }
  32925. if (Filesystem::isLocalPath($url)) {
  32926. $url = Filesystem::getPlatformPath($url);
  32927. if (!is_dir($url)) {
  32928. return false;
  32929. }
  32930. $process = new ProcessExecutor($io);
  32931. if ($process->execute('hg summary', $output, $url) === 0) {
  32932. return true;
  32933. }
  32934. }
  32935. if (!$deep) {
  32936. return false;
  32937. }
  32938. $process = new ProcessExecutor($io);
  32939. $exit = $process->execute(sprintf('hg identify -- %s', ProcessExecutor::escape($url)), $ignored);
  32940. return $exit === 0;
  32941. }
  32942. }
  32943. <?php declare(strict_types=1);
  32944. namespace Composer\Repository\Vcs;
  32945. use Composer\Config;
  32946. use Composer\Cache;
  32947. use Composer\IO\IOInterface;
  32948. use Composer\Pcre\Preg;
  32949. use Composer\Util\ProcessExecutor;
  32950. use Composer\Util\Perforce;
  32951. use Composer\Util\Http\Response;
  32952. class PerforceDriver extends VcsDriver
  32953. {
  32954. protected $depot;
  32955. protected $branch;
  32956. protected $perforce = null;
  32957. public function initialize(): void
  32958. {
  32959. $this->depot = $this->repoConfig['depot'];
  32960. $this->branch = '';
  32961. if (!empty($this->repoConfig['branch'])) {
  32962. $this->branch = $this->repoConfig['branch'];
  32963. }
  32964. $this->initPerforce($this->repoConfig);
  32965. $this->perforce->p4Login();
  32966. $this->perforce->checkStream();
  32967. $this->perforce->writeP4ClientSpec();
  32968. $this->perforce->connectClient();
  32969. }
  32970. private function initPerforce(array $repoConfig): void
  32971. {
  32972. if (!empty($this->perforce)) {
  32973. return;
  32974. }
  32975. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  32976. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  32977. }
  32978. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  32979. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  32980. }
  32981. public function getFileContent(string $file, string $identifier): ?string
  32982. {
  32983. return $this->perforce->getFileContent($file, $identifier);
  32984. }
  32985. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32986. {
  32987. return null;
  32988. }
  32989. public function getRootIdentifier(): string
  32990. {
  32991. return $this->branch;
  32992. }
  32993. public function getBranches(): array
  32994. {
  32995. return $this->perforce->getBranches();
  32996. }
  32997. public function getTags(): array
  32998. {
  32999. return $this->perforce->getTags();
  33000. }
  33001. public function getDist(string $identifier): ?array
  33002. {
  33003. return null;
  33004. }
  33005. public function getSource(string $identifier): array
  33006. {
  33007. return [
  33008. 'type' => 'perforce',
  33009. 'url' => $this->repoConfig['url'],
  33010. 'reference' => $identifier,
  33011. 'p4user' => $this->perforce->getUser(),
  33012. ];
  33013. }
  33014. public function getUrl(): string
  33015. {
  33016. return $this->url;
  33017. }
  33018. public function hasComposerFile(string $identifier): bool
  33019. {
  33020. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  33021. return !empty($composerInfo);
  33022. }
  33023. public function getContents(string $url): Response
  33024. {
  33025. throw new \BadMethodCallException('Not implemented/used in PerforceDriver');
  33026. }
  33027. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  33028. {
  33029. if ($deep || Preg::isMatch('#\b(perforce|p4)\b#i', $url)) {
  33030. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  33031. }
  33032. return false;
  33033. }
  33034. public function cleanup(): void
  33035. {
  33036. $this->perforce->cleanupClientSpec();
  33037. $this->perforce = null;
  33038. }
  33039. public function getDepot(): string
  33040. {
  33041. return $this->depot;
  33042. }
  33043. public function getBranch(): string
  33044. {
  33045. return $this->branch;
  33046. }
  33047. }
  33048. <?php declare(strict_types=1);
  33049. namespace Composer\Repository\Vcs;
  33050. use Composer\Cache;
  33051. use Composer\Config;
  33052. use Composer\Json\JsonFile;
  33053. use Composer\Pcre\Preg;
  33054. use Composer\Util\ProcessExecutor;
  33055. use Composer\Util\Filesystem;
  33056. use Composer\Util\Url;
  33057. use Composer\Util\Svn as SvnUtil;
  33058. use Composer\IO\IOInterface;
  33059. use Composer\Downloader\TransportException;
  33060. class SvnDriver extends VcsDriver
  33061. {
  33062. protected $baseUrl;
  33063. protected $tags;
  33064. protected $branches;
  33065. protected $rootIdentifier;
  33066. protected $trunkPath = 'trunk';
  33067. protected $branchesPath = 'branches';
  33068. protected $tagsPath = 'tags';
  33069. protected $packagePath = '';
  33070. protected $cacheCredentials = true;
  33071. private $util;
  33072. public function initialize(): void
  33073. {
  33074. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  33075. SvnUtil::cleanEnv();
  33076. if (isset($this->repoConfig['trunk-path'])) {
  33077. $this->trunkPath = $this->repoConfig['trunk-path'];
  33078. }
  33079. if (isset($this->repoConfig['branches-path'])) {
  33080. $this->branchesPath = $this->repoConfig['branches-path'];
  33081. }
  33082. if (isset($this->repoConfig['tags-path'])) {
  33083. $this->tagsPath = $this->repoConfig['tags-path'];
  33084. }
  33085. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  33086. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  33087. }
  33088. if (isset($this->repoConfig['package-path'])) {
  33089. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  33090. }
  33091. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  33092. $this->baseUrl = substr($this->url, 0, $pos);
  33093. }
  33094. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->baseUrl)));
  33095. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  33096. $this->getBranches();
  33097. $this->getTags();
  33098. }
  33099. public function getRootIdentifier(): string
  33100. {
  33101. return $this->rootIdentifier ?: $this->trunkPath;
  33102. }
  33103. public function getUrl(): string
  33104. {
  33105. return $this->url;
  33106. }
  33107. public function getSource(string $identifier): array
  33108. {
  33109. return ['type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier];
  33110. }
  33111. public function getDist(string $identifier): ?array
  33112. {
  33113. return null;
  33114. }
  33115. protected function shouldCache(string $identifier): bool
  33116. {
  33117. return $this->cache && Preg::isMatch('{@\d+$}', $identifier);
  33118. }
  33119. public function getComposerInformation(string $identifier): ?array
  33120. {
  33121. if (!isset($this->infoCache[$identifier])) {
  33122. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  33123. if ($res === '""') {
  33124. $res = 'null';
  33125. $this->cache->write($identifier.'.json', json_encode(null));
  33126. }
  33127. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  33128. }
  33129. try {
  33130. $composer = $this->getBaseComposerInformation($identifier);
  33131. } catch (TransportException $e) {
  33132. $message = $e->getMessage();
  33133. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  33134. throw $e;
  33135. }
  33136. $composer = null;
  33137. }
  33138. if ($this->shouldCache($identifier)) {
  33139. $this->cache->write($identifier.'.json', json_encode($composer));
  33140. }
  33141. $this->infoCache[$identifier] = $composer;
  33142. }
  33143. if (!is_array($this->infoCache[$identifier])) {
  33144. return null;
  33145. }
  33146. return $this->infoCache[$identifier];
  33147. }
  33148. public function getFileContent(string $file, string $identifier): ?string
  33149. {
  33150. $identifier = '/' . trim($identifier, '/') . '/';
  33151. Preg::match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  33152. if (!empty($match[2])) {
  33153. $path = $match[1];
  33154. $rev = $match[2];
  33155. } else {
  33156. $path = $identifier;
  33157. $rev = '';
  33158. }
  33159. try {
  33160. $resource = $path.$file;
  33161. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  33162. if (!trim($output)) {
  33163. return null;
  33164. }
  33165. } catch (\RuntimeException $e) {
  33166. throw new TransportException($e->getMessage());
  33167. }
  33168. return $output;
  33169. }
  33170. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  33171. {
  33172. $identifier = '/' . trim($identifier, '/') . '/';
  33173. Preg::match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  33174. if (null !== $match[2] && null !== $match[1]) {
  33175. $path = $match[1];
  33176. $rev = $match[2];
  33177. } else {
  33178. $path = $identifier;
  33179. $rev = '';
  33180. }
  33181. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  33182. foreach ($this->process->splitLines($output) as $line) {
  33183. if ($line && Preg::isMatchStrictGroups('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  33184. return new \DateTimeImmutable($match[1], new \DateTimeZone('UTC'));
  33185. }
  33186. }
  33187. return null;
  33188. }
  33189. public function getTags(): array
  33190. {
  33191. if (null === $this->tags) {
  33192. $tags = [];
  33193. if ($this->tagsPath !== false) {
  33194. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  33195. if ($output) {
  33196. $lastRev = 0;
  33197. foreach ($this->process->splitLines($output) as $line) {
  33198. $line = trim($line);
  33199. if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  33200. if (isset($match[1], $match[2])) {
  33201. if ($match[2] === './') {
  33202. $lastRev = (int) $match[1];
  33203. } else {
  33204. $tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  33205. '/' . $this->tagsPath . '/' . $match[2],
  33206. max($lastRev, (int) $match[1])
  33207. );
  33208. }
  33209. }
  33210. }
  33211. }
  33212. }
  33213. }
  33214. $this->tags = $tags;
  33215. }
  33216. return $this->tags;
  33217. }
  33218. public function getBranches(): array
  33219. {
  33220. if (null === $this->branches) {
  33221. $branches = [];
  33222. if (false === $this->trunkPath) {
  33223. $trunkParent = $this->baseUrl . '/';
  33224. } else {
  33225. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  33226. }
  33227. $output = $this->execute('svn ls --verbose', $trunkParent);
  33228. if ($output) {
  33229. foreach ($this->process->splitLines($output) as $line) {
  33230. $line = trim($line);
  33231. if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  33232. if (isset($match[1], $match[2]) && $match[2] === './') {
  33233. $branches['trunk'] = $this->buildIdentifier(
  33234. '/' . $this->trunkPath,
  33235. (int) $match[1]
  33236. );
  33237. $this->rootIdentifier = $branches['trunk'];
  33238. break;
  33239. }
  33240. }
  33241. }
  33242. }
  33243. unset($output);
  33244. if ($this->branchesPath !== false) {
  33245. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  33246. if ($output) {
  33247. $lastRev = 0;
  33248. foreach ($this->process->splitLines(trim($output)) as $line) {
  33249. $line = trim($line);
  33250. if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  33251. if (isset($match[1], $match[2])) {
  33252. if ($match[2] === './') {
  33253. $lastRev = (int) $match[1];
  33254. } else {
  33255. $branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  33256. '/' . $this->branchesPath . '/' . $match[2],
  33257. max($lastRev, (int) $match[1])
  33258. );
  33259. }
  33260. }
  33261. }
  33262. }
  33263. }
  33264. }
  33265. $this->branches = $branches;
  33266. }
  33267. return $this->branches;
  33268. }
  33269. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  33270. {
  33271. $url = self::normalizeUrl($url);
  33272. if (Preg::isMatch('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  33273. return true;
  33274. }
  33275. if (!$deep && !Filesystem::isLocalPath($url)) {
  33276. return false;
  33277. }
  33278. $process = new ProcessExecutor($io);
  33279. $exit = $process->execute(
  33280. "svn info --non-interactive -- ".ProcessExecutor::escape($url),
  33281. $ignoredOutput
  33282. );
  33283. if ($exit === 0) {
  33284. return true;
  33285. }
  33286. if (false !== stripos($process->getErrorOutput(), 'authorization failed:')) {
  33287. return true;
  33288. }
  33289. if (false !== stripos($process->getErrorOutput(), 'Authentication failed')) {
  33290. return true;
  33291. }
  33292. return false;
  33293. }
  33294. protected static function normalizeUrl(string $url): string
  33295. {
  33296. $fs = new Filesystem();
  33297. if ($fs->isAbsolutePath($url)) {
  33298. return 'file://' . strtr($url, '\\', '/');
  33299. }
  33300. return $url;
  33301. }
  33302. protected function execute(string $command, string $url): string
  33303. {
  33304. if (null === $this->util) {
  33305. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  33306. $this->util->setCacheCredentials($this->cacheCredentials);
  33307. }
  33308. try {
  33309. return $this->util->execute($command, $url);
  33310. } catch (\RuntimeException $e) {
  33311. if (null === $this->util->binaryVersion()) {
  33312. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  33313. }
  33314. throw new \RuntimeException(
  33315. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  33316. );
  33317. }
  33318. }
  33319. protected function buildIdentifier(string $baseDir, int $revision): string
  33320. {
  33321. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  33322. }
  33323. }
  33324. <?php declare(strict_types=1);
  33325. namespace Composer\Repository\Vcs;
  33326. use Composer\Cache;
  33327. use Composer\Downloader\TransportException;
  33328. use Composer\Config;
  33329. use Composer\IO\IOInterface;
  33330. use Composer\Json\JsonFile;
  33331. use Composer\Pcre\Preg;
  33332. use Composer\Util\ProcessExecutor;
  33333. use Composer\Util\HttpDownloader;
  33334. use Composer\Util\Filesystem;
  33335. use Composer\Util\Http\Response;
  33336. abstract class VcsDriver implements VcsDriverInterface
  33337. {
  33338. protected $url;
  33339. protected $originUrl;
  33340. protected $repoConfig;
  33341. protected $io;
  33342. protected $config;
  33343. protected $process;
  33344. protected $httpDownloader;
  33345. protected $infoCache = [];
  33346. protected $cache;
  33347. final public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process)
  33348. {
  33349. if (Filesystem::isLocalPath($repoConfig['url'])) {
  33350. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  33351. }
  33352. $this->url = $repoConfig['url'];
  33353. $this->originUrl = $repoConfig['url'];
  33354. $this->repoConfig = $repoConfig;
  33355. $this->io = $io;
  33356. $this->config = $config;
  33357. $this->httpDownloader = $httpDownloader;
  33358. $this->process = $process;
  33359. }
  33360. protected function shouldCache(string $identifier): bool
  33361. {
  33362. return $this->cache && Preg::isMatch('{^[a-f0-9]{40}$}iD', $identifier);
  33363. }
  33364. public function getComposerInformation(string $identifier): ?array
  33365. {
  33366. if (!isset($this->infoCache[$identifier])) {
  33367. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  33368. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  33369. }
  33370. $composer = $this->getBaseComposerInformation($identifier);
  33371. if ($this->shouldCache($identifier)) {
  33372. $this->cache->write($identifier, JsonFile::encode($composer, 0));
  33373. }
  33374. $this->infoCache[$identifier] = $composer;
  33375. }
  33376. return $this->infoCache[$identifier];
  33377. }
  33378. protected function getBaseComposerInformation(string $identifier): ?array
  33379. {
  33380. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  33381. if (!$composerFileContent) {
  33382. return null;
  33383. }
  33384. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  33385. if ([] === $composer || !is_array($composer)) {
  33386. return null;
  33387. }
  33388. if (empty($composer['time']) && null !== ($changeDate = $this->getChangeDate($identifier))) {
  33389. $composer['time'] = $changeDate->format(DATE_RFC3339);
  33390. }
  33391. return $composer;
  33392. }
  33393. public function hasComposerFile(string $identifier): bool
  33394. {
  33395. try {
  33396. return null !== $this->getComposerInformation($identifier);
  33397. } catch (TransportException $e) {
  33398. }
  33399. return false;
  33400. }
  33401. protected function getScheme(): string
  33402. {
  33403. if (extension_loaded('openssl')) {
  33404. return 'https';
  33405. }
  33406. return 'http';
  33407. }
  33408. protected function getContents(string $url): Response
  33409. {
  33410. $options = $this->repoConfig['options'] ?? [];
  33411. return $this->httpDownloader->get($url, $options);
  33412. }
  33413. public function cleanup(): void
  33414. {
  33415. }
  33416. }
  33417. <?php declare(strict_types=1);
  33418. namespace Composer\Repository\Vcs;
  33419. use Composer\Config;
  33420. use Composer\IO\IOInterface;
  33421. interface VcsDriverInterface
  33422. {
  33423. public function initialize(): void;
  33424. public function getComposerInformation(string $identifier): ?array;
  33425. public function getFileContent(string $file, string $identifier): ?string;
  33426. public function getChangeDate(string $identifier): ?\DateTimeImmutable;
  33427. public function getRootIdentifier(): string;
  33428. public function getBranches(): array;
  33429. public function getTags(): array;
  33430. public function getDist(string $identifier): ?array;
  33431. public function getSource(string $identifier): array;
  33432. public function getUrl(): string;
  33433. public function hasComposerFile(string $identifier): bool;
  33434. public function cleanup(): void;
  33435. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool;
  33436. }
  33437. <?php declare(strict_types=1);
  33438. namespace Composer\Repository;
  33439. use Composer\Downloader\TransportException;
  33440. use Composer\Pcre\Preg;
  33441. use Composer\Repository\Vcs\VcsDriverInterface;
  33442. use Composer\Package\Version\VersionParser;
  33443. use Composer\Package\Loader\ArrayLoader;
  33444. use Composer\Package\Loader\ValidatingArrayLoader;
  33445. use Composer\Package\Loader\InvalidPackageException;
  33446. use Composer\Package\Loader\LoaderInterface;
  33447. use Composer\EventDispatcher\EventDispatcher;
  33448. use Composer\Util\Platform;
  33449. use Composer\Util\ProcessExecutor;
  33450. use Composer\Util\HttpDownloader;
  33451. use Composer\Util\Url;
  33452. use Composer\Semver\Constraint\Constraint;
  33453. use Composer\IO\IOInterface;
  33454. use Composer\Config;
  33455. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  33456. {
  33457. protected $url;
  33458. protected $packageName;
  33459. protected $isVerbose;
  33460. protected $isVeryVerbose;
  33461. protected $io;
  33462. protected $config;
  33463. protected $versionParser;
  33464. protected $type;
  33465. protected $loader;
  33466. protected $repoConfig;
  33467. protected $httpDownloader;
  33468. protected $processExecutor;
  33469. protected $branchErrorOccurred = false;
  33470. private $drivers;
  33471. private $driver;
  33472. private $versionCache;
  33473. private $emptyReferences = [];
  33474. private $versionTransportExceptions = [];
  33475. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $dispatcher = null, ?ProcessExecutor $process = null, ?array $drivers = null, ?VersionCacheInterface $versionCache = null)
  33476. {
  33477. parent::__construct();
  33478. $this->drivers = $drivers ?: [
  33479. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  33480. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  33481. 'bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  33482. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  33483. 'git' => 'Composer\Repository\Vcs\GitDriver',
  33484. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  33485. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  33486. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  33487. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  33488. ];
  33489. $this->url = $repoConfig['url'] = Platform::expandPath($repoConfig['url']);
  33490. $this->io = $io;
  33491. $this->type = $repoConfig['type'] ?? 'vcs';
  33492. $this->isVerbose = $io->isVerbose();
  33493. $this->isVeryVerbose = $io->isVeryVerbose();
  33494. $this->config = $config;
  33495. $this->repoConfig = $repoConfig;
  33496. $this->versionCache = $versionCache;
  33497. $this->httpDownloader = $httpDownloader;
  33498. $this->processExecutor = $process ?? new ProcessExecutor($io);
  33499. }
  33500. public function getRepoName()
  33501. {
  33502. $driverClass = get_class($this->getDriver());
  33503. $driverType = array_search($driverClass, $this->drivers);
  33504. if (!$driverType) {
  33505. $driverType = $driverClass;
  33506. }
  33507. return 'vcs repo ('.$driverType.' '.Url::sanitize($this->url).')';
  33508. }
  33509. public function getRepoConfig()
  33510. {
  33511. return $this->repoConfig;
  33512. }
  33513. public function setLoader(LoaderInterface $loader): void
  33514. {
  33515. $this->loader = $loader;
  33516. }
  33517. public function getDriver(): ?VcsDriverInterface
  33518. {
  33519. if ($this->driver) {
  33520. return $this->driver;
  33521. }
  33522. if (isset($this->drivers[$this->type])) {
  33523. $class = $this->drivers[$this->type];
  33524. $this->driver = new $class($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  33525. $this->driver->initialize();
  33526. return $this->driver;
  33527. }
  33528. foreach ($this->drivers as $driver) {
  33529. if ($driver::supports($this->io, $this->config, $this->url)) {
  33530. $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  33531. $this->driver->initialize();
  33532. return $this->driver;
  33533. }
  33534. }
  33535. foreach ($this->drivers as $driver) {
  33536. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  33537. $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  33538. $this->driver->initialize();
  33539. return $this->driver;
  33540. }
  33541. }
  33542. return null;
  33543. }
  33544. public function hadInvalidBranches(): bool
  33545. {
  33546. return $this->branchErrorOccurred;
  33547. }
  33548. public function getEmptyReferences(): array
  33549. {
  33550. return $this->emptyReferences;
  33551. }
  33552. public function getVersionTransportExceptions(): array
  33553. {
  33554. return $this->versionTransportExceptions;
  33555. }
  33556. protected function initialize()
  33557. {
  33558. parent::initialize();
  33559. $isVerbose = $this->isVerbose;
  33560. $isVeryVerbose = $this->isVeryVerbose;
  33561. $driver = $this->getDriver();
  33562. if (!$driver) {
  33563. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  33564. }
  33565. $this->versionParser = new VersionParser;
  33566. if (!$this->loader) {
  33567. $this->loader = new ArrayLoader($this->versionParser);
  33568. }
  33569. $hasRootIdentifierComposerJson = false;
  33570. try {
  33571. $hasRootIdentifierComposerJson = $driver->hasComposerFile($driver->getRootIdentifier());
  33572. if ($hasRootIdentifierComposerJson) {
  33573. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  33574. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  33575. }
  33576. } catch (\Exception $e) {
  33577. if ($e instanceof TransportException && $this->shouldRethrowTransportException($e)) {
  33578. throw $e;
  33579. }
  33580. if ($isVeryVerbose) {
  33581. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  33582. }
  33583. }
  33584. foreach ($driver->getTags() as $tag => $identifier) {
  33585. $tag = (string) $tag;
  33586. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  33587. if ($isVeryVerbose) {
  33588. $this->io->writeError($msg);
  33589. } elseif ($isVerbose) {
  33590. $this->io->overwriteError($msg, false);
  33591. }
  33592. $tag = str_replace('release-', '', $tag);
  33593. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  33594. if ($cachedPackage) {
  33595. $this->addPackage($cachedPackage);
  33596. continue;
  33597. }
  33598. if ($cachedPackage === false) {
  33599. $this->emptyReferences[] = $identifier;
  33600. continue;
  33601. }
  33602. if (!$parsedTag = $this->validateTag($tag)) {
  33603. if ($isVeryVerbose) {
  33604. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  33605. }
  33606. continue;
  33607. }
  33608. try {
  33609. $data = $driver->getComposerInformation($identifier);
  33610. if (null === $data) {
  33611. if ($isVeryVerbose) {
  33612. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  33613. }
  33614. $this->emptyReferences[] = $identifier;
  33615. continue;
  33616. }
  33617. if (isset($data['version'])) {
  33618. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  33619. } else {
  33620. $data['version'] = $tag;
  33621. $data['version_normalized'] = $parsedTag;
  33622. }
  33623. $data['version'] = Preg::replace('{[.-]?dev$}i', '', $data['version']);
  33624. $data['version_normalized'] = Preg::replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  33625. unset($data['default-branch']);
  33626. if ($data['version_normalized'] !== $parsedTag) {
  33627. if ($isVeryVerbose) {
  33628. if (Preg::isMatch('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  33629. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  33630. } else {
  33631. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  33632. }
  33633. }
  33634. continue;
  33635. }
  33636. $tagPackageName = $this->packageName ?: ($data['name'] ?? '');
  33637. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  33638. if ($isVeryVerbose) {
  33639. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  33640. }
  33641. continue;
  33642. }
  33643. if ($isVeryVerbose) {
  33644. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  33645. }
  33646. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  33647. } catch (\Exception $e) {
  33648. if ($e instanceof TransportException) {
  33649. $this->versionTransportExceptions['tags'][$tag] = $e;
  33650. if ($e->getCode() === 404) {
  33651. $this->emptyReferences[] = $identifier;
  33652. }
  33653. if ($this->shouldRethrowTransportException($e)) {
  33654. throw $e;
  33655. }
  33656. }
  33657. if ($isVeryVerbose) {
  33658. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  33659. }
  33660. continue;
  33661. }
  33662. }
  33663. if (!$isVeryVerbose) {
  33664. $this->io->overwriteError('', false);
  33665. }
  33666. $branches = $driver->getBranches();
  33667. if ($hasRootIdentifierComposerJson && isset($branches[$driver->getRootIdentifier()])) {
  33668. $branches = [$driver->getRootIdentifier() => $branches[$driver->getRootIdentifier()]] + $branches;
  33669. }
  33670. foreach ($branches as $branch => $identifier) {
  33671. $branch = (string) $branch;
  33672. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  33673. if ($isVeryVerbose) {
  33674. $this->io->writeError($msg);
  33675. } elseif ($isVerbose) {
  33676. $this->io->overwriteError($msg, false);
  33677. }
  33678. if (!$parsedBranch = $this->validateBranch($branch)) {
  33679. if ($isVeryVerbose) {
  33680. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  33681. }
  33682. continue;
  33683. }
  33684. if (strpos($parsedBranch, 'dev-') === 0 || VersionParser::DEFAULT_BRANCH_ALIAS === $parsedBranch) {
  33685. $version = 'dev-' . $branch;
  33686. } else {
  33687. $prefix = strpos($branch, 'v') === 0 ? 'v' : '';
  33688. $version = $prefix . Preg::replace('{(\.9{7})+}', '.x', $parsedBranch);
  33689. }
  33690. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose, $driver->getRootIdentifier() === $branch);
  33691. if ($cachedPackage) {
  33692. $this->addPackage($cachedPackage);
  33693. continue;
  33694. }
  33695. if ($cachedPackage === false) {
  33696. $this->emptyReferences[] = $identifier;
  33697. continue;
  33698. }
  33699. try {
  33700. $data = $driver->getComposerInformation($identifier);
  33701. if (null === $data) {
  33702. if ($isVeryVerbose) {
  33703. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  33704. }
  33705. $this->emptyReferences[] = $identifier;
  33706. continue;
  33707. }
  33708. $data['version'] = $version;
  33709. $data['version_normalized'] = $parsedBranch;
  33710. unset($data['default-branch']);
  33711. if ($driver->getRootIdentifier() === $branch) {
  33712. $data['default-branch'] = true;
  33713. }
  33714. if ($isVeryVerbose) {
  33715. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  33716. }
  33717. $packageData = $this->preProcess($driver, $data, $identifier);
  33718. $package = $this->loader->load($packageData);
  33719. if ($this->loader instanceof ValidatingArrayLoader && \count($this->loader->getWarnings()) > 0) {
  33720. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  33721. }
  33722. $this->addPackage($package);
  33723. } catch (TransportException $e) {
  33724. $this->versionTransportExceptions['branches'][$branch] = $e;
  33725. if ($e->getCode() === 404) {
  33726. $this->emptyReferences[] = $identifier;
  33727. }
  33728. if ($this->shouldRethrowTransportException($e)) {
  33729. throw $e;
  33730. }
  33731. if ($isVeryVerbose) {
  33732. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  33733. }
  33734. continue;
  33735. } catch (\Exception $e) {
  33736. if (!$isVeryVerbose) {
  33737. $this->io->writeError('');
  33738. }
  33739. $this->branchErrorOccurred = true;
  33740. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  33741. $this->io->writeError('');
  33742. continue;
  33743. }
  33744. }
  33745. $driver->cleanup();
  33746. if (!$isVeryVerbose) {
  33747. $this->io->overwriteError('', false);
  33748. }
  33749. if (!$this->getPackages()) {
  33750. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  33751. }
  33752. }
  33753. protected function preProcess(VcsDriverInterface $driver, array $data, string $identifier): array
  33754. {
  33755. $dataPackageName = $data['name'] ?? null;
  33756. $data['name'] = $this->packageName ?: $dataPackageName;
  33757. if (!isset($data['dist'])) {
  33758. $data['dist'] = $driver->getDist($identifier);
  33759. }
  33760. if (!isset($data['source'])) {
  33761. $data['source'] = $driver->getSource($identifier);
  33762. }
  33763. return $data;
  33764. }
  33765. private function validateBranch(string $branch)
  33766. {
  33767. try {
  33768. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  33769. $this->versionParser->parseConstraints($normalizedBranch);
  33770. return $normalizedBranch;
  33771. } catch (\Exception $e) {
  33772. }
  33773. return false;
  33774. }
  33775. private function validateTag(string $version)
  33776. {
  33777. try {
  33778. return $this->versionParser->normalize($version);
  33779. } catch (\Exception $e) {
  33780. }
  33781. return false;
  33782. }
  33783. private function getCachedPackageVersion(string $version, string $identifier, bool $isVerbose, bool $isVeryVerbose, bool $isDefaultBranch = false)
  33784. {
  33785. if (!$this->versionCache) {
  33786. return null;
  33787. }
  33788. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  33789. if ($cachedPackage === false) {
  33790. if ($isVeryVerbose) {
  33791. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  33792. }
  33793. return false;
  33794. }
  33795. if ($cachedPackage) {
  33796. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  33797. if ($isVeryVerbose) {
  33798. $this->io->writeError($msg);
  33799. } elseif ($isVerbose) {
  33800. $this->io->overwriteError($msg, false);
  33801. }
  33802. unset($cachedPackage['default-branch']);
  33803. if ($isDefaultBranch) {
  33804. $cachedPackage['default-branch'] = true;
  33805. }
  33806. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  33807. if ($isVeryVerbose) {
  33808. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  33809. }
  33810. $cachedPackage = null;
  33811. }
  33812. }
  33813. if ($cachedPackage) {
  33814. return $this->loader->load($cachedPackage);
  33815. }
  33816. return null;
  33817. }
  33818. private function shouldRethrowTransportException(TransportException $e): bool
  33819. {
  33820. return in_array($e->getCode(), [401, 403, 429], true) || $e->getCode() >= 500;
  33821. }
  33822. }
  33823. <?php declare(strict_types=1);
  33824. namespace Composer\Repository;
  33825. interface VersionCacheInterface
  33826. {
  33827. public function getVersionPackage(string $version, string $identifier);
  33828. }
  33829. <?php declare(strict_types=1);
  33830. namespace Composer\Repository;
  33831. use Composer\Installer\InstallationManager;
  33832. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  33833. {
  33834. use CanonicalPackagesTrait;
  33835. protected $devPackageNames = [];
  33836. private $devMode = null;
  33837. public function getDevMode()
  33838. {
  33839. return $this->devMode;
  33840. }
  33841. public function setDevPackageNames(array $devPackageNames)
  33842. {
  33843. $this->devPackageNames = $devPackageNames;
  33844. }
  33845. public function getDevPackageNames()
  33846. {
  33847. return $this->devPackageNames;
  33848. }
  33849. public function write(bool $devMode, InstallationManager $installationManager)
  33850. {
  33851. $this->devMode = $devMode;
  33852. }
  33853. public function reload()
  33854. {
  33855. $this->devMode = null;
  33856. }
  33857. }
  33858. <?php declare(strict_types=1);
  33859. namespace Composer\Repository;
  33860. use Composer\Package\PackageInterface;
  33861. use Composer\Installer\InstallationManager;
  33862. interface WritableRepositoryInterface extends RepositoryInterface
  33863. {
  33864. public function write(bool $devMode, InstallationManager $installationManager);
  33865. public function addPackage(PackageInterface $package);
  33866. public function removePackage(PackageInterface $package);
  33867. public function getCanonicalPackages();
  33868. public function reload();
  33869. public function setDevPackageNames(array $devPackageNames);
  33870. public function getDevPackageNames();
  33871. }
  33872. <?php declare(strict_types=1);
  33873. namespace Composer\Script;
  33874. use Composer\Composer;
  33875. use Composer\IO\IOInterface;
  33876. use Composer\EventDispatcher\Event as BaseEvent;
  33877. class Event extends BaseEvent
  33878. {
  33879. private $composer;
  33880. private $io;
  33881. private $devMode;
  33882. private $originatingEvent;
  33883. public function __construct(string $name, Composer $composer, IOInterface $io, bool $devMode = false, array $args = [], array $flags = [])
  33884. {
  33885. parent::__construct($name, $args, $flags);
  33886. $this->composer = $composer;
  33887. $this->io = $io;
  33888. $this->devMode = $devMode;
  33889. }
  33890. public function getComposer(): Composer
  33891. {
  33892. return $this->composer;
  33893. }
  33894. public function getIO(): IOInterface
  33895. {
  33896. return $this->io;
  33897. }
  33898. public function isDevMode(): bool
  33899. {
  33900. return $this->devMode;
  33901. }
  33902. public function getOriginatingEvent(): ?BaseEvent
  33903. {
  33904. return $this->originatingEvent;
  33905. }
  33906. public function setOriginatingEvent(BaseEvent $event): self
  33907. {
  33908. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  33909. return $this;
  33910. }
  33911. private function calculateOriginatingEvent(BaseEvent $event): BaseEvent
  33912. {
  33913. if ($event instanceof Event && $event->getOriginatingEvent()) {
  33914. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  33915. }
  33916. return $event;
  33917. }
  33918. }
  33919. <?php declare(strict_types=1);
  33920. namespace Composer\Script;
  33921. class ScriptEvents
  33922. {
  33923. public const PRE_INSTALL_CMD = 'pre-install-cmd';
  33924. public const POST_INSTALL_CMD = 'post-install-cmd';
  33925. public const PRE_UPDATE_CMD = 'pre-update-cmd';
  33926. public const POST_UPDATE_CMD = 'post-update-cmd';
  33927. public const PRE_STATUS_CMD = 'pre-status-cmd';
  33928. public const POST_STATUS_CMD = 'post-status-cmd';
  33929. public const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  33930. public const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  33931. public const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  33932. public const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  33933. public const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  33934. public const POST_ARCHIVE_CMD = 'post-archive-cmd';
  33935. }
  33936. <?php declare(strict_types=1);
  33937. namespace Composer\SelfUpdate;
  33938. use Composer\Pcre\Preg;
  33939. class Keys
  33940. {
  33941. public static function fingerprint(string $path): string
  33942. {
  33943. $hash = strtoupper(hash('sha256', Preg::replace('{\s}', '', file_get_contents($path))));
  33944. return implode(' ', [
  33945. substr($hash, 0, 8),
  33946. substr($hash, 8, 8),
  33947. substr($hash, 16, 8),
  33948. substr($hash, 24, 8),
  33949. '',
  33950. substr($hash, 32, 8),
  33951. substr($hash, 40, 8),
  33952. substr($hash, 48, 8),
  33953. substr($hash, 56, 8),
  33954. ]);
  33955. }
  33956. }
  33957. <?php declare(strict_types=1);
  33958. namespace Composer\SelfUpdate;
  33959. use Composer\IO\IOInterface;
  33960. use Composer\Pcre\Preg;
  33961. use Composer\Util\HttpDownloader;
  33962. use Composer\Config;
  33963. class Versions
  33964. {
  33965. public static $channels = self::CHANNELS;
  33966. public const CHANNELS = ['stable', 'preview', 'snapshot', '1', '2', '2.2'];
  33967. private $httpDownloader;
  33968. private $config;
  33969. private $channel;
  33970. private $versionsData = null;
  33971. public function __construct(Config $config, HttpDownloader $httpDownloader)
  33972. {
  33973. $this->httpDownloader = $httpDownloader;
  33974. $this->config = $config;
  33975. }
  33976. public function getChannel(): string
  33977. {
  33978. if ($this->channel) {
  33979. return $this->channel;
  33980. }
  33981. $channelFile = $this->config->get('home').'/update-channel';
  33982. if (file_exists($channelFile)) {
  33983. $channel = trim(file_get_contents($channelFile));
  33984. if (in_array($channel, ['stable', 'preview', 'snapshot', '2.2'], true)) {
  33985. return $this->channel = $channel;
  33986. }
  33987. }
  33988. return $this->channel = 'stable';
  33989. }
  33990. public function setChannel(string $channel, ?IOInterface $io = null): void
  33991. {
  33992. if (!in_array($channel, self::CHANNELS, true)) {
  33993. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::CHANNELS));
  33994. }
  33995. $channelFile = $this->config->get('home').'/update-channel';
  33996. $this->channel = $channel;
  33997. $storedChannel = Preg::isMatch('{^\d+$}D', $channel) ? 'stable' : $channel;
  33998. $previouslyStored = file_exists($channelFile) ? trim((string) file_get_contents($channelFile)) : null;
  33999. file_put_contents($channelFile, $storedChannel.PHP_EOL);
  34000. if ($io !== null && $previouslyStored !== $storedChannel) {
  34001. $io->writeError('Storing "<info>'.$storedChannel.'</info>" as default update channel for the next self-update run.');
  34002. }
  34003. }
  34004. public function getLatest(?string $channel = null): array
  34005. {
  34006. $versions = $this->getVersionsData();
  34007. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  34008. if ($version['min-php'] <= PHP_VERSION_ID) {
  34009. return $version;
  34010. }
  34011. }
  34012. throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  34013. }
  34014. private function getVersionsData(): array
  34015. {
  34016. if (null === $this->versionsData) {
  34017. if ($this->config->get('disable-tls') === true) {
  34018. $protocol = 'http';
  34019. } else {
  34020. $protocol = 'https';
  34021. }
  34022. $this->versionsData = $this->httpDownloader->get($protocol . '://getcomposer.org/versions')->decodeJson();
  34023. }
  34024. return $this->versionsData;
  34025. }
  34026. }
  34027. <?php declare(strict_types=1);
  34028. namespace Composer\Util;
  34029. use Composer\Config;
  34030. use Composer\IO\IOInterface;
  34031. use Composer\Downloader\TransportException;
  34032. use Composer\Pcre\Preg;
  34033. class AuthHelper
  34034. {
  34035. protected $io;
  34036. protected $config;
  34037. private $displayedOriginAuthentications = [];
  34038. private $bitbucketRetry = [];
  34039. public function __construct(IOInterface $io, Config $config)
  34040. {
  34041. $this->io = $io;
  34042. $this->config = $config;
  34043. }
  34044. public function storeAuth(string $origin, $storeAuth): void
  34045. {
  34046. $store = false;
  34047. $configSource = $this->config->getAuthConfigSource();
  34048. if ($storeAuth === true) {
  34049. $store = $configSource;
  34050. } elseif ($storeAuth === 'prompt') {
  34051. $answer = $this->io->askAndValidate(
  34052. 'Do you want to store credentials for '.$origin.' in '.$configSource->getName().' ? [Yn] ',
  34053. static function ($value): string {
  34054. $input = strtolower(substr(trim($value), 0, 1));
  34055. if (in_array($input, ['y','n'])) {
  34056. return $input;
  34057. }
  34058. throw new \RuntimeException('Please answer (y)es or (n)o');
  34059. },
  34060. null,
  34061. 'y'
  34062. );
  34063. if ($answer === 'y') {
  34064. $store = $configSource;
  34065. }
  34066. }
  34067. if ($store) {
  34068. $store->addConfigSetting(
  34069. 'http-basic.'.$origin,
  34070. $this->io->getAuthentication($origin)
  34071. );
  34072. }
  34073. }
  34074. public function promptAuthIfNeeded(string $url, string $origin, int $statusCode, ?string $reason = null, array $headers = [], int $retryCount = 0): array
  34075. {
  34076. $storeAuth = false;
  34077. if (in_array($origin, $this->config->get('github-domains'), true)) {
  34078. $gitHubUtil = new GitHub($this->io, $this->config, null);
  34079. $message = "\n";
  34080. $rateLimited = $gitHubUtil->isRateLimited($headers);
  34081. $requiresSso = $gitHubUtil->requiresSso($headers);
  34082. if ($requiresSso) {
  34083. $ssoUrl = $gitHubUtil->getSsoUrl($headers);
  34084. $message = 'GitHub API token requires SSO authorization. Authorize this token at ' . $ssoUrl . "\n";
  34085. $this->io->writeError($message);
  34086. if (!$this->io->isInteractive()) {
  34087. throw new TransportException('Could not authenticate against ' . $origin, 403);
  34088. }
  34089. $this->io->ask('After authorizing your token, confirm that you would like to retry the request');
  34090. return ['retry' => true, 'storeAuth' => $storeAuth];
  34091. }
  34092. if ($rateLimited) {
  34093. $rateLimit = $gitHubUtil->getRateLimit($headers);
  34094. if ($this->io->hasAuthentication($origin)) {
  34095. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  34096. } else {
  34097. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  34098. }
  34099. $message = sprintf(
  34100. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$url.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  34101. $rateLimit['limit'],
  34102. $rateLimit['reset']
  34103. )."\n";
  34104. } else {
  34105. $message .= 'Could not fetch '.$url.', please ';
  34106. if ($this->io->hasAuthentication($origin)) {
  34107. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  34108. } else {
  34109. $message .= 'create a GitHub OAuth token to access private repos';
  34110. }
  34111. }
  34112. if (!$gitHubUtil->authorizeOAuth($origin)
  34113. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($origin, $message))
  34114. ) {
  34115. throw new TransportException('Could not authenticate against '.$origin, 401);
  34116. }
  34117. } elseif (in_array($origin, $this->config->get('gitlab-domains'), true)) {
  34118. $message = "\n".'Could not fetch '.$url.', enter your ' . $origin . ' credentials ' .($statusCode === 401 ? 'to access private repos' : 'to go over the API rate limit');
  34119. $gitLabUtil = new GitLab($this->io, $this->config, null);
  34120. $auth = null;
  34121. if ($this->io->hasAuthentication($origin)) {
  34122. $auth = $this->io->getAuthentication($origin);
  34123. if (in_array($auth['password'], ['gitlab-ci-token', 'private-token', 'oauth2'], true)) {
  34124. throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
  34125. }
  34126. }
  34127. if (!$gitLabUtil->authorizeOAuth($origin)
  34128. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively(parse_url($url, PHP_URL_SCHEME), $origin, $message))
  34129. ) {
  34130. throw new TransportException('Could not authenticate against '.$origin, 401);
  34131. }
  34132. if ($auth !== null && $this->io->hasAuthentication($origin)) {
  34133. if ($auth === $this->io->getAuthentication($origin)) {
  34134. throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
  34135. }
  34136. }
  34137. } elseif ($origin === 'bitbucket.org' || $origin === 'api.bitbucket.org') {
  34138. $askForOAuthToken = true;
  34139. $origin = 'bitbucket.org';
  34140. if ($this->io->hasAuthentication($origin)) {
  34141. $auth = $this->io->getAuthentication($origin);
  34142. if ($auth['username'] !== 'x-token-auth') {
  34143. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  34144. $accessToken = $bitbucketUtil->requestToken($origin, $auth['username'], $auth['password']);
  34145. if (!empty($accessToken)) {
  34146. $this->io->setAuthentication($origin, 'x-token-auth', $accessToken);
  34147. $askForOAuthToken = false;
  34148. }
  34149. } elseif (!isset($this->bitbucketRetry[$url])) {
  34150. $askForOAuthToken = false;
  34151. $this->bitbucketRetry[$url] = true;
  34152. } else {
  34153. throw new TransportException('Could not authenticate against ' . $origin, 401);
  34154. }
  34155. }
  34156. if ($askForOAuthToken) {
  34157. $message = "\n".'Could not fetch ' . $url . ', please create a bitbucket OAuth token to ' . (($statusCode === 401 || $statusCode === 403) ? 'access private repos' : 'go over the API rate limit');
  34158. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  34159. if (!$bitBucketUtil->authorizeOAuth($origin)
  34160. && (!$this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($origin, $message))
  34161. ) {
  34162. throw new TransportException('Could not authenticate against ' . $origin, 401);
  34163. }
  34164. }
  34165. } else {
  34166. if ($statusCode === 404) {
  34167. return ['retry' => false, 'storeAuth' => false];
  34168. }
  34169. if (!$this->io->isInteractive()) {
  34170. if ($statusCode === 401) {
  34171. $message = "The '" . $url . "' URL required authentication (HTTP 401).\nYou must be using the interactive console to authenticate";
  34172. } elseif ($statusCode === 403) {
  34173. $message = "The '" . $url . "' URL could not be accessed (HTTP 403): " . $reason;
  34174. } else {
  34175. $message = "Unknown error code '" . $statusCode . "', reason: " . $reason;
  34176. }
  34177. throw new TransportException($message, $statusCode);
  34178. }
  34179. if ($this->io->hasAuthentication($origin)) {
  34180. if ($retryCount === 0) {
  34181. return ['retry' => true, 'storeAuth' => false];
  34182. }
  34183. throw new TransportException("Invalid credentials (HTTP $statusCode) for '$url', aborting.", $statusCode);
  34184. }
  34185. $this->io->writeError(' Authentication required (<info>'.$origin.'</info>):');
  34186. $username = $this->io->ask(' Username: ');
  34187. $password = $this->io->askAndHideAnswer(' Password: ');
  34188. $this->io->setAuthentication($origin, $username, $password);
  34189. $storeAuth = $this->config->get('store-auths');
  34190. }
  34191. return ['retry' => true, 'storeAuth' => $storeAuth];
  34192. }
  34193. public function addAuthenticationHeader(array $headers, string $origin, string $url): array
  34194. {
  34195. if ($this->io->hasAuthentication($origin)) {
  34196. $authenticationDisplayMessage = null;
  34197. $auth = $this->io->getAuthentication($origin);
  34198. if ($auth['password'] === 'bearer') {
  34199. $headers[] = 'Authorization: Bearer '.$auth['username'];
  34200. } elseif ('github.com' === $origin && 'x-oauth-basic' === $auth['password']) {
  34201. if (Preg::isMatch('{^https?://api\.github\.com/}', $url)) {
  34202. $headers[] = 'Authorization: token '.$auth['username'];
  34203. $authenticationDisplayMessage = 'Using GitHub token authentication';
  34204. }
  34205. } elseif (
  34206. in_array($origin, $this->config->get('gitlab-domains'), true)
  34207. && in_array($auth['password'], ['oauth2', 'private-token', 'gitlab-ci-token'], true)
  34208. ) {
  34209. if ($auth['password'] === 'oauth2') {
  34210. $headers[] = 'Authorization: Bearer '.$auth['username'];
  34211. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  34212. } else {
  34213. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  34214. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  34215. }
  34216. } elseif (
  34217. 'bitbucket.org' === $origin
  34218. && $url !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL
  34219. && 'x-token-auth' === $auth['username']
  34220. ) {
  34221. if (!$this->isPublicBitBucketDownload($url)) {
  34222. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  34223. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  34224. }
  34225. } else {
  34226. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  34227. $headers[] = 'Authorization: Basic '.$authStr;
  34228. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  34229. }
  34230. if ($authenticationDisplayMessage && (!isset($this->displayedOriginAuthentications[$origin]) || $this->displayedOriginAuthentications[$origin] !== $authenticationDisplayMessage)) {
  34231. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  34232. $this->displayedOriginAuthentications[$origin] = $authenticationDisplayMessage;
  34233. }
  34234. } elseif (in_array($origin, ['api.bitbucket.org', 'api.github.com'], true)) {
  34235. return $this->addAuthenticationHeader($headers, str_replace('api.', '', $origin), $url);
  34236. }
  34237. return $headers;
  34238. }
  34239. public function isPublicBitBucketDownload(string $urlToBitBucketFile): bool
  34240. {
  34241. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  34242. if (strpos($domain, 'bitbucket.org') === false) {
  34243. return true;
  34244. }
  34245. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  34246. $pathParts = explode('/', $path);
  34247. return count($pathParts) >= 4 && $pathParts[3] === 'downloads';
  34248. }
  34249. }
  34250. <?php declare(strict_types=1);
  34251. namespace Composer\Util;
  34252. use Composer\Factory;
  34253. use Composer\IO\IOInterface;
  34254. use Composer\Config;
  34255. use Composer\Downloader\TransportException;
  34256. class Bitbucket
  34257. {
  34258. private $io;
  34259. private $config;
  34260. private $process;
  34261. private $httpDownloader;
  34262. private $token = null;
  34263. private $time;
  34264. public const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  34265. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null, ?int $time = null)
  34266. {
  34267. $this->io = $io;
  34268. $this->config = $config;
  34269. $this->process = $process ?: new ProcessExecutor($io);
  34270. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  34271. $this->time = $time;
  34272. }
  34273. public function getToken(): string
  34274. {
  34275. if (!isset($this->token['access_token'])) {
  34276. return '';
  34277. }
  34278. return $this->token['access_token'];
  34279. }
  34280. public function authorizeOAuth(string $originUrl): bool
  34281. {
  34282. if ($originUrl !== 'bitbucket.org') {
  34283. return false;
  34284. }
  34285. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  34286. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  34287. return true;
  34288. }
  34289. return false;
  34290. }
  34291. private function requestAccessToken(): bool
  34292. {
  34293. try {
  34294. $response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, [
  34295. 'retry-auth-failure' => false,
  34296. 'http' => [
  34297. 'method' => 'POST',
  34298. 'content' => 'grant_type=client_credentials',
  34299. ],
  34300. ]);
  34301. $token = $response->decodeJson();
  34302. if (!isset($token['expires_in']) || !isset($token['access_token'])) {
  34303. throw new \LogicException('Expected a token configured with expires_in and access_token present, got '.json_encode($token));
  34304. }
  34305. $this->token = $token;
  34306. } catch (TransportException $e) {
  34307. if ($e->getCode() === 400) {
  34308. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  34309. $this->io->writeError('This can have three reasons:');
  34310. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  34311. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  34312. $this->io->writeError('3. You are using an OAuth consumer, but didn\'t configure it as private consumer');
  34313. return false;
  34314. }
  34315. if (in_array($e->getCode(), [403, 401])) {
  34316. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  34317. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  34318. return false;
  34319. }
  34320. throw $e;
  34321. }
  34322. return true;
  34323. }
  34324. public function authorizeOAuthInteractively(string $originUrl, ?string $message = null): bool
  34325. {
  34326. if ($message) {
  34327. $this->io->writeError($message);
  34328. }
  34329. $localAuthConfig = $this->config->getLocalAuthConfigSource();
  34330. $url = 'https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/';
  34331. $this->io->writeError('Follow the instructions here:');
  34332. $this->io->writeError($url);
  34333. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName()));
  34334. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  34335. $storeInLocalAuthConfig = false;
  34336. if ($localAuthConfig !== null) {
  34337. $storeInLocalAuthConfig = $this->io->askConfirmation('A local auth config source was found, do you want to store the token there?', true);
  34338. }
  34339. $consumerKey = trim((string) $this->io->askAndHideAnswer('Consumer Key (hidden): '));
  34340. if (!$consumerKey) {
  34341. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  34342. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  34343. return false;
  34344. }
  34345. $consumerSecret = trim((string) $this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  34346. if (!$consumerSecret) {
  34347. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  34348. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  34349. return false;
  34350. }
  34351. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  34352. if (!$this->requestAccessToken()) {
  34353. return false;
  34354. }
  34355. $authConfigSource = $storeInLocalAuthConfig && $localAuthConfig !== null ? $localAuthConfig : $this->config->getAuthConfigSource();
  34356. $this->storeInAuthConfig($authConfigSource, $originUrl, $consumerKey, $consumerSecret);
  34357. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  34358. $this->io->writeError('<info>Consumer stored successfully.</info>');
  34359. return true;
  34360. }
  34361. public function requestToken(string $originUrl, string $consumerKey, string $consumerSecret): string
  34362. {
  34363. if ($this->token !== null || $this->getTokenFromConfig($originUrl)) {
  34364. return $this->token['access_token'];
  34365. }
  34366. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  34367. if (!$this->requestAccessToken()) {
  34368. return '';
  34369. }
  34370. $this->storeInAuthConfig($this->config->getLocalAuthConfigSource() ?? $this->config->getAuthConfigSource(), $originUrl, $consumerKey, $consumerSecret);
  34371. if (!isset($this->token['access_token'])) {
  34372. throw new \LogicException('Failed to initialize token above');
  34373. }
  34374. return $this->token['access_token'];
  34375. }
  34376. private function storeInAuthConfig(Config\ConfigSourceInterface $authConfigSource, string $originUrl, string $consumerKey, string $consumerSecret): void
  34377. {
  34378. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  34379. if (null === $this->token || !isset($this->token['expires_in'])) {
  34380. throw new \LogicException('Expected a token configured with expires_in present, got '.json_encode($this->token));
  34381. }
  34382. $time = null === $this->time ? time() : $this->time;
  34383. $consumer = [
  34384. "consumer-key" => $consumerKey,
  34385. "consumer-secret" => $consumerSecret,
  34386. "access-token" => $this->token['access_token'],
  34387. "access-token-expiration" => $time + $this->token['expires_in'],
  34388. ];
  34389. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  34390. }
  34391. private function getTokenFromConfig(string $originUrl): bool
  34392. {
  34393. $authConfig = $this->config->get('bitbucket-oauth');
  34394. if (
  34395. !isset($authConfig[$originUrl]['access-token'], $authConfig[$originUrl]['access-token-expiration'])
  34396. || time() > $authConfig[$originUrl]['access-token-expiration']
  34397. ) {
  34398. return false;
  34399. }
  34400. $this->token = [
  34401. 'access_token' => $authConfig[$originUrl]['access-token'],
  34402. ];
  34403. return true;
  34404. }
  34405. }
  34406. <?php declare(strict_types=1);
  34407. namespace Composer\Util;
  34408. use Composer\Pcre\Preg;
  34409. class ComposerMirror
  34410. {
  34411. public static function processUrl(string $mirrorUrl, string $packageName, string $version, ?string $reference, ?string $type, ?string $prettyVersion = null): string
  34412. {
  34413. if ($reference) {
  34414. $reference = Preg::isMatch('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  34415. }
  34416. $version = strpos($version, '/') === false ? $version : md5($version);
  34417. $from = ['%package%', '%version%', '%reference%', '%type%'];
  34418. $to = [$packageName, $version, $reference, $type];
  34419. if (null !== $prettyVersion) {
  34420. $from[] = '%prettyVersion%';
  34421. $to[] = $prettyVersion;
  34422. }
  34423. $url = str_replace($from, $to, $mirrorUrl);
  34424. assert($url !== '');
  34425. return $url;
  34426. }
  34427. public static function processGitUrl(string $mirrorUrl, string $packageName, string $url, ?string $type): string
  34428. {
  34429. if (Preg::isMatch('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  34430. $url = 'gh-'.$match[1].'/'.$match[2];
  34431. } elseif (Preg::isMatch('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  34432. $url = 'bb-'.$match[1].'/'.$match[2];
  34433. } else {
  34434. $url = Preg::replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  34435. }
  34436. return str_replace(
  34437. ['%package%', '%normalizedUrl%', '%type%'],
  34438. [$packageName, $url, $type],
  34439. $mirrorUrl
  34440. );
  34441. }
  34442. public static function processHgUrl(string $mirrorUrl, string $packageName, string $url, string $type): string
  34443. {
  34444. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  34445. }
  34446. }
  34447. <?php declare(strict_types=1);
  34448. namespace Composer\Util;
  34449. use Composer\Package\Loader\ArrayLoader;
  34450. use Composer\Package\Loader\ValidatingArrayLoader;
  34451. use Composer\Package\Loader\InvalidPackageException;
  34452. use Composer\Json\JsonValidationException;
  34453. use Composer\IO\IOInterface;
  34454. use Composer\Json\JsonFile;
  34455. use Composer\Pcre\Preg;
  34456. use Composer\Spdx\SpdxLicenses;
  34457. use Seld\JsonLint\DuplicateKeyException;
  34458. use Seld\JsonLint\JsonParser;
  34459. class ConfigValidator
  34460. {
  34461. public const CHECK_VERSION = 1;
  34462. private $io;
  34463. public function __construct(IOInterface $io)
  34464. {
  34465. $this->io = $io;
  34466. }
  34467. public function validate(string $file, int $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL, int $flags = self::CHECK_VERSION): array
  34468. {
  34469. $errors = [];
  34470. $publishErrors = [];
  34471. $warnings = [];
  34472. $laxValid = false;
  34473. $manifest = null;
  34474. try {
  34475. $json = new JsonFile($file, null, $this->io);
  34476. $manifest = $json->read();
  34477. $json->validateSchema(JsonFile::LAX_SCHEMA);
  34478. $laxValid = true;
  34479. $json->validateSchema();
  34480. } catch (JsonValidationException $e) {
  34481. foreach ($e->getErrors() as $message) {
  34482. if ($laxValid) {
  34483. $publishErrors[] = $message;
  34484. } else {
  34485. $errors[] = $message;
  34486. }
  34487. }
  34488. } catch (\Exception $e) {
  34489. $errors[] = $e->getMessage();
  34490. return [$errors, $publishErrors, $warnings];
  34491. }
  34492. if (is_array($manifest)) {
  34493. $jsonParser = new JsonParser();
  34494. try {
  34495. $jsonParser->parse((string) file_get_contents($file), JsonParser::DETECT_KEY_CONFLICTS);
  34496. } catch (DuplicateKeyException $e) {
  34497. $details = $e->getDetails();
  34498. $warnings[] = 'Key '.$details['key'].' is a duplicate in '.$file.' at line '.$details['line'];
  34499. }
  34500. }
  34501. if (empty($manifest['license'])) {
  34502. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  34503. } else {
  34504. $licenses = (array) $manifest['license'];
  34505. foreach ($licenses as $key => $license) {
  34506. if ('proprietary' === $license) {
  34507. unset($licenses[$key]);
  34508. }
  34509. }
  34510. $licenseValidator = new SpdxLicenses();
  34511. foreach ($licenses as $license) {
  34512. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  34513. if ($spdxLicense && $spdxLicense[3]) {
  34514. if (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  34515. $warnings[] = sprintf(
  34516. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  34517. $license
  34518. );
  34519. } elseif (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  34520. $warnings[] = sprintf(
  34521. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  34522. $license
  34523. );
  34524. } else {
  34525. $warnings[] = sprintf(
  34526. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  34527. $license
  34528. );
  34529. }
  34530. }
  34531. }
  34532. }
  34533. if (($flags & self::CHECK_VERSION) && isset($manifest['version'])) {
  34534. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  34535. }
  34536. if (!empty($manifest['name']) && Preg::isMatch('{[A-Z]}', $manifest['name'])) {
  34537. $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  34538. $suggestName = strtolower($suggestName);
  34539. $publishErrors[] = sprintf(
  34540. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  34541. $manifest['name'],
  34542. $suggestName
  34543. );
  34544. }
  34545. if (!empty($manifest['type']) && $manifest['type'] === 'composer-installer') {
  34546. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  34547. }
  34548. if (isset($manifest['require'], $manifest['require-dev'])) {
  34549. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  34550. if (!empty($requireOverrides)) {
  34551. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  34552. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  34553. }
  34554. }
  34555. foreach (['provide', 'replace'] as $linkType) {
  34556. if (isset($manifest[$linkType])) {
  34557. foreach (['require', 'require-dev'] as $requireType) {
  34558. if (isset($manifest[$requireType])) {
  34559. foreach ($manifest[$linkType] as $provide => $constraint) {
  34560. if (isset($manifest[$requireType][$provide])) {
  34561. $warnings[] = 'The package ' . $provide . ' in '.$requireType.' is also listed in '.$linkType.' which satisfies the requirement. Remove it from '.$linkType.' if you wish to install it.';
  34562. }
  34563. }
  34564. }
  34565. }
  34566. }
  34567. }
  34568. $require = $manifest['require'] ?? [];
  34569. $requireDev = $manifest['require-dev'] ?? [];
  34570. $packages = array_merge($require, $requireDev);
  34571. foreach ($packages as $package => $version) {
  34572. if (Preg::isMatch('/#/', $version)) {
  34573. $warnings[] = sprintf(
  34574. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  34575. $package
  34576. );
  34577. }
  34578. }
  34579. $scriptsDescriptions = $manifest['scripts-descriptions'] ?? [];
  34580. $scripts = $manifest['scripts'] ?? [];
  34581. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  34582. if (!array_key_exists($scriptName, $scripts)) {
  34583. $warnings[] = sprintf(
  34584. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  34585. $scriptName
  34586. );
  34587. }
  34588. }
  34589. $scriptAliases = $manifest['scripts-aliases'] ?? [];
  34590. foreach ($scriptAliases as $scriptName => $scriptAlias) {
  34591. if (!array_key_exists($scriptName, $scripts)) {
  34592. $warnings[] = sprintf(
  34593. 'Aliases for non-existent script "%s" found in "scripts-aliases"',
  34594. $scriptName
  34595. );
  34596. }
  34597. }
  34598. if (isset($manifest['autoload']['psr-0'][''])) {
  34599. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  34600. }
  34601. if (isset($manifest['autoload']['psr-4'][''])) {
  34602. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  34603. }
  34604. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  34605. try {
  34606. if (!isset($manifest['version'])) {
  34607. $manifest['version'] = '1.0.0';
  34608. }
  34609. if (!isset($manifest['name'])) {
  34610. $manifest['name'] = 'dummy/dummy';
  34611. }
  34612. $loader->load($manifest);
  34613. } catch (InvalidPackageException $e) {
  34614. $errors = array_merge($errors, $e->getErrors());
  34615. }
  34616. $warnings = array_merge($warnings, $loader->getWarnings());
  34617. return [$errors, $publishErrors, $warnings];
  34618. }
  34619. }
  34620. <?php declare(strict_types=1);
  34621. namespace Composer\Util;
  34622. use Composer\IO\IOInterface;
  34623. class ErrorHandler
  34624. {
  34625. private static $io;
  34626. public static function handle(int $level, string $message, string $file, int $line): bool
  34627. {
  34628. $isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED;
  34629. if (!$isDeprecationNotice && !(error_reporting() & $level)) {
  34630. return true;
  34631. }
  34632. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  34633. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  34634. "\na legitimately suppressed error that you were not supposed to see.";
  34635. }
  34636. if (!$isDeprecationNotice) {
  34637. throw new \ErrorException($message, 0, $level, $file, $line);
  34638. }
  34639. if (self::$io) {
  34640. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  34641. if (self::$io->isVerbose()) {
  34642. self::$io->writeError('<warning>Stack trace:</warning>');
  34643. self::$io->writeError(array_filter(array_map(static function ($a): ?string {
  34644. if (isset($a['line'], $a['file'])) {
  34645. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  34646. }
  34647. return null;
  34648. }, array_slice(debug_backtrace(), 2))));
  34649. }
  34650. }
  34651. return true;
  34652. }
  34653. public static function register(?IOInterface $io = null): void
  34654. {
  34655. set_error_handler([__CLASS__, 'handle']);
  34656. error_reporting(E_ALL | E_STRICT);
  34657. self::$io = $io;
  34658. }
  34659. }
  34660. <?php declare(strict_types=1);
  34661. namespace Composer\Util;
  34662. use Composer\Pcre\Preg;
  34663. use React\Promise\PromiseInterface;
  34664. use RecursiveDirectoryIterator;
  34665. use RecursiveIteratorIterator;
  34666. use Symfony\Component\Filesystem\Exception\IOException;
  34667. use Symfony\Component\Finder\Finder;
  34668. class Filesystem
  34669. {
  34670. private $processExecutor;
  34671. public function __construct(?ProcessExecutor $executor = null)
  34672. {
  34673. $this->processExecutor = $executor;
  34674. }
  34675. public function remove(string $file)
  34676. {
  34677. if (is_dir($file)) {
  34678. return $this->removeDirectory($file);
  34679. }
  34680. if (file_exists($file)) {
  34681. return $this->unlink($file);
  34682. }
  34683. return false;
  34684. }
  34685. public function isDirEmpty(string $dir)
  34686. {
  34687. $finder = Finder::create()
  34688. ->ignoreVCS(false)
  34689. ->ignoreDotFiles(false)
  34690. ->depth(0)
  34691. ->in($dir);
  34692. return \count($finder) === 0;
  34693. }
  34694. public function emptyDirectory(string $dir, bool $ensureDirectoryExists = true)
  34695. {
  34696. if (is_link($dir) && file_exists($dir)) {
  34697. $this->unlink($dir);
  34698. }
  34699. if ($ensureDirectoryExists) {
  34700. $this->ensureDirectoryExists($dir);
  34701. }
  34702. if (is_dir($dir)) {
  34703. $finder = Finder::create()
  34704. ->ignoreVCS(false)
  34705. ->ignoreDotFiles(false)
  34706. ->depth(0)
  34707. ->in($dir);
  34708. foreach ($finder as $path) {
  34709. $this->remove((string) $path);
  34710. }
  34711. }
  34712. }
  34713. public function removeDirectory(string $directory)
  34714. {
  34715. $edgeCaseResult = $this->removeEdgeCases($directory);
  34716. if ($edgeCaseResult !== null) {
  34717. return $edgeCaseResult;
  34718. }
  34719. if (Platform::isWindows()) {
  34720. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  34721. } else {
  34722. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  34723. }
  34724. $result = $this->getProcess()->execute($cmd, $output) === 0;
  34725. clearstatcache();
  34726. if ($result && !is_dir($directory)) {
  34727. return true;
  34728. }
  34729. return $this->removeDirectoryPhp($directory);
  34730. }
  34731. public function removeDirectoryAsync(string $directory)
  34732. {
  34733. $edgeCaseResult = $this->removeEdgeCases($directory);
  34734. if ($edgeCaseResult !== null) {
  34735. return \React\Promise\resolve($edgeCaseResult);
  34736. }
  34737. if (Platform::isWindows()) {
  34738. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  34739. } else {
  34740. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  34741. }
  34742. $promise = $this->getProcess()->executeAsync($cmd);
  34743. return $promise->then(function ($process) use ($directory) {
  34744. clearstatcache();
  34745. if ($process->isSuccessful()) {
  34746. if (!is_dir($directory)) {
  34747. return \React\Promise\resolve(true);
  34748. }
  34749. }
  34750. return \React\Promise\resolve($this->removeDirectoryPhp($directory));
  34751. });
  34752. }
  34753. private function removeEdgeCases(string $directory, bool $fallbackToPhp = true): ?bool
  34754. {
  34755. if ($this->isSymlinkedDirectory($directory)) {
  34756. return $this->unlinkSymlinkedDirectory($directory);
  34757. }
  34758. if ($this->isJunction($directory)) {
  34759. return $this->removeJunction($directory);
  34760. }
  34761. if (is_link($directory)) {
  34762. return unlink($directory);
  34763. }
  34764. if (!is_dir($directory) || !file_exists($directory)) {
  34765. return true;
  34766. }
  34767. if (Preg::isMatch('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  34768. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  34769. }
  34770. if (!\function_exists('proc_open') && $fallbackToPhp) {
  34771. return $this->removeDirectoryPhp($directory);
  34772. }
  34773. return null;
  34774. }
  34775. public function removeDirectoryPhp(string $directory)
  34776. {
  34777. $edgeCaseResult = $this->removeEdgeCases($directory, false);
  34778. if ($edgeCaseResult !== null) {
  34779. return $edgeCaseResult;
  34780. }
  34781. try {
  34782. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  34783. } catch (\UnexpectedValueException $e) {
  34784. clearstatcache();
  34785. usleep(100000);
  34786. if (!is_dir($directory)) {
  34787. return true;
  34788. }
  34789. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  34790. }
  34791. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  34792. foreach ($ri as $file) {
  34793. if ($file->isDir()) {
  34794. $this->rmdir($file->getPathname());
  34795. } else {
  34796. $this->unlink($file->getPathname());
  34797. }
  34798. }
  34799. unset($ri, $it, $file);
  34800. return $this->rmdir($directory);
  34801. }
  34802. public function ensureDirectoryExists(string $directory)
  34803. {
  34804. if (!is_dir($directory)) {
  34805. if (file_exists($directory)) {
  34806. throw new \RuntimeException(
  34807. $directory.' exists and is not a directory.'
  34808. );
  34809. }
  34810. if (is_link($directory) && !@$this->unlinkImplementation($directory)) {
  34811. throw new \RuntimeException('Could not delete symbolic link '.$directory.': '.(error_get_last()['message'] ?? ''));
  34812. }
  34813. if (!@mkdir($directory, 0777, true)) {
  34814. throw new \RuntimeException($directory.' does not exist and could not be created: '.(error_get_last()['message'] ?? ''));
  34815. }
  34816. }
  34817. }
  34818. public function unlink(string $path)
  34819. {
  34820. $unlinked = @$this->unlinkImplementation($path);
  34821. if (!$unlinked) {
  34822. if (Platform::isWindows()) {
  34823. usleep(350000);
  34824. $unlinked = @$this->unlinkImplementation($path);
  34825. }
  34826. if (!$unlinked) {
  34827. $error = error_get_last();
  34828. $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
  34829. if (Platform::isWindows()) {
  34830. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  34831. }
  34832. throw new \RuntimeException($message);
  34833. }
  34834. }
  34835. return true;
  34836. }
  34837. public function rmdir(string $path)
  34838. {
  34839. $deleted = @rmdir($path);
  34840. if (!$deleted) {
  34841. if (Platform::isWindows()) {
  34842. usleep(350000);
  34843. $deleted = @rmdir($path);
  34844. }
  34845. if (!$deleted) {
  34846. $error = error_get_last();
  34847. $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
  34848. if (Platform::isWindows()) {
  34849. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  34850. }
  34851. throw new \RuntimeException($message);
  34852. }
  34853. }
  34854. return true;
  34855. }
  34856. public function copyThenRemove(string $source, string $target)
  34857. {
  34858. $this->copy($source, $target);
  34859. if (!is_dir($source)) {
  34860. $this->unlink($source);
  34861. return;
  34862. }
  34863. $this->removeDirectoryPhp($source);
  34864. }
  34865. public function copy(string $source, string $target)
  34866. {
  34867. if (!is_dir($source)) {
  34868. return copy($source, $target);
  34869. }
  34870. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  34871. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  34872. $this->ensureDirectoryExists($target);
  34873. $result = true;
  34874. foreach ($ri as $file) {
  34875. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathname();
  34876. if ($file->isDir()) {
  34877. $this->ensureDirectoryExists($targetPath);
  34878. } else {
  34879. $result = $result && copy($file->getPathname(), $targetPath);
  34880. }
  34881. }
  34882. return $result;
  34883. }
  34884. public function rename(string $source, string $target)
  34885. {
  34886. if (true === @rename($source, $target)) {
  34887. return;
  34888. }
  34889. if (!\function_exists('proc_open')) {
  34890. $this->copyThenRemove($source, $target);
  34891. return;
  34892. }
  34893. if (Platform::isWindows()) {
  34894. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  34895. $result = $this->getProcess()->execute($command, $output);
  34896. clearstatcache();
  34897. if (0 === $result) {
  34898. $this->remove($source);
  34899. return;
  34900. }
  34901. } else {
  34902. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  34903. $result = $this->getProcess()->execute($command, $output);
  34904. clearstatcache();
  34905. if (0 === $result) {
  34906. return;
  34907. }
  34908. }
  34909. $this->copyThenRemove($source, $target);
  34910. }
  34911. public function findShortestPath(string $from, string $to, bool $directories = false)
  34912. {
  34913. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  34914. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  34915. }
  34916. $from = $this->normalizePath($from);
  34917. $to = $this->normalizePath($to);
  34918. if ($directories) {
  34919. $from = rtrim($from, '/') . '/dummy_file';
  34920. }
  34921. if (\dirname($from) === \dirname($to)) {
  34922. return './'.basename($to);
  34923. }
  34924. $commonPath = $to;
  34925. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath)) {
  34926. $commonPath = strtr(\dirname($commonPath), '\\', '/');
  34927. }
  34928. if (0 !== strpos($from, $commonPath)) {
  34929. return $to;
  34930. }
  34931. $commonPath = rtrim($commonPath, '/') . '/';
  34932. $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/');
  34933. $commonPathCode = str_repeat('../', $sourcePathDepth);
  34934. if ('/' === $commonPath && $sourcePathDepth > 1) {
  34935. return $to;
  34936. }
  34937. $result = $commonPathCode . substr($to, \strlen($commonPath));
  34938. if (\strlen($result) === 0) {
  34939. return './';
  34940. }
  34941. return $result;
  34942. }
  34943. public function findShortestPathCode(string $from, string $to, bool $directories = false, bool $staticCode = false)
  34944. {
  34945. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  34946. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  34947. }
  34948. $from = $this->normalizePath($from);
  34949. $to = $this->normalizePath($to);
  34950. if ($from === $to) {
  34951. return $directories ? '__DIR__' : '__FILE__';
  34952. }
  34953. $commonPath = $to;
  34954. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  34955. $commonPath = strtr(\dirname($commonPath), '\\', '/');
  34956. }
  34957. if (0 !== strpos($from, $commonPath) || '.' === $commonPath) {
  34958. return var_export($to, true);
  34959. }
  34960. $commonPath = rtrim($commonPath, '/') . '/';
  34961. if (str_starts_with($to, $from.'/')) {
  34962. return '__DIR__ . '.var_export((string) substr($to, \strlen($from)), true);
  34963. }
  34964. $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/') + (int) $directories;
  34965. if ('/' === $commonPath && $sourcePathDepth > 1) {
  34966. return var_export($to, true);
  34967. }
  34968. if ($staticCode) {
  34969. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  34970. } else {
  34971. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  34972. }
  34973. $relTarget = (string) substr($to, \strlen($commonPath));
  34974. return $commonPathCode . (\strlen($relTarget) > 0 ? '.' . var_export('/' . $relTarget, true) : '');
  34975. }
  34976. public function isAbsolutePath(string $path)
  34977. {
  34978. return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
  34979. }
  34980. public function size(string $path)
  34981. {
  34982. if (!file_exists($path)) {
  34983. throw new \RuntimeException("$path does not exist.");
  34984. }
  34985. if (is_dir($path)) {
  34986. return $this->directorySize($path);
  34987. }
  34988. return (int) filesize($path);
  34989. }
  34990. public function normalizePath(string $path)
  34991. {
  34992. $parts = [];
  34993. $path = strtr($path, '\\', '/');
  34994. $prefix = '';
  34995. $absolute = '';
  34996. if (strpos($path, '//') === 0 && \strlen($path) > 2) {
  34997. $absolute = '//';
  34998. $path = substr($path, 2);
  34999. }
  35000. if (Preg::isMatchStrictGroups('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  35001. $prefix = $match[1];
  35002. $path = substr($path, \strlen($prefix));
  35003. }
  35004. if (strpos($path, '/') === 0) {
  35005. $absolute = '/';
  35006. $path = substr($path, 1);
  35007. }
  35008. $up = false;
  35009. foreach (explode('/', $path) as $chunk) {
  35010. if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
  35011. array_pop($parts);
  35012. $up = !(\count($parts) === 0 || '..' === end($parts));
  35013. } elseif ('.' !== $chunk && '' !== $chunk) {
  35014. $parts[] = $chunk;
  35015. $up = '..' !== $chunk;
  35016. }
  35017. }
  35018. $prefix = Preg::replaceCallback('{(^|://)[a-z]:$}i', static function (array $m) {
  35019. assert(is_string($m[0]));
  35020. return strtoupper($m[0]);
  35021. }, $prefix);
  35022. return $prefix.$absolute.implode('/', $parts);
  35023. }
  35024. public static function trimTrailingSlash(string $path)
  35025. {
  35026. if (!Preg::isMatch('{^[/\\\\]+$}', $path)) {
  35027. $path = rtrim($path, '/\\');
  35028. }
  35029. return $path;
  35030. }
  35031. public static function isLocalPath(string $path)
  35032. {
  35033. return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  35034. }
  35035. public static function getPlatformPath(string $path)
  35036. {
  35037. if (Platform::isWindows()) {
  35038. $path = Preg::replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  35039. }
  35040. return Preg::replace('{^file://}i', '', $path);
  35041. }
  35042. public static function isReadable(string $path)
  35043. {
  35044. if (is_readable($path)) {
  35045. return true;
  35046. }
  35047. if (is_file($path)) {
  35048. return false !== Silencer::call('file_get_contents', $path, false, null, 0, 1);
  35049. }
  35050. if (is_dir($path)) {
  35051. return false !== Silencer::call('opendir', $path);
  35052. }
  35053. return false;
  35054. }
  35055. protected function directorySize(string $directory)
  35056. {
  35057. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  35058. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  35059. $size = 0;
  35060. foreach ($ri as $file) {
  35061. if ($file->isFile()) {
  35062. $size += $file->getSize();
  35063. }
  35064. }
  35065. return $size;
  35066. }
  35067. protected function getProcess()
  35068. {
  35069. if (null === $this->processExecutor) {
  35070. $this->processExecutor = new ProcessExecutor();
  35071. }
  35072. return $this->processExecutor;
  35073. }
  35074. private function unlinkImplementation(string $path): bool
  35075. {
  35076. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  35077. return rmdir($path);
  35078. }
  35079. return unlink($path);
  35080. }
  35081. public function relativeSymlink(string $target, string $link)
  35082. {
  35083. if (!function_exists('symlink')) {
  35084. return false;
  35085. }
  35086. $cwd = Platform::getCwd();
  35087. $relativePath = $this->findShortestPath($link, $target);
  35088. chdir(\dirname($link));
  35089. $result = @symlink($relativePath, $link);
  35090. chdir($cwd);
  35091. return $result;
  35092. }
  35093. public function isSymlinkedDirectory(string $directory)
  35094. {
  35095. if (!is_dir($directory)) {
  35096. return false;
  35097. }
  35098. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  35099. return is_link($resolved);
  35100. }
  35101. private function unlinkSymlinkedDirectory(string $directory): bool
  35102. {
  35103. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  35104. return $this->unlink($resolved);
  35105. }
  35106. private function resolveSymlinkedDirectorySymlink(string $pathname): string
  35107. {
  35108. if (!is_dir($pathname)) {
  35109. return $pathname;
  35110. }
  35111. $resolved = rtrim($pathname, '/');
  35112. if (0 === \strlen($resolved)) {
  35113. return $pathname;
  35114. }
  35115. return $resolved;
  35116. }
  35117. public function junction(string $target, string $junction)
  35118. {
  35119. if (!Platform::isWindows()) {
  35120. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  35121. }
  35122. if (!is_dir($target)) {
  35123. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  35124. }
  35125. if (!is_dir($junction) || $this->isJunction($junction)) {
  35126. @rmdir($junction);
  35127. }
  35128. $cmd = sprintf(
  35129. 'mklink /J %s %s',
  35130. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  35131. ProcessExecutor::escape(realpath($target))
  35132. );
  35133. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  35134. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  35135. }
  35136. clearstatcache(true, $junction);
  35137. }
  35138. public function isJunction(string $junction)
  35139. {
  35140. if (!Platform::isWindows()) {
  35141. return false;
  35142. }
  35143. clearstatcache(true, $junction);
  35144. if (!is_dir($junction) || is_link($junction)) {
  35145. return false;
  35146. }
  35147. $stat = lstat($junction);
  35148. return is_array($stat) ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  35149. }
  35150. public function removeJunction(string $junction)
  35151. {
  35152. if (!Platform::isWindows()) {
  35153. return false;
  35154. }
  35155. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  35156. if (!$this->isJunction($junction)) {
  35157. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  35158. }
  35159. return $this->rmdir($junction);
  35160. }
  35161. public function filePutContentsIfModified(string $path, string $content)
  35162. {
  35163. $currentContent = Silencer::call('file_get_contents', $path);
  35164. if (false === $currentContent || $currentContent !== $content) {
  35165. return file_put_contents($path, $content);
  35166. }
  35167. return 0;
  35168. }
  35169. public function safeCopy(string $source, string $target): void
  35170. {
  35171. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  35172. $sourceHandle = fopen($source, 'r');
  35173. assert($sourceHandle !== false, 'Could not open "'.$source.'" for reading.');
  35174. $targetHandle = fopen($target, 'w+');
  35175. assert($targetHandle !== false, 'Could not open "'.$target.'" for writing.');
  35176. stream_copy_to_stream($sourceHandle, $targetHandle);
  35177. fclose($sourceHandle);
  35178. fclose($targetHandle);
  35179. touch($target, (int) filemtime($source), (int) fileatime($source));
  35180. }
  35181. }
  35182. private function filesAreEqual(string $a, string $b): bool
  35183. {
  35184. if (filesize($a) !== filesize($b)) {
  35185. return false;
  35186. }
  35187. $aHandle = fopen($a, 'rb');
  35188. assert($aHandle !== false, 'Could not open "'.$a.'" for reading.');
  35189. $bHandle = fopen($b, 'rb');
  35190. assert($bHandle !== false, 'Could not open "'.$b.'" for reading.');
  35191. $result = true;
  35192. while (!feof($aHandle)) {
  35193. if (fread($aHandle, 8192) !== fread($bHandle, 8192)) {
  35194. $result = false;
  35195. break;
  35196. }
  35197. }
  35198. fclose($aHandle);
  35199. fclose($bHandle);
  35200. return $result;
  35201. }
  35202. }
  35203. <?php declare(strict_types=1);
  35204. namespace Composer\Util;
  35205. use Composer\Config;
  35206. use Composer\IO\IOInterface;
  35207. use Composer\Pcre\Preg;
  35208. class Git
  35209. {
  35210. private static $version = false;
  35211. protected $io;
  35212. protected $config;
  35213. protected $process;
  35214. protected $filesystem;
  35215. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  35216. {
  35217. $this->io = $io;
  35218. $this->config = $config;
  35219. $this->process = $process;
  35220. $this->filesystem = $fs;
  35221. }
  35222. public function runCommand(callable $commandCallable, string $url, ?string $cwd, bool $initialClone = false, &$commandOutput = null): void
  35223. {
  35224. $this->config->prohibitUrlByConfig($url, $this->io);
  35225. if ($initialClone) {
  35226. $origCwd = $cwd;
  35227. $cwd = null;
  35228. }
  35229. if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  35230. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  35231. }
  35232. if (!$initialClone) {
  35233. $this->process->execute('git remote -v', $output, $cwd);
  35234. if (Preg::isMatchStrictGroups('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  35235. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  35236. }
  35237. }
  35238. $protocols = $this->config->get('github-protocols');
  35239. if (Preg::isMatchStrictGroups('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  35240. $messages = [];
  35241. foreach ($protocols as $protocol) {
  35242. if ('ssh' === $protocol) {
  35243. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  35244. } else {
  35245. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  35246. }
  35247. if (0 === $this->process->execute($commandCallable($protoUrl), $commandOutput, $cwd)) {
  35248. return;
  35249. }
  35250. $messages[] = '- ' . $protoUrl . "\n" . Preg::replace('#^#m', ' ', $this->process->getErrorOutput());
  35251. if ($initialClone && isset($origCwd)) {
  35252. $this->filesystem->removeDirectory($origCwd);
  35253. }
  35254. }
  35255. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  35256. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  35257. }
  35258. }
  35259. $bypassSshForGitHub = Preg::isMatch('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  35260. $command = $commandCallable($url);
  35261. $auth = null;
  35262. $credentials = [];
  35263. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $commandOutput, $cwd)) {
  35264. $errorMsg = $this->process->getErrorOutput();
  35265. if (Preg::isMatchStrictGroups('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  35266. || Preg::isMatchStrictGroups('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*?)(?:\.git)?$}i', $url, $match)
  35267. ) {
  35268. if (!$this->io->hasAuthentication($match[1])) {
  35269. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  35270. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  35271. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  35272. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  35273. }
  35274. }
  35275. if ($this->io->hasAuthentication($match[1])) {
  35276. $auth = $this->io->getAuthentication($match[1]);
  35277. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  35278. $command = $commandCallable($authUrl);
  35279. if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
  35280. return;
  35281. }
  35282. $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
  35283. $errorMsg = $this->process->getErrorOutput();
  35284. }
  35285. } elseif (Preg::isMatchStrictGroups('{^https://(bitbucket\.org)/(.*?)(?:\.git)?$}i', $url, $match)) {
  35286. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  35287. if (!$this->io->hasAuthentication($match[1])) {
  35288. $message = 'Enter your Bitbucket credentials to access private repos';
  35289. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  35290. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  35291. $accessToken = $bitbucketUtil->getToken();
  35292. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  35293. }
  35294. } else {
  35295. $auth = $this->io->getAuthentication($match[1]);
  35296. if ($auth['username'] !== 'x-token-auth') {
  35297. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  35298. if (!empty($accessToken)) {
  35299. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  35300. }
  35301. }
  35302. }
  35303. if ($this->io->hasAuthentication($match[1])) {
  35304. $auth = $this->io->getAuthentication($match[1]);
  35305. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  35306. $command = $commandCallable($authUrl);
  35307. if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
  35308. return;
  35309. }
  35310. $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
  35311. $errorMsg = $this->process->getErrorOutput();
  35312. } else {
  35313. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  35314. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  35315. $command = $commandCallable($sshUrl);
  35316. if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
  35317. return;
  35318. }
  35319. $errorMsg = $this->process->getErrorOutput();
  35320. }
  35321. } elseif (
  35322. Preg::isMatchStrictGroups('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  35323. || Preg::isMatchStrictGroups('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}i', $url, $match)
  35324. ) {
  35325. if ($match[1] === 'git') {
  35326. $match[1] = 'https';
  35327. }
  35328. if (!$this->io->hasAuthentication($match[2])) {
  35329. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  35330. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  35331. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  35332. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  35333. }
  35334. }
  35335. if ($this->io->hasAuthentication($match[2])) {
  35336. $auth = $this->io->getAuthentication($match[2]);
  35337. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  35338. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  35339. } else {
  35340. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  35341. }
  35342. $command = $commandCallable($authUrl);
  35343. if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
  35344. return;
  35345. }
  35346. $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
  35347. $errorMsg = $this->process->getErrorOutput();
  35348. }
  35349. } elseif ($this->isAuthenticationFailure($url, $match)) {
  35350. if (strpos($match[2], '@')) {
  35351. [$authParts, $match[2]] = explode('@', $match[2], 2);
  35352. }
  35353. $storeAuth = false;
  35354. if ($this->io->hasAuthentication($match[2])) {
  35355. $auth = $this->io->getAuthentication($match[2]);
  35356. } elseif ($this->io->isInteractive()) {
  35357. $defaultUsername = null;
  35358. if (isset($authParts) && $authParts) {
  35359. if (false !== strpos($authParts, ':')) {
  35360. [$defaultUsername, ] = explode(':', $authParts, 2);
  35361. } else {
  35362. $defaultUsername = $authParts;
  35363. }
  35364. }
  35365. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  35366. $this->io->writeError('<warning>' . trim($errorMsg) . '</warning>', true, IOInterface::VERBOSE);
  35367. $auth = [
  35368. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  35369. 'password' => $this->io->askAndHideAnswer(' Password: '),
  35370. ];
  35371. $storeAuth = $this->config->get('store-auths');
  35372. }
  35373. if (null !== $auth) {
  35374. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  35375. $command = $commandCallable($authUrl);
  35376. if (0 === $this->process->execute($command, $commandOutput, $cwd)) {
  35377. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  35378. $authHelper = new AuthHelper($this->io, $this->config);
  35379. $authHelper->storeAuth($match[2], $storeAuth);
  35380. return;
  35381. }
  35382. $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
  35383. $errorMsg = $this->process->getErrorOutput();
  35384. }
  35385. }
  35386. if ($initialClone && isset($origCwd)) {
  35387. $this->filesystem->removeDirectory($origCwd);
  35388. }
  35389. if (count($credentials) > 0) {
  35390. $command = $this->maskCredentials($command, $credentials);
  35391. $errorMsg = $this->maskCredentials($errorMsg, $credentials);
  35392. }
  35393. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  35394. }
  35395. }
  35396. public function syncMirror(string $url, string $dir): bool
  35397. {
  35398. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK') && Platform::getEnv('COMPOSER_DISABLE_NETWORK') !== 'prime') {
  35399. $this->io->writeError('<warning>Aborting git mirror sync of '.$url.' as network is disabled</warning>');
  35400. return false;
  35401. }
  35402. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  35403. try {
  35404. $commandCallable = static function ($url): string {
  35405. $sanitizedUrl = Preg::replace('{://([^@]+?):(.+?)@}', '://', $url);
  35406. return sprintf('git remote set-url origin -- %s && git remote update --prune origin && git remote set-url origin -- %s && git gc --auto', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  35407. };
  35408. $this->runCommand($commandCallable, $url, $dir);
  35409. } catch (\Exception $e) {
  35410. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  35411. return false;
  35412. }
  35413. return true;
  35414. }
  35415. $this->filesystem->removeDirectory($dir);
  35416. $commandCallable = static function ($url) use ($dir): string {
  35417. return sprintf('git clone --mirror -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  35418. };
  35419. $this->runCommand($commandCallable, $url, $dir, true);
  35420. return true;
  35421. }
  35422. public function fetchRefOrSyncMirror(string $url, string $dir, string $ref, string $prettyVersion = null): bool
  35423. {
  35424. if ($this->checkRefIsInMirror($dir, $ref)) {
  35425. if (Preg::isMatch('{^[a-f0-9]{40}$}', $ref) && $prettyVersion !== null) {
  35426. $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
  35427. $branches = null;
  35428. $tags = null;
  35429. if (0 === $this->process->execute('git branch', $output, $dir)) {
  35430. $branches = $output;
  35431. }
  35432. if (0 === $this->process->execute('git tag', $output, $dir)) {
  35433. $tags = $output;
  35434. }
  35435. if (null !== $branches && !Preg::isMatch('{^[\s*]*v?'.preg_quote($branch).'$}m', $branches)
  35436. && null !== $tags && !Preg::isMatch('{^[\s*]*'.preg_quote($branch).'$}m', $tags)
  35437. ) {
  35438. $this->syncMirror($url, $dir);
  35439. }
  35440. }
  35441. return true;
  35442. }
  35443. if ($this->syncMirror($url, $dir)) {
  35444. return $this->checkRefIsInMirror($dir, $ref);
  35445. }
  35446. return false;
  35447. }
  35448. public static function getNoShowSignatureFlag(ProcessExecutor $process): string
  35449. {
  35450. $gitVersion = self::getVersion($process);
  35451. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  35452. return ' --no-show-signature';
  35453. }
  35454. return '';
  35455. }
  35456. private function checkRefIsInMirror(string $dir, string $ref): bool
  35457. {
  35458. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  35459. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  35460. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  35461. if ($exitCode === 0) {
  35462. return true;
  35463. }
  35464. }
  35465. return false;
  35466. }
  35467. private function isAuthenticationFailure(string $url, array &$match): bool
  35468. {
  35469. if (!Preg::isMatch('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  35470. return false;
  35471. }
  35472. $authFailures = [
  35473. 'fatal: Authentication failed',
  35474. 'remote error: Invalid username or password.',
  35475. 'error: 401 Unauthorized',
  35476. 'fatal: unable to access',
  35477. 'fatal: could not read Username',
  35478. ];
  35479. $errorOutput = $this->process->getErrorOutput();
  35480. foreach ($authFailures as $authFailure) {
  35481. if (strpos($errorOutput, $authFailure) !== false) {
  35482. return true;
  35483. }
  35484. }
  35485. return false;
  35486. }
  35487. public function getMirrorDefaultBranch(string $url, string $dir, bool $isLocalPathRepository): ?string
  35488. {
  35489. if ((bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  35490. return null;
  35491. }
  35492. try {
  35493. if ($isLocalPathRepository) {
  35494. $this->process->execute('git remote show origin', $output, $dir);
  35495. } else {
  35496. $commandCallable = static function ($url): string {
  35497. $sanitizedUrl = Preg::replace('{://([^@]+?):(.+?)@}', '://', $url);
  35498. return sprintf('git remote set-url origin -- %s && git remote show origin && git remote set-url origin -- %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  35499. };
  35500. $this->runCommand($commandCallable, $url, $dir, false, $output);
  35501. }
  35502. $lines = $this->process->splitLines($output);
  35503. foreach ($lines as $line) {
  35504. if (Preg::match('{^\s*HEAD branch:\s(.+)\s*$}m', $line, $matches) > 0) {
  35505. return $matches[1];
  35506. }
  35507. }
  35508. } catch (\Exception $e) {
  35509. $this->io->writeError('<error>Failed to fetch root identifier from remote: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  35510. }
  35511. return null;
  35512. }
  35513. public static function cleanEnv(): void
  35514. {
  35515. if (Platform::getEnv('GIT_ASKPASS') !== 'echo') {
  35516. Platform::putEnv('GIT_ASKPASS', 'echo');
  35517. }
  35518. if (Platform::getEnv('GIT_DIR')) {
  35519. Platform::clearEnv('GIT_DIR');
  35520. }
  35521. if (Platform::getEnv('GIT_WORK_TREE')) {
  35522. Platform::clearEnv('GIT_WORK_TREE');
  35523. }
  35524. if (Platform::getEnv('LANGUAGE') !== 'C') {
  35525. Platform::putEnv('LANGUAGE', 'C');
  35526. }
  35527. Platform::clearEnv('DYLD_LIBRARY_PATH');
  35528. }
  35529. public static function getGitHubDomainsRegex(Config $config): string
  35530. {
  35531. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  35532. }
  35533. public static function getGitLabDomainsRegex(Config $config): string
  35534. {
  35535. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  35536. }
  35537. private function throwException($message, string $url): void
  35538. {
  35539. clearstatcache();
  35540. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  35541. throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  35542. }
  35543. throw new \RuntimeException(Url::sanitize($message));
  35544. }
  35545. public static function getVersion(ProcessExecutor $process): ?string
  35546. {
  35547. if (false === self::$version) {
  35548. self::$version = null;
  35549. if (0 === $process->execute('git --version', $output) && Preg::isMatch('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  35550. self::$version = $matches[1];
  35551. }
  35552. }
  35553. return self::$version;
  35554. }
  35555. private function maskCredentials(string $error, array $credentials): string
  35556. {
  35557. $maskedCredentials = [];
  35558. foreach ($credentials as $credential) {
  35559. if (in_array($credential, ['private-token', 'x-token-auth', 'oauth2', 'gitlab-ci-token', 'x-oauth-basic'])) {
  35560. $maskedCredentials[] = $credential;
  35561. } elseif (strlen($credential) > 6) {
  35562. $maskedCredentials[] = substr($credential, 0, 3) . '...' . substr($credential, -3);
  35563. } elseif (strlen($credential) > 3) {
  35564. $maskedCredentials[] = substr($credential, 0, 3) . '...';
  35565. } else {
  35566. $maskedCredentials[] = 'XXX';
  35567. }
  35568. }
  35569. return str_replace($credentials, $maskedCredentials, $error);
  35570. }
  35571. }
  35572. <?php declare(strict_types=1);
  35573. namespace Composer\Util;
  35574. use Composer\Factory;
  35575. use Composer\IO\IOInterface;
  35576. use Composer\Config;
  35577. use Composer\Downloader\TransportException;
  35578. use Composer\Pcre\Preg;
  35579. class GitHub
  35580. {
  35581. protected $io;
  35582. protected $config;
  35583. protected $process;
  35584. protected $httpDownloader;
  35585. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null)
  35586. {
  35587. $this->io = $io;
  35588. $this->config = $config;
  35589. $this->process = $process ?: new ProcessExecutor($io);
  35590. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  35591. }
  35592. public function authorizeOAuth(string $originUrl): bool
  35593. {
  35594. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  35595. return false;
  35596. }
  35597. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  35598. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  35599. return true;
  35600. }
  35601. return false;
  35602. }
  35603. public function authorizeOAuthInteractively(string $originUrl, ?string $message = null): bool
  35604. {
  35605. if ($message) {
  35606. $this->io->writeError($message);
  35607. }
  35608. $note = 'Composer';
  35609. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  35610. $note .= ' on ' . trim($output);
  35611. }
  35612. $note .= ' ' . date('Y-m-d Hi');
  35613. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=&description=' . str_replace('%20', '+', rawurlencode($note));
  35614. $this->io->writeError('When working with _public_ GitHub repositories only, head here to retrieve a token:');
  35615. $this->io->writeError($url);
  35616. $this->io->writeError('This token will have read-only permission for public information only.');
  35617. $localAuthConfig = $this->config->getLocalAuthConfigSource();
  35618. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  35619. $this->io->writeError('When you need to access _private_ GitHub repositories as well, go to:');
  35620. $this->io->writeError($url);
  35621. $this->io->writeError('Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.');
  35622. $this->io->writeError(sprintf('Tokens will be stored in plain text in "%s" for future use by Composer.', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName()));
  35623. $this->io->writeError('For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth');
  35624. $storeInLocalAuthConfig = false;
  35625. if ($localAuthConfig !== null) {
  35626. $storeInLocalAuthConfig = $this->io->askConfirmation('A local auth config source was found, do you want to store the token there?', true);
  35627. }
  35628. $token = trim((string) $this->io->askAndHideAnswer('Token (hidden): '));
  35629. if ($token === '') {
  35630. $this->io->writeError('<warning>No token given, aborting.</warning>');
  35631. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  35632. return false;
  35633. }
  35634. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  35635. try {
  35636. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  35637. $this->httpDownloader->get('https://'. $apiUrl, [
  35638. 'retry-auth-failure' => false,
  35639. ]);
  35640. } catch (TransportException $e) {
  35641. if (in_array($e->getCode(), [403, 401])) {
  35642. $this->io->writeError('<error>Invalid token provided.</error>');
  35643. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  35644. return false;
  35645. }
  35646. throw $e;
  35647. }
  35648. $authConfigSource = $storeInLocalAuthConfig && $localAuthConfig !== null ? $localAuthConfig : $this->config->getAuthConfigSource();
  35649. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  35650. $authConfigSource->addConfigSetting('github-oauth.'.$originUrl, $token);
  35651. $this->io->writeError('<info>Token stored successfully.</info>');
  35652. return true;
  35653. }
  35654. public function getRateLimit(array $headers): array
  35655. {
  35656. $rateLimit = [
  35657. 'limit' => '?',
  35658. 'reset' => '?',
  35659. ];
  35660. foreach ($headers as $header) {
  35661. $header = trim($header);
  35662. if (false === stripos($header, 'x-ratelimit-')) {
  35663. continue;
  35664. }
  35665. [$type, $value] = explode(':', $header, 2);
  35666. switch (strtolower($type)) {
  35667. case 'x-ratelimit-limit':
  35668. $rateLimit['limit'] = (int) trim($value);
  35669. break;
  35670. case 'x-ratelimit-reset':
  35671. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  35672. break;
  35673. }
  35674. }
  35675. return $rateLimit;
  35676. }
  35677. public function getSsoUrl(array $headers): ?string
  35678. {
  35679. foreach ($headers as $header) {
  35680. $header = trim($header);
  35681. if (false === stripos($header, 'x-github-sso: required')) {
  35682. continue;
  35683. }
  35684. if (Preg::isMatch('{\burl=(?P<url>[^\s;]+)}', $header, $match)) {
  35685. return $match['url'];
  35686. }
  35687. }
  35688. return null;
  35689. }
  35690. public function isRateLimited(array $headers): bool
  35691. {
  35692. foreach ($headers as $header) {
  35693. if (Preg::isMatch('{^x-ratelimit-remaining: *0$}i', trim($header))) {
  35694. return true;
  35695. }
  35696. }
  35697. return false;
  35698. }
  35699. public function requiresSso(array $headers): bool
  35700. {
  35701. foreach ($headers as $header) {
  35702. if (Preg::isMatch('{^x-github-sso: required}i', trim($header))) {
  35703. return true;
  35704. }
  35705. }
  35706. return false;
  35707. }
  35708. }
  35709. <?php declare(strict_types=1);
  35710. namespace Composer\Util;
  35711. use Composer\IO\IOInterface;
  35712. use Composer\Config;
  35713. use Composer\Factory;
  35714. use Composer\Downloader\TransportException;
  35715. use Composer\Pcre\Preg;
  35716. class GitLab
  35717. {
  35718. protected $io;
  35719. protected $config;
  35720. protected $process;
  35721. protected $httpDownloader;
  35722. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null)
  35723. {
  35724. $this->io = $io;
  35725. $this->config = $config;
  35726. $this->process = $process ?: new ProcessExecutor($io);
  35727. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  35728. }
  35729. public function authorizeOAuth(string $originUrl): bool
  35730. {
  35731. $bcOriginUrl = Preg::replace('{:\d+}', '', $originUrl);
  35732. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  35733. return false;
  35734. }
  35735. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  35736. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  35737. return true;
  35738. }
  35739. if (0 === $this->process->execute('git config gitlab.deploytoken.user', $tokenUser) && 0 === $this->process->execute('git config gitlab.deploytoken.token', $tokenPassword)) {
  35740. $this->io->setAuthentication($originUrl, trim($tokenUser), trim($tokenPassword));
  35741. return true;
  35742. }
  35743. $authTokens = $this->config->get('gitlab-token');
  35744. if (isset($authTokens[$originUrl])) {
  35745. $token = $authTokens[$originUrl];
  35746. }
  35747. if (isset($authTokens[$bcOriginUrl])) {
  35748. $token = $authTokens[$bcOriginUrl];
  35749. }
  35750. if (isset($token)) {
  35751. $username = is_array($token) ? $token["username"] : $token;
  35752. $password = is_array($token) ? $token["token"] : 'private-token';
  35753. if (in_array($username, ['private-token', 'gitlab-ci-token', 'oauth2'], true)) {
  35754. $this->io->setAuthentication($originUrl, $password, $username);
  35755. } else {
  35756. $this->io->setAuthentication($originUrl, $username, $password);
  35757. }
  35758. return true;
  35759. }
  35760. return false;
  35761. }
  35762. public function authorizeOAuthInteractively(string $scheme, string $originUrl, ?string $message = null): bool
  35763. {
  35764. if ($message) {
  35765. $this->io->writeError($message);
  35766. }
  35767. $localAuthConfig = $this->config->getLocalAuthConfigSource();
  35768. $personalAccessTokenLink = $scheme.'://'.$originUrl.'/-/profile/personal_access_tokens';
  35769. $revokeLink = $scheme.'://'.$originUrl.'/-/profile/applications';
  35770. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName()));
  35771. $this->io->writeError('To revoke access to this token you can visit:');
  35772. $this->io->writeError($revokeLink);
  35773. $this->io->writeError('Alternatively you can setup an personal access token on:');
  35774. $this->io->writeError($personalAccessTokenLink);
  35775. $this->io->writeError('and store it under "gitlab-token" see https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token for more details.');
  35776. $this->io->writeError('https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token');
  35777. $this->io->writeError('for more details.');
  35778. $storeInLocalAuthConfig = false;
  35779. if ($localAuthConfig !== null) {
  35780. $storeInLocalAuthConfig = $this->io->askConfirmation('A local auth config source was found, do you want to store the token there?', true);
  35781. }
  35782. $attemptCounter = 0;
  35783. while ($attemptCounter++ < 5) {
  35784. try {
  35785. $response = $this->createToken($scheme, $originUrl);
  35786. } catch (TransportException $e) {
  35787. if (in_array($e->getCode(), [403, 401])) {
  35788. if (401 === $e->getCode()) {
  35789. $response = json_decode($e->getResponse(), true);
  35790. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  35791. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  35792. } else {
  35793. $this->io->writeError('Bad credentials.');
  35794. }
  35795. } else {
  35796. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  35797. }
  35798. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at:');
  35799. $this->io->writeError($scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  35800. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  35801. continue;
  35802. }
  35803. throw $e;
  35804. }
  35805. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  35806. $authConfigSource = $storeInLocalAuthConfig && $localAuthConfig !== null ? $localAuthConfig : $this->config->getAuthConfigSource();
  35807. if (isset($response['expires_in'])) {
  35808. $authConfigSource->addConfigSetting(
  35809. 'gitlab-oauth.'.$originUrl,
  35810. [
  35811. 'expires-at' => intval($response['created_at']) + intval($response['expires_in']),
  35812. 'refresh-token' => $response['refresh_token'],
  35813. 'token' => $response['access_token'],
  35814. ]
  35815. );
  35816. } else {
  35817. $authConfigSource->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  35818. }
  35819. return true;
  35820. }
  35821. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  35822. }
  35823. public function authorizeOAuthRefresh(string $scheme, string $originUrl): bool
  35824. {
  35825. try {
  35826. $response = $this->refreshToken($scheme, $originUrl);
  35827. } catch (TransportException $e) {
  35828. $this->io->writeError("Couldn't refresh access token: ".$e->getMessage());
  35829. return false;
  35830. }
  35831. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  35832. $this->config->getAuthConfigSource()->addConfigSetting(
  35833. 'gitlab-oauth.'.$originUrl,
  35834. [
  35835. 'expires-at' => intval($response['created_at']) + intval($response['expires_in']),
  35836. 'refresh-token' => $response['refresh_token'],
  35837. 'token' => $response['access_token'],
  35838. ]
  35839. );
  35840. return true;
  35841. }
  35842. private function createToken(string $scheme, string $originUrl): array
  35843. {
  35844. $username = $this->io->ask('Username: ');
  35845. $password = $this->io->askAndHideAnswer('Password: ');
  35846. $headers = ['Content-Type: application/x-www-form-urlencoded'];
  35847. $apiUrl = $originUrl;
  35848. $data = http_build_query([
  35849. 'username' => $username,
  35850. 'password' => $password,
  35851. 'grant_type' => 'password',
  35852. ], '', '&');
  35853. $options = [
  35854. 'retry-auth-failure' => false,
  35855. 'http' => [
  35856. 'method' => 'POST',
  35857. 'header' => $headers,
  35858. 'content' => $data,
  35859. ],
  35860. ];
  35861. $token = $this->httpDownloader->get($scheme.'://'.$apiUrl.'/oauth/token', $options)->decodeJson();
  35862. $this->io->writeError('Token successfully created');
  35863. return $token;
  35864. }
  35865. public function isOAuthExpired(string $originUrl): bool
  35866. {
  35867. $authTokens = $this->config->get('gitlab-oauth');
  35868. if (isset($authTokens[$originUrl]['expires-at'])) {
  35869. if ($authTokens[$originUrl]['expires-at'] < time()) {
  35870. return true;
  35871. }
  35872. }
  35873. return false;
  35874. }
  35875. private function refreshToken(string $scheme, string $originUrl): array
  35876. {
  35877. $authTokens = $this->config->get('gitlab-oauth');
  35878. if (!isset($authTokens[$originUrl]['refresh-token'])) {
  35879. throw new \RuntimeException('No GitLab refresh token present for '.$originUrl.'.');
  35880. }
  35881. $refreshToken = $authTokens[$originUrl]['refresh-token'];
  35882. $headers = ['Content-Type: application/x-www-form-urlencoded'];
  35883. $data = http_build_query([
  35884. 'refresh_token' => $refreshToken,
  35885. 'grant_type' => 'refresh_token',
  35886. ], '', '&');
  35887. $options = [
  35888. 'retry-auth-failure' => false,
  35889. 'http' => [
  35890. 'method' => 'POST',
  35891. 'header' => $headers,
  35892. 'content' => $data,
  35893. ],
  35894. ];
  35895. $token = $this->httpDownloader->get($scheme.'://'.$originUrl.'/oauth/token', $options)->decodeJson();
  35896. $this->io->writeError('GitLab token successfully refreshed', true, IOInterface::VERY_VERBOSE);
  35897. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/-/profile/applications', true, IOInterface::VERY_VERBOSE);
  35898. return $token;
  35899. }
  35900. }
  35901. <?php declare(strict_types=1);
  35902. namespace Composer\Util;
  35903. use Composer\Config;
  35904. use Composer\IO\IOInterface;
  35905. use Composer\Pcre\Preg;
  35906. class Hg
  35907. {
  35908. private static $version = false;
  35909. private $io;
  35910. private $config;
  35911. private $process;
  35912. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  35913. {
  35914. $this->io = $io;
  35915. $this->config = $config;
  35916. $this->process = $process;
  35917. }
  35918. public function runCommand(callable $commandCallable, string $url, ?string $cwd): void
  35919. {
  35920. $this->config->prohibitUrlByConfig($url, $this->io);
  35921. $command = $commandCallable($url);
  35922. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  35923. return;
  35924. }
  35925. if (Preg::isMatch('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication((string) $match[5])) {
  35926. $auth = $this->io->getAuthentication((string) $match[5]);
  35927. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . $match[6];
  35928. $command = $commandCallable($authenticatedUrl);
  35929. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  35930. return;
  35931. }
  35932. $error = $this->process->getErrorOutput();
  35933. } else {
  35934. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  35935. }
  35936. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  35937. }
  35938. private function throwException($message, string $url): void
  35939. {
  35940. if (null === self::getVersion($this->process)) {
  35941. throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  35942. }
  35943. throw new \RuntimeException(Url::sanitize($message));
  35944. }
  35945. public static function getVersion(ProcessExecutor $process): ?string
  35946. {
  35947. if (false === self::$version) {
  35948. self::$version = null;
  35949. if (0 === $process->execute('hg --version', $output) && Preg::isMatch('/^.+? (\d+(?:\.\d+)+)(?:\+.*?)?\)?\r?\n/', $output, $matches)) {
  35950. self::$version = $matches[1];
  35951. }
  35952. }
  35953. return self::$version;
  35954. }
  35955. }
  35956. <?php declare(strict_types=1);
  35957. namespace Composer\Util\Http;
  35958. use Composer\Config;
  35959. use Composer\Downloader\MaxFileSizeExceededException;
  35960. use Composer\IO\IOInterface;
  35961. use Composer\Downloader\TransportException;
  35962. use Composer\Pcre\Preg;
  35963. use Composer\Util\Platform;
  35964. use Composer\Util\StreamContextFactory;
  35965. use Composer\Util\AuthHelper;
  35966. use Composer\Util\Url;
  35967. use Composer\Util\HttpDownloader;
  35968. use React\Promise\Promise;
  35969. class CurlDownloader
  35970. {
  35971. private $multiHandle;
  35972. private $shareHandle;
  35973. private $jobs = [];
  35974. private $io;
  35975. private $config;
  35976. private $authHelper;
  35977. private $selectTimeout = 5.0;
  35978. private $maxRedirects = 20;
  35979. private $maxRetries = 3;
  35980. private $proxyManager;
  35981. private $supportsSecureProxy;
  35982. protected $multiErrors = [
  35983. CURLM_BAD_HANDLE => ['CURLM_BAD_HANDLE', 'The passed-in handle is not a valid CURLM handle.'],
  35984. CURLM_BAD_EASY_HANDLE => ['CURLM_BAD_EASY_HANDLE', "An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle."],
  35985. CURLM_OUT_OF_MEMORY => ['CURLM_OUT_OF_MEMORY', 'You are doomed.'],
  35986. CURLM_INTERNAL_ERROR => ['CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!'],
  35987. ];
  35988. private static $options = [
  35989. 'http' => [
  35990. 'method' => CURLOPT_CUSTOMREQUEST,
  35991. 'content' => CURLOPT_POSTFIELDS,
  35992. 'header' => CURLOPT_HTTPHEADER,
  35993. 'timeout' => CURLOPT_TIMEOUT,
  35994. ],
  35995. 'ssl' => [
  35996. 'cafile' => CURLOPT_CAINFO,
  35997. 'capath' => CURLOPT_CAPATH,
  35998. 'verify_peer' => CURLOPT_SSL_VERIFYPEER,
  35999. 'verify_peer_name' => CURLOPT_SSL_VERIFYHOST,
  36000. 'local_cert' => CURLOPT_SSLCERT,
  36001. 'local_pk' => CURLOPT_SSLKEY,
  36002. 'passphrase' => CURLOPT_SSLKEYPASSWD,
  36003. ],
  36004. ];
  36005. private static $timeInfo = [
  36006. 'total_time' => true,
  36007. 'namelookup_time' => true,
  36008. 'connect_time' => true,
  36009. 'pretransfer_time' => true,
  36010. 'starttransfer_time' => true,
  36011. 'redirect_time' => true,
  36012. ];
  36013. public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false)
  36014. {
  36015. $this->io = $io;
  36016. $this->config = $config;
  36017. $this->multiHandle = $mh = curl_multi_init();
  36018. if (function_exists('curl_multi_setopt')) {
  36019. curl_multi_setopt($mh, CURLMOPT_PIPELINING, PHP_VERSION_ID >= 70400 ? 2 : 3);
  36020. if (defined('CURLMOPT_MAX_HOST_CONNECTIONS') && !defined('HHVM_VERSION')) {
  36021. curl_multi_setopt($mh, CURLMOPT_MAX_HOST_CONNECTIONS, 8);
  36022. }
  36023. }
  36024. if (function_exists('curl_share_init')) {
  36025. $this->shareHandle = $sh = curl_share_init();
  36026. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
  36027. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
  36028. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
  36029. }
  36030. $this->authHelper = new AuthHelper($io, $config);
  36031. $this->proxyManager = ProxyManager::getInstance();
  36032. $version = curl_version();
  36033. $features = $version['features'];
  36034. $this->supportsSecureProxy = defined('CURL_VERSION_HTTPS_PROXY') && ($features & CURL_VERSION_HTTPS_PROXY);
  36035. }
  36036. public function download(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null): int
  36037. {
  36038. $attributes = [];
  36039. if (isset($options['retry-auth-failure'])) {
  36040. $attributes['retryAuthFailure'] = $options['retry-auth-failure'];
  36041. unset($options['retry-auth-failure']);
  36042. }
  36043. return $this->initDownload($resolve, $reject, $origin, $url, $options, $copyTo, $attributes);
  36044. }
  36045. private function initDownload(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null, array $attributes = []): int
  36046. {
  36047. $attributes = array_merge([
  36048. 'retryAuthFailure' => true,
  36049. 'redirects' => 0,
  36050. 'retries' => 0,
  36051. 'storeAuth' => false,
  36052. 'ipResolve' => null,
  36053. ], $attributes);
  36054. if ($attributes['ipResolve'] === null && Platform::getEnv('COMPOSER_IPRESOLVE') === '4') {
  36055. $attributes['ipResolve'] = 4;
  36056. } elseif ($attributes['ipResolve'] === null && Platform::getEnv('COMPOSER_IPRESOLVE') === '6') {
  36057. $attributes['ipResolve'] = 6;
  36058. }
  36059. $originalOptions = $options;
  36060. if (!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $url) || (false === strpos($url, '$') && false === strpos($url, '%24'))) {
  36061. $this->config->prohibitUrlByConfig($url, $this->io, $options);
  36062. }
  36063. $curlHandle = curl_init();
  36064. $headerHandle = fopen('php://temp/maxmemory:32768', 'w+b');
  36065. if (false === $headerHandle) {
  36066. throw new \RuntimeException('Failed to open a temp stream to store curl headers');
  36067. }
  36068. if ($copyTo !== null) {
  36069. $bodyTarget = $copyTo.'~';
  36070. } else {
  36071. $bodyTarget = 'php://temp/maxmemory:524288';
  36072. }
  36073. $errorMessage = '';
  36074. set_error_handler(static function ($code, $msg) use (&$errorMessage): void {
  36075. if ($errorMessage) {
  36076. $errorMessage .= "\n";
  36077. }
  36078. $errorMessage .= Preg::replace('{^fopen\(.*?\): }', '', $msg);
  36079. });
  36080. $bodyHandle = fopen($bodyTarget, 'w+b');
  36081. restore_error_handler();
  36082. if (false === $bodyHandle) {
  36083. throw new TransportException('The "'.$url.'" file could not be written to '.($copyTo ?? 'a temporary file').': '.$errorMessage);
  36084. }
  36085. curl_setopt($curlHandle, CURLOPT_URL, $url);
  36086. curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, false);
  36087. curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 10);
  36088. curl_setopt($curlHandle, CURLOPT_TIMEOUT, max((int) ini_get("default_socket_timeout"), 300));
  36089. curl_setopt($curlHandle, CURLOPT_WRITEHEADER, $headerHandle);
  36090. curl_setopt($curlHandle, CURLOPT_FILE, $bodyHandle);
  36091. curl_setopt($curlHandle, CURLOPT_ENCODING, "");
  36092. curl_setopt($curlHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
  36093. if ($attributes['ipResolve'] === 4) {
  36094. curl_setopt($curlHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
  36095. } elseif ($attributes['ipResolve'] === 6) {
  36096. curl_setopt($curlHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
  36097. }
  36098. if (function_exists('curl_share_init')) {
  36099. curl_setopt($curlHandle, CURLOPT_SHARE, $this->shareHandle);
  36100. }
  36101. if (!isset($options['http']['header'])) {
  36102. $options['http']['header'] = [];
  36103. }
  36104. $options['http']['header'] = array_diff($options['http']['header'], ['Connection: close']);
  36105. $options['http']['header'][] = 'Connection: keep-alive';
  36106. $version = curl_version();
  36107. $features = $version['features'];
  36108. if (0 === strpos($url, 'https://') && \defined('CURL_VERSION_HTTP2') && \defined('CURL_HTTP_VERSION_2_0') && (CURL_VERSION_HTTP2 & $features)) {
  36109. curl_setopt($curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
  36110. }
  36111. $options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
  36112. $options = StreamContextFactory::initOptions($url, $options, true);
  36113. foreach (self::$options as $type => $curlOptions) {
  36114. foreach ($curlOptions as $name => $curlOption) {
  36115. if (isset($options[$type][$name])) {
  36116. if ($type === 'ssl' && $name === 'verify_peer_name') {
  36117. curl_setopt($curlHandle, $curlOption, $options[$type][$name] === true ? 2 : $options[$type][$name]);
  36118. } else {
  36119. curl_setopt($curlHandle, $curlOption, $options[$type][$name]);
  36120. }
  36121. }
  36122. }
  36123. }
  36124. $proxy = $this->proxyManager->getProxyForRequest($url);
  36125. if ($proxy->getUrl() !== '') {
  36126. curl_setopt($curlHandle, CURLOPT_PROXY, $proxy->getUrl());
  36127. }
  36128. if ($proxy->isSecure()) {
  36129. if (!$this->supportsSecureProxy) {
  36130. throw new TransportException('Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.');
  36131. }
  36132. if (!empty($options['ssl']['cafile'])) {
  36133. curl_setopt($curlHandle, CURLOPT_PROXY_CAINFO, $options['ssl']['cafile']);
  36134. }
  36135. if (!empty($options['ssl']['capath'])) {
  36136. curl_setopt($curlHandle, CURLOPT_PROXY_CAPATH, $options['ssl']['capath']);
  36137. }
  36138. }
  36139. $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
  36140. $this->jobs[(int) $curlHandle] = [
  36141. 'url' => $url,
  36142. 'origin' => $origin,
  36143. 'attributes' => $attributes,
  36144. 'options' => $originalOptions,
  36145. 'progress' => $progress,
  36146. 'curlHandle' => $curlHandle,
  36147. 'filename' => $copyTo,
  36148. 'headerHandle' => $headerHandle,
  36149. 'bodyHandle' => $bodyHandle,
  36150. 'resolve' => $resolve,
  36151. 'reject' => $reject,
  36152. ];
  36153. $usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
  36154. $ifModified = false !== stripos(implode(',', $options['http']['header']), 'if-modified-since:') ? ' if modified' : '';
  36155. if ($attributes['redirects'] === 0 && $attributes['retries'] === 0) {
  36156. $this->io->writeError('Downloading ' . Url::sanitize($url) . $usingProxy . $ifModified, true, IOInterface::DEBUG);
  36157. }
  36158. $this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
  36159. return (int) $curlHandle;
  36160. }
  36161. public function abortRequest(int $id): void
  36162. {
  36163. if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) {
  36164. $job = $this->jobs[$id];
  36165. curl_multi_remove_handle($this->multiHandle, $job['curlHandle']);
  36166. curl_close($job['curlHandle']);
  36167. if (is_resource($job['headerHandle'])) {
  36168. fclose($job['headerHandle']);
  36169. }
  36170. if (is_resource($job['bodyHandle'])) {
  36171. fclose($job['bodyHandle']);
  36172. }
  36173. if (null !== $job['filename']) {
  36174. @unlink($job['filename'].'~');
  36175. }
  36176. unset($this->jobs[$id]);
  36177. }
  36178. }
  36179. public function tick(): void
  36180. {
  36181. static $timeoutWarning = false;
  36182. if (count($this->jobs) === 0) {
  36183. return;
  36184. }
  36185. $active = true;
  36186. $this->checkCurlResult(curl_multi_exec($this->multiHandle, $active));
  36187. if (-1 === curl_multi_select($this->multiHandle, $this->selectTimeout)) {
  36188. usleep(150);
  36189. }
  36190. while ($progress = curl_multi_info_read($this->multiHandle)) {
  36191. $curlHandle = $progress['handle'];
  36192. $result = $progress['result'];
  36193. $i = (int) $curlHandle;
  36194. if (!isset($this->jobs[$i])) {
  36195. continue;
  36196. }
  36197. $progress = curl_getinfo($curlHandle);
  36198. if (false === $progress) {
  36199. throw new \RuntimeException('Failed getting info from curl handle '.$i.' ('.$this->jobs[$i]['url'].')');
  36200. }
  36201. $job = $this->jobs[$i];
  36202. unset($this->jobs[$i]);
  36203. $error = curl_error($curlHandle);
  36204. $errno = curl_errno($curlHandle);
  36205. curl_multi_remove_handle($this->multiHandle, $curlHandle);
  36206. curl_close($curlHandle);
  36207. $headers = null;
  36208. $statusCode = null;
  36209. $response = null;
  36210. try {
  36211. if (CURLE_OK !== $errno || $error || $result !== CURLE_OK) {
  36212. $errno = $errno ?: $result;
  36213. if (!$error && function_exists('curl_strerror')) {
  36214. $error = curl_strerror($errno);
  36215. }
  36216. $progress['error_code'] = $errno;
  36217. if (
  36218. (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
  36219. && (
  36220. in_array($errno, [7 , 16 , 92 , 6 ], true)
  36221. || (in_array($errno, [56 , 35 ], true) && str_contains((string) $error, 'Connection reset by peer'))
  36222. ) && $job['attributes']['retries'] < $this->maxRetries
  36223. ) {
  36224. $attributes = ['retries' => $job['attributes']['retries'] + 1];
  36225. if ($errno === 7 && !isset($job['attributes']['ipResolve'])) {
  36226. $attributes['ipResolve'] = 4;
  36227. }
  36228. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to curl error '. $errno, true, IOInterface::DEBUG);
  36229. $this->restartJobWithDelay($job, $job['url'], $attributes);
  36230. continue;
  36231. }
  36232. if ($errno === 55 ) {
  36233. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to curl error '. $errno, true, IOInterface::DEBUG);
  36234. $this->restartJobWithDelay($job, $job['url'], ['retries' => $job['attributes']['retries'] + 1]);
  36235. continue;
  36236. }
  36237. if ($errno === 28 && PHP_VERSION_ID >= 70300 && $progress['namelookup_time'] === 0.0 && !$timeoutWarning) {
  36238. $timeoutWarning = true;
  36239. $this->io->writeError('<warning>A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.</warning>');
  36240. }
  36241. throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error);
  36242. }
  36243. $statusCode = $progress['http_code'];
  36244. rewind($job['headerHandle']);
  36245. $headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle'])));
  36246. fclose($job['headerHandle']);
  36247. if ($statusCode === 0) {
  36248. throw new \LogicException('Received unexpected http status code 0 without error for '.Url::sanitize($progress['url']).': headers '.var_export($headers, true).' curl info '.var_export($progress, true));
  36249. }
  36250. if (null !== $job['filename']) {
  36251. $contents = $job['filename'].'~';
  36252. if ($statusCode >= 300) {
  36253. rewind($job['bodyHandle']);
  36254. $contents = stream_get_contents($job['bodyHandle']);
  36255. }
  36256. $response = new CurlResponse(['url' => $job['url']], $statusCode, $headers, $contents, $progress);
  36257. $this->io->writeError('['.$statusCode.'] '.Url::sanitize($job['url']), true, IOInterface::DEBUG);
  36258. } else {
  36259. $maxFileSize = $job['options']['max_file_size'] ?? null;
  36260. rewind($job['bodyHandle']);
  36261. if ($maxFileSize !== null) {
  36262. $contents = stream_get_contents($job['bodyHandle'], $maxFileSize);
  36263. if ($contents !== false && Platform::strlen($contents) >= $maxFileSize) {
  36264. throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($contents) . ' of allowed ' . $maxFileSize . ' bytes');
  36265. }
  36266. } else {
  36267. $contents = stream_get_contents($job['bodyHandle']);
  36268. }
  36269. $response = new CurlResponse(['url' => $job['url']], $statusCode, $headers, $contents, $progress);
  36270. $this->io->writeError('['.$statusCode.'] '.Url::sanitize($job['url']), true, IOInterface::DEBUG);
  36271. }
  36272. fclose($job['bodyHandle']);
  36273. if ($response->getStatusCode() >= 400 && $response->getHeader('content-type') === 'application/json') {
  36274. HttpDownloader::outputWarnings($this->io, $job['origin'], json_decode($response->getBody(), true));
  36275. }
  36276. $result = $this->isAuthenticatedRetryNeeded($job, $response);
  36277. if ($result['retry']) {
  36278. $this->restartJob($job, $job['url'], ['storeAuth' => $result['storeAuth'], 'retries' => $job['attributes']['retries'] + 1]);
  36279. continue;
  36280. }
  36281. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $job['attributes']['redirects'] < $this->maxRedirects) {
  36282. $location = $this->handleRedirect($job, $response);
  36283. if ($location) {
  36284. $this->restartJob($job, $location, ['redirects' => $job['attributes']['redirects'] + 1]);
  36285. continue;
  36286. }
  36287. }
  36288. if ($statusCode >= 400 && $statusCode <= 599) {
  36289. if (
  36290. (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
  36291. && in_array($statusCode, [423, 425, 500, 502, 503, 504, 507, 510], true)
  36292. && $job['attributes']['retries'] < $this->maxRetries
  36293. ) {
  36294. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to status code '. $statusCode, true, IOInterface::DEBUG);
  36295. $this->restartJobWithDelay($job, $job['url'], ['retries' => $job['attributes']['retries'] + 1]);
  36296. continue;
  36297. }
  36298. throw $this->failResponse($job, $response, $response->getStatusMessage());
  36299. }
  36300. if ($job['attributes']['storeAuth'] !== false) {
  36301. $this->authHelper->storeAuth($job['origin'], $job['attributes']['storeAuth']);
  36302. }
  36303. if (null !== $job['filename']) {
  36304. rename($job['filename'].'~', $job['filename']);
  36305. $job['resolve']($response);
  36306. } else {
  36307. $job['resolve']($response);
  36308. }
  36309. } catch (\Exception $e) {
  36310. if ($e instanceof TransportException) {
  36311. if (null !== $headers) {
  36312. $e->setHeaders($headers);
  36313. $e->setStatusCode($statusCode);
  36314. }
  36315. if (null !== $response) {
  36316. $e->setResponse($response->getBody());
  36317. }
  36318. $e->setResponseInfo($progress);
  36319. }
  36320. $this->rejectJob($job, $e);
  36321. }
  36322. }
  36323. foreach ($this->jobs as $i => $curlHandle) {
  36324. $curlHandle = $this->jobs[$i]['curlHandle'];
  36325. $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
  36326. if ($this->jobs[$i]['progress'] !== $progress) {
  36327. $this->jobs[$i]['progress'] = $progress;
  36328. if (isset($this->jobs[$i]['options']['max_file_size'])) {
  36329. if ($this->jobs[$i]['options']['max_file_size'] < $progress['download_content_length']) {
  36330. $this->rejectJob($this->jobs[$i], new MaxFileSizeExceededException('Maximum allowed download size reached. Content-length header indicates ' . $progress['download_content_length'] . ' bytes. Allowed ' . $this->jobs[$i]['options']['max_file_size'] . ' bytes'));
  36331. }
  36332. if ($this->jobs[$i]['options']['max_file_size'] < $progress['size_download']) {
  36333. $this->rejectJob($this->jobs[$i], new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . $progress['size_download'] . ' of allowed ' . $this->jobs[$i]['options']['max_file_size'] . ' bytes'));
  36334. }
  36335. }
  36336. }
  36337. }
  36338. }
  36339. private function handleRedirect(array $job, Response $response): string
  36340. {
  36341. if ($locationHeader = $response->getHeader('location')) {
  36342. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  36343. $targetUrl = $locationHeader;
  36344. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  36345. $targetUrl = parse_url($job['url'], PHP_URL_SCHEME).':'.$locationHeader;
  36346. } elseif ('/' === $locationHeader[0]) {
  36347. $urlHost = parse_url($job['url'], PHP_URL_HOST);
  36348. $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $job['url']);
  36349. } else {
  36350. $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $job['url']);
  36351. }
  36352. }
  36353. if (!empty($targetUrl)) {
  36354. $this->io->writeError(sprintf('Following redirect (%u) %s', $job['attributes']['redirects'] + 1, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
  36355. return $targetUrl;
  36356. }
  36357. throw new TransportException('The "'.$job['url'].'" file could not be downloaded, got redirect without Location ('.$response->getStatusMessage().')');
  36358. }
  36359. private function isAuthenticatedRetryNeeded(array $job, Response $response): array
  36360. {
  36361. if (in_array($response->getStatusCode(), [401, 403]) && $job['attributes']['retryAuthFailure']) {
  36362. $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], $response->getStatusCode(), $response->getStatusMessage(), $response->getHeaders(), $job['attributes']['retries']);
  36363. if ($result['retry']) {
  36364. return $result;
  36365. }
  36366. }
  36367. $locationHeader = $response->getHeader('location');
  36368. $needsAuthRetry = false;
  36369. if (
  36370. $job['origin'] === 'bitbucket.org'
  36371. && !$this->authHelper->isPublicBitBucketDownload($job['url'])
  36372. && substr($job['url'], -4) === '.zip'
  36373. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  36374. && Preg::isMatch('{^text/html\b}i', $response->getHeader('content-type'))
  36375. ) {
  36376. $needsAuthRetry = 'Bitbucket requires authentication and it was not provided';
  36377. }
  36378. if (
  36379. $response->getStatusCode() === 404
  36380. && in_array($job['origin'], $this->config->get('gitlab-domains'), true)
  36381. && false !== strpos($job['url'], 'archive.zip')
  36382. ) {
  36383. $needsAuthRetry = 'GitLab requires authentication and it was not provided';
  36384. }
  36385. if ($needsAuthRetry) {
  36386. if ($job['attributes']['retryAuthFailure']) {
  36387. $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], 401, null, [], $job['attributes']['retries']);
  36388. if ($result['retry']) {
  36389. return $result;
  36390. }
  36391. }
  36392. throw $this->failResponse($job, $response, $needsAuthRetry);
  36393. }
  36394. return ['retry' => false, 'storeAuth' => false];
  36395. }
  36396. private function restartJob(array $job, string $url, array $attributes = []): void
  36397. {
  36398. if (null !== $job['filename']) {
  36399. @unlink($job['filename'].'~');
  36400. }
  36401. $attributes = array_merge($job['attributes'], $attributes);
  36402. $origin = Url::getOrigin($this->config, $url);
  36403. $this->initDownload($job['resolve'], $job['reject'], $origin, $url, $job['options'], $job['filename'], $attributes);
  36404. }
  36405. private function restartJobWithDelay(array $job, string $url, array $attributes): void
  36406. {
  36407. if ($attributes['retries'] >= 3) {
  36408. usleep(500000);
  36409. } elseif ($attributes['retries'] >= 2) {
  36410. usleep(100000);
  36411. }
  36412. $this->restartJob($job, $url, $attributes);
  36413. }
  36414. private function failResponse(array $job, Response $response, string $errorMessage): TransportException
  36415. {
  36416. if (null !== $job['filename']) {
  36417. @unlink($job['filename'].'~');
  36418. }
  36419. $details = '';
  36420. if (in_array(strtolower((string) $response->getHeader('content-type')), ['application/json', 'application/json; charset=utf-8'], true)) {
  36421. $details = ':'.PHP_EOL.substr($response->getBody(), 0, 200).(strlen($response->getBody()) > 200 ? '...' : '');
  36422. }
  36423. return new TransportException('The "'.$job['url'].'" file could not be downloaded ('.$errorMessage.')' . $details, $response->getStatusCode());
  36424. }
  36425. private function rejectJob(array $job, \Exception $e): void
  36426. {
  36427. if (is_resource($job['headerHandle'])) {
  36428. fclose($job['headerHandle']);
  36429. }
  36430. if (is_resource($job['bodyHandle'])) {
  36431. fclose($job['bodyHandle']);
  36432. }
  36433. if (null !== $job['filename']) {
  36434. @unlink($job['filename'].'~');
  36435. }
  36436. $job['reject']($e);
  36437. }
  36438. private function checkCurlResult(int $code): void
  36439. {
  36440. if ($code !== CURLM_OK && $code !== CURLM_CALL_MULTI_PERFORM) {
  36441. throw new \RuntimeException(
  36442. isset($this->multiErrors[$code])
  36443. ? "cURL error: {$code} ({$this->multiErrors[$code][0]}): cURL message: {$this->multiErrors[$code][1]}"
  36444. : 'Unexpected cURL error: ' . $code
  36445. );
  36446. }
  36447. }
  36448. }
  36449. <?php declare(strict_types=1);
  36450. namespace Composer\Util\Http;
  36451. class CurlResponse extends Response
  36452. {
  36453. private $curlInfo;
  36454. public function __construct(array $request, ?int $code, array $headers, ?string $body, array $curlInfo)
  36455. {
  36456. parent::__construct($request, $code, $headers, $body);
  36457. $this->curlInfo = $curlInfo;
  36458. }
  36459. public function getCurlInfo(): array
  36460. {
  36461. return $this->curlInfo;
  36462. }
  36463. }
  36464. <?php declare(strict_types=1);
  36465. namespace Composer\Util\Http;
  36466. class ProxyHelper
  36467. {
  36468. public static function getProxyData(): array
  36469. {
  36470. $httpProxy = null;
  36471. $httpsProxy = null;
  36472. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  36473. if ($env = self::getProxyEnv(['http_proxy', 'HTTP_PROXY'], $name)) {
  36474. $httpProxy = self::checkProxy($env, $name);
  36475. }
  36476. }
  36477. if ($env = self::getProxyEnv(['CGI_HTTP_PROXY'], $name)) {
  36478. $httpProxy = self::checkProxy($env, $name);
  36479. }
  36480. if ($env = self::getProxyEnv(['https_proxy', 'HTTPS_PROXY'], $name)) {
  36481. $httpsProxy = self::checkProxy($env, $name);
  36482. } else {
  36483. $httpsProxy = $httpProxy;
  36484. }
  36485. $noProxy = self::getProxyEnv(['no_proxy', 'NO_PROXY'], $name);
  36486. return [$httpProxy, $httpsProxy, $noProxy];
  36487. }
  36488. public static function getContextOptions(string $proxyUrl): array
  36489. {
  36490. $proxy = parse_url($proxyUrl);
  36491. $proxyUrl = self::formatParsedUrl($proxy, false);
  36492. $proxyUrl = str_replace(['http://', 'https://'], ['tcp://', 'ssl://'], $proxyUrl);
  36493. $options['http']['proxy'] = $proxyUrl;
  36494. if (isset($proxy['user'])) {
  36495. $auth = rawurldecode($proxy['user']);
  36496. if (isset($proxy['pass'])) {
  36497. $auth .= ':' . rawurldecode($proxy['pass']);
  36498. }
  36499. $auth = base64_encode($auth);
  36500. $options['http']['header'] = "Proxy-Authorization: Basic {$auth}";
  36501. }
  36502. return $options;
  36503. }
  36504. public static function setRequestFullUri(string $requestUrl, array &$options): void
  36505. {
  36506. if ('http' === parse_url($requestUrl, PHP_URL_SCHEME)) {
  36507. $options['http']['request_fulluri'] = true;
  36508. } else {
  36509. unset($options['http']['request_fulluri']);
  36510. }
  36511. }
  36512. private static function getProxyEnv(array $names, ?string &$name): ?string
  36513. {
  36514. foreach ($names as $name) {
  36515. if (!empty($_SERVER[$name])) {
  36516. return $_SERVER[$name];
  36517. }
  36518. }
  36519. return null;
  36520. }
  36521. private static function checkProxy(string $proxyUrl, string $envName): string
  36522. {
  36523. $error = sprintf('malformed %s url', $envName);
  36524. $proxy = parse_url($proxyUrl);
  36525. if (!isset($proxy['host'])) {
  36526. throw new \RuntimeException($error);
  36527. }
  36528. $proxyUrl = self::formatParsedUrl($proxy, true);
  36529. if (!parse_url($proxyUrl, PHP_URL_PORT)) {
  36530. throw new \RuntimeException($error);
  36531. }
  36532. return $proxyUrl;
  36533. }
  36534. private static function formatParsedUrl(array $proxy, bool $includeAuth): string
  36535. {
  36536. $proxyUrl = isset($proxy['scheme']) ? strtolower($proxy['scheme']) . '://' : '';
  36537. if ($includeAuth && isset($proxy['user'])) {
  36538. $proxyUrl .= $proxy['user'];
  36539. if (isset($proxy['pass'])) {
  36540. $proxyUrl .= ':' . $proxy['pass'];
  36541. }
  36542. $proxyUrl .= '@';
  36543. }
  36544. $proxyUrl .= $proxy['host'];
  36545. if (isset($proxy['port'])) {
  36546. $proxyUrl .= ':' . $proxy['port'];
  36547. } elseif (strpos($proxyUrl, 'http://') === 0) {
  36548. $proxyUrl .= ':80';
  36549. } elseif (strpos($proxyUrl, 'https://') === 0) {
  36550. $proxyUrl .= ':443';
  36551. }
  36552. return $proxyUrl;
  36553. }
  36554. }
  36555. <?php declare(strict_types=1);
  36556. namespace Composer\Util\Http;
  36557. use Composer\Downloader\TransportException;
  36558. use Composer\Util\NoProxyPattern;
  36559. use Composer\Util\Url;
  36560. class ProxyManager
  36561. {
  36562. private $error = null;
  36563. private $fullProxy;
  36564. private $safeProxy;
  36565. private $streams;
  36566. private $hasProxy;
  36567. private $info = null;
  36568. private $noProxyHandler = null;
  36569. private static $instance = null;
  36570. private function __construct()
  36571. {
  36572. $this->fullProxy = $this->safeProxy = [
  36573. 'http' => null,
  36574. 'https' => null,
  36575. ];
  36576. $this->streams['http'] = $this->streams['https'] = [
  36577. 'options' => null,
  36578. ];
  36579. $this->hasProxy = false;
  36580. $this->initProxyData();
  36581. }
  36582. public static function getInstance(): ProxyManager
  36583. {
  36584. if (!self::$instance) {
  36585. self::$instance = new self();
  36586. }
  36587. return self::$instance;
  36588. }
  36589. public static function reset(): void
  36590. {
  36591. self::$instance = null;
  36592. }
  36593. public function getProxyForRequest(string $requestUrl): RequestProxy
  36594. {
  36595. if ($this->error) {
  36596. throw new TransportException('Unable to use a proxy: '.$this->error);
  36597. }
  36598. $scheme = parse_url($requestUrl, PHP_URL_SCHEME) ?: 'http';
  36599. $proxyUrl = '';
  36600. $options = [];
  36601. $formattedProxyUrl = '';
  36602. if ($this->hasProxy && in_array($scheme, ['http', 'https'], true) && $this->fullProxy[$scheme]) {
  36603. if ($this->noProxy($requestUrl)) {
  36604. $formattedProxyUrl = 'excluded by no_proxy';
  36605. } else {
  36606. $proxyUrl = $this->fullProxy[$scheme];
  36607. $options = $this->streams[$scheme]['options'];
  36608. ProxyHelper::setRequestFullUri($requestUrl, $options);
  36609. $formattedProxyUrl = $this->safeProxy[$scheme];
  36610. }
  36611. }
  36612. return new RequestProxy($proxyUrl, $options, $formattedProxyUrl);
  36613. }
  36614. public function isProxying(): bool
  36615. {
  36616. return $this->hasProxy;
  36617. }
  36618. public function getFormattedProxy(): ?string
  36619. {
  36620. return $this->hasProxy ? $this->info : $this->error;
  36621. }
  36622. private function initProxyData(): void
  36623. {
  36624. try {
  36625. [$httpProxy, $httpsProxy, $noProxy] = ProxyHelper::getProxyData();
  36626. } catch (\RuntimeException $e) {
  36627. $this->error = $e->getMessage();
  36628. return;
  36629. }
  36630. $info = [];
  36631. if ($httpProxy) {
  36632. $info[] = $this->setData($httpProxy, 'http');
  36633. }
  36634. if ($httpsProxy) {
  36635. $info[] = $this->setData($httpsProxy, 'https');
  36636. }
  36637. if ($this->hasProxy) {
  36638. $this->info = implode(', ', $info);
  36639. if ($noProxy) {
  36640. $this->noProxyHandler = new NoProxyPattern($noProxy);
  36641. }
  36642. }
  36643. }
  36644. private function setData($url, $scheme): string
  36645. {
  36646. $safeProxy = Url::sanitize($url);
  36647. $this->fullProxy[$scheme] = $url;
  36648. $this->safeProxy[$scheme] = $safeProxy;
  36649. $this->streams[$scheme]['options'] = ProxyHelper::getContextOptions($url);
  36650. $this->hasProxy = true;
  36651. return sprintf('%s=%s', $scheme, $safeProxy);
  36652. }
  36653. private function noProxy(string $requestUrl): bool
  36654. {
  36655. return $this->noProxyHandler && $this->noProxyHandler->test($requestUrl);
  36656. }
  36657. }
  36658. <?php declare(strict_types=1);
  36659. namespace Composer\Util\Http;
  36660. use Composer\Util\Url;
  36661. class RequestProxy
  36662. {
  36663. private $contextOptions;
  36664. private $isSecure;
  36665. private $formattedUrl;
  36666. private $url;
  36667. public function __construct(string $url, array $contextOptions, string $formattedUrl)
  36668. {
  36669. $this->url = $url;
  36670. $this->contextOptions = $contextOptions;
  36671. $this->formattedUrl = $formattedUrl;
  36672. $this->isSecure = 0 === strpos($url, 'https://');
  36673. }
  36674. public function getContextOptions(): array
  36675. {
  36676. return $this->contextOptions;
  36677. }
  36678. public function getFormattedUrl(?string $format = ''): string
  36679. {
  36680. $result = '';
  36681. if ($this->formattedUrl) {
  36682. $format = $format ?: '%s';
  36683. $result = sprintf($format, $this->formattedUrl);
  36684. }
  36685. return $result;
  36686. }
  36687. public function getUrl(): string
  36688. {
  36689. return $this->url;
  36690. }
  36691. public function isSecure(): bool
  36692. {
  36693. return $this->isSecure;
  36694. }
  36695. }
  36696. <?php declare(strict_types=1);
  36697. namespace Composer\Util\Http;
  36698. use Composer\Json\JsonFile;
  36699. use Composer\Pcre\Preg;
  36700. use Composer\Util\HttpDownloader;
  36701. class Response
  36702. {
  36703. private $request;
  36704. private $code;
  36705. private $headers;
  36706. private $body;
  36707. public function __construct(array $request, ?int $code, array $headers, ?string $body)
  36708. {
  36709. if (!isset($request['url'])) {
  36710. throw new \LogicException('url key missing from request array');
  36711. }
  36712. $this->request = $request;
  36713. $this->code = (int) $code;
  36714. $this->headers = $headers;
  36715. $this->body = $body;
  36716. }
  36717. public function getStatusCode(): int
  36718. {
  36719. return $this->code;
  36720. }
  36721. public function getStatusMessage(): ?string
  36722. {
  36723. $value = null;
  36724. foreach ($this->headers as $header) {
  36725. if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
  36726. $value = $header;
  36727. }
  36728. }
  36729. return $value;
  36730. }
  36731. public function getHeaders(): array
  36732. {
  36733. return $this->headers;
  36734. }
  36735. public function getHeader(string $name): ?string
  36736. {
  36737. return self::findHeaderValue($this->headers, $name);
  36738. }
  36739. public function getBody(): ?string
  36740. {
  36741. return $this->body;
  36742. }
  36743. public function decodeJson()
  36744. {
  36745. return JsonFile::parseJson($this->body, $this->request['url']);
  36746. }
  36747. public function collect(): void
  36748. {
  36749. $this->request = $this->code = $this->headers = $this->body = null;
  36750. }
  36751. public static function findHeaderValue(array $headers, string $name): ?string
  36752. {
  36753. $value = null;
  36754. foreach ($headers as $header) {
  36755. if (Preg::isMatch('{^'.preg_quote($name).':\s*(.+?)\s*$}i', $header, $match)) {
  36756. $value = $match[1];
  36757. }
  36758. }
  36759. return $value;
  36760. }
  36761. }
  36762. <?php declare(strict_types=1);
  36763. namespace Composer\Util;
  36764. use Composer\Config;
  36765. use Composer\IO\IOInterface;
  36766. use Composer\Downloader\TransportException;
  36767. use Composer\Pcre\Preg;
  36768. use Composer\Util\Http\Response;
  36769. use Composer\Util\Http\CurlDownloader;
  36770. use Composer\Composer;
  36771. use Composer\Package\Version\VersionParser;
  36772. use Composer\Semver\Constraint\Constraint;
  36773. use Composer\Exception\IrrecoverableDownloadException;
  36774. use React\Promise\Promise;
  36775. use React\Promise\PromiseInterface;
  36776. class HttpDownloader
  36777. {
  36778. private const STATUS_QUEUED = 1;
  36779. private const STATUS_STARTED = 2;
  36780. private const STATUS_COMPLETED = 3;
  36781. private const STATUS_FAILED = 4;
  36782. private const STATUS_ABORTED = 5;
  36783. private $io;
  36784. private $config;
  36785. private $jobs = [];
  36786. private $options = [];
  36787. private $runningJobs = 0;
  36788. private $maxJobs = 12;
  36789. private $curl;
  36790. private $rfs;
  36791. private $idGen = 0;
  36792. private $disabled;
  36793. private $allowAsync = false;
  36794. public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false)
  36795. {
  36796. $this->io = $io;
  36797. $this->disabled = (bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK');
  36798. if ($disableTls === false) {
  36799. $this->options = StreamContextFactory::getTlsDefaults($options, $io);
  36800. }
  36801. $this->options = array_replace_recursive($this->options, $options);
  36802. $this->config = $config;
  36803. if (self::isCurlEnabled()) {
  36804. $this->curl = new CurlDownloader($io, $config, $options, $disableTls);
  36805. }
  36806. $this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls);
  36807. if (is_numeric($maxJobs = Platform::getEnv('COMPOSER_MAX_PARALLEL_HTTP'))) {
  36808. $this->maxJobs = max(1, min(50, (int) $maxJobs));
  36809. }
  36810. }
  36811. public function get(string $url, array $options = [])
  36812. {
  36813. if ('' === $url) {
  36814. throw new \InvalidArgumentException('$url must not be an empty string');
  36815. }
  36816. [$job, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true);
  36817. $promise->then(null, function (\Throwable $e) {
  36818. });
  36819. $this->wait($job['id']);
  36820. $response = $this->getResponse($job['id']);
  36821. return $response;
  36822. }
  36823. public function add(string $url, array $options = [])
  36824. {
  36825. if ('' === $url) {
  36826. throw new \InvalidArgumentException('$url must not be an empty string');
  36827. }
  36828. [, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null]);
  36829. return $promise;
  36830. }
  36831. public function copy(string $url, string $to, array $options = [])
  36832. {
  36833. if ('' === $url) {
  36834. throw new \InvalidArgumentException('$url must not be an empty string');
  36835. }
  36836. [$job] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => $to], true);
  36837. $this->wait($job['id']);
  36838. return $this->getResponse($job['id']);
  36839. }
  36840. public function addCopy(string $url, string $to, array $options = [])
  36841. {
  36842. if ('' === $url) {
  36843. throw new \InvalidArgumentException('$url must not be an empty string');
  36844. }
  36845. [, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => $to]);
  36846. return $promise;
  36847. }
  36848. public function getOptions()
  36849. {
  36850. return $this->options;
  36851. }
  36852. public function setOptions(array $options)
  36853. {
  36854. $this->options = array_replace_recursive($this->options, $options);
  36855. }
  36856. private function addJob(array $request, bool $sync = false): array
  36857. {
  36858. $request['options'] = array_replace_recursive($this->options, $request['options']);
  36859. $job = [
  36860. 'id' => $this->idGen++,
  36861. 'status' => self::STATUS_QUEUED,
  36862. 'request' => $request,
  36863. 'sync' => $sync,
  36864. 'origin' => Url::getOrigin($this->config, $request['url']),
  36865. ];
  36866. if (!$sync && !$this->allowAsync) {
  36867. throw new \LogicException('You must use the HttpDownloader instance which is part of a Composer\Loop instance to be able to run async http requests');
  36868. }
  36869. if (Preg::isMatchStrictGroups('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $request['url'], $match)) {
  36870. $this->io->setAuthentication($job['origin'], rawurldecode($match[1]), rawurldecode($match[2]));
  36871. }
  36872. $rfs = $this->rfs;
  36873. if ($this->canUseCurl($job)) {
  36874. $resolver = static function ($resolve, $reject) use (&$job): void {
  36875. $job['status'] = HttpDownloader::STATUS_QUEUED;
  36876. $job['resolve'] = $resolve;
  36877. $job['reject'] = $reject;
  36878. };
  36879. } else {
  36880. $resolver = static function ($resolve, $reject) use (&$job, $rfs): void {
  36881. $url = $job['request']['url'];
  36882. $options = $job['request']['options'];
  36883. $job['status'] = HttpDownloader::STATUS_STARTED;
  36884. if ($job['request']['copyTo']) {
  36885. $rfs->copy($job['origin'], $url, $job['request']['copyTo'], false , $options);
  36886. $headers = $rfs->getLastHeaders();
  36887. $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $job['request']['copyTo'].'~');
  36888. $resolve($response);
  36889. } else {
  36890. $body = $rfs->getContents($job['origin'], $url, false , $options);
  36891. $headers = $rfs->getLastHeaders();
  36892. $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $body);
  36893. $resolve($response);
  36894. }
  36895. };
  36896. }
  36897. $curl = $this->curl;
  36898. $canceler = static function () use (&$job, $curl): void {
  36899. if ($job['status'] === HttpDownloader::STATUS_QUEUED) {
  36900. $job['status'] = HttpDownloader::STATUS_ABORTED;
  36901. }
  36902. if ($job['status'] !== HttpDownloader::STATUS_STARTED) {
  36903. return;
  36904. }
  36905. $job['status'] = HttpDownloader::STATUS_ABORTED;
  36906. if (isset($job['curl_id'])) {
  36907. $curl->abortRequest($job['curl_id']);
  36908. }
  36909. throw new IrrecoverableDownloadException('Download of ' . Url::sanitize($job['request']['url']) . ' canceled');
  36910. };
  36911. $promise = new Promise($resolver, $canceler);
  36912. $promise = $promise->then(function ($response) use (&$job) {
  36913. $job['status'] = HttpDownloader::STATUS_COMPLETED;
  36914. $job['response'] = $response;
  36915. $this->markJobDone();
  36916. return $response;
  36917. }, function ($e) use (&$job): void {
  36918. $job['status'] = HttpDownloader::STATUS_FAILED;
  36919. $job['exception'] = $e;
  36920. $this->markJobDone();
  36921. throw $e;
  36922. });
  36923. $this->jobs[$job['id']] = &$job;
  36924. if ($this->runningJobs < $this->maxJobs) {
  36925. $this->startJob($job['id']);
  36926. }
  36927. return [$job, $promise];
  36928. }
  36929. private function startJob(int $id): void
  36930. {
  36931. $job = &$this->jobs[$id];
  36932. if ($job['status'] !== self::STATUS_QUEUED) {
  36933. return;
  36934. }
  36935. $job['status'] = self::STATUS_STARTED;
  36936. $this->runningJobs++;
  36937. assert(isset($job['resolve']));
  36938. assert(isset($job['reject']));
  36939. $resolve = $job['resolve'];
  36940. $reject = $job['reject'];
  36941. $url = $job['request']['url'];
  36942. $options = $job['request']['options'];
  36943. $origin = $job['origin'];
  36944. if ($this->disabled) {
  36945. if (isset($job['request']['options']['http']['header']) && false !== stripos(implode('', $job['request']['options']['http']['header']), 'if-modified-since')) {
  36946. $resolve(new Response(['url' => $url], 304, [], ''));
  36947. } else {
  36948. $e = new TransportException('Network disabled, request canceled: '.Url::sanitize($url), 499);
  36949. $e->setStatusCode(499);
  36950. $reject($e);
  36951. }
  36952. return;
  36953. }
  36954. try {
  36955. if ($job['request']['copyTo']) {
  36956. $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options, $job['request']['copyTo']);
  36957. } else {
  36958. $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options);
  36959. }
  36960. } catch (\Exception $exception) {
  36961. $reject($exception);
  36962. }
  36963. }
  36964. private function markJobDone(): void
  36965. {
  36966. $this->runningJobs--;
  36967. }
  36968. public function wait(?int $index = null)
  36969. {
  36970. do {
  36971. $jobCount = $this->countActiveJobs($index);
  36972. } while ($jobCount);
  36973. }
  36974. public function enableAsync(): void
  36975. {
  36976. $this->allowAsync = true;
  36977. }
  36978. public function countActiveJobs(?int $index = null): int
  36979. {
  36980. if ($this->runningJobs < $this->maxJobs) {
  36981. foreach ($this->jobs as $job) {
  36982. if ($job['status'] === self::STATUS_QUEUED && $this->runningJobs < $this->maxJobs) {
  36983. $this->startJob($job['id']);
  36984. }
  36985. }
  36986. }
  36987. if ($this->curl) {
  36988. $this->curl->tick();
  36989. }
  36990. if (null !== $index) {
  36991. return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
  36992. }
  36993. $active = 0;
  36994. foreach ($this->jobs as $job) {
  36995. if ($job['status'] < self::STATUS_COMPLETED) {
  36996. $active++;
  36997. } elseif (!$job['sync']) {
  36998. unset($this->jobs[$job['id']]);
  36999. }
  37000. }
  37001. return $active;
  37002. }
  37003. private function getResponse(int $index): Response
  37004. {
  37005. if (!isset($this->jobs[$index])) {
  37006. throw new \LogicException('Invalid request id');
  37007. }
  37008. if ($this->jobs[$index]['status'] === self::STATUS_FAILED) {
  37009. assert(isset($this->jobs[$index]['exception']));
  37010. throw $this->jobs[$index]['exception'];
  37011. }
  37012. if (!isset($this->jobs[$index]['response'])) {
  37013. throw new \LogicException('Response not available yet, call wait() first');
  37014. }
  37015. $resp = $this->jobs[$index]['response'];
  37016. unset($this->jobs[$index]);
  37017. return $resp;
  37018. }
  37019. public static function outputWarnings(IOInterface $io, string $url, $data): void
  37020. {
  37021. $cleanMessage = static function ($msg) use ($io) {
  37022. if (!$io->isDecorated()) {
  37023. $msg = Preg::replace('{'.chr(27).'\\[[;\d]*m}u', '', $msg);
  37024. }
  37025. return $msg;
  37026. };
  37027. foreach (['warning', 'info'] as $type) {
  37028. if (empty($data[$type])) {
  37029. continue;
  37030. }
  37031. if (!empty($data[$type . '-versions'])) {
  37032. $versionParser = new VersionParser();
  37033. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  37034. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  37035. if (!$constraint->matches($composer)) {
  37036. continue;
  37037. }
  37038. }
  37039. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($data[$type]).'</'.$type.'>');
  37040. }
  37041. foreach (['warnings', 'infos'] as $key) {
  37042. if (empty($data[$key])) {
  37043. continue;
  37044. }
  37045. $versionParser = new VersionParser();
  37046. foreach ($data[$key] as $spec) {
  37047. $type = substr($key, 0, -1);
  37048. $constraint = $versionParser->parseConstraints($spec['versions']);
  37049. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  37050. if (!$constraint->matches($composer)) {
  37051. continue;
  37052. }
  37053. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($spec['message']).'</'.$type.'>');
  37054. }
  37055. }
  37056. }
  37057. public static function getExceptionHints(\Throwable $e): ?array
  37058. {
  37059. if (!$e instanceof TransportException) {
  37060. return null;
  37061. }
  37062. if (
  37063. false !== strpos($e->getMessage(), 'Resolving timed out')
  37064. || false !== strpos($e->getMessage(), 'Could not resolve host')
  37065. ) {
  37066. Silencer::suppress();
  37067. $testConnectivity = file_get_contents('https://8.8.8.8', false, stream_context_create([
  37068. 'ssl' => ['verify_peer' => false],
  37069. 'http' => ['follow_location' => false, 'ignore_errors' => true],
  37070. ]));
  37071. Silencer::restore();
  37072. if (false !== $testConnectivity) {
  37073. return [
  37074. '<error>The following exception probably indicates you have misconfigured DNS resolver(s)</error>',
  37075. ];
  37076. }
  37077. return [
  37078. '<error>The following exception probably indicates you are offline or have misconfigured DNS resolver(s)</error>',
  37079. ];
  37080. }
  37081. return null;
  37082. }
  37083. private function canUseCurl(array $job): bool
  37084. {
  37085. if (!$this->curl) {
  37086. return false;
  37087. }
  37088. if (!Preg::isMatch('{^https?://}i', $job['request']['url'])) {
  37089. return false;
  37090. }
  37091. if (!empty($job['request']['options']['ssl']['allow_self_signed'])) {
  37092. return false;
  37093. }
  37094. return true;
  37095. }
  37096. public static function isCurlEnabled(): bool
  37097. {
  37098. return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init');
  37099. }
  37100. }
  37101. <?php declare(strict_types=1);
  37102. namespace Composer\Util;
  37103. use Composer\XdebugHandler\XdebugHandler;
  37104. class IniHelper
  37105. {
  37106. public static function getAll(): array
  37107. {
  37108. return XdebugHandler::getAllIniFiles();
  37109. }
  37110. public static function getMessage(): string
  37111. {
  37112. $paths = self::getAll();
  37113. if (empty($paths[0])) {
  37114. array_shift($paths);
  37115. }
  37116. $ini = array_shift($paths);
  37117. if (empty($ini)) {
  37118. return 'A php.ini file does not exist. You will have to create one.';
  37119. }
  37120. if (!empty($paths)) {
  37121. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  37122. }
  37123. return 'The php.ini used by your command-line PHP is: '.$ini;
  37124. }
  37125. }
  37126. <?php declare(strict_types=1);
  37127. namespace Composer\Util;
  37128. use React\Promise\CancellablePromiseInterface;
  37129. use Symfony\Component\Console\Helper\ProgressBar;
  37130. use React\Promise\PromiseInterface;
  37131. class Loop
  37132. {
  37133. private $httpDownloader;
  37134. private $processExecutor;
  37135. private $currentPromises = [];
  37136. private $waitIndex = 0;
  37137. public function __construct(HttpDownloader $httpDownloader, ?ProcessExecutor $processExecutor = null)
  37138. {
  37139. $this->httpDownloader = $httpDownloader;
  37140. $this->httpDownloader->enableAsync();
  37141. $this->processExecutor = $processExecutor;
  37142. if ($this->processExecutor) {
  37143. $this->processExecutor->enableAsync();
  37144. }
  37145. }
  37146. public function getHttpDownloader(): HttpDownloader
  37147. {
  37148. return $this->httpDownloader;
  37149. }
  37150. public function getProcessExecutor(): ?ProcessExecutor
  37151. {
  37152. return $this->processExecutor;
  37153. }
  37154. public function wait(array $promises, ?ProgressBar $progress = null): void
  37155. {
  37156. $uncaught = null;
  37157. \React\Promise\all($promises)->then(
  37158. static function (): void {
  37159. },
  37160. static function (\Throwable $e) use (&$uncaught): void {
  37161. $uncaught = $e;
  37162. }
  37163. );
  37164. $waitIndex = $this->waitIndex++;
  37165. $this->currentPromises[$waitIndex] = $promises;
  37166. if ($progress) {
  37167. $totalJobs = 0;
  37168. $totalJobs += $this->httpDownloader->countActiveJobs();
  37169. if ($this->processExecutor) {
  37170. $totalJobs += $this->processExecutor->countActiveJobs();
  37171. }
  37172. $progress->start($totalJobs);
  37173. }
  37174. $lastUpdate = 0;
  37175. while (true) {
  37176. $activeJobs = 0;
  37177. $activeJobs += $this->httpDownloader->countActiveJobs();
  37178. if ($this->processExecutor) {
  37179. $activeJobs += $this->processExecutor->countActiveJobs();
  37180. }
  37181. if ($progress && microtime(true) - $lastUpdate > 0.1) {
  37182. $lastUpdate = microtime(true);
  37183. $progress->setProgress($progress->getMaxSteps() - $activeJobs);
  37184. }
  37185. if (!$activeJobs) {
  37186. break;
  37187. }
  37188. }
  37189. if ($progress) {
  37190. $progress->finish();
  37191. }
  37192. unset($this->currentPromises[$waitIndex]);
  37193. if (null !== $uncaught) {
  37194. throw $uncaught;
  37195. }
  37196. }
  37197. public function abortJobs(): void
  37198. {
  37199. foreach ($this->currentPromises as $promiseGroup) {
  37200. foreach ($promiseGroup as $promise) {
  37201. \React\Promise\resolve($promise)->cancel();
  37202. }
  37203. }
  37204. }
  37205. }
  37206. <?php declare(strict_types=1);
  37207. namespace Composer\Util;
  37208. @trigger_error('Composer\Util\MetadataMinifier is deprecated, use Composer\MetadataMinifier\MetadataMinifier from composer/metadata-minifier instead.', E_USER_DEPRECATED);
  37209. class MetadataMinifier extends \Composer\MetadataMinifier\MetadataMinifier
  37210. {
  37211. }
  37212. <?php declare(strict_types=1);
  37213. namespace Composer\Util;
  37214. use Composer\Pcre\Preg;
  37215. use stdClass;
  37216. class NoProxyPattern
  37217. {
  37218. protected $hostNames = [];
  37219. protected $rules = [];
  37220. protected $noproxy;
  37221. public function __construct(string $pattern)
  37222. {
  37223. $this->hostNames = Preg::split('{[\s,]+}', $pattern, -1, PREG_SPLIT_NO_EMPTY);
  37224. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  37225. }
  37226. public function test(string $url): bool
  37227. {
  37228. if ($this->noproxy) {
  37229. return true;
  37230. }
  37231. if (!$urlData = $this->getUrlData($url)) {
  37232. return false;
  37233. }
  37234. foreach ($this->hostNames as $index => $hostName) {
  37235. if ($this->match($index, $hostName, $urlData)) {
  37236. return true;
  37237. }
  37238. }
  37239. return false;
  37240. }
  37241. protected function getUrlData(string $url)
  37242. {
  37243. if (!$host = parse_url($url, PHP_URL_HOST)) {
  37244. return false;
  37245. }
  37246. $port = parse_url($url, PHP_URL_PORT);
  37247. if (empty($port)) {
  37248. switch (parse_url($url, PHP_URL_SCHEME)) {
  37249. case 'http':
  37250. $port = 80;
  37251. break;
  37252. case 'https':
  37253. $port = 443;
  37254. break;
  37255. }
  37256. }
  37257. $hostName = $host . ($port ? ':' . $port : '');
  37258. [$host, $port, $err] = $this->splitHostPort($hostName);
  37259. if ($err || !$this->ipCheckData($host, $ipdata)) {
  37260. return false;
  37261. }
  37262. return $this->makeData($host, $port, $ipdata);
  37263. }
  37264. protected function match(int $index, string $hostName, stdClass $url): bool
  37265. {
  37266. if (!$rule = $this->getRule($index, $hostName)) {
  37267. return false;
  37268. }
  37269. if ($rule->ipdata) {
  37270. if (!$url->ipdata) {
  37271. return false;
  37272. }
  37273. if ($rule->ipdata->netmask) {
  37274. return $this->matchRange($rule->ipdata, $url->ipdata);
  37275. }
  37276. $match = $rule->ipdata->ip === $url->ipdata->ip;
  37277. } else {
  37278. $haystack = substr($url->name, -strlen($rule->name));
  37279. $match = stripos($haystack, $rule->name) === 0;
  37280. }
  37281. if ($match && $rule->port) {
  37282. $match = $rule->port === $url->port;
  37283. }
  37284. return $match;
  37285. }
  37286. protected function matchRange(stdClass $network, stdClass $target): bool
  37287. {
  37288. $net = unpack('C*', $network->ip);
  37289. $mask = unpack('C*', $network->netmask);
  37290. $ip = unpack('C*', $target->ip);
  37291. if (false === $net) {
  37292. throw new \RuntimeException('Could not parse network IP '.$network->ip);
  37293. }
  37294. if (false === $mask) {
  37295. throw new \RuntimeException('Could not parse netmask '.$network->netmask);
  37296. }
  37297. if (false === $ip) {
  37298. throw new \RuntimeException('Could not parse target IP '.$target->ip);
  37299. }
  37300. for ($i = 1; $i < 17; ++$i) {
  37301. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  37302. return false;
  37303. }
  37304. }
  37305. return true;
  37306. }
  37307. private function getRule(int $index, string $hostName): ?stdClass
  37308. {
  37309. if (array_key_exists($index, $this->rules)) {
  37310. return $this->rules[$index];
  37311. }
  37312. $this->rules[$index] = null;
  37313. [$host, $port, $err] = $this->splitHostPort($hostName);
  37314. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  37315. return null;
  37316. }
  37317. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  37318. return $this->rules[$index];
  37319. }
  37320. private function ipCheckData(string $host, ?stdClass &$ipdata, bool $allowPrefix = false): bool
  37321. {
  37322. $ipdata = null;
  37323. $netmask = null;
  37324. $prefix = null;
  37325. $modified = false;
  37326. if (strpos($host, '/') !== false) {
  37327. [$host, $prefix] = explode('/', $host);
  37328. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  37329. return false;
  37330. }
  37331. $prefix = (int) $prefix;
  37332. $modified = true;
  37333. }
  37334. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  37335. return !$modified;
  37336. }
  37337. [$ip, $size] = $this->ipGetAddr($host);
  37338. if ($prefix !== null) {
  37339. if ($prefix > $size * 8) {
  37340. return false;
  37341. }
  37342. [$ip, $netmask] = $this->ipGetNetwork($ip, $size, $prefix);
  37343. }
  37344. $ipdata = $this->makeIpData($ip, $size, $netmask);
  37345. return true;
  37346. }
  37347. private function ipGetAddr(string $host): array
  37348. {
  37349. $ip = inet_pton($host);
  37350. $size = strlen($ip);
  37351. $mapped = $this->ipMapTo6($ip, $size);
  37352. return [$mapped, $size];
  37353. }
  37354. private function ipGetMask(int $prefix, int $size): string
  37355. {
  37356. $mask = '';
  37357. if ($ones = floor($prefix / 8)) {
  37358. $mask = str_repeat(chr(255), (int) $ones);
  37359. }
  37360. if ($remainder = $prefix % 8) {
  37361. $mask .= chr(0xff ^ (0xff >> $remainder));
  37362. }
  37363. $mask = str_pad($mask, $size, chr(0));
  37364. return $this->ipMapTo6($mask, $size);
  37365. }
  37366. private function ipGetNetwork(string $rangeIp, int $size, int $prefix): array
  37367. {
  37368. $netmask = $this->ipGetMask($prefix, $size);
  37369. $mask = unpack('C*', $netmask);
  37370. $ip = unpack('C*', $rangeIp);
  37371. $net = '';
  37372. if (false === $mask) {
  37373. throw new \RuntimeException('Could not parse netmask '.$netmask);
  37374. }
  37375. if (false === $ip) {
  37376. throw new \RuntimeException('Could not parse range IP '.$rangeIp);
  37377. }
  37378. for ($i = 1; $i < 17; ++$i) {
  37379. $net .= chr($ip[$i] & $mask[$i]);
  37380. }
  37381. return [$net, $netmask];
  37382. }
  37383. private function ipMapTo6(string $binary, int $size): string
  37384. {
  37385. if ($size === 4) {
  37386. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  37387. $binary = $prefix . $binary;
  37388. }
  37389. return $binary;
  37390. }
  37391. private function makeData(string $host, int $port, ?stdClass $ipdata): stdClass
  37392. {
  37393. return (object) [
  37394. 'host' => $host,
  37395. 'name' => '.' . ltrim($host, '.'),
  37396. 'port' => $port,
  37397. 'ipdata' => $ipdata,
  37398. ];
  37399. }
  37400. private function makeIpData(string $ip, int $size, ?string $netmask): stdClass
  37401. {
  37402. return (object) [
  37403. 'ip' => $ip,
  37404. 'size' => $size,
  37405. 'netmask' => $netmask,
  37406. ];
  37407. }
  37408. private function splitHostPort(string $hostName): array
  37409. {
  37410. $error = ['', '', true];
  37411. $port = 0;
  37412. $ip6 = '';
  37413. if ($hostName[0] === '[') {
  37414. $index = strpos($hostName, ']');
  37415. if (false === $index || $index < 3) {
  37416. return $error;
  37417. }
  37418. $ip6 = substr($hostName, 1, $index - 1);
  37419. $hostName = substr($hostName, $index + 1);
  37420. if (strpbrk($hostName, '[]') !== false || substr_count($hostName, ':') > 1) {
  37421. return $error;
  37422. }
  37423. }
  37424. if (substr_count($hostName, ':') === 1) {
  37425. $index = strpos($hostName, ':');
  37426. $port = substr($hostName, $index + 1);
  37427. $hostName = substr($hostName, 0, $index);
  37428. if (!$this->validateInt($port, 1, 65535)) {
  37429. return $error;
  37430. }
  37431. $port = (int) $port;
  37432. }
  37433. $host = $ip6 . $hostName;
  37434. return [$host, $port, false];
  37435. }
  37436. private function validateInt(string $int, int $min, int $max): bool
  37437. {
  37438. $options = [
  37439. 'options' => [
  37440. 'min_range' => $min,
  37441. 'max_range' => $max,
  37442. ],
  37443. ];
  37444. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  37445. }
  37446. }
  37447. <?php declare(strict_types=1);
  37448. namespace Composer\Util;
  37449. use Composer\Package\CompletePackageInterface;
  37450. use Composer\Package\PackageInterface;
  37451. class PackageInfo
  37452. {
  37453. public static function getViewSourceUrl(PackageInterface $package): ?string
  37454. {
  37455. if ($package instanceof CompletePackageInterface && isset($package->getSupport()['source']) && '' !== $package->getSupport()['source']) {
  37456. return $package->getSupport()['source'];
  37457. }
  37458. return $package->getSourceUrl();
  37459. }
  37460. public static function getViewSourceOrHomepageUrl(PackageInterface $package): ?string
  37461. {
  37462. $url = self::getViewSourceUrl($package) ?? ($package instanceof CompletePackageInterface ? $package->getHomepage() : null);
  37463. if ($url === '') {
  37464. return null;
  37465. }
  37466. return $url;
  37467. }
  37468. }
  37469. <?php declare(strict_types=1);
  37470. namespace Composer\Util;
  37471. use Composer\Package\PackageInterface;
  37472. use Composer\Package\RootPackageInterface;
  37473. class PackageSorter
  37474. {
  37475. public static function getMostCurrentVersion(array $packages): ?PackageInterface
  37476. {
  37477. if (count($packages) === 0) {
  37478. return null;
  37479. }
  37480. $highest = reset($packages);
  37481. foreach ($packages as $candidate) {
  37482. if ($candidate->isDefaultBranch()) {
  37483. return $candidate;
  37484. }
  37485. if (version_compare($highest->getVersion(), $candidate->getVersion(), '<')) {
  37486. $highest = $candidate;
  37487. }
  37488. }
  37489. return $highest;
  37490. }
  37491. public static function sortPackagesAlphabetically(array $packages): array
  37492. {
  37493. usort($packages, static function (PackageInterface $a, PackageInterface $b) {
  37494. return $a->getName() <=> $b->getName();
  37495. });
  37496. return $packages;
  37497. }
  37498. public static function sortPackages(array $packages, array $weights = []): array
  37499. {
  37500. $usageList = [];
  37501. foreach ($packages as $package) {
  37502. $links = $package->getRequires();
  37503. if ($package instanceof RootPackageInterface) {
  37504. $links = array_merge($links, $package->getDevRequires());
  37505. }
  37506. foreach ($links as $link) {
  37507. $target = $link->getTarget();
  37508. $usageList[$target][] = $package->getName();
  37509. }
  37510. }
  37511. $computing = [];
  37512. $computed = [];
  37513. $computeImportance = static function ($name) use (&$computeImportance, &$computing, &$computed, $usageList, $weights) {
  37514. if (isset($computed[$name])) {
  37515. return $computed[$name];
  37516. }
  37517. if (isset($computing[$name])) {
  37518. return 0;
  37519. }
  37520. $computing[$name] = true;
  37521. $weight = $weights[$name] ?? 0;
  37522. if (isset($usageList[$name])) {
  37523. foreach ($usageList[$name] as $user) {
  37524. $weight -= 1 - $computeImportance($user);
  37525. }
  37526. }
  37527. unset($computing[$name]);
  37528. $computed[$name] = $weight;
  37529. return $weight;
  37530. };
  37531. $weightedPackages = [];
  37532. foreach ($packages as $index => $package) {
  37533. $name = $package->getName();
  37534. $weight = $computeImportance($name);
  37535. $weightedPackages[] = ['name' => $name, 'weight' => $weight, 'index' => $index];
  37536. }
  37537. usort($weightedPackages, static function (array $a, array $b): int {
  37538. if ($a['weight'] !== $b['weight']) {
  37539. return $a['weight'] - $b['weight'];
  37540. }
  37541. return strnatcasecmp($a['name'], $b['name']);
  37542. });
  37543. $sortedPackages = [];
  37544. foreach ($weightedPackages as $pkg) {
  37545. $sortedPackages[] = $packages[$pkg['index']];
  37546. }
  37547. return $sortedPackages;
  37548. }
  37549. }
  37550. <?php declare(strict_types=1);
  37551. namespace Composer\Util;
  37552. use Composer\IO\IOInterface;
  37553. use Composer\Pcre\Preg;
  37554. use Symfony\Component\Process\Process;
  37555. class Perforce
  37556. {
  37557. protected $path;
  37558. protected $p4Depot;
  37559. protected $p4Client;
  37560. protected $p4User;
  37561. protected $p4Password;
  37562. protected $p4Port;
  37563. protected $p4Stream;
  37564. protected $p4ClientSpec;
  37565. protected $p4DepotType;
  37566. protected $p4Branch;
  37567. protected $process;
  37568. protected $uniquePerforceClientName;
  37569. protected $windowsFlag;
  37570. protected $commandResult;
  37571. protected $io;
  37572. protected $filesystem;
  37573. public function __construct($repoConfig, string $port, string $path, ProcessExecutor $process, bool $isWindows, IOInterface $io)
  37574. {
  37575. $this->windowsFlag = $isWindows;
  37576. $this->p4Port = $port;
  37577. $this->initializePath($path);
  37578. $this->process = $process;
  37579. $this->initialize($repoConfig);
  37580. $this->io = $io;
  37581. }
  37582. public static function create($repoConfig, string $port, string $path, ProcessExecutor $process, IOInterface $io): self
  37583. {
  37584. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  37585. }
  37586. public static function checkServerExists(string $url, ProcessExecutor $processExecutor): bool
  37587. {
  37588. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $ignoredOutput);
  37589. }
  37590. public function initialize($repoConfig): void
  37591. {
  37592. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  37593. if (!$repoConfig) {
  37594. return;
  37595. }
  37596. if (isset($repoConfig['unique_perforce_client_name'])) {
  37597. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  37598. }
  37599. if (isset($repoConfig['depot'])) {
  37600. $this->p4Depot = $repoConfig['depot'];
  37601. }
  37602. if (isset($repoConfig['branch'])) {
  37603. $this->p4Branch = $repoConfig['branch'];
  37604. }
  37605. if (isset($repoConfig['p4user'])) {
  37606. $this->p4User = $repoConfig['p4user'];
  37607. } else {
  37608. $this->p4User = $this->getP4variable('P4USER');
  37609. }
  37610. if (isset($repoConfig['p4password'])) {
  37611. $this->p4Password = $repoConfig['p4password'];
  37612. }
  37613. }
  37614. public function initializeDepotAndBranch(?string $depot, ?string $branch): void
  37615. {
  37616. if (isset($depot)) {
  37617. $this->p4Depot = $depot;
  37618. }
  37619. if (isset($branch)) {
  37620. $this->p4Branch = $branch;
  37621. }
  37622. }
  37623. public function generateUniquePerforceClientName(): string
  37624. {
  37625. return gethostname() . "_" . time();
  37626. }
  37627. public function cleanupClientSpec(): void
  37628. {
  37629. $client = $this->getClient();
  37630. $task = 'client -d ' . ProcessExecutor::escape($client);
  37631. $useP4Client = false;
  37632. $command = $this->generateP4Command($task, $useP4Client);
  37633. $this->executeCommand($command);
  37634. $clientSpec = $this->getP4ClientSpec();
  37635. $fileSystem = $this->getFilesystem();
  37636. $fileSystem->remove($clientSpec);
  37637. }
  37638. protected function executeCommand($command): int
  37639. {
  37640. $this->commandResult = '';
  37641. return $this->process->execute($command, $this->commandResult);
  37642. }
  37643. public function getClient(): string
  37644. {
  37645. if (!isset($this->p4Client)) {
  37646. $cleanStreamName = str_replace(['//', '/', '@'], ['', '_', ''], $this->getStream());
  37647. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  37648. }
  37649. return $this->p4Client;
  37650. }
  37651. protected function getPath(): string
  37652. {
  37653. return $this->path;
  37654. }
  37655. public function initializePath(string $path): void
  37656. {
  37657. $this->path = $path;
  37658. $fs = $this->getFilesystem();
  37659. $fs->ensureDirectoryExists($path);
  37660. }
  37661. protected function getPort(): string
  37662. {
  37663. return $this->p4Port;
  37664. }
  37665. public function setStream(string $stream): void
  37666. {
  37667. $this->p4Stream = $stream;
  37668. $index = strrpos($stream, '/');
  37669. if ($index > 2) {
  37670. $this->p4DepotType = 'stream';
  37671. }
  37672. }
  37673. public function isStream(): bool
  37674. {
  37675. return is_string($this->p4DepotType) && (strcmp($this->p4DepotType, 'stream') === 0);
  37676. }
  37677. public function getStream(): string
  37678. {
  37679. if (!isset($this->p4Stream)) {
  37680. if ($this->isStream()) {
  37681. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  37682. } else {
  37683. $this->p4Stream = '//' . $this->p4Depot;
  37684. }
  37685. }
  37686. return $this->p4Stream;
  37687. }
  37688. public function getStreamWithoutLabel(string $stream): string
  37689. {
  37690. $index = strpos($stream, '@');
  37691. if ($index === false) {
  37692. return $stream;
  37693. }
  37694. return substr($stream, 0, $index);
  37695. }
  37696. public function getP4ClientSpec(): string
  37697. {
  37698. return $this->path . '/' . $this->getClient() . '.p4.spec';
  37699. }
  37700. public function getUser(): ?string
  37701. {
  37702. return $this->p4User;
  37703. }
  37704. public function setUser(?string $user): void
  37705. {
  37706. $this->p4User = $user;
  37707. }
  37708. public function queryP4User(): void
  37709. {
  37710. $this->getUser();
  37711. if (strlen((string) $this->p4User) > 0) {
  37712. return;
  37713. }
  37714. $this->p4User = $this->getP4variable('P4USER');
  37715. if (strlen((string) $this->p4User) > 0) {
  37716. return;
  37717. }
  37718. $this->p4User = $this->io->ask('Enter P4 User:');
  37719. if ($this->windowsFlag) {
  37720. $command = 'p4 set P4USER=' . $this->p4User;
  37721. } else {
  37722. $command = 'export P4USER=' . $this->p4User;
  37723. }
  37724. $this->executeCommand($command);
  37725. }
  37726. protected function getP4variable(string $name): ?string
  37727. {
  37728. if ($this->windowsFlag) {
  37729. $command = 'p4 set';
  37730. $this->executeCommand($command);
  37731. $result = trim($this->commandResult);
  37732. $resArray = explode(PHP_EOL, $result);
  37733. foreach ($resArray as $line) {
  37734. $fields = explode('=', $line);
  37735. if (strcmp($name, $fields[0]) === 0) {
  37736. $index = strpos($fields[1], ' ');
  37737. if ($index === false) {
  37738. $value = $fields[1];
  37739. } else {
  37740. $value = substr($fields[1], 0, $index);
  37741. }
  37742. $value = trim($value);
  37743. return $value;
  37744. }
  37745. }
  37746. return null;
  37747. }
  37748. $command = 'echo $' . $name;
  37749. $this->executeCommand($command);
  37750. $result = trim($this->commandResult);
  37751. return $result;
  37752. }
  37753. public function queryP4Password(): ?string
  37754. {
  37755. if (isset($this->p4Password)) {
  37756. return $this->p4Password;
  37757. }
  37758. $password = $this->getP4variable('P4PASSWD');
  37759. if (strlen((string) $password) <= 0) {
  37760. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  37761. }
  37762. $this->p4Password = $password;
  37763. return $password;
  37764. }
  37765. public function generateP4Command(string $command, bool $useClient = true): string
  37766. {
  37767. $p4Command = 'p4 ';
  37768. $p4Command .= '-u ' . $this->getUser() . ' ';
  37769. if ($useClient) {
  37770. $p4Command .= '-c ' . $this->getClient() . ' ';
  37771. }
  37772. $p4Command .= '-p ' . $this->getPort() . ' ' . $command;
  37773. return $p4Command;
  37774. }
  37775. public function isLoggedIn(): bool
  37776. {
  37777. $command = $this->generateP4Command('login -s', false);
  37778. $exitCode = $this->executeCommand($command);
  37779. if ($exitCode) {
  37780. $errorOutput = $this->process->getErrorOutput();
  37781. $index = strpos($errorOutput, $this->getUser());
  37782. if ($index === false) {
  37783. $index = strpos($errorOutput, 'p4');
  37784. if ($index === false) {
  37785. return false;
  37786. }
  37787. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  37788. }
  37789. throw new \Exception('Invalid user name: ' . $this->getUser());
  37790. }
  37791. return true;
  37792. }
  37793. public function connectClient(): void
  37794. {
  37795. $p4CreateClientCommand = $this->generateP4Command(
  37796. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  37797. );
  37798. $this->executeCommand($p4CreateClientCommand);
  37799. }
  37800. public function syncCodeBase(?string $sourceReference): void
  37801. {
  37802. $prevDir = Platform::getCwd();
  37803. chdir($this->path);
  37804. $p4SyncCommand = $this->generateP4Command('sync -f ');
  37805. if (null !== $sourceReference) {
  37806. $p4SyncCommand .= '@' . $sourceReference;
  37807. }
  37808. $this->executeCommand($p4SyncCommand);
  37809. chdir($prevDir);
  37810. }
  37811. public function writeClientSpecToFile($spec): void
  37812. {
  37813. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  37814. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  37815. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  37816. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  37817. fwrite($spec, 'Description:' . PHP_EOL);
  37818. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  37819. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  37820. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  37821. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  37822. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  37823. if ($this->isStream()) {
  37824. fwrite($spec, 'Stream:' . PHP_EOL);
  37825. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  37826. } else {
  37827. fwrite(
  37828. $spec,
  37829. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  37830. );
  37831. }
  37832. }
  37833. public function writeP4ClientSpec(): void
  37834. {
  37835. $clientSpec = $this->getP4ClientSpec();
  37836. $spec = fopen($clientSpec, 'w');
  37837. try {
  37838. $this->writeClientSpecToFile($spec);
  37839. } catch (\Exception $e) {
  37840. fclose($spec);
  37841. throw $e;
  37842. }
  37843. fclose($spec);
  37844. }
  37845. protected function read($pipe, $name): void
  37846. {
  37847. if (feof($pipe)) {
  37848. return;
  37849. }
  37850. $line = fgets($pipe);
  37851. while ($line !== false) {
  37852. $line = fgets($pipe);
  37853. }
  37854. }
  37855. public function windowsLogin(?string $password): int
  37856. {
  37857. $command = $this->generateP4Command(' login -a');
  37858. $process = Process::fromShellCommandline($command, null, null, $password);
  37859. return $process->run();
  37860. }
  37861. public function p4Login(): void
  37862. {
  37863. $this->queryP4User();
  37864. if (!$this->isLoggedIn()) {
  37865. $password = $this->queryP4Password();
  37866. if ($this->windowsFlag) {
  37867. $this->windowsLogin($password);
  37868. } else {
  37869. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  37870. $exitCode = $this->executeCommand($command);
  37871. if ($exitCode) {
  37872. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  37873. }
  37874. }
  37875. }
  37876. }
  37877. public function getComposerInformation(string $identifier): ?array
  37878. {
  37879. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  37880. if (!$composerFileContent) {
  37881. return null;
  37882. }
  37883. return json_decode($composerFileContent, true);
  37884. }
  37885. public function getFileContent(string $file, string $identifier): ?string
  37886. {
  37887. $path = $this->getFilePath($file, $identifier);
  37888. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  37889. $this->executeCommand($command);
  37890. $result = $this->commandResult;
  37891. if (!trim($result)) {
  37892. return null;
  37893. }
  37894. return $result;
  37895. }
  37896. public function getFilePath(string $file, string $identifier): ?string
  37897. {
  37898. $index = strpos($identifier, '@');
  37899. if ($index === false) {
  37900. return $identifier. '/' . $file;
  37901. }
  37902. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  37903. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  37904. $this->executeCommand($command);
  37905. $result = $this->commandResult;
  37906. $index2 = strpos($result, 'no such file(s).');
  37907. if ($index2 === false) {
  37908. $index3 = strpos($result, 'change');
  37909. if ($index3 !== false) {
  37910. $phrase = trim(substr($result, $index3));
  37911. $fields = explode(' ', $phrase);
  37912. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  37913. }
  37914. }
  37915. return null;
  37916. }
  37917. public function getBranches(): array
  37918. {
  37919. $possibleBranches = [];
  37920. if (!$this->isStream()) {
  37921. $possibleBranches[$this->p4Branch] = $this->getStream();
  37922. } else {
  37923. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  37924. $this->executeCommand($command);
  37925. $result = $this->commandResult;
  37926. $resArray = explode(PHP_EOL, $result);
  37927. foreach ($resArray as $line) {
  37928. $resBits = explode(' ', $line);
  37929. if (count($resBits) > 4) {
  37930. $branch = Preg::replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  37931. $possibleBranches[$branch] = $resBits[1];
  37932. }
  37933. }
  37934. }
  37935. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  37936. $this->executeCommand($command);
  37937. $result = $this->commandResult;
  37938. $resArray = explode(PHP_EOL, $result);
  37939. $lastCommit = $resArray[0];
  37940. $lastCommitArr = explode(' ', $lastCommit);
  37941. $lastCommitNum = $lastCommitArr[1];
  37942. return ['master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum];
  37943. }
  37944. public function getTags(): array
  37945. {
  37946. $command = $this->generateP4Command('labels');
  37947. $this->executeCommand($command);
  37948. $result = $this->commandResult;
  37949. $resArray = explode(PHP_EOL, $result);
  37950. $tags = [];
  37951. foreach ($resArray as $line) {
  37952. if (strpos($line, 'Label') !== false) {
  37953. $fields = explode(' ', $line);
  37954. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  37955. }
  37956. }
  37957. return $tags;
  37958. }
  37959. public function checkStream(): bool
  37960. {
  37961. $command = $this->generateP4Command('depots', false);
  37962. $this->executeCommand($command);
  37963. $result = $this->commandResult;
  37964. $resArray = explode(PHP_EOL, $result);
  37965. foreach ($resArray as $line) {
  37966. if (strpos($line, 'Depot') !== false) {
  37967. $fields = explode(' ', $line);
  37968. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  37969. $this->p4DepotType = $fields[3];
  37970. return $this->isStream();
  37971. }
  37972. }
  37973. }
  37974. return false;
  37975. }
  37976. protected function getChangeList(string $reference): mixed
  37977. {
  37978. $index = strpos($reference, '@');
  37979. if ($index === false) {
  37980. return null;
  37981. }
  37982. $label = substr($reference, $index);
  37983. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  37984. $this->executeCommand($command);
  37985. $changes = $this->commandResult;
  37986. if (strpos($changes, 'Change') !== 0) {
  37987. return null;
  37988. }
  37989. $fields = explode(' ', $changes);
  37990. return $fields[1];
  37991. }
  37992. public function getCommitLogs(string $fromReference, string $toReference): mixed
  37993. {
  37994. $fromChangeList = $this->getChangeList($fromReference);
  37995. if ($fromChangeList === null) {
  37996. return null;
  37997. }
  37998. $toChangeList = $this->getChangeList($toReference);
  37999. if ($toChangeList === null) {
  38000. return null;
  38001. }
  38002. $index = strpos($fromReference, '@');
  38003. $main = substr($fromReference, 0, $index) . '/...';
  38004. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  38005. $this->executeCommand($command);
  38006. return $this->commandResult;
  38007. }
  38008. public function getFilesystem(): Filesystem
  38009. {
  38010. if (null === $this->filesystem) {
  38011. $this->filesystem = new Filesystem($this->process);
  38012. }
  38013. return $this->filesystem;
  38014. }
  38015. public function setFilesystem(Filesystem $fs): void
  38016. {
  38017. $this->filesystem = $fs;
  38018. }
  38019. }
  38020. <?php declare(strict_types=1);
  38021. namespace Composer\Util;
  38022. use Composer\Pcre\Preg;
  38023. class Platform
  38024. {
  38025. private static $isVirtualBoxGuest = null;
  38026. private static $isWindowsSubsystemForLinux = null;
  38027. public static function getCwd(bool $allowEmpty = false): string
  38028. {
  38029. $cwd = getcwd();
  38030. if (false === $cwd) {
  38031. $cwd = realpath('');
  38032. }
  38033. if (false === $cwd) {
  38034. if ($allowEmpty) {
  38035. return '';
  38036. }
  38037. throw new \RuntimeException('Could not determine the current working directory');
  38038. }
  38039. return $cwd;
  38040. }
  38041. public static function getEnv(string $name)
  38042. {
  38043. if (array_key_exists($name, $_SERVER)) {
  38044. return (string) $_SERVER[$name];
  38045. }
  38046. if (array_key_exists($name, $_ENV)) {
  38047. return (string) $_ENV[$name];
  38048. }
  38049. return getenv($name);
  38050. }
  38051. public static function putEnv(string $name, string $value): void
  38052. {
  38053. $value = (string) $value;
  38054. putenv($name . '=' . $value);
  38055. $_SERVER[$name] = $_ENV[$name] = $value;
  38056. }
  38057. public static function clearEnv(string $name): void
  38058. {
  38059. putenv($name);
  38060. unset($_SERVER[$name], $_ENV[$name]);
  38061. }
  38062. public static function expandPath(string $path): string
  38063. {
  38064. if (Preg::isMatch('#^~[\\/]#', $path)) {
  38065. return self::getUserDirectory() . substr($path, 1);
  38066. }
  38067. return Preg::replaceCallback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', static function ($matches): string {
  38068. assert(is_string($matches['var']));
  38069. if (Platform::isWindows() && $matches['var'] === 'HOME') {
  38070. return (Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE')) . $matches['path'];
  38071. }
  38072. return Platform::getEnv($matches['var']) . $matches['path'];
  38073. }, $path);
  38074. }
  38075. public static function getUserDirectory(): string
  38076. {
  38077. if (false !== ($home = self::getEnv('HOME'))) {
  38078. return $home;
  38079. }
  38080. if (self::isWindows() && false !== ($home = self::getEnv('USERPROFILE'))) {
  38081. return $home;
  38082. }
  38083. if (\function_exists('posix_getuid') && \function_exists('posix_getpwuid')) {
  38084. $info = posix_getpwuid(posix_getuid());
  38085. return $info['dir'];
  38086. }
  38087. throw new \RuntimeException('Could not determine user directory');
  38088. }
  38089. public static function isWindowsSubsystemForLinux(): bool
  38090. {
  38091. if (null === self::$isWindowsSubsystemForLinux) {
  38092. self::$isWindowsSubsystemForLinux = false;
  38093. if (self::isWindows()) {
  38094. return self::$isWindowsSubsystemForLinux = false;
  38095. }
  38096. if (
  38097. !ini_get('open_basedir')
  38098. && is_readable('/proc/version')
  38099. && false !== stripos((string)Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
  38100. && !file_exists('/.dockerenv')
  38101. ) {
  38102. return self::$isWindowsSubsystemForLinux = true;
  38103. }
  38104. }
  38105. return self::$isWindowsSubsystemForLinux;
  38106. }
  38107. public static function isWindows(): bool
  38108. {
  38109. return \defined('PHP_WINDOWS_VERSION_BUILD');
  38110. }
  38111. public static function strlen(string $str): int
  38112. {
  38113. static $useMbString = null;
  38114. if (null === $useMbString) {
  38115. $useMbString = \function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  38116. }
  38117. if ($useMbString) {
  38118. return mb_strlen($str, '8bit');
  38119. }
  38120. return \strlen($str);
  38121. }
  38122. public static function isTty($fd = null): bool
  38123. {
  38124. if ($fd === null) {
  38125. $fd = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w');
  38126. if ($fd === false) {
  38127. return false;
  38128. }
  38129. }
  38130. if (in_array(strtoupper(self::getEnv('MSYSTEM') ?: ''), ['MINGW32', 'MINGW64'], true)) {
  38131. return true;
  38132. }
  38133. if (function_exists('stream_isatty')) {
  38134. return stream_isatty($fd);
  38135. }
  38136. if (function_exists('posix_isatty') && posix_isatty($fd)) {
  38137. return true;
  38138. }
  38139. $stat = @fstat($fd);
  38140. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  38141. }
  38142. public static function isInputCompletionProcess(): bool
  38143. {
  38144. return '_complete' === ($_SERVER['argv'][1] ?? null);
  38145. }
  38146. public static function workaroundFilesystemIssues(): void
  38147. {
  38148. if (self::isVirtualBoxGuest()) {
  38149. usleep(200000);
  38150. }
  38151. }
  38152. private static function isVirtualBoxGuest(): bool
  38153. {
  38154. if (null === self::$isVirtualBoxGuest) {
  38155. self::$isVirtualBoxGuest = false;
  38156. if (self::isWindows()) {
  38157. return self::$isVirtualBoxGuest;
  38158. }
  38159. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  38160. $processUser = posix_getpwuid(posix_geteuid());
  38161. if ($processUser && $processUser['name'] === 'vagrant') {
  38162. return self::$isVirtualBoxGuest = true;
  38163. }
  38164. }
  38165. if (self::getEnv('COMPOSER_RUNTIME_ENV') === 'virtualbox') {
  38166. return self::$isVirtualBoxGuest = true;
  38167. }
  38168. if (defined('PHP_OS_FAMILY') && PHP_OS_FAMILY === 'Linux') {
  38169. $process = new ProcessExecutor();
  38170. try {
  38171. if (0 === $process->execute('lsmod | grep vboxguest', $ignoredOutput)) {
  38172. return self::$isVirtualBoxGuest = true;
  38173. }
  38174. } catch (\Exception $e) {
  38175. }
  38176. }
  38177. }
  38178. return self::$isVirtualBoxGuest;
  38179. }
  38180. public static function getDevNull(): string
  38181. {
  38182. if (self::isWindows()) {
  38183. return 'NUL';
  38184. }
  38185. return '/dev/null';
  38186. }
  38187. }
  38188. <?php declare(strict_types=1);
  38189. namespace Composer\Util;
  38190. use Composer\IO\IOInterface;
  38191. use Composer\Pcre\Preg;
  38192. use Seld\Signal\SignalHandler;
  38193. use Symfony\Component\Process\Exception\ProcessSignaledException;
  38194. use Symfony\Component\Process\Process;
  38195. use Symfony\Component\Process\Exception\RuntimeException;
  38196. use React\Promise\Promise;
  38197. use React\Promise\PromiseInterface;
  38198. class ProcessExecutor
  38199. {
  38200. private const STATUS_QUEUED = 1;
  38201. private const STATUS_STARTED = 2;
  38202. private const STATUS_COMPLETED = 3;
  38203. private const STATUS_FAILED = 4;
  38204. private const STATUS_ABORTED = 5;
  38205. protected static $timeout = 300;
  38206. protected $captureOutput = false;
  38207. protected $errorOutput = '';
  38208. protected $io;
  38209. private $jobs = [];
  38210. private $runningJobs = 0;
  38211. private $maxJobs = 10;
  38212. private $idGen = 0;
  38213. private $allowAsync = false;
  38214. public function __construct(?IOInterface $io = null)
  38215. {
  38216. $this->io = $io;
  38217. }
  38218. public function execute($command, &$output = null, ?string $cwd = null): int
  38219. {
  38220. if (func_num_args() > 1) {
  38221. return $this->doExecute($command, $cwd, false, $output);
  38222. }
  38223. return $this->doExecute($command, $cwd, false);
  38224. }
  38225. public function executeTty($command, ?string $cwd = null): int
  38226. {
  38227. if (Platform::isTty()) {
  38228. return $this->doExecute($command, $cwd, true);
  38229. }
  38230. return $this->doExecute($command, $cwd, false);
  38231. }
  38232. private function doExecute($command, ?string $cwd, bool $tty, &$output = null): int
  38233. {
  38234. $this->outputCommandRun($command, $cwd, false);
  38235. $this->captureOutput = func_num_args() > 3;
  38236. $this->errorOutput = '';
  38237. if (is_string($command)) {
  38238. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  38239. } else {
  38240. $process = new Process($command, $cwd, null, null, static::getTimeout());
  38241. }
  38242. if (!Platform::isWindows() && $tty) {
  38243. try {
  38244. $process->setTty(true);
  38245. } catch (RuntimeException $e) {
  38246. }
  38247. }
  38248. $callback = is_callable($output) ? $output : function (string $type, string $buffer): void {
  38249. $this->outputHandler($type, $buffer);
  38250. };
  38251. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal) {
  38252. if ($this->io !== null) {
  38253. $this->io->writeError('Received '.$signal.', aborting when child process is done', true, IOInterface::DEBUG);
  38254. }
  38255. });
  38256. try {
  38257. $process->run($callback);
  38258. if ($this->captureOutput && !is_callable($output)) {
  38259. $output = $process->getOutput();
  38260. }
  38261. $this->errorOutput = $process->getErrorOutput();
  38262. } catch (ProcessSignaledException $e) {
  38263. if ($signalHandler->isTriggered()) {
  38264. $signalHandler->exitWithLastSignal();
  38265. }
  38266. } finally {
  38267. $signalHandler->unregister();
  38268. }
  38269. return $process->getExitCode();
  38270. }
  38271. public function executeAsync($command, ?string $cwd = null): PromiseInterface
  38272. {
  38273. if (!$this->allowAsync) {
  38274. throw new \LogicException('You must use the ProcessExecutor instance which is part of a Composer\Loop instance to be able to run async processes');
  38275. }
  38276. $job = [
  38277. 'id' => $this->idGen++,
  38278. 'status' => self::STATUS_QUEUED,
  38279. 'command' => $command,
  38280. 'cwd' => $cwd,
  38281. ];
  38282. $resolver = static function ($resolve, $reject) use (&$job): void {
  38283. $job['status'] = ProcessExecutor::STATUS_QUEUED;
  38284. $job['resolve'] = $resolve;
  38285. $job['reject'] = $reject;
  38286. };
  38287. $canceler = static function () use (&$job): void {
  38288. if ($job['status'] === ProcessExecutor::STATUS_QUEUED) {
  38289. $job['status'] = ProcessExecutor::STATUS_ABORTED;
  38290. }
  38291. if ($job['status'] !== ProcessExecutor::STATUS_STARTED) {
  38292. return;
  38293. }
  38294. $job['status'] = ProcessExecutor::STATUS_ABORTED;
  38295. try {
  38296. if (defined('SIGINT')) {
  38297. $job['process']->signal(SIGINT);
  38298. }
  38299. } catch (\Exception $e) {
  38300. }
  38301. $job['process']->stop(1);
  38302. throw new \RuntimeException('Aborted process');
  38303. };
  38304. $promise = new Promise($resolver, $canceler);
  38305. $promise = $promise->then(function () use (&$job) {
  38306. if ($job['process']->isSuccessful()) {
  38307. $job['status'] = ProcessExecutor::STATUS_COMPLETED;
  38308. } else {
  38309. $job['status'] = ProcessExecutor::STATUS_FAILED;
  38310. }
  38311. $this->markJobDone();
  38312. return $job['process'];
  38313. }, function ($e) use (&$job): void {
  38314. $job['status'] = ProcessExecutor::STATUS_FAILED;
  38315. $this->markJobDone();
  38316. throw $e;
  38317. });
  38318. $this->jobs[$job['id']] = &$job;
  38319. if ($this->runningJobs < $this->maxJobs) {
  38320. $this->startJob($job['id']);
  38321. }
  38322. return $promise;
  38323. }
  38324. protected function outputHandler(string $type, string $buffer): void
  38325. {
  38326. if ($this->captureOutput) {
  38327. return;
  38328. }
  38329. if (null === $this->io) {
  38330. echo $buffer;
  38331. return;
  38332. }
  38333. if (Process::ERR === $type) {
  38334. $this->io->writeErrorRaw($buffer, false);
  38335. } else {
  38336. $this->io->writeRaw($buffer, false);
  38337. }
  38338. }
  38339. private function startJob(int $id): void
  38340. {
  38341. $job = &$this->jobs[$id];
  38342. if ($job['status'] !== self::STATUS_QUEUED) {
  38343. return;
  38344. }
  38345. $job['status'] = self::STATUS_STARTED;
  38346. $this->runningJobs++;
  38347. $command = $job['command'];
  38348. $cwd = $job['cwd'];
  38349. $this->outputCommandRun($command, $cwd, true);
  38350. try {
  38351. if (is_string($command)) {
  38352. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  38353. } else {
  38354. $process = new Process($command, $cwd, null, null, static::getTimeout());
  38355. }
  38356. } catch (\Throwable $e) {
  38357. $job['reject']($e);
  38358. return;
  38359. }
  38360. $job['process'] = $process;
  38361. try {
  38362. $process->start();
  38363. } catch (\Throwable $e) {
  38364. $job['reject']($e);
  38365. return;
  38366. }
  38367. }
  38368. public function setMaxJobs(int $maxJobs): void
  38369. {
  38370. $this->maxJobs = $maxJobs;
  38371. }
  38372. public function resetMaxJobs(): void
  38373. {
  38374. $this->maxJobs = 10;
  38375. }
  38376. public function wait($index = null): void
  38377. {
  38378. while (true) {
  38379. if (0 === $this->countActiveJobs($index)) {
  38380. return;
  38381. }
  38382. usleep(1000);
  38383. }
  38384. }
  38385. public function enableAsync(): void
  38386. {
  38387. $this->allowAsync = true;
  38388. }
  38389. public function countActiveJobs($index = null): int
  38390. {
  38391. foreach ($this->jobs as $job) {
  38392. if ($job['status'] === self::STATUS_STARTED) {
  38393. if (!$job['process']->isRunning()) {
  38394. call_user_func($job['resolve'], $job['process']);
  38395. }
  38396. $job['process']->checkTimeout();
  38397. }
  38398. if ($this->runningJobs < $this->maxJobs) {
  38399. if ($job['status'] === self::STATUS_QUEUED) {
  38400. $this->startJob($job['id']);
  38401. }
  38402. }
  38403. }
  38404. if (null !== $index) {
  38405. return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
  38406. }
  38407. $active = 0;
  38408. foreach ($this->jobs as $job) {
  38409. if ($job['status'] < self::STATUS_COMPLETED) {
  38410. $active++;
  38411. } else {
  38412. unset($this->jobs[$job['id']]);
  38413. }
  38414. }
  38415. return $active;
  38416. }
  38417. private function markJobDone(): void
  38418. {
  38419. $this->runningJobs--;
  38420. }
  38421. public function splitLines(?string $output): array
  38422. {
  38423. $output = trim((string) $output);
  38424. return $output === '' ? [] : Preg::split('{\r?\n}', $output);
  38425. }
  38426. public function getErrorOutput(): string
  38427. {
  38428. return $this->errorOutput;
  38429. }
  38430. public static function getTimeout(): int
  38431. {
  38432. return static::$timeout;
  38433. }
  38434. public static function setTimeout(int $timeout): void
  38435. {
  38436. static::$timeout = $timeout;
  38437. }
  38438. public static function escape($argument): string
  38439. {
  38440. return self::escapeArgument($argument);
  38441. }
  38442. private function outputCommandRun($command, ?string $cwd, bool $async): void
  38443. {
  38444. if (null === $this->io || !$this->io->isDebug()) {
  38445. return;
  38446. }
  38447. $commandString = is_string($command) ? $command : implode(' ', array_map(self::class.'::escape', $command));
  38448. $safeCommand = Preg::replaceCallback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', static function ($m): string {
  38449. assert(is_string($m['user']));
  38450. if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
  38451. return '://***:***@';
  38452. }
  38453. if (Preg::isMatch('{^[a-f0-9]{12,}$}', $m['user'])) {
  38454. return '://***:***@';
  38455. }
  38456. return '://'.$m['user'].':***@';
  38457. }, $commandString);
  38458. $safeCommand = Preg::replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  38459. $this->io->writeError('Executing'.($async ? ' async' : '').' command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  38460. }
  38461. private static function escapeArgument($argument): string
  38462. {
  38463. if ('' === ($argument = (string) $argument)) {
  38464. return escapeshellarg($argument);
  38465. }
  38466. if (!Platform::isWindows()) {
  38467. return "'".str_replace("'", "'\\''", $argument)."'";
  38468. }
  38469. $argument = strtr($argument, "\n", ' ');
  38470. $quote = strpbrk($argument, " \t,") !== false;
  38471. $argument = Preg::replace('/(\\\\*)"/', '$1$1\\"', $argument, -1, $dquotes);
  38472. $meta = $dquotes > 0 || Preg::isMatch('/%[^%]+%|![^!]+!/', $argument);
  38473. if (!$meta && !$quote) {
  38474. $quote = strpbrk($argument, '^&|<>()') !== false;
  38475. }
  38476. if ($quote) {
  38477. $argument = '"'.Preg::replace('/(\\\\*)$/', '$1$1', $argument).'"';
  38478. }
  38479. if ($meta) {
  38480. $argument = Preg::replace('/(["^&|<>()%])/', '^$1', $argument);
  38481. $argument = Preg::replace('/(!)/', '^^$1', $argument);
  38482. }
  38483. return $argument;
  38484. }
  38485. }
  38486. <?php declare(strict_types=1);
  38487. namespace Composer\Util;
  38488. use Composer\Config;
  38489. use Composer\Downloader\MaxFileSizeExceededException;
  38490. use Composer\IO\IOInterface;
  38491. use Composer\Downloader\TransportException;
  38492. use Composer\Pcre\Preg;
  38493. use Composer\Util\Http\Response;
  38494. use Composer\Util\Http\ProxyManager;
  38495. class RemoteFilesystem
  38496. {
  38497. private $io;
  38498. private $config;
  38499. private $scheme;
  38500. private $bytesMax;
  38501. private $originUrl;
  38502. private $fileUrl;
  38503. private $fileName;
  38504. private $retry = false;
  38505. private $progress;
  38506. private $lastProgress;
  38507. private $options = [];
  38508. private $disableTls = false;
  38509. private $lastHeaders;
  38510. private $storeAuth = false;
  38511. private $authHelper;
  38512. private $degradedMode = false;
  38513. private $redirects;
  38514. private $maxRedirects = 20;
  38515. private $proxyManager;
  38516. public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false, ?AuthHelper $authHelper = null)
  38517. {
  38518. $this->io = $io;
  38519. if ($disableTls === false) {
  38520. $this->options = StreamContextFactory::getTlsDefaults($options, $io);
  38521. } else {
  38522. $this->disableTls = true;
  38523. }
  38524. $this->options = array_replace_recursive($this->options, $options);
  38525. $this->config = $config;
  38526. $this->authHelper = $authHelper ?? new AuthHelper($io, $config);
  38527. $this->proxyManager = ProxyManager::getInstance();
  38528. }
  38529. public function copy(string $originUrl, string $fileUrl, string $fileName, bool $progress = true, array $options = [])
  38530. {
  38531. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  38532. }
  38533. public function getContents(string $originUrl, string $fileUrl, bool $progress = true, array $options = [])
  38534. {
  38535. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  38536. }
  38537. public function getOptions()
  38538. {
  38539. return $this->options;
  38540. }
  38541. public function setOptions(array $options)
  38542. {
  38543. $this->options = array_replace_recursive($this->options, $options);
  38544. }
  38545. public function isTlsDisabled()
  38546. {
  38547. return $this->disableTls === true;
  38548. }
  38549. public function getLastHeaders()
  38550. {
  38551. return $this->lastHeaders;
  38552. }
  38553. public static function findStatusCode(array $headers)
  38554. {
  38555. $value = null;
  38556. foreach ($headers as $header) {
  38557. if (Preg::isMatch('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  38558. $value = (int) $match[1];
  38559. }
  38560. }
  38561. return $value;
  38562. }
  38563. public function findStatusMessage(array $headers)
  38564. {
  38565. $value = null;
  38566. foreach ($headers as $header) {
  38567. if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
  38568. $value = $header;
  38569. }
  38570. }
  38571. return $value;
  38572. }
  38573. protected function get(string $originUrl, string $fileUrl, array $additionalOptions = [], ?string $fileName = null, bool $progress = true)
  38574. {
  38575. $this->scheme = parse_url(strtr($fileUrl, '\\', '/'), PHP_URL_SCHEME);
  38576. $this->bytesMax = 0;
  38577. $this->originUrl = $originUrl;
  38578. $this->fileUrl = $fileUrl;
  38579. $this->fileName = $fileName;
  38580. $this->progress = $progress;
  38581. $this->lastProgress = null;
  38582. $retryAuthFailure = true;
  38583. $this->lastHeaders = [];
  38584. $this->redirects = 1;
  38585. $tempAdditionalOptions = $additionalOptions;
  38586. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  38587. $retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  38588. unset($tempAdditionalOptions['retry-auth-failure']);
  38589. }
  38590. $isRedirect = false;
  38591. if (isset($tempAdditionalOptions['redirects'])) {
  38592. $this->redirects = $tempAdditionalOptions['redirects'];
  38593. $isRedirect = true;
  38594. unset($tempAdditionalOptions['redirects']);
  38595. }
  38596. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  38597. unset($tempAdditionalOptions);
  38598. $origFileUrl = $fileUrl;
  38599. if (isset($options['gitlab-token'])) {
  38600. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  38601. unset($options['gitlab-token']);
  38602. }
  38603. if (isset($options['http'])) {
  38604. $options['http']['ignore_errors'] = true;
  38605. }
  38606. if ($this->degradedMode && strpos($fileUrl, 'http://repo.packagist.org/') === 0) {
  38607. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  38608. $degradedPackagist = true;
  38609. }
  38610. $maxFileSize = null;
  38611. if (isset($options['max_file_size'])) {
  38612. $maxFileSize = $options['max_file_size'];
  38613. unset($options['max_file_size']);
  38614. }
  38615. $ctx = StreamContextFactory::getContext($fileUrl, $options, ['notification' => [$this, 'callbackGet']]);
  38616. $proxy = $this->proxyManager->getProxyForRequest($fileUrl);
  38617. $usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
  38618. $this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  38619. unset($origFileUrl, $proxy, $usingProxy);
  38620. if ((!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist)) {
  38621. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  38622. }
  38623. if ($this->progress && !$isRedirect) {
  38624. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  38625. }
  38626. $errorMessage = '';
  38627. $errorCode = 0;
  38628. $result = false;
  38629. set_error_handler(static function ($code, $msg) use (&$errorMessage): bool {
  38630. if ($errorMessage) {
  38631. $errorMessage .= "\n";
  38632. }
  38633. $errorMessage .= Preg::replace('{^file_get_contents\(.*?\): }', '', $msg);
  38634. return true;
  38635. });
  38636. $http_response_header = [];
  38637. try {
  38638. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header, $maxFileSize);
  38639. if (!empty($http_response_header[0])) {
  38640. $statusCode = self::findStatusCode($http_response_header);
  38641. if ($statusCode >= 400 && Response::findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  38642. HttpDownloader::outputWarnings($this->io, $originUrl, json_decode($result, true));
  38643. }
  38644. if (in_array($statusCode, [401, 403]) && $retryAuthFailure) {
  38645. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $http_response_header);
  38646. }
  38647. }
  38648. $contentLength = !empty($http_response_header[0]) ? Response::findHeaderValue($http_response_header, 'content-length') : null;
  38649. if ($contentLength && Platform::strlen($result) < $contentLength) {
  38650. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  38651. $e->setHeaders($http_response_header);
  38652. $e->setStatusCode(self::findStatusCode($http_response_header));
  38653. try {
  38654. $e->setResponse($this->decodeResult($result, $http_response_header));
  38655. } catch (\Exception $discarded) {
  38656. $e->setResponse($this->normalizeResult($result));
  38657. }
  38658. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  38659. throw $e;
  38660. }
  38661. } catch (\Exception $e) {
  38662. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  38663. $e->setHeaders($http_response_header);
  38664. $e->setStatusCode(self::findStatusCode($http_response_header));
  38665. }
  38666. if ($e instanceof TransportException && $result !== false) {
  38667. $e->setResponse($this->decodeResult($result, $http_response_header));
  38668. }
  38669. $result = false;
  38670. }
  38671. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  38672. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  38673. }
  38674. restore_error_handler();
  38675. if (isset($e) && !$this->retry) {
  38676. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  38677. $this->degradedMode = true;
  38678. $this->io->writeError('');
  38679. $this->io->writeError([
  38680. '<error>'.$e->getMessage().'</error>',
  38681. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  38682. ]);
  38683. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  38684. }
  38685. throw $e;
  38686. }
  38687. $statusCode = null;
  38688. $contentType = null;
  38689. $locationHeader = null;
  38690. if (!empty($http_response_header[0])) {
  38691. $statusCode = self::findStatusCode($http_response_header);
  38692. $contentType = Response::findHeaderValue($http_response_header, 'content-type');
  38693. $locationHeader = Response::findHeaderValue($http_response_header, 'location');
  38694. }
  38695. if ($originUrl === 'bitbucket.org'
  38696. && !$this->authHelper->isPublicBitBucketDownload($fileUrl)
  38697. && substr($fileUrl, -4) === '.zip'
  38698. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  38699. && $contentType && Preg::isMatch('{^text/html\b}i', $contentType)
  38700. ) {
  38701. $result = false;
  38702. if ($retryAuthFailure) {
  38703. $this->promptAuthAndRetry(401);
  38704. }
  38705. }
  38706. if ($statusCode === 404
  38707. && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  38708. && false !== strpos($fileUrl, 'archive.zip')
  38709. ) {
  38710. $result = false;
  38711. if ($retryAuthFailure) {
  38712. $this->promptAuthAndRetry(401);
  38713. }
  38714. }
  38715. $hasFollowedRedirect = false;
  38716. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  38717. $hasFollowedRedirect = true;
  38718. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  38719. }
  38720. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  38721. if (!$this->retry) {
  38722. if ($this->progress && !$isRedirect) {
  38723. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  38724. }
  38725. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  38726. $e->setHeaders($http_response_header);
  38727. $e->setResponse($this->decodeResult($result, $http_response_header));
  38728. $e->setStatusCode($statusCode);
  38729. throw $e;
  38730. }
  38731. $result = false;
  38732. }
  38733. if ($this->progress && !$this->retry && !$isRedirect) {
  38734. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  38735. }
  38736. if ($result && extension_loaded('zlib') && strpos($fileUrl, 'http') === 0 && !$hasFollowedRedirect) {
  38737. try {
  38738. $result = $this->decodeResult($result, $http_response_header);
  38739. } catch (\Exception $e) {
  38740. if ($this->degradedMode) {
  38741. throw $e;
  38742. }
  38743. $this->degradedMode = true;
  38744. $this->io->writeError([
  38745. '',
  38746. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  38747. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  38748. ]);
  38749. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  38750. }
  38751. }
  38752. if (false !== $result && null !== $fileName && !$isRedirect) {
  38753. if ('' === $result) {
  38754. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  38755. }
  38756. $errorMessage = '';
  38757. set_error_handler(static function ($code, $msg) use (&$errorMessage): bool {
  38758. if ($errorMessage) {
  38759. $errorMessage .= "\n";
  38760. }
  38761. $errorMessage .= Preg::replace('{^file_put_contents\(.*?\): }', '', $msg);
  38762. return true;
  38763. });
  38764. $result = (bool) file_put_contents($fileName, $result);
  38765. restore_error_handler();
  38766. if (false === $result) {
  38767. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  38768. }
  38769. }
  38770. if ($this->retry) {
  38771. $this->retry = false;
  38772. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  38773. if ($this->storeAuth) {
  38774. $this->authHelper->storeAuth($this->originUrl, $this->storeAuth);
  38775. $this->storeAuth = false;
  38776. }
  38777. return $result;
  38778. }
  38779. if (false === $result) {
  38780. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  38781. if (!empty($http_response_header[0])) {
  38782. $e->setHeaders($http_response_header);
  38783. }
  38784. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  38785. $this->degradedMode = true;
  38786. $this->io->writeError('');
  38787. $this->io->writeError([
  38788. '<error>'.$e->getMessage().'</error>',
  38789. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  38790. ]);
  38791. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  38792. }
  38793. throw $e;
  38794. }
  38795. if (!empty($http_response_header[0])) {
  38796. $this->lastHeaders = $http_response_header;
  38797. }
  38798. return $result;
  38799. }
  38800. protected function getRemoteContents(string $originUrl, string $fileUrl, $context, ?array &$responseHeaders = null, ?int $maxFileSize = null)
  38801. {
  38802. $result = false;
  38803. try {
  38804. $e = null;
  38805. if ($maxFileSize !== null) {
  38806. $result = file_get_contents($fileUrl, false, $context, 0, $maxFileSize);
  38807. } else {
  38808. $result = file_get_contents($fileUrl, false, $context);
  38809. }
  38810. } catch (\Throwable $e) {
  38811. }
  38812. if ($result !== false && $maxFileSize !== null && Platform::strlen($result) >= $maxFileSize) {
  38813. throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($result) . ' of allowed ' . $maxFileSize . ' bytes');
  38814. }
  38815. $responseHeaders = $http_response_header ?? [];
  38816. if (null !== $e) {
  38817. throw $e;
  38818. }
  38819. return $result;
  38820. }
  38821. protected function callbackGet(int $notificationCode, int $severity, ?string $message, int $messageCode, int $bytesTransferred, int $bytesMax)
  38822. {
  38823. switch ($notificationCode) {
  38824. case STREAM_NOTIFY_FAILURE:
  38825. if (400 === $messageCode) {
  38826. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  38827. }
  38828. break;
  38829. case STREAM_NOTIFY_FILE_SIZE_IS:
  38830. $this->bytesMax = $bytesMax;
  38831. break;
  38832. case STREAM_NOTIFY_PROGRESS:
  38833. if ($this->bytesMax > 0 && $this->progress) {
  38834. $progression = min(100, (int) round($bytesTransferred / $this->bytesMax * 100));
  38835. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  38836. $this->lastProgress = $progression;
  38837. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  38838. }
  38839. }
  38840. break;
  38841. default:
  38842. break;
  38843. }
  38844. }
  38845. protected function promptAuthAndRetry($httpStatus, ?string $reason = null, array $headers = [])
  38846. {
  38847. $result = $this->authHelper->promptAuthIfNeeded($this->fileUrl, $this->originUrl, $httpStatus, $reason, $headers, 1 );
  38848. $this->storeAuth = $result['storeAuth'];
  38849. $this->retry = $result['retry'];
  38850. if ($this->retry) {
  38851. throw new TransportException('RETRY');
  38852. }
  38853. }
  38854. protected function getOptionsForUrl(string $originUrl, array $additionalOptions)
  38855. {
  38856. $tlsOptions = [];
  38857. $headers = [];
  38858. if (extension_loaded('zlib')) {
  38859. $headers[] = 'Accept-Encoding: gzip';
  38860. }
  38861. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  38862. if (!$this->degradedMode) {
  38863. $options['http']['protocol_version'] = 1.1;
  38864. $headers[] = 'Connection: close';
  38865. }
  38866. $headers = $this->authHelper->addAuthenticationHeader($headers, $originUrl, $this->fileUrl);
  38867. $options['http']['follow_location'] = 0;
  38868. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  38869. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  38870. }
  38871. foreach ($headers as $header) {
  38872. $options['http']['header'][] = $header;
  38873. }
  38874. return $options;
  38875. }
  38876. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  38877. {
  38878. if ($locationHeader = Response::findHeaderValue($http_response_header, 'location')) {
  38879. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  38880. $targetUrl = $locationHeader;
  38881. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  38882. $targetUrl = $this->scheme.':'.$locationHeader;
  38883. } elseif ('/' === $locationHeader[0]) {
  38884. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  38885. $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  38886. } else {
  38887. $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  38888. }
  38889. }
  38890. if (!empty($targetUrl)) {
  38891. $this->redirects++;
  38892. $this->io->writeError('', true, IOInterface::DEBUG);
  38893. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
  38894. $additionalOptions['redirects'] = $this->redirects;
  38895. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  38896. }
  38897. if (!$this->retry) {
  38898. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  38899. $e->setHeaders($http_response_header);
  38900. $e->setResponse($this->decodeResult($result, $http_response_header));
  38901. throw $e;
  38902. }
  38903. return false;
  38904. }
  38905. private function decodeResult($result, array $http_response_header): ?string
  38906. {
  38907. if ($result && extension_loaded('zlib')) {
  38908. $contentEncoding = Response::findHeaderValue($http_response_header, 'content-encoding');
  38909. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  38910. if ($decode) {
  38911. $result = zlib_decode($result);
  38912. if ($result === false) {
  38913. throw new TransportException('Failed to decode zlib stream');
  38914. }
  38915. }
  38916. }
  38917. return $this->normalizeResult($result);
  38918. }
  38919. private function normalizeResult($result): ?string
  38920. {
  38921. if ($result === false) {
  38922. return null;
  38923. }
  38924. return $result;
  38925. }
  38926. }
  38927. <?php declare(strict_types=1);
  38928. namespace Composer\Util;
  38929. class Silencer
  38930. {
  38931. private static $stack = [];
  38932. public static function suppress(?int $mask = null): int
  38933. {
  38934. if (!isset($mask)) {
  38935. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  38936. }
  38937. $old = error_reporting();
  38938. self::$stack[] = $old;
  38939. error_reporting($old & ~$mask);
  38940. return $old;
  38941. }
  38942. public static function restore(): void
  38943. {
  38944. if (!empty(self::$stack)) {
  38945. error_reporting(array_pop(self::$stack));
  38946. }
  38947. }
  38948. public static function call(callable $callable, ...$parameters)
  38949. {
  38950. try {
  38951. self::suppress();
  38952. $result = $callable(...$parameters);
  38953. self::restore();
  38954. return $result;
  38955. } catch (\Exception $e) {
  38956. self::restore();
  38957. throw $e;
  38958. }
  38959. }
  38960. }
  38961. <?php declare(strict_types=1);
  38962. namespace Composer\Util;
  38963. use Composer\Composer;
  38964. use Composer\CaBundle\CaBundle;
  38965. use Composer\Downloader\TransportException;
  38966. use Composer\Repository\PlatformRepository;
  38967. use Composer\Util\Http\ProxyManager;
  38968. use Psr\Log\LoggerInterface;
  38969. final class StreamContextFactory
  38970. {
  38971. public static function getContext(string $url, array $defaultOptions = [], array $defaultParams = [])
  38972. {
  38973. $options = ['http' => [
  38974. 'follow_location' => 1,
  38975. 'max_redirects' => 20,
  38976. ]];
  38977. $options = array_replace_recursive($options, self::initOptions($url, $defaultOptions));
  38978. unset($defaultOptions['http']['header']);
  38979. $options = array_replace_recursive($options, $defaultOptions);
  38980. if (isset($options['http']['header'])) {
  38981. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  38982. }
  38983. return stream_context_create($options, $defaultParams);
  38984. }
  38985. public static function initOptions(string $url, array $options, bool $forCurl = false): array
  38986. {
  38987. if (!isset($options['http']['header'])) {
  38988. $options['http']['header'] = [];
  38989. }
  38990. if (is_string($options['http']['header'])) {
  38991. $options['http']['header'] = explode("\r\n", $options['http']['header']);
  38992. }
  38993. if (!$forCurl) {
  38994. $proxy = ProxyManager::getInstance()->getProxyForRequest($url);
  38995. if ($proxyOptions = $proxy->getContextOptions()) {
  38996. $isHttpsRequest = 0 === strpos($url, 'https://');
  38997. if ($proxy->isSecure()) {
  38998. if (!extension_loaded('openssl')) {
  38999. throw new TransportException('You must enable the openssl extension to use a secure proxy.');
  39000. }
  39001. if ($isHttpsRequest) {
  39002. throw new TransportException('You must enable the curl extension to make https requests through a secure proxy.');
  39003. }
  39004. } elseif ($isHttpsRequest && !extension_loaded('openssl')) {
  39005. throw new TransportException('You must enable the openssl extension to make https requests through a proxy.');
  39006. }
  39007. if (isset($proxyOptions['http']['header'])) {
  39008. $options['http']['header'][] = $proxyOptions['http']['header'];
  39009. unset($proxyOptions['http']['header']);
  39010. }
  39011. $options = array_replace_recursive($options, $proxyOptions);
  39012. }
  39013. }
  39014. if (defined('HHVM_VERSION')) {
  39015. $phpVersion = 'HHVM ' . HHVM_VERSION;
  39016. } else {
  39017. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  39018. }
  39019. if ($forCurl) {
  39020. $curl = curl_version();
  39021. $httpVersion = 'cURL '.$curl['version'];
  39022. } else {
  39023. $httpVersion = 'streams';
  39024. }
  39025. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  39026. $platformPhpVersion = PlatformRepository::getPlatformPhpVersion();
  39027. $options['http']['header'][] = sprintf(
  39028. 'User-Agent: Composer/%s (%s; %s; %s; %s%s%s)',
  39029. Composer::getVersion(),
  39030. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  39031. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  39032. $phpVersion,
  39033. $httpVersion,
  39034. $platformPhpVersion ? '; Platform-PHP '.$platformPhpVersion : '',
  39035. Platform::getEnv('CI') ? '; CI' : ''
  39036. );
  39037. }
  39038. return $options;
  39039. }
  39040. public static function getTlsDefaults(array $options, ?LoggerInterface $logger = null): array
  39041. {
  39042. $ciphers = implode(':', [
  39043. 'ECDHE-RSA-AES128-GCM-SHA256',
  39044. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  39045. 'ECDHE-RSA-AES256-GCM-SHA384',
  39046. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  39047. 'DHE-RSA-AES128-GCM-SHA256',
  39048. 'DHE-DSS-AES128-GCM-SHA256',
  39049. 'kEDH+AESGCM',
  39050. 'ECDHE-RSA-AES128-SHA256',
  39051. 'ECDHE-ECDSA-AES128-SHA256',
  39052. 'ECDHE-RSA-AES128-SHA',
  39053. 'ECDHE-ECDSA-AES128-SHA',
  39054. 'ECDHE-RSA-AES256-SHA384',
  39055. 'ECDHE-ECDSA-AES256-SHA384',
  39056. 'ECDHE-RSA-AES256-SHA',
  39057. 'ECDHE-ECDSA-AES256-SHA',
  39058. 'DHE-RSA-AES128-SHA256',
  39059. 'DHE-RSA-AES128-SHA',
  39060. 'DHE-DSS-AES128-SHA256',
  39061. 'DHE-RSA-AES256-SHA256',
  39062. 'DHE-DSS-AES256-SHA',
  39063. 'DHE-RSA-AES256-SHA',
  39064. 'AES128-GCM-SHA256',
  39065. 'AES256-GCM-SHA384',
  39066. 'AES128-SHA256',
  39067. 'AES256-SHA256',
  39068. 'AES128-SHA',
  39069. 'AES256-SHA',
  39070. 'AES',
  39071. 'CAMELLIA',
  39072. 'DES-CBC3-SHA',
  39073. '!aNULL',
  39074. '!eNULL',
  39075. '!EXPORT',
  39076. '!DES',
  39077. '!RC4',
  39078. '!MD5',
  39079. '!PSK',
  39080. '!aECDH',
  39081. '!EDH-DSS-DES-CBC3-SHA',
  39082. '!EDH-RSA-DES-CBC3-SHA',
  39083. '!KRB5-DES-CBC3-SHA',
  39084. ]);
  39085. $defaults = [
  39086. 'ssl' => [
  39087. 'ciphers' => $ciphers,
  39088. 'verify_peer' => true,
  39089. 'verify_depth' => 7,
  39090. 'SNI_enabled' => true,
  39091. 'capture_peer_cert' => true,
  39092. ],
  39093. ];
  39094. if (isset($options['ssl'])) {
  39095. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  39096. }
  39097. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  39098. $result = CaBundle::getSystemCaRootBundlePath($logger);
  39099. if (is_dir($result)) {
  39100. $defaults['ssl']['capath'] = $result;
  39101. } else {
  39102. $defaults['ssl']['cafile'] = $result;
  39103. }
  39104. }
  39105. if (isset($defaults['ssl']['cafile']) && (!Filesystem::isReadable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $logger))) {
  39106. throw new TransportException('The configured cafile was not valid or could not be read.');
  39107. }
  39108. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !Filesystem::isReadable($defaults['ssl']['capath']))) {
  39109. throw new TransportException('The configured capath was not valid or could not be read.');
  39110. }
  39111. $defaults['ssl']['disable_compression'] = true;
  39112. return $defaults;
  39113. }
  39114. private static function fixHttpHeaderField($header): array
  39115. {
  39116. if (!is_array($header)) {
  39117. $header = explode("\r\n", $header);
  39118. }
  39119. uasort($header, static function ($el): int {
  39120. return stripos($el, 'content-type') === 0 ? 1 : -1;
  39121. });
  39122. return $header;
  39123. }
  39124. }
  39125. <?php declare(strict_types=1);
  39126. namespace Composer\Util;
  39127. use Composer\Config;
  39128. use Composer\IO\IOInterface;
  39129. use Composer\Pcre\Preg;
  39130. class Svn
  39131. {
  39132. private const MAX_QTY_AUTH_TRIES = 5;
  39133. protected $credentials;
  39134. protected $hasAuth;
  39135. protected $io;
  39136. protected $url;
  39137. protected $cacheCredentials = true;
  39138. protected $process;
  39139. protected $qtyAuthTries = 0;
  39140. protected $config;
  39141. private static $version;
  39142. public function __construct(string $url, IOInterface $io, Config $config, ?ProcessExecutor $process = null)
  39143. {
  39144. $this->url = $url;
  39145. $this->io = $io;
  39146. $this->config = $config;
  39147. $this->process = $process ?: new ProcessExecutor($io);
  39148. }
  39149. public static function cleanEnv(): void
  39150. {
  39151. Platform::clearEnv('DYLD_LIBRARY_PATH');
  39152. }
  39153. public function execute(string $command, string $url, ?string $cwd = null, ?string $path = null, bool $verbose = false): string
  39154. {
  39155. $this->config->prohibitUrlByConfig($url, $this->io);
  39156. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  39157. }
  39158. public function executeLocal(string $command, string $path, ?string $cwd = null, bool $verbose = false): string
  39159. {
  39160. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  39161. }
  39162. private function executeWithAuthRetry(string $svnCommand, ?string $cwd, string $url, ?string $path, bool $verbose): ?string
  39163. {
  39164. $command = $this->getCommand($svnCommand, $url, $path);
  39165. $output = null;
  39166. $io = $this->io;
  39167. $handler = static function ($type, $buffer) use (&$output, $io, $verbose) {
  39168. if ($type !== 'out') {
  39169. return null;
  39170. }
  39171. if (strpos($buffer, 'Redirecting to URL ') === 0) {
  39172. return null;
  39173. }
  39174. $output .= $buffer;
  39175. if ($verbose) {
  39176. $io->writeError($buffer, false);
  39177. }
  39178. };
  39179. $status = $this->process->execute($command, $handler, $cwd);
  39180. if (0 === $status) {
  39181. return $output;
  39182. }
  39183. $errorOutput = $this->process->getErrorOutput();
  39184. $fullOutput = trim(implode("\n", [$output, $errorOutput]));
  39185. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  39186. && false === stripos($fullOutput, 'authorization failed')
  39187. && false === stripos($fullOutput, 'svn: E170001:')
  39188. && false === stripos($fullOutput, 'svn: E215004:')) {
  39189. throw new \RuntimeException($fullOutput);
  39190. }
  39191. if (!$this->hasAuth()) {
  39192. $this->doAuthDance();
  39193. }
  39194. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  39195. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  39196. }
  39197. throw new \RuntimeException(
  39198. 'wrong credentials provided ('.$fullOutput.')'
  39199. );
  39200. }
  39201. public function setCacheCredentials(bool $cacheCredentials): void
  39202. {
  39203. $this->cacheCredentials = $cacheCredentials;
  39204. }
  39205. protected function doAuthDance(): Svn
  39206. {
  39207. if (!$this->io->isInteractive()) {
  39208. throw new \RuntimeException(
  39209. 'can not ask for authentication in non interactive mode'
  39210. );
  39211. }
  39212. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  39213. $this->hasAuth = true;
  39214. $this->credentials = [
  39215. 'username' => (string) $this->io->ask("Username: ", ''),
  39216. 'password' => (string) $this->io->askAndHideAnswer("Password: "),
  39217. ];
  39218. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ");
  39219. return $this;
  39220. }
  39221. protected function getCommand(string $cmd, string $url, ?string $path = null): string
  39222. {
  39223. $cmd = sprintf(
  39224. '%s %s%s -- %s',
  39225. $cmd,
  39226. '--non-interactive ',
  39227. $this->getCredentialString(),
  39228. ProcessExecutor::escape($url)
  39229. );
  39230. if ($path) {
  39231. $cmd .= ' ' . ProcessExecutor::escape($path);
  39232. }
  39233. return $cmd;
  39234. }
  39235. protected function getCredentialString(): string
  39236. {
  39237. if (!$this->hasAuth()) {
  39238. return '';
  39239. }
  39240. return sprintf(
  39241. ' %s--username %s --password %s ',
  39242. $this->getAuthCache(),
  39243. ProcessExecutor::escape($this->getUsername()),
  39244. ProcessExecutor::escape($this->getPassword())
  39245. );
  39246. }
  39247. protected function getPassword(): string
  39248. {
  39249. if ($this->credentials === null) {
  39250. throw new \LogicException("No svn auth detected.");
  39251. }
  39252. return $this->credentials['password'];
  39253. }
  39254. protected function getUsername(): string
  39255. {
  39256. if ($this->credentials === null) {
  39257. throw new \LogicException("No svn auth detected.");
  39258. }
  39259. return $this->credentials['username'];
  39260. }
  39261. protected function hasAuth(): bool
  39262. {
  39263. if (null !== $this->hasAuth) {
  39264. return $this->hasAuth;
  39265. }
  39266. if (false === $this->createAuthFromConfig()) {
  39267. $this->createAuthFromUrl();
  39268. }
  39269. return (bool) $this->hasAuth;
  39270. }
  39271. protected function getAuthCache(): string
  39272. {
  39273. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  39274. }
  39275. private function createAuthFromConfig(): bool
  39276. {
  39277. if (!$this->config->has('http-basic')) {
  39278. return $this->hasAuth = false;
  39279. }
  39280. $authConfig = $this->config->get('http-basic');
  39281. $host = parse_url($this->url, PHP_URL_HOST);
  39282. if (isset($authConfig[$host])) {
  39283. $this->credentials = [
  39284. 'username' => $authConfig[$host]['username'],
  39285. 'password' => $authConfig[$host]['password'],
  39286. ];
  39287. return $this->hasAuth = true;
  39288. }
  39289. return $this->hasAuth = false;
  39290. }
  39291. private function createAuthFromUrl(): bool
  39292. {
  39293. $uri = parse_url($this->url);
  39294. if (empty($uri['user'])) {
  39295. return $this->hasAuth = false;
  39296. }
  39297. $this->credentials = [
  39298. 'username' => $uri['user'],
  39299. 'password' => !empty($uri['pass']) ? $uri['pass'] : '',
  39300. ];
  39301. return $this->hasAuth = true;
  39302. }
  39303. public function binaryVersion(): ?string
  39304. {
  39305. if (!self::$version) {
  39306. if (0 === $this->process->execute('svn --version', $output)) {
  39307. if (Preg::isMatch('{(\d+(?:\.\d+)+)}', $output, $match)) {
  39308. self::$version = $match[1];
  39309. }
  39310. }
  39311. }
  39312. return self::$version;
  39313. }
  39314. }
  39315. <?php declare(strict_types=1);
  39316. namespace Composer\Util;
  39317. use Composer\Downloader\DownloaderInterface;
  39318. use Composer\Downloader\DownloadManager;
  39319. use Composer\Package\PackageInterface;
  39320. use React\Promise\PromiseInterface;
  39321. class SyncHelper
  39322. {
  39323. public static function downloadAndInstallPackageSync(Loop $loop, $downloader, string $path, PackageInterface $package, ?PackageInterface $prevPackage = null): void
  39324. {
  39325. assert($downloader instanceof DownloaderInterface || $downloader instanceof DownloadManager);
  39326. $type = $prevPackage !== null ? 'update' : 'install';
  39327. try {
  39328. self::await($loop, $downloader->download($package, $path, $prevPackage));
  39329. self::await($loop, $downloader->prepare($type, $package, $path, $prevPackage));
  39330. if ($type === 'update' && $prevPackage !== null) {
  39331. self::await($loop, $downloader->update($package, $prevPackage, $path));
  39332. } else {
  39333. self::await($loop, $downloader->install($package, $path));
  39334. }
  39335. } catch (\Exception $e) {
  39336. self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
  39337. throw $e;
  39338. }
  39339. self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
  39340. }
  39341. public static function await(Loop $loop, ?PromiseInterface $promise = null): void
  39342. {
  39343. if ($promise !== null) {
  39344. $loop->wait([$promise]);
  39345. }
  39346. }
  39347. }
  39348. <?php declare(strict_types=1);
  39349. namespace Composer\Util;
  39350. class Tar
  39351. {
  39352. public static function getComposerJson(string $pathToArchive): ?string
  39353. {
  39354. $phar = new \PharData($pathToArchive);
  39355. if (!$phar->valid()) {
  39356. return null;
  39357. }
  39358. return self::extractComposerJsonFromFolder($phar);
  39359. }
  39360. private static function extractComposerJsonFromFolder(\PharData $phar): string
  39361. {
  39362. if (isset($phar['composer.json'])) {
  39363. return $phar['composer.json']->getContent();
  39364. }
  39365. $topLevelPaths = [];
  39366. foreach ($phar as $folderFile) {
  39367. $name = $folderFile->getBasename();
  39368. if ($folderFile->isDir()) {
  39369. $topLevelPaths[$name] = true;
  39370. if (\count($topLevelPaths) > 1) {
  39371. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  39372. }
  39373. }
  39374. }
  39375. $composerJsonPath = key($topLevelPaths).'/composer.json';
  39376. if ($topLevelPaths && isset($phar[$composerJsonPath])) {
  39377. return $phar[$composerJsonPath]->getContent();
  39378. }
  39379. throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
  39380. }
  39381. }
  39382. <?php declare(strict_types=1);
  39383. namespace Composer\Util;
  39384. use Composer\CaBundle\CaBundle;
  39385. use Composer\Pcre\Preg;
  39386. final class TlsHelper
  39387. {
  39388. public static function checkCertificateHost($certificate, string $hostname, ?string &$cn = null): bool
  39389. {
  39390. $names = self::getCertificateNames($certificate);
  39391. if (empty($names)) {
  39392. return false;
  39393. }
  39394. $combinedNames = array_merge($names['san'], [$names['cn']]);
  39395. $hostname = strtolower($hostname);
  39396. foreach ($combinedNames as $certName) {
  39397. $matcher = self::certNameMatcher($certName);
  39398. if ($matcher && $matcher($hostname)) {
  39399. $cn = $names['cn'];
  39400. return true;
  39401. }
  39402. }
  39403. return false;
  39404. }
  39405. public static function getCertificateNames($certificate): ?array
  39406. {
  39407. if (is_array($certificate)) {
  39408. $info = $certificate;
  39409. } elseif (CaBundle::isOpensslParseSafe()) {
  39410. $info = openssl_x509_parse($certificate, false);
  39411. }
  39412. if (!isset($info['subject']['commonName'])) {
  39413. return null;
  39414. }
  39415. $commonName = strtolower($info['subject']['commonName']);
  39416. $subjectAltNames = [];
  39417. if (isset($info['extensions']['subjectAltName'])) {
  39418. $subjectAltNames = Preg::split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  39419. $subjectAltNames = array_filter(array_map(static function ($name): ?string {
  39420. if (0 === strpos($name, 'DNS:')) {
  39421. return strtolower(ltrim(substr($name, 4)));
  39422. }
  39423. return null;
  39424. }, $subjectAltNames));
  39425. $subjectAltNames = array_values($subjectAltNames);
  39426. }
  39427. return [
  39428. 'cn' => $commonName,
  39429. 'san' => $subjectAltNames,
  39430. ];
  39431. }
  39432. public static function getCertificateFingerprint(string $certificate): string
  39433. {
  39434. $pubkey = openssl_get_publickey($certificate);
  39435. if ($pubkey === false) {
  39436. throw new \RuntimeException('Failed to retrieve the public key from certificate');
  39437. }
  39438. $pubkeydetails = openssl_pkey_get_details($pubkey);
  39439. $pubkeypem = $pubkeydetails['key'];
  39440. $start = '-----BEGIN PUBLIC KEY-----';
  39441. $end = '-----END PUBLIC KEY-----';
  39442. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  39443. $der = base64_decode($pemtrim);
  39444. return sha1($der);
  39445. }
  39446. public static function isOpensslParseSafe(): bool
  39447. {
  39448. return CaBundle::isOpensslParseSafe();
  39449. }
  39450. private static function certNameMatcher(string $certName): ?callable
  39451. {
  39452. $wildcards = substr_count($certName, '*');
  39453. if (0 === $wildcards) {
  39454. return static function ($hostname) use ($certName): bool {
  39455. return $hostname === $certName;
  39456. };
  39457. }
  39458. if (1 === $wildcards) {
  39459. $components = explode('.', $certName);
  39460. if (3 > count($components)) {
  39461. return null;
  39462. }
  39463. $firstComponent = $components[0];
  39464. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  39465. return null;
  39466. }
  39467. $wildcardRegex = preg_quote($certName);
  39468. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  39469. $wildcardRegex = "{^{$wildcardRegex}$}";
  39470. return static function ($hostname) use ($wildcardRegex): bool {
  39471. return Preg::isMatch($wildcardRegex, $hostname);
  39472. };
  39473. }
  39474. return null;
  39475. }
  39476. }
  39477. <?php declare(strict_types=1);
  39478. namespace Composer\Util;
  39479. use Composer\Config;
  39480. use Composer\Pcre\Preg;
  39481. class Url
  39482. {
  39483. public static function updateDistReference(Config $config, string $url, string $ref): string
  39484. {
  39485. $host = parse_url($url, PHP_URL_HOST);
  39486. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  39487. if (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  39488. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  39489. } elseif (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  39490. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  39491. } elseif (Preg::isMatch('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  39492. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  39493. }
  39494. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  39495. if (Preg::isMatch('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  39496. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  39497. }
  39498. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  39499. if (Preg::isMatch('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  39500. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  39501. }
  39502. } elseif (in_array($host, $config->get('github-domains'), true)) {
  39503. $url = Preg::replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  39504. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  39505. $url = Preg::replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  39506. }
  39507. assert($url !== '');
  39508. return $url;
  39509. }
  39510. public static function getOrigin(Config $config, string $url): string
  39511. {
  39512. if (0 === strpos($url, 'file://')) {
  39513. return $url;
  39514. }
  39515. $origin = (string) parse_url($url, PHP_URL_HOST);
  39516. if ($port = parse_url($url, PHP_URL_PORT)) {
  39517. $origin .= ':'.$port;
  39518. }
  39519. if (strpos($origin, '.github.com') === (strlen($origin) - 11)) {
  39520. return 'github.com';
  39521. }
  39522. if ($origin === 'repo.packagist.org') {
  39523. return 'packagist.org';
  39524. }
  39525. if ($origin === '') {
  39526. $origin = $url;
  39527. }
  39528. if (
  39529. false === strpos($origin, '/')
  39530. && !in_array($origin, $config->get('gitlab-domains'), true)
  39531. ) {
  39532. foreach ($config->get('gitlab-domains') as $gitlabDomain) {
  39533. if ($gitlabDomain !== '' && str_starts_with($gitlabDomain, $origin)) {
  39534. return $gitlabDomain;
  39535. }
  39536. }
  39537. }
  39538. return $origin;
  39539. }
  39540. public static function sanitize(string $url): string
  39541. {
  39542. $url = Preg::replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  39543. $url = Preg::replaceCallback('{^(?P<prefix>[a-z0-9]+://)?(?P<user>[^:/\s@]+):(?P<password>[^@\s/]+)@}i', static function ($m): string {
  39544. assert(is_string($m['user']));
  39545. if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+|github_pat_[a-zA-Z0-9_]+)$}', $m['user'])) {
  39546. return $m['prefix'].'***:***@';
  39547. }
  39548. return $m['prefix'].$m['user'].':***@';
  39549. }, $url);
  39550. return $url;
  39551. }
  39552. }
  39553. <?php declare(strict_types=1);
  39554. namespace Composer\Util;
  39555. class Zip
  39556. {
  39557. public static function getComposerJson(string $pathToZip): ?string
  39558. {
  39559. if (!extension_loaded('zip')) {
  39560. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  39561. }
  39562. $zip = new \ZipArchive();
  39563. if ($zip->open($pathToZip) !== true) {
  39564. return null;
  39565. }
  39566. if (0 === $zip->numFiles) {
  39567. $zip->close();
  39568. return null;
  39569. }
  39570. $foundFileIndex = self::locateFile($zip, 'composer.json');
  39571. $content = null;
  39572. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  39573. $stream = $zip->getStream($configurationFileName);
  39574. if (false !== $stream) {
  39575. $content = stream_get_contents($stream);
  39576. }
  39577. $zip->close();
  39578. return $content;
  39579. }
  39580. private static function locateFile(\ZipArchive $zip, string $filename): int
  39581. {
  39582. if (false !== ($index = $zip->locateName($filename)) && $zip->getFromIndex($index) !== false) {
  39583. return $index;
  39584. }
  39585. $topLevelPaths = [];
  39586. for ($i = 0; $i < $zip->numFiles; $i++) {
  39587. $name = $zip->getNameIndex($i);
  39588. $dirname = dirname($name);
  39589. if (strpos($name, '__MACOSX') !== false) {
  39590. continue;
  39591. }
  39592. if ($dirname === '.') {
  39593. $topLevelPaths[$name] = true;
  39594. if (\count($topLevelPaths) > 1) {
  39595. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  39596. }
  39597. continue;
  39598. }
  39599. if (false === strpos($dirname, '\\') && false === strpos($dirname, '/')) {
  39600. $topLevelPaths[$dirname.'/'] = true;
  39601. if (\count($topLevelPaths) > 1) {
  39602. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  39603. }
  39604. }
  39605. }
  39606. if ($topLevelPaths && false !== ($index = $zip->locateName(key($topLevelPaths).$filename)) && $zip->getFromIndex($index) !== false) {
  39607. return $index;
  39608. }
  39609. throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
  39610. }
  39611. }
  39612. <?php declare(strict_types=1);
  39613. use Composer\Autoload\ClassLoader;
  39614. function includeIfExists(string $file): ?ClassLoader
  39615. {
  39616. return file_exists($file) ? include $file : null;
  39617. }
  39618. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  39619. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  39620. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  39621. exit(1);
  39622. }
  39623. return $loader;
  39624. <?php
  39625. /*
  39626. * This file is part of Composer.
  39627. *
  39628. * (c) Nils Adermann <naderman@naderman.de>
  39629. * Jordi Boggiano <j.boggiano@seld.be>
  39630. *
  39631. * For the full copyright and license information, please view the LICENSE
  39632. * file that was distributed with this source code.
  39633. */
  39634. namespace Composer\Autoload;
  39635. /**
  39636. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  39637. *
  39638. * $loader = new \Composer\Autoload\ClassLoader();
  39639. *
  39640. * // register classes with namespaces
  39641. * $loader->add('Symfony\Component', __DIR__.'/component');
  39642. * $loader->add('Symfony', __DIR__.'/framework');
  39643. *
  39644. * // activate the autoloader
  39645. * $loader->register();
  39646. *
  39647. * // to enable searching the include path (eg. for PEAR packages)
  39648. * $loader->setUseIncludePath(true);
  39649. *
  39650. * In this example, if you try to use a class in the Symfony\Component
  39651. * namespace or one of its children (Symfony\Component\Console for instance),
  39652. * the autoloader will first look for the class under the component/
  39653. * directory, and it will then fallback to the framework/ directory if not
  39654. * found before giving up.
  39655. *
  39656. * This class is loosely based on the Symfony UniversalClassLoader.
  39657. *
  39658. * @author Fabien Potencier <fabien@symfony.com>
  39659. * @author Jordi Boggiano <j.boggiano@seld.be>
  39660. * @see https://www.php-fig.org/psr/psr-0/
  39661. * @see https://www.php-fig.org/psr/psr-4/
  39662. */
  39663. class ClassLoader
  39664. {
  39665. /** @var \Closure(string):void */
  39666. private static $includeFile;
  39667. /** @var string|null */
  39668. private $vendorDir;
  39669. // PSR-4
  39670. /**
  39671. * @var array<string, array<string, int>>
  39672. */
  39673. private $prefixLengthsPsr4 = array();
  39674. /**
  39675. * @var array<string, list<string>>
  39676. */
  39677. private $prefixDirsPsr4 = array();
  39678. /**
  39679. * @var list<string>
  39680. */
  39681. private $fallbackDirsPsr4 = array();
  39682. // PSR-0
  39683. /**
  39684. * List of PSR-0 prefixes
  39685. *
  39686. * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
  39687. *
  39688. * @var array<string, array<string, list<string>>>
  39689. */
  39690. private $prefixesPsr0 = array();
  39691. /**
  39692. * @var list<string>
  39693. */
  39694. private $fallbackDirsPsr0 = array();
  39695. /** @var bool */
  39696. private $useIncludePath = false;
  39697. /**
  39698. * @var array<string, string>
  39699. */
  39700. private $classMap = array();
  39701. /** @var bool */
  39702. private $classMapAuthoritative = false;
  39703. /**
  39704. * @var array<string, bool>
  39705. */
  39706. private $missingClasses = array();
  39707. /** @var string|null */
  39708. private $apcuPrefix;
  39709. /**
  39710. * @var array<string, self>
  39711. */
  39712. private static $registeredLoaders = array();
  39713. /**
  39714. * @param string|null $vendorDir
  39715. */
  39716. public function __construct($vendorDir = null)
  39717. {
  39718. $this->vendorDir = $vendorDir;
  39719. self::initializeIncludeClosure();
  39720. }
  39721. /**
  39722. * @return array<string, list<string>>
  39723. */
  39724. public function getPrefixes()
  39725. {
  39726. if (!empty($this->prefixesPsr0)) {
  39727. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  39728. }
  39729. return array();
  39730. }
  39731. /**
  39732. * @return array<string, list<string>>
  39733. */
  39734. public function getPrefixesPsr4()
  39735. {
  39736. return $this->prefixDirsPsr4;
  39737. }
  39738. /**
  39739. * @return list<string>
  39740. */
  39741. public function getFallbackDirs()
  39742. {
  39743. return $this->fallbackDirsPsr0;
  39744. }
  39745. /**
  39746. * @return list<string>
  39747. */
  39748. public function getFallbackDirsPsr4()
  39749. {
  39750. return $this->fallbackDirsPsr4;
  39751. }
  39752. /**
  39753. * @return array<string, string> Array of classname => path
  39754. */
  39755. public function getClassMap()
  39756. {
  39757. return $this->classMap;
  39758. }
  39759. /**
  39760. * @param array<string, string> $classMap Class to filename map
  39761. *
  39762. * @return void
  39763. */
  39764. public function addClassMap(array $classMap)
  39765. {
  39766. if ($this->classMap) {
  39767. $this->classMap = array_merge($this->classMap, $classMap);
  39768. } else {
  39769. $this->classMap = $classMap;
  39770. }
  39771. }
  39772. /**
  39773. * Registers a set of PSR-0 directories for a given prefix, either
  39774. * appending or prepending to the ones previously set for this prefix.
  39775. *
  39776. * @param string $prefix The prefix
  39777. * @param list<string>|string $paths The PSR-0 root directories
  39778. * @param bool $prepend Whether to prepend the directories
  39779. *
  39780. * @return void
  39781. */
  39782. public function add($prefix, $paths, $prepend = false)
  39783. {
  39784. $paths = (array) $paths;
  39785. if (!$prefix) {
  39786. if ($prepend) {
  39787. $this->fallbackDirsPsr0 = array_merge(
  39788. $paths,
  39789. $this->fallbackDirsPsr0
  39790. );
  39791. } else {
  39792. $this->fallbackDirsPsr0 = array_merge(
  39793. $this->fallbackDirsPsr0,
  39794. $paths
  39795. );
  39796. }
  39797. return;
  39798. }
  39799. $first = $prefix[0];
  39800. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  39801. $this->prefixesPsr0[$first][$prefix] = $paths;
  39802. return;
  39803. }
  39804. if ($prepend) {
  39805. $this->prefixesPsr0[$first][$prefix] = array_merge(
  39806. $paths,
  39807. $this->prefixesPsr0[$first][$prefix]
  39808. );
  39809. } else {
  39810. $this->prefixesPsr0[$first][$prefix] = array_merge(
  39811. $this->prefixesPsr0[$first][$prefix],
  39812. $paths
  39813. );
  39814. }
  39815. }
  39816. /**
  39817. * Registers a set of PSR-4 directories for a given namespace, either
  39818. * appending or prepending to the ones previously set for this namespace.
  39819. *
  39820. * @param string $prefix The prefix/namespace, with trailing '\\'
  39821. * @param list<string>|string $paths The PSR-4 base directories
  39822. * @param bool $prepend Whether to prepend the directories
  39823. *
  39824. * @throws \InvalidArgumentException
  39825. *
  39826. * @return void
  39827. */
  39828. public function addPsr4($prefix, $paths, $prepend = false)
  39829. {
  39830. $paths = (array) $paths;
  39831. if (!$prefix) {
  39832. // Register directories for the root namespace.
  39833. if ($prepend) {
  39834. $this->fallbackDirsPsr4 = array_merge(
  39835. $paths,
  39836. $this->fallbackDirsPsr4
  39837. );
  39838. } else {
  39839. $this->fallbackDirsPsr4 = array_merge(
  39840. $this->fallbackDirsPsr4,
  39841. $paths
  39842. );
  39843. }
  39844. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  39845. // Register directories for a new namespace.
  39846. $length = strlen($prefix);
  39847. if ('\\' !== $prefix[$length - 1]) {
  39848. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  39849. }
  39850. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  39851. $this->prefixDirsPsr4[$prefix] = $paths;
  39852. } elseif ($prepend) {
  39853. // Prepend directories for an already registered namespace.
  39854. $this->prefixDirsPsr4[$prefix] = array_merge(
  39855. $paths,
  39856. $this->prefixDirsPsr4[$prefix]
  39857. );
  39858. } else {
  39859. // Append directories for an already registered namespace.
  39860. $this->prefixDirsPsr4[$prefix] = array_merge(
  39861. $this->prefixDirsPsr4[$prefix],
  39862. $paths
  39863. );
  39864. }
  39865. }
  39866. /**
  39867. * Registers a set of PSR-0 directories for a given prefix,
  39868. * replacing any others previously set for this prefix.
  39869. *
  39870. * @param string $prefix The prefix
  39871. * @param list<string>|string $paths The PSR-0 base directories
  39872. *
  39873. * @return void
  39874. */
  39875. public function set($prefix, $paths)
  39876. {
  39877. if (!$prefix) {
  39878. $this->fallbackDirsPsr0 = (array) $paths;
  39879. } else {
  39880. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  39881. }
  39882. }
  39883. /**
  39884. * Registers a set of PSR-4 directories for a given namespace,
  39885. * replacing any others previously set for this namespace.
  39886. *
  39887. * @param string $prefix The prefix/namespace, with trailing '\\'
  39888. * @param list<string>|string $paths The PSR-4 base directories
  39889. *
  39890. * @throws \InvalidArgumentException
  39891. *
  39892. * @return void
  39893. */
  39894. public function setPsr4($prefix, $paths)
  39895. {
  39896. if (!$prefix) {
  39897. $this->fallbackDirsPsr4 = (array) $paths;
  39898. } else {
  39899. $length = strlen($prefix);
  39900. if ('\\' !== $prefix[$length - 1]) {
  39901. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  39902. }
  39903. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  39904. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  39905. }
  39906. }
  39907. /**
  39908. * Turns on searching the include path for class files.
  39909. *
  39910. * @param bool $useIncludePath
  39911. *
  39912. * @return void
  39913. */
  39914. public function setUseIncludePath($useIncludePath)
  39915. {
  39916. $this->useIncludePath = $useIncludePath;
  39917. }
  39918. /**
  39919. * Can be used to check if the autoloader uses the include path to check
  39920. * for classes.
  39921. *
  39922. * @return bool
  39923. */
  39924. public function getUseIncludePath()
  39925. {
  39926. return $this->useIncludePath;
  39927. }
  39928. /**
  39929. * Turns off searching the prefix and fallback directories for classes
  39930. * that have not been registered with the class map.
  39931. *
  39932. * @param bool $classMapAuthoritative
  39933. *
  39934. * @return void
  39935. */
  39936. public function setClassMapAuthoritative($classMapAuthoritative)
  39937. {
  39938. $this->classMapAuthoritative = $classMapAuthoritative;
  39939. }
  39940. /**
  39941. * Should class lookup fail if not found in the current class map?
  39942. *
  39943. * @return bool
  39944. */
  39945. public function isClassMapAuthoritative()
  39946. {
  39947. return $this->classMapAuthoritative;
  39948. }
  39949. /**
  39950. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  39951. *
  39952. * @param string|null $apcuPrefix
  39953. *
  39954. * @return void
  39955. */
  39956. public function setApcuPrefix($apcuPrefix)
  39957. {
  39958. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  39959. }
  39960. /**
  39961. * The APCu prefix in use, or null if APCu caching is not enabled.
  39962. *
  39963. * @return string|null
  39964. */
  39965. public function getApcuPrefix()
  39966. {
  39967. return $this->apcuPrefix;
  39968. }
  39969. /**
  39970. * Registers this instance as an autoloader.
  39971. *
  39972. * @param bool $prepend Whether to prepend the autoloader or not
  39973. *
  39974. * @return void
  39975. */
  39976. public function register($prepend = false)
  39977. {
  39978. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  39979. if (null === $this->vendorDir) {
  39980. return;
  39981. }
  39982. if ($prepend) {
  39983. self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
  39984. } else {
  39985. unset(self::$registeredLoaders[$this->vendorDir]);
  39986. self::$registeredLoaders[$this->vendorDir] = $this;
  39987. }
  39988. }
  39989. /**
  39990. * Unregisters this instance as an autoloader.
  39991. *
  39992. * @return void
  39993. */
  39994. public function unregister()
  39995. {
  39996. spl_autoload_unregister(array($this, 'loadClass'));
  39997. if (null !== $this->vendorDir) {
  39998. unset(self::$registeredLoaders[$this->vendorDir]);
  39999. }
  40000. }
  40001. /**
  40002. * Loads the given class or interface.
  40003. *
  40004. * @param string $class The name of the class
  40005. * @return true|null True if loaded, null otherwise
  40006. */
  40007. public function loadClass($class)
  40008. {
  40009. if ($file = $this->findFile($class)) {
  40010. $includeFile = self::$includeFile;
  40011. $includeFile($file);
  40012. return true;
  40013. }
  40014. return null;
  40015. }
  40016. /**
  40017. * Finds the path to the file where the class is defined.
  40018. *
  40019. * @param string $class The name of the class
  40020. *
  40021. * @return string|false The path if found, false otherwise
  40022. */
  40023. public function findFile($class)
  40024. {
  40025. // class map lookup
  40026. if (isset($this->classMap[$class])) {
  40027. return $this->classMap[$class];
  40028. }
  40029. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  40030. return false;
  40031. }
  40032. if (null !== $this->apcuPrefix) {
  40033. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  40034. if ($hit) {
  40035. return $file;
  40036. }
  40037. }
  40038. $file = $this->findFileWithExtension($class, '.php');
  40039. // Search for Hack files if we are running on HHVM
  40040. if (false === $file && defined('HHVM_VERSION')) {
  40041. $file = $this->findFileWithExtension($class, '.hh');
  40042. }
  40043. if (null !== $this->apcuPrefix) {
  40044. apcu_add($this->apcuPrefix.$class, $file);
  40045. }
  40046. if (false === $file) {
  40047. // Remember that this class does not exist.
  40048. $this->missingClasses[$class] = true;
  40049. }
  40050. return $file;
  40051. }
  40052. /**
  40053. * Returns the currently registered loaders keyed by their corresponding vendor directories.
  40054. *
  40055. * @return array<string, self>
  40056. */
  40057. public static function getRegisteredLoaders()
  40058. {
  40059. return self::$registeredLoaders;
  40060. }
  40061. /**
  40062. * @param string $class
  40063. * @param string $ext
  40064. * @return string|false
  40065. */
  40066. private function findFileWithExtension($class, $ext)
  40067. {
  40068. // PSR-4 lookup
  40069. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  40070. $first = $class[0];
  40071. if (isset($this->prefixLengthsPsr4[$first])) {
  40072. $subPath = $class;
  40073. while (false !== $lastPos = strrpos($subPath, '\\')) {
  40074. $subPath = substr($subPath, 0, $lastPos);
  40075. $search = $subPath . '\\';
  40076. if (isset($this->prefixDirsPsr4[$search])) {
  40077. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  40078. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  40079. if (file_exists($file = $dir . $pathEnd)) {
  40080. return $file;
  40081. }
  40082. }
  40083. }
  40084. }
  40085. }
  40086. // PSR-4 fallback dirs
  40087. foreach ($this->fallbackDirsPsr4 as $dir) {
  40088. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  40089. return $file;
  40090. }
  40091. }
  40092. // PSR-0 lookup
  40093. if (false !== $pos = strrpos($class, '\\')) {
  40094. // namespaced class name
  40095. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  40096. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  40097. } else {
  40098. // PEAR-like class name
  40099. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  40100. }
  40101. if (isset($this->prefixesPsr0[$first])) {
  40102. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  40103. if (0 === strpos($class, $prefix)) {
  40104. foreach ($dirs as $dir) {
  40105. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  40106. return $file;
  40107. }
  40108. }
  40109. }
  40110. }
  40111. }
  40112. // PSR-0 fallback dirs
  40113. foreach ($this->fallbackDirsPsr0 as $dir) {
  40114. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  40115. return $file;
  40116. }
  40117. }
  40118. // PSR-0 include paths.
  40119. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  40120. return $file;
  40121. }
  40122. return false;
  40123. }
  40124. /**
  40125. * @return void
  40126. */
  40127. private static function initializeIncludeClosure()
  40128. {
  40129. if (self::$includeFile !== null) {
  40130. return;
  40131. }
  40132. /**
  40133. * Scope isolated include.
  40134. *
  40135. * Prevents access to $this/self from included files.
  40136. *
  40137. * @param string $file
  40138. * @return void
  40139. */
  40140. self::$includeFile = \Closure::bind(static function($file) {
  40141. include $file;
  40142. }, null, null);
  40143. }
  40144. }
  40145. <?php
  40146. /*
  40147. * This file is part of Composer.
  40148. *
  40149. * (c) Nils Adermann <naderman@naderman.de>
  40150. * Jordi Boggiano <j.boggiano@seld.be>
  40151. *
  40152. * For the full copyright and license information, please view the LICENSE
  40153. * file that was distributed with this source code.
  40154. */
  40155. namespace Composer;
  40156. use Composer\Autoload\ClassLoader;
  40157. use Composer\Semver\VersionParser;
  40158. /**
  40159. * This class is copied in every Composer installed project and available to all
  40160. *
  40161. * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
  40162. *
  40163. * To require its presence, you can require `composer-runtime-api ^2.0`
  40164. *
  40165. * @final
  40166. */
  40167. class InstalledVersions
  40168. {
  40169. /**
  40170. * @var mixed[]|null
  40171. * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
  40172. */
  40173. private static $installed;
  40174. /**
  40175. * @var bool|null
  40176. */
  40177. private static $canGetVendors;
  40178. /**
  40179. * @var array[]
  40180. * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
  40181. */
  40182. private static $installedByVendor = array();
  40183. /**
  40184. * Returns a list of all package names which are present, either by being installed, replaced or provided
  40185. *
  40186. * @return string[]
  40187. * @psalm-return list<string>
  40188. */
  40189. public static function getInstalledPackages()
  40190. {
  40191. $packages = array();
  40192. foreach (self::getInstalled() as $installed) {
  40193. $packages[] = array_keys($installed['versions']);
  40194. }
  40195. if (1 === \count($packages)) {
  40196. return $packages[0];
  40197. }
  40198. return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
  40199. }
  40200. /**
  40201. * Returns a list of all package names with a specific type e.g. 'library'
  40202. *
  40203. * @param string $type
  40204. * @return string[]
  40205. * @psalm-return list<string>
  40206. */
  40207. public static function getInstalledPackagesByType($type)
  40208. {
  40209. $packagesByType = array();
  40210. foreach (self::getInstalled() as $installed) {
  40211. foreach ($installed['versions'] as $name => $package) {
  40212. if (isset($package['type']) && $package['type'] === $type) {
  40213. $packagesByType[] = $name;
  40214. }
  40215. }
  40216. }
  40217. return $packagesByType;
  40218. }
  40219. /**
  40220. * Checks whether the given package is installed
  40221. *
  40222. * This also returns true if the package name is provided or replaced by another package
  40223. *
  40224. * @param string $packageName
  40225. * @param bool $includeDevRequirements
  40226. * @return bool
  40227. */
  40228. public static function isInstalled($packageName, $includeDevRequirements = true)
  40229. {
  40230. foreach (self::getInstalled() as $installed) {
  40231. if (isset($installed['versions'][$packageName])) {
  40232. return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
  40233. }
  40234. }
  40235. return false;
  40236. }
  40237. /**
  40238. * Checks whether the given package satisfies a version constraint
  40239. *
  40240. * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
  40241. *
  40242. * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
  40243. *
  40244. * @param VersionParser $parser Install composer/semver to have access to this class and functionality
  40245. * @param string $packageName
  40246. * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
  40247. * @return bool
  40248. */
  40249. public static function satisfies(VersionParser $parser, $packageName, $constraint)
  40250. {
  40251. $constraint = $parser->parseConstraints((string) $constraint);
  40252. $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
  40253. return $provided->matches($constraint);
  40254. }
  40255. /**
  40256. * Returns a version constraint representing all the range(s) which are installed for a given package
  40257. *
  40258. * It is easier to use this via isInstalled() with the $constraint argument if you need to check
  40259. * whether a given version of a package is installed, and not just whether it exists
  40260. *
  40261. * @param string $packageName
  40262. * @return string Version constraint usable with composer/semver
  40263. */
  40264. public static function getVersionRanges($packageName)
  40265. {
  40266. foreach (self::getInstalled() as $installed) {
  40267. if (!isset($installed['versions'][$packageName])) {
  40268. continue;
  40269. }
  40270. $ranges = array();
  40271. if (isset($installed['versions'][$packageName]['pretty_version'])) {
  40272. $ranges[] = $installed['versions'][$packageName]['pretty_version'];
  40273. }
  40274. if (array_key_exists('aliases', $installed['versions'][$packageName])) {
  40275. $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
  40276. }
  40277. if (array_key_exists('replaced', $installed['versions'][$packageName])) {
  40278. $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
  40279. }
  40280. if (array_key_exists('provided', $installed['versions'][$packageName])) {
  40281. $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
  40282. }
  40283. return implode(' || ', $ranges);
  40284. }
  40285. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  40286. }
  40287. /**
  40288. * @param string $packageName
  40289. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
  40290. */
  40291. public static function getVersion($packageName)
  40292. {
  40293. foreach (self::getInstalled() as $installed) {
  40294. if (!isset($installed['versions'][$packageName])) {
  40295. continue;
  40296. }
  40297. if (!isset($installed['versions'][$packageName]['version'])) {
  40298. return null;
  40299. }
  40300. return $installed['versions'][$packageName]['version'];
  40301. }
  40302. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  40303. }
  40304. /**
  40305. * @param string $packageName
  40306. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
  40307. */
  40308. public static function getPrettyVersion($packageName)
  40309. {
  40310. foreach (self::getInstalled() as $installed) {
  40311. if (!isset($installed['versions'][$packageName])) {
  40312. continue;
  40313. }
  40314. if (!isset($installed['versions'][$packageName]['pretty_version'])) {
  40315. return null;
  40316. }
  40317. return $installed['versions'][$packageName]['pretty_version'];
  40318. }
  40319. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  40320. }
  40321. /**
  40322. * @param string $packageName
  40323. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
  40324. */
  40325. public static function getReference($packageName)
  40326. {
  40327. foreach (self::getInstalled() as $installed) {
  40328. if (!isset($installed['versions'][$packageName])) {
  40329. continue;
  40330. }
  40331. if (!isset($installed['versions'][$packageName]['reference'])) {
  40332. return null;
  40333. }
  40334. return $installed['versions'][$packageName]['reference'];
  40335. }
  40336. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  40337. }
  40338. /**
  40339. * @param string $packageName
  40340. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
  40341. */
  40342. public static function getInstallPath($packageName)
  40343. {
  40344. foreach (self::getInstalled() as $installed) {
  40345. if (!isset($installed['versions'][$packageName])) {
  40346. continue;
  40347. }
  40348. return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
  40349. }
  40350. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  40351. }
  40352. /**
  40353. * @return array
  40354. * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
  40355. */
  40356. public static function getRootPackage()
  40357. {
  40358. $installed = self::getInstalled();
  40359. return $installed[0]['root'];
  40360. }
  40361. /**
  40362. * Returns the raw installed.php data for custom implementations
  40363. *
  40364. * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
  40365. * @return array[]
  40366. * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
  40367. */
  40368. public static function getRawData()
  40369. {
  40370. @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
  40371. if (null === self::$installed) {
  40372. // only require the installed.php file if this file is loaded from its dumped location,
  40373. // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
  40374. if (substr(__DIR__, -8, 1) !== 'C') {
  40375. self::$installed = include __DIR__ . '/installed.php';
  40376. } else {
  40377. self::$installed = array();
  40378. }
  40379. }
  40380. return self::$installed;
  40381. }
  40382. /**
  40383. * Returns the raw data of all installed.php which are currently loaded for custom implementations
  40384. *
  40385. * @return array[]
  40386. * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
  40387. */
  40388. public static function getAllRawData()
  40389. {
  40390. return self::getInstalled();
  40391. }
  40392. /**
  40393. * Lets you reload the static array from another file
  40394. *
  40395. * This is only useful for complex integrations in which a project needs to use
  40396. * this class but then also needs to execute another project's autoloader in process,
  40397. * and wants to ensure both projects have access to their version of installed.php.
  40398. *
  40399. * A typical case would be PHPUnit, where it would need to make sure it reads all
  40400. * the data it needs from this class, then call reload() with
  40401. * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
  40402. * the project in which it runs can then also use this class safely, without
  40403. * interference between PHPUnit's dependencies and the project's dependencies.
  40404. *
  40405. * @param array[] $data A vendor/composer/installed.php data set
  40406. * @return void
  40407. *
  40408. * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
  40409. */
  40410. public static function reload($data)
  40411. {
  40412. self::$installed = $data;
  40413. self::$installedByVendor = array();
  40414. }
  40415. /**
  40416. * @return array[]
  40417. * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
  40418. */
  40419. private static function getInstalled()
  40420. {
  40421. if (null === self::$canGetVendors) {
  40422. self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
  40423. }
  40424. $installed = array();
  40425. if (self::$canGetVendors) {
  40426. foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
  40427. if (isset(self::$installedByVendor[$vendorDir])) {
  40428. $installed[] = self::$installedByVendor[$vendorDir];
  40429. } elseif (is_file($vendorDir.'/composer/installed.php')) {
  40430. /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
  40431. $required = require $vendorDir.'/composer/installed.php';
  40432. $installed[] = self::$installedByVendor[$vendorDir] = $required;
  40433. if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
  40434. self::$installed = $installed[count($installed) - 1];
  40435. }
  40436. }
  40437. }
  40438. }
  40439. if (null === self::$installed) {
  40440. // only require the installed.php file if this file is loaded from its dumped location,
  40441. // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
  40442. if (substr(__DIR__, -8, 1) !== 'C') {
  40443. /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
  40444. $required = require __DIR__ . '/installed.php';
  40445. self::$installed = $required;
  40446. } else {
  40447. self::$installed = array();
  40448. }
  40449. }
  40450. if (self::$installed !== array()) {
  40451. $installed[] = self::$installed;
  40452. }
  40453. return $installed;
  40454. }
  40455. }
  40456. {
  40457. "$schema": "https://json-schema.org/draft-04/schema#",
  40458. "description": "A representation of packages metadata.",
  40459. "type": "object",
  40460. "oneOf": [
  40461. { "required": [ "packages" ] },
  40462. { "required": [ "providers" ] },
  40463. { "required": [ "provider-includes", "providers-url" ] }
  40464. ],
  40465. "properties": {
  40466. "packages": {
  40467. "type": ["object", "array"],
  40468. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  40469. "additionalProperties": { "$ref": "#/definitions/versions" }
  40470. },
  40471. "providers-url": {
  40472. "type": "string",
  40473. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  40474. },
  40475. "provider-includes": {
  40476. "type": "object",
  40477. "description": "A hashmap of provider listings.",
  40478. "additionalProperties": { "$ref": "#/definitions/provider" }
  40479. },
  40480. "providers": {
  40481. "type": "object",
  40482. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  40483. "additionalProperties": { "$ref": "#/definitions/provider" }
  40484. },
  40485. "notify-batch": {
  40486. "type": "string",
  40487. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  40488. },
  40489. "search": {
  40490. "type": "string",
  40491. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  40492. },
  40493. "warning": {
  40494. "type": "string",
  40495. "description": "A message that will be output by Composer as a warning when this source is consulted."
  40496. }
  40497. },
  40498. "definitions": {
  40499. "versions": {
  40500. "type": "object",
  40501. "description": "A hashmap of versions and their metadata.",
  40502. "additionalProperties": { "$ref": "#/definitions/version" }
  40503. },
  40504. "version": {
  40505. "type": "object",
  40506. "oneOf": [
  40507. { "$ref": "#/definitions/package" },
  40508. { "$ref": "#/definitions/metapackage" }
  40509. ]
  40510. },
  40511. "package-base": {
  40512. "properties": {
  40513. "name": { "type": "string" },
  40514. "type": { "type": "string" },
  40515. "version": { "type": "string" },
  40516. "version_normalized": {
  40517. "type": "string",
  40518. "description": "Normalized version, optional but can save computational time on client side."
  40519. },
  40520. "autoload": { "type": "object" },
  40521. "require": { "type": "object" },
  40522. "replace": { "type": "object" },
  40523. "conflict": { "type": "object" },
  40524. "provide": { "type": "object" },
  40525. "time": { "type": "string" }
  40526. },
  40527. "additionalProperties": true
  40528. },
  40529. "package": {
  40530. "allOf": [
  40531. { "$ref": "#/definitions/package-base" },
  40532. {
  40533. "properties": {
  40534. "dist": { "type": "object" },
  40535. "source": { "type": "object" }
  40536. }
  40537. },
  40538. { "oneOf": [
  40539. { "required": [ "name", "version", "source" ] },
  40540. { "required": [ "name", "version", "dist" ] }
  40541. ] }
  40542. ]
  40543. },
  40544. "metapackage": {
  40545. "allOf": [
  40546. { "$ref": "#/definitions/package-base" },
  40547. {
  40548. "properties": {
  40549. "type": { "type": "string", "enum": [ "metapackage" ] }
  40550. },
  40551. "required": [ "name", "version", "type" ]
  40552. }
  40553. ]
  40554. },
  40555. "provider": {
  40556. "type": "object",
  40557. "properties": {
  40558. "sha256": {
  40559. "type": "string",
  40560. "description": "Hash value that can be used to validate the resource."
  40561. }
  40562. }
  40563. }
  40564. }
  40565. }
  40566. {
  40567. "$schema": "https://json-schema.org/draft-04/schema#",
  40568. "title": "Package",
  40569. "type": "object",
  40570. "properties": {
  40571. "name": {
  40572. "type": "string",
  40573. "description": "Package name, including 'vendor-name/' prefix.",
  40574. "pattern": "^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$"
  40575. },
  40576. "description": {
  40577. "type": "string",
  40578. "description": "Short package description."
  40579. },
  40580. "license": {
  40581. "type": ["string", "array"],
  40582. "description": "License name. Or an array of license names."
  40583. },
  40584. "type": {
  40585. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  40586. "type": "string",
  40587. "pattern": "^[a-z0-9-]+$"
  40588. },
  40589. "abandoned": {
  40590. "type": ["boolean", "string"],
  40591. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  40592. },
  40593. "version": {
  40594. "type": "string",
  40595. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  40596. "pattern": "^v?\\d+(\\.\\d+){0,3}|^dev-"
  40597. },
  40598. "default-branch": {
  40599. "type": ["boolean"],
  40600. "description": "Internal use only, do not specify this in composer.json. Indicates whether this version is the default branch of the linked VCS repository. Defaults to false."
  40601. },
  40602. "non-feature-branches": {
  40603. "type": ["array"],
  40604. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  40605. "items": {
  40606. "type": "string"
  40607. }
  40608. },
  40609. "keywords": {
  40610. "type": "array",
  40611. "items": {
  40612. "type": "string",
  40613. "description": "A tag/keyword that this package relates to."
  40614. }
  40615. },
  40616. "readme": {
  40617. "type": "string",
  40618. "description": "Relative path to the readme document."
  40619. },
  40620. "time": {
  40621. "type": "string",
  40622. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  40623. },
  40624. "authors": {
  40625. "$ref": "#/definitions/authors"
  40626. },
  40627. "homepage": {
  40628. "type": "string",
  40629. "description": "Homepage URL for the project.",
  40630. "format": "uri"
  40631. },
  40632. "support": {
  40633. "type": "object",
  40634. "properties": {
  40635. "email": {
  40636. "type": "string",
  40637. "description": "Email address for support.",
  40638. "format": "email"
  40639. },
  40640. "issues": {
  40641. "type": "string",
  40642. "description": "URL to the issue tracker.",
  40643. "format": "uri"
  40644. },
  40645. "forum": {
  40646. "type": "string",
  40647. "description": "URL to the forum.",
  40648. "format": "uri"
  40649. },
  40650. "wiki": {
  40651. "type": "string",
  40652. "description": "URL to the wiki.",
  40653. "format": "uri"
  40654. },
  40655. "irc": {
  40656. "type": "string",
  40657. "description": "IRC channel for support, as irc://server/channel.",
  40658. "format": "uri"
  40659. },
  40660. "chat": {
  40661. "type": "string",
  40662. "description": "URL to the support chat.",
  40663. "format": "uri"
  40664. },
  40665. "source": {
  40666. "type": "string",
  40667. "description": "URL to browse or download the sources.",
  40668. "format": "uri"
  40669. },
  40670. "docs": {
  40671. "type": "string",
  40672. "description": "URL to the documentation.",
  40673. "format": "uri"
  40674. },
  40675. "rss": {
  40676. "type": "string",
  40677. "description": "URL to the RSS feed.",
  40678. "format": "uri"
  40679. },
  40680. "security": {
  40681. "type": "string",
  40682. "description": "URL to the vulnerability disclosure policy (VDP).",
  40683. "format": "uri"
  40684. }
  40685. }
  40686. },
  40687. "funding": {
  40688. "type": "array",
  40689. "description": "A list of options to fund the development and maintenance of the package.",
  40690. "items": {
  40691. "type": "object",
  40692. "properties": {
  40693. "type": {
  40694. "type": "string",
  40695. "description": "Type of funding or platform through which funding is possible."
  40696. },
  40697. "url": {
  40698. "type": "string",
  40699. "description": "URL to a website with details on funding and a way to fund the package.",
  40700. "format": "uri"
  40701. }
  40702. }
  40703. }
  40704. },
  40705. "source": {
  40706. "$ref": "#/definitions/source"
  40707. },
  40708. "dist": {
  40709. "$ref": "#/definitions/dist"
  40710. },
  40711. "_comment": {
  40712. "type": ["array", "string"],
  40713. "description": "A key to store comments in"
  40714. },
  40715. "require": {
  40716. "type": "object",
  40717. "description": "This is an object of package name (keys) and version constraints (values) that are required to run this package.",
  40718. "additionalProperties": {
  40719. "type": "string"
  40720. }
  40721. },
  40722. "require-dev": {
  40723. "type": "object",
  40724. "description": "This is an object of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  40725. "additionalProperties": {
  40726. "type": "string"
  40727. }
  40728. },
  40729. "replace": {
  40730. "type": "object",
  40731. "description": "This is an object of package name (keys) and version constraints (values) that can be replaced by this package.",
  40732. "additionalProperties": {
  40733. "type": "string"
  40734. }
  40735. },
  40736. "conflict": {
  40737. "type": "object",
  40738. "description": "This is an object of package name (keys) and version constraints (values) that conflict with this package.",
  40739. "additionalProperties": {
  40740. "type": "string"
  40741. }
  40742. },
  40743. "provide": {
  40744. "type": "object",
  40745. "description": "This is an object of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  40746. "additionalProperties": {
  40747. "type": "string"
  40748. }
  40749. },
  40750. "suggest": {
  40751. "type": "object",
  40752. "description": "This is an object of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  40753. "additionalProperties": {
  40754. "type": "string"
  40755. }
  40756. },
  40757. "repositories": {
  40758. "type": ["object", "array"],
  40759. "description": "A set of additional repositories where packages can be found.",
  40760. "additionalProperties": {
  40761. "anyOf": [
  40762. { "$ref": "#/definitions/repository" },
  40763. { "type": "boolean", "enum": [false] }
  40764. ]
  40765. },
  40766. "items": {
  40767. "anyOf": [
  40768. { "$ref": "#/definitions/repository" },
  40769. {
  40770. "type": "object",
  40771. "additionalProperties": { "type": "boolean", "enum": [false] },
  40772. "minProperties": 1,
  40773. "maxProperties": 1
  40774. }
  40775. ]
  40776. }
  40777. },
  40778. "minimum-stability": {
  40779. "type": ["string"],
  40780. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  40781. "enum": ["dev", "alpha", "beta", "rc", "RC", "stable"]
  40782. },
  40783. "prefer-stable": {
  40784. "type": ["boolean"],
  40785. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  40786. },
  40787. "autoload": {
  40788. "$ref": "#/definitions/autoload"
  40789. },
  40790. "autoload-dev": {
  40791. "type": "object",
  40792. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  40793. "properties": {
  40794. "psr-0": {
  40795. "type": "object",
  40796. "description": "This is an object of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  40797. "additionalProperties": {
  40798. "type": ["string", "array"],
  40799. "items": {
  40800. "type": "string"
  40801. }
  40802. }
  40803. },
  40804. "psr-4": {
  40805. "type": "object",
  40806. "description": "This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  40807. "additionalProperties": {
  40808. "type": ["string", "array"],
  40809. "items": {
  40810. "type": "string"
  40811. }
  40812. }
  40813. },
  40814. "classmap": {
  40815. "type": "array",
  40816. "description": "This is an array of paths that contain classes to be included in the class-map generation process."
  40817. },
  40818. "files": {
  40819. "type": "array",
  40820. "description": "This is an array of files that are always required on every request."
  40821. }
  40822. }
  40823. },
  40824. "target-dir": {
  40825. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  40826. "type": "string"
  40827. },
  40828. "include-path": {
  40829. "type": ["array"],
  40830. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  40831. "items": {
  40832. "type": "string"
  40833. }
  40834. },
  40835. "bin": {
  40836. "type": ["string", "array"],
  40837. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  40838. "items": {
  40839. "type": "string"
  40840. }
  40841. },
  40842. "archive": {
  40843. "type": ["object"],
  40844. "description": "Options for creating package archives for distribution.",
  40845. "properties": {
  40846. "name": {
  40847. "type": "string",
  40848. "description": "A base name for archive."
  40849. },
  40850. "exclude": {
  40851. "type": "array",
  40852. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  40853. }
  40854. }
  40855. },
  40856. "config": {
  40857. "type": "object",
  40858. "description": "Composer options.",
  40859. "properties": {
  40860. "platform": {
  40861. "type": "object",
  40862. "description": "This is an object of package name (keys) and version (values) that will be used to mock the platform packages on this machine, the version can be set to false to make it appear like the package is not present.",
  40863. "additionalProperties": {
  40864. "type": ["string", "boolean"]
  40865. }
  40866. },
  40867. "allow-plugins": {
  40868. "type": ["object", "boolean"],
  40869. "description": "This is an object of {\"pattern\": true|false} with packages which are allowed to be loaded as plugins, or true to allow all, false to allow none. Defaults to {} which prompts when an unknown plugin is added.",
  40870. "additionalProperties": {
  40871. "type": ["boolean"]
  40872. }
  40873. },
  40874. "process-timeout": {
  40875. "type": "integer",
  40876. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  40877. },
  40878. "use-include-path": {
  40879. "type": "boolean",
  40880. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  40881. },
  40882. "use-parent-dir": {
  40883. "type": ["string", "boolean"],
  40884. "description": "When running Composer in a directory where there is no composer.json, if there is one present in a directory above Composer will by default ask you whether you want to use that directory's composer.json instead. One of: true (always use parent if needed), false (never ask or use it) or \"prompt\" (ask every time), defaults to prompt."
  40885. },
  40886. "preferred-install": {
  40887. "type": ["string", "object"],
  40888. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or an object of {\"pattern\": \"preference\"}.",
  40889. "additionalProperties": {
  40890. "type": ["string"]
  40891. }
  40892. },
  40893. "audit": {
  40894. "type": "object",
  40895. "description": "Security audit configuration options",
  40896. "properties": {
  40897. "ignore": {
  40898. "anyOf": [
  40899. {
  40900. "type": "object",
  40901. "description": "A list of advisory ids, remote ids or CVE ids (keys) and the explanations (values) for why they're being ignored. The listed items are reported but let the audit command pass.",
  40902. "additionalProperties": {
  40903. "type": ["string", "string"]
  40904. }
  40905. },
  40906. {
  40907. "type": "array",
  40908. "description": "A set of advisory ids, remote ids or CVE ids that are reported but let the audit command pass.",
  40909. "items": {
  40910. "type": "string"
  40911. }
  40912. }
  40913. ]
  40914. },
  40915. "abandoned": {
  40916. "enum": ["ignore", "report", "fail"],
  40917. "description": "Whether abandoned packages should be ignored, reported as problems or cause an audit failure."
  40918. }
  40919. }
  40920. },
  40921. "notify-on-install": {
  40922. "type": "boolean",
  40923. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  40924. },
  40925. "github-protocols": {
  40926. "type": "array",
  40927. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"https\", \"ssh\", \"git\"].",
  40928. "items": {
  40929. "type": "string"
  40930. }
  40931. },
  40932. "github-oauth": {
  40933. "type": "object",
  40934. "description": "An object of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  40935. "additionalProperties": {
  40936. "type": "string"
  40937. }
  40938. },
  40939. "gitlab-oauth": {
  40940. "type": "object",
  40941. "description": "An object of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":{\"expires-at\":\"<expiration date>\", \"refresh-token\":\"<refresh token>\", \"token\":\"<token>\"}}.",
  40942. "additionalProperties": {
  40943. "type": ["string", "object"],
  40944. "required": [ "token"],
  40945. "properties": {
  40946. "expires-at": {
  40947. "type": "integer",
  40948. "description": "The expiration date for this GitLab token"
  40949. },
  40950. "refresh-token": {
  40951. "type": "string",
  40952. "description": "The refresh token used for GitLab authentication"
  40953. },
  40954. "token": {
  40955. "type": "string",
  40956. "description": "The token used for GitLab authentication"
  40957. }
  40958. }
  40959. }
  40960. },
  40961. "gitlab-token": {
  40962. "type": "object",
  40963. "description": "An object of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}, or an object with username and token keys.",
  40964. "additionalProperties": {
  40965. "type": ["string", "object"],
  40966. "required": ["username", "token"],
  40967. "properties": {
  40968. "username": {
  40969. "type": "string",
  40970. "description": "The username used for GitLab authentication"
  40971. },
  40972. "token": {
  40973. "type": "string",
  40974. "description": "The token used for GitLab authentication"
  40975. }
  40976. }
  40977. }
  40978. },
  40979. "gitlab-protocol": {
  40980. "enum": ["git", "http", "https"],
  40981. "description": "A protocol to force use of when creating a repository URL for the `source` value of the package metadata. One of `git` or `http`. By default, Composer will generate a git URL for private repositories and http one for public repos."
  40982. },
  40983. "bearer": {
  40984. "type": "object",
  40985. "description": "An object of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  40986. "additionalProperties": {
  40987. "type": "string"
  40988. }
  40989. },
  40990. "disable-tls": {
  40991. "type": "boolean",
  40992. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  40993. },
  40994. "secure-http": {
  40995. "type": "boolean",
  40996. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  40997. },
  40998. "secure-svn-domains": {
  40999. "type": "array",
  41000. "description": "A list of domains which should be trusted/marked as using a secure Subversion/SVN transport. By default svn:// protocol is seen as insecure and will throw. This is a better/safer alternative to disabling `secure-http` altogether.",
  41001. "items": {
  41002. "type": "string"
  41003. }
  41004. },
  41005. "cafile": {
  41006. "type": "string",
  41007. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  41008. },
  41009. "capath": {
  41010. "type": "string",
  41011. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  41012. },
  41013. "http-basic": {
  41014. "type": "object",
  41015. "description": "An object of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  41016. "additionalProperties": {
  41017. "type": "object",
  41018. "required": ["username", "password"],
  41019. "properties": {
  41020. "username": {
  41021. "type": "string",
  41022. "description": "The username used for HTTP Basic authentication"
  41023. },
  41024. "password": {
  41025. "type": "string",
  41026. "description": "The password used for HTTP Basic authentication"
  41027. }
  41028. }
  41029. }
  41030. },
  41031. "store-auths": {
  41032. "type": ["string", "boolean"],
  41033. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  41034. },
  41035. "vendor-dir": {
  41036. "type": "string",
  41037. "description": "The location where all packages are installed, defaults to \"vendor\"."
  41038. },
  41039. "bin-dir": {
  41040. "type": "string",
  41041. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  41042. },
  41043. "data-dir": {
  41044. "type": "string",
  41045. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  41046. },
  41047. "cache-dir": {
  41048. "type": "string",
  41049. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  41050. },
  41051. "cache-files-dir": {
  41052. "type": "string",
  41053. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  41054. },
  41055. "cache-repo-dir": {
  41056. "type": "string",
  41057. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  41058. },
  41059. "cache-vcs-dir": {
  41060. "type": "string",
  41061. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  41062. },
  41063. "cache-ttl": {
  41064. "type": "integer",
  41065. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  41066. },
  41067. "cache-files-ttl": {
  41068. "type": "integer",
  41069. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  41070. },
  41071. "cache-files-maxsize": {
  41072. "type": ["string", "integer"],
  41073. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  41074. },
  41075. "cache-read-only": {
  41076. "type": ["boolean"],
  41077. "description": "Whether to use the Composer cache in read-only mode."
  41078. },
  41079. "bin-compat": {
  41080. "enum": ["auto", "full", "proxy", "symlink"],
  41081. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed), can be \"full\" (compatible with both Windows and Unix-based systems) and \"proxy\" (only bash-style proxy)."
  41082. },
  41083. "discard-changes": {
  41084. "type": ["string", "boolean"],
  41085. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  41086. },
  41087. "autoloader-suffix": {
  41088. "type": "string",
  41089. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  41090. },
  41091. "optimize-autoloader": {
  41092. "type": "boolean",
  41093. "description": "Always optimize when dumping the autoloader."
  41094. },
  41095. "prepend-autoloader": {
  41096. "type": "boolean",
  41097. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  41098. },
  41099. "classmap-authoritative": {
  41100. "type": "boolean",
  41101. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  41102. },
  41103. "apcu-autoloader": {
  41104. "type": "boolean",
  41105. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  41106. },
  41107. "github-domains": {
  41108. "type": "array",
  41109. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  41110. "items": {
  41111. "type": "string"
  41112. }
  41113. },
  41114. "github-expose-hostname": {
  41115. "type": "boolean",
  41116. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  41117. },
  41118. "gitlab-domains": {
  41119. "type": "array",
  41120. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  41121. "items": {
  41122. "type": "string"
  41123. }
  41124. },
  41125. "bitbucket-oauth": {
  41126. "type": "object",
  41127. "description": "An object of domain name => {\"consumer-key\": \"...\", \"consumer-secret\": \"...\"}.",
  41128. "additionalProperties": {
  41129. "type": "object",
  41130. "required": ["consumer-key", "consumer-secret"],
  41131. "properties": {
  41132. "consumer-key": {
  41133. "type": "string",
  41134. "description": "The consumer-key used for OAuth authentication"
  41135. },
  41136. "consumer-secret": {
  41137. "type": "string",
  41138. "description": "The consumer-secret used for OAuth authentication"
  41139. },
  41140. "access-token": {
  41141. "type": "string",
  41142. "description": "The OAuth token retrieved from Bitbucket's API, this is written by Composer and you should not set it nor modify it."
  41143. },
  41144. "access-token-expiration": {
  41145. "type": "integer",
  41146. "description": "The generated token's expiration timestamp, this is written by Composer and you should not set it nor modify it."
  41147. }
  41148. }
  41149. }
  41150. },
  41151. "use-github-api": {
  41152. "type": "boolean",
  41153. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  41154. },
  41155. "archive-format": {
  41156. "type": "string",
  41157. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  41158. },
  41159. "archive-dir": {
  41160. "type": "string",
  41161. "description": "The default archive path when not provided on cli, defaults to \".\"."
  41162. },
  41163. "htaccess-protect": {
  41164. "type": "boolean",
  41165. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  41166. },
  41167. "sort-packages": {
  41168. "type": "boolean",
  41169. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  41170. },
  41171. "lock": {
  41172. "type": "boolean",
  41173. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  41174. },
  41175. "platform-check": {
  41176. "type": ["boolean", "string"],
  41177. "description": "Defaults to \"php-only\" which checks only the PHP version. Setting to true will also check the presence of required PHP extensions. If set to false, Composer will not create and require a platform_check.php file as part of the autoloader bootstrap."
  41178. }
  41179. }
  41180. },
  41181. "extra": {
  41182. "type": ["object", "array"],
  41183. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  41184. "additionalProperties": true
  41185. },
  41186. "scripts": {
  41187. "type": ["object"],
  41188. "description": "Script listeners that will be executed before/after some events.",
  41189. "properties": {
  41190. "pre-install-cmd": {
  41191. "type": ["array", "string"],
  41192. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  41193. },
  41194. "post-install-cmd": {
  41195. "type": ["array", "string"],
  41196. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  41197. },
  41198. "pre-update-cmd": {
  41199. "type": ["array", "string"],
  41200. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  41201. },
  41202. "post-update-cmd": {
  41203. "type": ["array", "string"],
  41204. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  41205. },
  41206. "pre-status-cmd": {
  41207. "type": ["array", "string"],
  41208. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  41209. },
  41210. "post-status-cmd": {
  41211. "type": ["array", "string"],
  41212. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  41213. },
  41214. "pre-package-install": {
  41215. "type": ["array", "string"],
  41216. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  41217. },
  41218. "post-package-install": {
  41219. "type": ["array", "string"],
  41220. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  41221. },
  41222. "pre-package-update": {
  41223. "type": ["array", "string"],
  41224. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  41225. },
  41226. "post-package-update": {
  41227. "type": ["array", "string"],
  41228. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  41229. },
  41230. "pre-package-uninstall": {
  41231. "type": ["array", "string"],
  41232. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  41233. },
  41234. "post-package-uninstall": {
  41235. "type": ["array", "string"],
  41236. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  41237. },
  41238. "pre-autoload-dump": {
  41239. "type": ["array", "string"],
  41240. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  41241. },
  41242. "post-autoload-dump": {
  41243. "type": ["array", "string"],
  41244. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  41245. },
  41246. "post-root-package-install": {
  41247. "type": ["array", "string"],
  41248. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  41249. },
  41250. "post-create-project-cmd": {
  41251. "type": ["array", "string"],
  41252. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  41253. }
  41254. }
  41255. },
  41256. "scripts-descriptions": {
  41257. "type": ["object"],
  41258. "description": "Descriptions for custom commands, shown in console help.",
  41259. "additionalProperties": {
  41260. "type": "string"
  41261. }
  41262. },
  41263. "scripts-aliases": {
  41264. "type": ["object"],
  41265. "description": "Aliases for custom commands.",
  41266. "additionalProperties": {
  41267. "type": "array"
  41268. }
  41269. }
  41270. },
  41271. "definitions": {
  41272. "authors": {
  41273. "type": "array",
  41274. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  41275. "items": {
  41276. "type": "object",
  41277. "additionalProperties": false,
  41278. "required": [ "name"],
  41279. "properties": {
  41280. "name": {
  41281. "type": "string",
  41282. "description": "Full name of the author."
  41283. },
  41284. "email": {
  41285. "type": "string",
  41286. "description": "Email address of the author.",
  41287. "format": "email"
  41288. },
  41289. "homepage": {
  41290. "type": "string",
  41291. "description": "Homepage URL for the author.",
  41292. "format": "uri"
  41293. },
  41294. "role": {
  41295. "type": "string",
  41296. "description": "Author's role in the project."
  41297. }
  41298. }
  41299. }
  41300. },
  41301. "autoload": {
  41302. "type": "object",
  41303. "description": "Description of how the package can be autoloaded.",
  41304. "properties": {
  41305. "psr-0": {
  41306. "type": "object",
  41307. "description": "This is an object of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  41308. "additionalProperties": {
  41309. "type": ["string", "array"],
  41310. "items": {
  41311. "type": "string"
  41312. }
  41313. }
  41314. },
  41315. "psr-4": {
  41316. "type": "object",
  41317. "description": "This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  41318. "additionalProperties": {
  41319. "type": ["string", "array"],
  41320. "items": {
  41321. "type": "string"
  41322. }
  41323. }
  41324. },
  41325. "classmap": {
  41326. "type": "array",
  41327. "description": "This is an array of paths that contain classes to be included in the class-map generation process."
  41328. },
  41329. "files": {
  41330. "type": "array",
  41331. "description": "This is an array of files that are always required on every request."
  41332. },
  41333. "exclude-from-classmap": {
  41334. "type": "array",
  41335. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  41336. }
  41337. }
  41338. },
  41339. "repository": {
  41340. "type": "object",
  41341. "anyOf": [
  41342. { "$ref": "#/definitions/composer-repository" },
  41343. { "$ref": "#/definitions/vcs-repository" },
  41344. { "$ref": "#/definitions/path-repository" },
  41345. { "$ref": "#/definitions/artifact-repository" },
  41346. { "$ref": "#/definitions/pear-repository" },
  41347. { "$ref": "#/definitions/package-repository" }
  41348. ]
  41349. },
  41350. "composer-repository": {
  41351. "type": "object",
  41352. "required": ["type", "url"],
  41353. "properties": {
  41354. "type": { "type": "string", "enum": ["composer"] },
  41355. "url": { "type": "string" },
  41356. "canonical": { "type": "boolean" },
  41357. "only": {
  41358. "type": "array",
  41359. "items": {
  41360. "type": "string"
  41361. }
  41362. },
  41363. "exclude": {
  41364. "type": "array",
  41365. "items": {
  41366. "type": "string"
  41367. }
  41368. },
  41369. "options": {
  41370. "type": "object",
  41371. "additionalProperties": true
  41372. },
  41373. "allow_ssl_downgrade": { "type": "boolean" },
  41374. "force-lazy-providers": { "type": "boolean" }
  41375. }
  41376. },
  41377. "vcs-repository": {
  41378. "type": "object",
  41379. "required": ["type", "url"],
  41380. "properties": {
  41381. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "bitbucket", "git-bitbucket", "hg", "fossil", "perforce", "svn"] },
  41382. "url": { "type": "string" },
  41383. "canonical": { "type": "boolean" },
  41384. "only": {
  41385. "type": "array",
  41386. "items": {
  41387. "type": "string"
  41388. }
  41389. },
  41390. "exclude": {
  41391. "type": "array",
  41392. "items": {
  41393. "type": "string"
  41394. }
  41395. },
  41396. "no-api": { "type": "boolean" },
  41397. "secure-http": { "type": "boolean" },
  41398. "svn-cache-credentials": { "type": "boolean" },
  41399. "trunk-path": { "type": ["string", "boolean"] },
  41400. "branches-path": { "type": ["string", "boolean"] },
  41401. "tags-path": { "type": ["string", "boolean"] },
  41402. "package-path": { "type": "string" },
  41403. "depot": { "type": "string" },
  41404. "branch": { "type": "string" },
  41405. "unique_perforce_client_name": { "type": "string" },
  41406. "p4user": { "type": "string" },
  41407. "p4password": { "type": "string" }
  41408. }
  41409. },
  41410. "path-repository": {
  41411. "type": "object",
  41412. "required": ["type", "url"],
  41413. "properties": {
  41414. "type": { "type": "string", "enum": ["path"] },
  41415. "url": { "type": "string" },
  41416. "canonical": { "type": "boolean" },
  41417. "only": {
  41418. "type": "array",
  41419. "items": {
  41420. "type": "string"
  41421. }
  41422. },
  41423. "exclude": {
  41424. "type": "array",
  41425. "items": {
  41426. "type": "string"
  41427. }
  41428. },
  41429. "options": {
  41430. "type": "object",
  41431. "properties": {
  41432. "symlink": { "type": ["boolean", "null"] }
  41433. },
  41434. "additionalProperties": true
  41435. }
  41436. }
  41437. },
  41438. "artifact-repository": {
  41439. "type": "object",
  41440. "required": ["type", "url"],
  41441. "properties": {
  41442. "type": { "type": "string", "enum": ["artifact"] },
  41443. "url": { "type": "string" },
  41444. "canonical": { "type": "boolean" },
  41445. "only": {
  41446. "type": "array",
  41447. "items": {
  41448. "type": "string"
  41449. }
  41450. },
  41451. "exclude": {
  41452. "type": "array",
  41453. "items": {
  41454. "type": "string"
  41455. }
  41456. }
  41457. }
  41458. },
  41459. "pear-repository": {
  41460. "type": "object",
  41461. "required": ["type", "url"],
  41462. "properties": {
  41463. "type": { "type": "string", "enum": ["pear"] },
  41464. "url": { "type": "string" },
  41465. "canonical": { "type": "boolean" },
  41466. "only": {
  41467. "type": "array",
  41468. "items": {
  41469. "type": "string"
  41470. }
  41471. },
  41472. "exclude": {
  41473. "type": "array",
  41474. "items": {
  41475. "type": "string"
  41476. }
  41477. },
  41478. "vendor-alias": { "type": "string" }
  41479. }
  41480. },
  41481. "package-repository": {
  41482. "type": "object",
  41483. "required": ["type", "package"],
  41484. "properties": {
  41485. "type": { "type": "string", "enum": ["package"] },
  41486. "canonical": { "type": "boolean" },
  41487. "only": {
  41488. "type": "array",
  41489. "items": {
  41490. "type": "string"
  41491. }
  41492. },
  41493. "exclude": {
  41494. "type": "array",
  41495. "items": {
  41496. "type": "string"
  41497. }
  41498. },
  41499. "package": {
  41500. "oneOf": [
  41501. { "$ref": "#/definitions/inline-package" },
  41502. {
  41503. "type": "array",
  41504. "items": { "$ref": "#/definitions/inline-package" }
  41505. }
  41506. ]
  41507. }
  41508. }
  41509. },
  41510. "inline-package": {
  41511. "type": "object",
  41512. "required": ["name", "version"],
  41513. "properties": {
  41514. "name": {
  41515. "type": "string",
  41516. "description": "Package name, including 'vendor-name/' prefix."
  41517. },
  41518. "type": {
  41519. "type": "string"
  41520. },
  41521. "target-dir": {
  41522. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  41523. "type": "string"
  41524. },
  41525. "description": {
  41526. "type": "string"
  41527. },
  41528. "keywords": {
  41529. "type": "array",
  41530. "items": {
  41531. "type": "string"
  41532. }
  41533. },
  41534. "homepage": {
  41535. "type": "string",
  41536. "format": "uri"
  41537. },
  41538. "version": {
  41539. "type": "string"
  41540. },
  41541. "time": {
  41542. "type": "string"
  41543. },
  41544. "license": {
  41545. "type": [
  41546. "string",
  41547. "array"
  41548. ]
  41549. },
  41550. "authors": {
  41551. "$ref": "#/definitions/authors"
  41552. },
  41553. "require": {
  41554. "type": "object",
  41555. "additionalProperties": {
  41556. "type": "string"
  41557. }
  41558. },
  41559. "replace": {
  41560. "type": "object",
  41561. "additionalProperties": {
  41562. "type": "string"
  41563. }
  41564. },
  41565. "conflict": {
  41566. "type": "object",
  41567. "additionalProperties": {
  41568. "type": "string"
  41569. }
  41570. },
  41571. "provide": {
  41572. "type": "object",
  41573. "additionalProperties": {
  41574. "type": "string"
  41575. }
  41576. },
  41577. "require-dev": {
  41578. "type": "object",
  41579. "additionalProperties": {
  41580. "type": "string"
  41581. }
  41582. },
  41583. "suggest": {
  41584. "type": "object",
  41585. "additionalProperties": {
  41586. "type": "string"
  41587. }
  41588. },
  41589. "extra": {
  41590. "type": ["object", "array"],
  41591. "additionalProperties": true
  41592. },
  41593. "autoload": {
  41594. "$ref": "#/definitions/autoload"
  41595. },
  41596. "archive": {
  41597. "type": ["object"],
  41598. "properties": {
  41599. "exclude": {
  41600. "type": "array"
  41601. }
  41602. }
  41603. },
  41604. "bin": {
  41605. "type": ["string", "array"],
  41606. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  41607. "items": {
  41608. "type": "string"
  41609. }
  41610. },
  41611. "include-path": {
  41612. "type": ["array"],
  41613. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  41614. "items": {
  41615. "type": "string"
  41616. }
  41617. },
  41618. "source": {
  41619. "$ref": "#/definitions/source"
  41620. },
  41621. "dist": {
  41622. "$ref": "#/definitions/dist"
  41623. }
  41624. },
  41625. "additionalProperties": true
  41626. },
  41627. "source": {
  41628. "type": "object",
  41629. "required": ["type", "url", "reference"],
  41630. "properties": {
  41631. "type": {
  41632. "type": "string"
  41633. },
  41634. "url": {
  41635. "type": "string"
  41636. },
  41637. "reference": {
  41638. "type": "string"
  41639. },
  41640. "mirrors": {
  41641. "type": "array"
  41642. }
  41643. }
  41644. },
  41645. "dist": {
  41646. "type": "object",
  41647. "required": ["type", "url"],
  41648. "properties": {
  41649. "type": {
  41650. "type": "string"
  41651. },
  41652. "url": {
  41653. "type": "string"
  41654. },
  41655. "reference": {
  41656. "type": "string"
  41657. },
  41658. "shasum": {
  41659. "type": "string"
  41660. },
  41661. "mirrors": {
  41662. "type": "array"
  41663. }
  41664. }
  41665. }
  41666. }
  41667. }
  41668. <?php
  41669. if (PHP_VERSION_ID < 50600) {
  41670. if (!headers_sent()) {
  41671. header('HTTP/1.1 500 Internal Server Error');
  41672. }
  41673. $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  41674. if (!ini_get('display_errors')) {
  41675. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  41676. fwrite(STDERR, $err);
  41677. } elseif (!headers_sent()) {
  41678. echo $err;
  41679. }
  41680. }
  41681. trigger_error(
  41682. $err,
  41683. E_USER_ERROR
  41684. );
  41685. }
  41686. require_once __DIR__ . '/composer/autoload_real.php';
  41687. return ComposerAutoloaderInitComposerPhar1707488788::getLoader();
  41688. <?php
  41689. namespace Composer\Autoload;
  41690. class ClassLoader
  41691. {
  41692. private static $includeFile;
  41693. private $vendorDir;
  41694. private $prefixLengthsPsr4 = array();
  41695. private $prefixDirsPsr4 = array();
  41696. private $fallbackDirsPsr4 = array();
  41697. private $prefixesPsr0 = array();
  41698. private $fallbackDirsPsr0 = array();
  41699. private $useIncludePath = false;
  41700. private $classMap = array();
  41701. private $classMapAuthoritative = false;
  41702. private $missingClasses = array();
  41703. private $apcuPrefix;
  41704. private static $registeredLoaders = array();
  41705. public function __construct($vendorDir = null)
  41706. {
  41707. $this->vendorDir = $vendorDir;
  41708. self::initializeIncludeClosure();
  41709. }
  41710. public function getPrefixes()
  41711. {
  41712. if (!empty($this->prefixesPsr0)) {
  41713. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  41714. }
  41715. return array();
  41716. }
  41717. public function getPrefixesPsr4()
  41718. {
  41719. return $this->prefixDirsPsr4;
  41720. }
  41721. public function getFallbackDirs()
  41722. {
  41723. return $this->fallbackDirsPsr0;
  41724. }
  41725. public function getFallbackDirsPsr4()
  41726. {
  41727. return $this->fallbackDirsPsr4;
  41728. }
  41729. public function getClassMap()
  41730. {
  41731. return $this->classMap;
  41732. }
  41733. public function addClassMap(array $classMap)
  41734. {
  41735. if ($this->classMap) {
  41736. $this->classMap = array_merge($this->classMap, $classMap);
  41737. } else {
  41738. $this->classMap = $classMap;
  41739. }
  41740. }
  41741. public function add($prefix, $paths, $prepend = false)
  41742. {
  41743. $paths = (array) $paths;
  41744. if (!$prefix) {
  41745. if ($prepend) {
  41746. $this->fallbackDirsPsr0 = array_merge(
  41747. $paths,
  41748. $this->fallbackDirsPsr0
  41749. );
  41750. } else {
  41751. $this->fallbackDirsPsr0 = array_merge(
  41752. $this->fallbackDirsPsr0,
  41753. $paths
  41754. );
  41755. }
  41756. return;
  41757. }
  41758. $first = $prefix[0];
  41759. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  41760. $this->prefixesPsr0[$first][$prefix] = $paths;
  41761. return;
  41762. }
  41763. if ($prepend) {
  41764. $this->prefixesPsr0[$first][$prefix] = array_merge(
  41765. $paths,
  41766. $this->prefixesPsr0[$first][$prefix]
  41767. );
  41768. } else {
  41769. $this->prefixesPsr0[$first][$prefix] = array_merge(
  41770. $this->prefixesPsr0[$first][$prefix],
  41771. $paths
  41772. );
  41773. }
  41774. }
  41775. public function addPsr4($prefix, $paths, $prepend = false)
  41776. {
  41777. $paths = (array) $paths;
  41778. if (!$prefix) {
  41779. if ($prepend) {
  41780. $this->fallbackDirsPsr4 = array_merge(
  41781. $paths,
  41782. $this->fallbackDirsPsr4
  41783. );
  41784. } else {
  41785. $this->fallbackDirsPsr4 = array_merge(
  41786. $this->fallbackDirsPsr4,
  41787. $paths
  41788. );
  41789. }
  41790. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  41791. $length = strlen($prefix);
  41792. if ('\\' !== $prefix[$length - 1]) {
  41793. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  41794. }
  41795. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  41796. $this->prefixDirsPsr4[$prefix] = $paths;
  41797. } elseif ($prepend) {
  41798. $this->prefixDirsPsr4[$prefix] = array_merge(
  41799. $paths,
  41800. $this->prefixDirsPsr4[$prefix]
  41801. );
  41802. } else {
  41803. $this->prefixDirsPsr4[$prefix] = array_merge(
  41804. $this->prefixDirsPsr4[$prefix],
  41805. $paths
  41806. );
  41807. }
  41808. }
  41809. public function set($prefix, $paths)
  41810. {
  41811. if (!$prefix) {
  41812. $this->fallbackDirsPsr0 = (array) $paths;
  41813. } else {
  41814. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  41815. }
  41816. }
  41817. public function setPsr4($prefix, $paths)
  41818. {
  41819. if (!$prefix) {
  41820. $this->fallbackDirsPsr4 = (array) $paths;
  41821. } else {
  41822. $length = strlen($prefix);
  41823. if ('\\' !== $prefix[$length - 1]) {
  41824. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  41825. }
  41826. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  41827. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  41828. }
  41829. }
  41830. public function setUseIncludePath($useIncludePath)
  41831. {
  41832. $this->useIncludePath = $useIncludePath;
  41833. }
  41834. public function getUseIncludePath()
  41835. {
  41836. return $this->useIncludePath;
  41837. }
  41838. public function setClassMapAuthoritative($classMapAuthoritative)
  41839. {
  41840. $this->classMapAuthoritative = $classMapAuthoritative;
  41841. }
  41842. public function isClassMapAuthoritative()
  41843. {
  41844. return $this->classMapAuthoritative;
  41845. }
  41846. public function setApcuPrefix($apcuPrefix)
  41847. {
  41848. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  41849. }
  41850. public function getApcuPrefix()
  41851. {
  41852. return $this->apcuPrefix;
  41853. }
  41854. public function register($prepend = false)
  41855. {
  41856. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  41857. if (null === $this->vendorDir) {
  41858. return;
  41859. }
  41860. if ($prepend) {
  41861. self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
  41862. } else {
  41863. unset(self::$registeredLoaders[$this->vendorDir]);
  41864. self::$registeredLoaders[$this->vendorDir] = $this;
  41865. }
  41866. }
  41867. public function unregister()
  41868. {
  41869. spl_autoload_unregister(array($this, 'loadClass'));
  41870. if (null !== $this->vendorDir) {
  41871. unset(self::$registeredLoaders[$this->vendorDir]);
  41872. }
  41873. }
  41874. public function loadClass($class)
  41875. {
  41876. if ($file = $this->findFile($class)) {
  41877. $includeFile = self::$includeFile;
  41878. $includeFile($file);
  41879. return true;
  41880. }
  41881. return null;
  41882. }
  41883. public function findFile($class)
  41884. {
  41885. if (isset($this->classMap[$class])) {
  41886. return $this->classMap[$class];
  41887. }
  41888. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  41889. return false;
  41890. }
  41891. if (null !== $this->apcuPrefix) {
  41892. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  41893. if ($hit) {
  41894. return $file;
  41895. }
  41896. }
  41897. $file = $this->findFileWithExtension($class, '.php');
  41898. if (false === $file && defined('HHVM_VERSION')) {
  41899. $file = $this->findFileWithExtension($class, '.hh');
  41900. }
  41901. if (null !== $this->apcuPrefix) {
  41902. apcu_add($this->apcuPrefix.$class, $file);
  41903. }
  41904. if (false === $file) {
  41905. $this->missingClasses[$class] = true;
  41906. }
  41907. return $file;
  41908. }
  41909. public static function getRegisteredLoaders()
  41910. {
  41911. return self::$registeredLoaders;
  41912. }
  41913. private function findFileWithExtension($class, $ext)
  41914. {
  41915. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  41916. $first = $class[0];
  41917. if (isset($this->prefixLengthsPsr4[$first])) {
  41918. $subPath = $class;
  41919. while (false !== $lastPos = strrpos($subPath, '\\')) {
  41920. $subPath = substr($subPath, 0, $lastPos);
  41921. $search = $subPath . '\\';
  41922. if (isset($this->prefixDirsPsr4[$search])) {
  41923. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  41924. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  41925. if (file_exists($file = $dir . $pathEnd)) {
  41926. return $file;
  41927. }
  41928. }
  41929. }
  41930. }
  41931. }
  41932. foreach ($this->fallbackDirsPsr4 as $dir) {
  41933. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  41934. return $file;
  41935. }
  41936. }
  41937. if (false !== $pos = strrpos($class, '\\')) {
  41938. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  41939. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  41940. } else {
  41941. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  41942. }
  41943. if (isset($this->prefixesPsr0[$first])) {
  41944. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  41945. if (0 === strpos($class, $prefix)) {
  41946. foreach ($dirs as $dir) {
  41947. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  41948. return $file;
  41949. }
  41950. }
  41951. }
  41952. }
  41953. }
  41954. foreach ($this->fallbackDirsPsr0 as $dir) {
  41955. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  41956. return $file;
  41957. }
  41958. }
  41959. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  41960. return $file;
  41961. }
  41962. return false;
  41963. }
  41964. private static function initializeIncludeClosure()
  41965. {
  41966. if (self::$includeFile !== null) {
  41967. return;
  41968. }
  41969. self::$includeFile = \Closure::bind(static function($file) {
  41970. include $file;
  41971. }, null, null);
  41972. }
  41973. }
  41974. <?php
  41975. namespace Composer;
  41976. use Composer\Autoload\ClassLoader;
  41977. use Composer\Semver\VersionParser;
  41978. class InstalledVersions
  41979. {
  41980. private static $installed;
  41981. private static $canGetVendors;
  41982. private static $installedByVendor = array();
  41983. public static function getInstalledPackages()
  41984. {
  41985. $packages = array();
  41986. foreach (self::getInstalled() as $installed) {
  41987. $packages[] = array_keys($installed['versions']);
  41988. }
  41989. if (1 === \count($packages)) {
  41990. return $packages[0];
  41991. }
  41992. return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
  41993. }
  41994. public static function getInstalledPackagesByType($type)
  41995. {
  41996. $packagesByType = array();
  41997. foreach (self::getInstalled() as $installed) {
  41998. foreach ($installed['versions'] as $name => $package) {
  41999. if (isset($package['type']) && $package['type'] === $type) {
  42000. $packagesByType[] = $name;
  42001. }
  42002. }
  42003. }
  42004. return $packagesByType;
  42005. }
  42006. public static function isInstalled($packageName, $includeDevRequirements = true)
  42007. {
  42008. foreach (self::getInstalled() as $installed) {
  42009. if (isset($installed['versions'][$packageName])) {
  42010. return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
  42011. }
  42012. }
  42013. return false;
  42014. }
  42015. public static function satisfies(VersionParser $parser, $packageName, $constraint)
  42016. {
  42017. $constraint = $parser->parseConstraints((string) $constraint);
  42018. $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
  42019. return $provided->matches($constraint);
  42020. }
  42021. public static function getVersionRanges($packageName)
  42022. {
  42023. foreach (self::getInstalled() as $installed) {
  42024. if (!isset($installed['versions'][$packageName])) {
  42025. continue;
  42026. }
  42027. $ranges = array();
  42028. if (isset($installed['versions'][$packageName]['pretty_version'])) {
  42029. $ranges[] = $installed['versions'][$packageName]['pretty_version'];
  42030. }
  42031. if (array_key_exists('aliases', $installed['versions'][$packageName])) {
  42032. $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
  42033. }
  42034. if (array_key_exists('replaced', $installed['versions'][$packageName])) {
  42035. $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
  42036. }
  42037. if (array_key_exists('provided', $installed['versions'][$packageName])) {
  42038. $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
  42039. }
  42040. return implode(' || ', $ranges);
  42041. }
  42042. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  42043. }
  42044. public static function getVersion($packageName)
  42045. {
  42046. foreach (self::getInstalled() as $installed) {
  42047. if (!isset($installed['versions'][$packageName])) {
  42048. continue;
  42049. }
  42050. if (!isset($installed['versions'][$packageName]['version'])) {
  42051. return null;
  42052. }
  42053. return $installed['versions'][$packageName]['version'];
  42054. }
  42055. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  42056. }
  42057. public static function getPrettyVersion($packageName)
  42058. {
  42059. foreach (self::getInstalled() as $installed) {
  42060. if (!isset($installed['versions'][$packageName])) {
  42061. continue;
  42062. }
  42063. if (!isset($installed['versions'][$packageName]['pretty_version'])) {
  42064. return null;
  42065. }
  42066. return $installed['versions'][$packageName]['pretty_version'];
  42067. }
  42068. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  42069. }
  42070. public static function getReference($packageName)
  42071. {
  42072. foreach (self::getInstalled() as $installed) {
  42073. if (!isset($installed['versions'][$packageName])) {
  42074. continue;
  42075. }
  42076. if (!isset($installed['versions'][$packageName]['reference'])) {
  42077. return null;
  42078. }
  42079. return $installed['versions'][$packageName]['reference'];
  42080. }
  42081. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  42082. }
  42083. public static function getInstallPath($packageName)
  42084. {
  42085. foreach (self::getInstalled() as $installed) {
  42086. if (!isset($installed['versions'][$packageName])) {
  42087. continue;
  42088. }
  42089. return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
  42090. }
  42091. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  42092. }
  42093. public static function getRootPackage()
  42094. {
  42095. $installed = self::getInstalled();
  42096. return $installed[0]['root'];
  42097. }
  42098. public static function getRawData()
  42099. {
  42100. @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
  42101. if (null === self::$installed) {
  42102. if (substr(__DIR__, -8, 1) !== 'C') {
  42103. self::$installed = include __DIR__ . '/installed.php';
  42104. } else {
  42105. self::$installed = array();
  42106. }
  42107. }
  42108. return self::$installed;
  42109. }
  42110. public static function getAllRawData()
  42111. {
  42112. return self::getInstalled();
  42113. }
  42114. public static function reload($data)
  42115. {
  42116. self::$installed = $data;
  42117. self::$installedByVendor = array();
  42118. }
  42119. private static function getInstalled()
  42120. {
  42121. if (null === self::$canGetVendors) {
  42122. self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
  42123. }
  42124. $installed = array();
  42125. if (self::$canGetVendors) {
  42126. foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
  42127. if (isset(self::$installedByVendor[$vendorDir])) {
  42128. $installed[] = self::$installedByVendor[$vendorDir];
  42129. } elseif (is_file($vendorDir.'/composer/installed.php')) {
  42130. $required = require $vendorDir.'/composer/installed.php';
  42131. $installed[] = self::$installedByVendor[$vendorDir] = $required;
  42132. if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
  42133. self::$installed = $installed[count($installed) - 1];
  42134. }
  42135. }
  42136. }
  42137. }
  42138. if (null === self::$installed) {
  42139. if (substr(__DIR__, -8, 1) !== 'C') {
  42140. $required = require __DIR__ . '/installed.php';
  42141. self::$installed = $required;
  42142. } else {
  42143. self::$installed = array();
  42144. }
  42145. }
  42146. if (self::$installed !== array()) {
  42147. $installed[] = self::$installed;
  42148. }
  42149. return $installed;
  42150. }
  42151. }
  42152. <?php
  42153. $vendorDir = dirname(__DIR__);
  42154. $baseDir = dirname($vendorDir);
  42155. return array(
  42156. 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
  42157. 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
  42158. 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
  42159. 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
  42160. 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
  42161. 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
  42162. 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php',
  42163. 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
  42164. 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
  42165. 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
  42166. );
  42167. <?php
  42168. $vendorDir = dirname(__DIR__);
  42169. $baseDir = dirname($vendorDir);
  42170. return array(
  42171. 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
  42172. '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
  42173. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  42174. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  42175. '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
  42176. 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
  42177. '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
  42178. 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
  42179. 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
  42180. '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
  42181. );
  42182. <?php
  42183. $vendorDir = dirname(__DIR__);
  42184. $baseDir = dirname($vendorDir);
  42185. return array(
  42186. );
  42187. <?php
  42188. $vendorDir = dirname(__DIR__);
  42189. $baseDir = dirname($vendorDir);
  42190. return array(
  42191. 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'),
  42192. 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
  42193. 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
  42194. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  42195. 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
  42196. 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
  42197. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  42198. 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
  42199. 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
  42200. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  42201. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  42202. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  42203. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  42204. 'Seld\\Signal\\' => array($vendorDir . '/seld/signal-handler/src'),
  42205. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  42206. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  42207. 'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
  42208. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  42209. 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
  42210. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  42211. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  42212. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  42213. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  42214. 'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
  42215. 'Composer\\MetadataMinifier\\' => array($vendorDir . '/composer/metadata-minifier/src'),
  42216. 'Composer\\ClassMapGenerator\\' => array($vendorDir . '/composer/class-map-generator/src'),
  42217. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  42218. 'Composer\\' => array($baseDir . '/src/Composer'),
  42219. );
  42220. <?php
  42221. class ComposerAutoloaderInitComposerPhar1707488788
  42222. {
  42223. private static $loader;
  42224. public static function loadClassLoader($class)
  42225. {
  42226. if ('Composer\Autoload\ClassLoader' === $class) {
  42227. require __DIR__ . '/ClassLoader.php';
  42228. }
  42229. }
  42230. public static function getLoader()
  42231. {
  42232. if (null !== self::$loader) {
  42233. return self::$loader;
  42234. }
  42235. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1707488788', 'loadClassLoader'), true, true);
  42236. self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
  42237. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1707488788', 'loadClassLoader'));
  42238. require __DIR__ . '/autoload_static.php';
  42239. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1707488788::getInitializer($loader));
  42240. $loader->register(true);
  42241. $filesToLoad = \Composer\Autoload\ComposerStaticInitComposerPhar1707488788::$files;
  42242. $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
  42243. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  42244. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  42245. require $file;
  42246. }
  42247. }, null, null);
  42248. foreach ($filesToLoad as $fileIdentifier => $file) {
  42249. $requireFile($fileIdentifier, $file);
  42250. }
  42251. return $loader;
  42252. }
  42253. }
  42254. <?php
  42255. namespace Composer\Autoload;
  42256. class ComposerStaticInitComposerPhar1707488788
  42257. {
  42258. public static $files = array (
  42259. 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
  42260. '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
  42261. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  42262. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  42263. '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
  42264. 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
  42265. '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
  42266. 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
  42267. 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
  42268. '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php',
  42269. );
  42270. public static $prefixLengthsPsr4 = array (
  42271. 'S' =>
  42272. array (
  42273. 'Symfony\\Polyfill\\Php81\\' => 23,
  42274. 'Symfony\\Polyfill\\Php80\\' => 23,
  42275. 'Symfony\\Polyfill\\Php73\\' => 23,
  42276. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  42277. 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
  42278. 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
  42279. 'Symfony\\Polyfill\\Ctype\\' => 23,
  42280. 'Symfony\\Contracts\\Service\\' => 26,
  42281. 'Symfony\\Component\\String\\' => 25,
  42282. 'Symfony\\Component\\Process\\' => 26,
  42283. 'Symfony\\Component\\Finder\\' => 25,
  42284. 'Symfony\\Component\\Filesystem\\' => 29,
  42285. 'Symfony\\Component\\Console\\' => 26,
  42286. 'Seld\\Signal\\' => 12,
  42287. 'Seld\\PharUtils\\' => 15,
  42288. 'Seld\\JsonLint\\' => 14,
  42289. ),
  42290. 'R' =>
  42291. array (
  42292. 'React\\Promise\\' => 14,
  42293. ),
  42294. 'P' =>
  42295. array (
  42296. 'Psr\\Log\\' => 8,
  42297. 'Psr\\Container\\' => 14,
  42298. ),
  42299. 'J' =>
  42300. array (
  42301. 'JsonSchema\\' => 11,
  42302. ),
  42303. 'C' =>
  42304. array (
  42305. 'Composer\\XdebugHandler\\' => 23,
  42306. 'Composer\\Spdx\\' => 14,
  42307. 'Composer\\Semver\\' => 16,
  42308. 'Composer\\Pcre\\' => 14,
  42309. 'Composer\\MetadataMinifier\\' => 26,
  42310. 'Composer\\ClassMapGenerator\\' => 27,
  42311. 'Composer\\CaBundle\\' => 18,
  42312. 'Composer\\' => 9,
  42313. ),
  42314. );
  42315. public static $prefixDirsPsr4 = array (
  42316. 'Symfony\\Polyfill\\Php81\\' =>
  42317. array (
  42318. 0 => __DIR__ . '/..' . '/symfony/polyfill-php81',
  42319. ),
  42320. 'Symfony\\Polyfill\\Php80\\' =>
  42321. array (
  42322. 0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
  42323. ),
  42324. 'Symfony\\Polyfill\\Php73\\' =>
  42325. array (
  42326. 0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
  42327. ),
  42328. 'Symfony\\Polyfill\\Mbstring\\' =>
  42329. array (
  42330. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  42331. ),
  42332. 'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
  42333. array (
  42334. 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
  42335. ),
  42336. 'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
  42337. array (
  42338. 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
  42339. ),
  42340. 'Symfony\\Polyfill\\Ctype\\' =>
  42341. array (
  42342. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  42343. ),
  42344. 'Symfony\\Contracts\\Service\\' =>
  42345. array (
  42346. 0 => __DIR__ . '/..' . '/symfony/service-contracts',
  42347. ),
  42348. 'Symfony\\Component\\String\\' =>
  42349. array (
  42350. 0 => __DIR__ . '/..' . '/symfony/string',
  42351. ),
  42352. 'Symfony\\Component\\Process\\' =>
  42353. array (
  42354. 0 => __DIR__ . '/..' . '/symfony/process',
  42355. ),
  42356. 'Symfony\\Component\\Finder\\' =>
  42357. array (
  42358. 0 => __DIR__ . '/..' . '/symfony/finder',
  42359. ),
  42360. 'Symfony\\Component\\Filesystem\\' =>
  42361. array (
  42362. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  42363. ),
  42364. 'Symfony\\Component\\Console\\' =>
  42365. array (
  42366. 0 => __DIR__ . '/..' . '/symfony/console',
  42367. ),
  42368. 'Seld\\Signal\\' =>
  42369. array (
  42370. 0 => __DIR__ . '/..' . '/seld/signal-handler/src',
  42371. ),
  42372. 'Seld\\PharUtils\\' =>
  42373. array (
  42374. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  42375. ),
  42376. 'Seld\\JsonLint\\' =>
  42377. array (
  42378. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  42379. ),
  42380. 'React\\Promise\\' =>
  42381. array (
  42382. 0 => __DIR__ . '/..' . '/react/promise/src',
  42383. ),
  42384. 'Psr\\Log\\' =>
  42385. array (
  42386. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  42387. ),
  42388. 'Psr\\Container\\' =>
  42389. array (
  42390. 0 => __DIR__ . '/..' . '/psr/container/src',
  42391. ),
  42392. 'JsonSchema\\' =>
  42393. array (
  42394. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  42395. ),
  42396. 'Composer\\XdebugHandler\\' =>
  42397. array (
  42398. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  42399. ),
  42400. 'Composer\\Spdx\\' =>
  42401. array (
  42402. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  42403. ),
  42404. 'Composer\\Semver\\' =>
  42405. array (
  42406. 0 => __DIR__ . '/..' . '/composer/semver/src',
  42407. ),
  42408. 'Composer\\Pcre\\' =>
  42409. array (
  42410. 0 => __DIR__ . '/..' . '/composer/pcre/src',
  42411. ),
  42412. 'Composer\\MetadataMinifier\\' =>
  42413. array (
  42414. 0 => __DIR__ . '/..' . '/composer/metadata-minifier/src',
  42415. ),
  42416. 'Composer\\ClassMapGenerator\\' =>
  42417. array (
  42418. 0 => __DIR__ . '/..' . '/composer/class-map-generator/src',
  42419. ),
  42420. 'Composer\\CaBundle\\' =>
  42421. array (
  42422. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  42423. ),
  42424. 'Composer\\' =>
  42425. array (
  42426. 0 => __DIR__ . '/../..' . '/src/Composer',
  42427. ),
  42428. );
  42429. public static $classMap = array (
  42430. 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
  42431. 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
  42432. 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
  42433. 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
  42434. 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
  42435. 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
  42436. 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php',
  42437. 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
  42438. 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
  42439. 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
  42440. );
  42441. public static function getInitializer(ClassLoader $loader)
  42442. {
  42443. return \Closure::bind(function () use ($loader) {
  42444. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1707488788::$prefixLengthsPsr4;
  42445. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1707488788::$prefixDirsPsr4;
  42446. $loader->classMap = ComposerStaticInitComposerPhar1707488788::$classMap;
  42447. }, null, ClassLoader::class);
  42448. }
  42449. }
  42450. Copyright (C) 2016 Composer
  42451. Permission is hereby granted, free of charge, to any person obtaining a copy of
  42452. this software and associated documentation files (the "Software"), to deal in
  42453. the Software without restriction, including without limitation the rights to
  42454. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  42455. of the Software, and to permit persons to whom the Software is furnished to do
  42456. so, subject to the following conditions:
  42457. The above copyright notice and this permission notice shall be included in all
  42458. copies or substantial portions of the Software.
  42459. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42460. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42461. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42462. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42463. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42464. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  42465. SOFTWARE.
  42466. ##
  42467. ## Bundle of CA Root Certificates
  42468. ##
  42469. ## Certificate data from Mozilla as of: Tue Dec 12 04:12:04 2023 GMT
  42470. ##
  42471. ## This is a bundle of X.509 certificates of public Certificate Authorities
  42472. ## (CA). These were automatically extracted from Mozilla's root certificates
  42473. ## file (certdata.txt). This file can be found in the mozilla source tree:
  42474. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  42475. ##
  42476. ## It contains the certificates in PEM format and therefore
  42477. ## can be directly used with curl / libcurl / php_curl, or with
  42478. ## an Apache+mod_ssl webserver for SSL client authentication.
  42479. ## Just configure this file as the SSLCACertificateFile.
  42480. ##
  42481. ## Conversion done with mk-ca-bundle.pl version 1.29.
  42482. ## SHA256: 1970dd65858925d68498d2356aea6d03f764422523c5887deca8ce3ba9e1f845
  42483. ##
  42484. GlobalSign Root CA
  42485. ==================
  42486. -----BEGIN CERTIFICATE-----
  42487. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  42488. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  42489. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  42490. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  42491. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  42492. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  42493. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  42494. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  42495. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  42496. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  42497. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  42498. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  42499. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  42500. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  42501. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  42502. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  42503. -----END CERTIFICATE-----
  42504. Entrust.net Premium 2048 Secure Server CA
  42505. =========================================
  42506. -----BEGIN CERTIFICATE-----
  42507. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  42508. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  42509. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  42510. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  42511. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  42512. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  42513. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  42514. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  42515. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  42516. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  42517. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  42518. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  42519. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  42520. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  42521. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  42522. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  42523. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  42524. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  42525. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  42526. -----END CERTIFICATE-----
  42527. Baltimore CyberTrust Root
  42528. =========================
  42529. -----BEGIN CERTIFICATE-----
  42530. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  42531. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  42532. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  42533. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  42534. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  42535. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  42536. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  42537. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  42538. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  42539. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  42540. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  42541. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  42542. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  42543. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  42544. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  42545. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  42546. -----END CERTIFICATE-----
  42547. Entrust Root Certification Authority
  42548. ====================================
  42549. -----BEGIN CERTIFICATE-----
  42550. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  42551. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  42552. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  42553. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  42554. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  42555. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  42556. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  42557. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  42558. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  42559. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  42560. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  42561. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  42562. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  42563. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  42564. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  42565. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  42566. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  42567. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  42568. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  42569. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  42570. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  42571. -----END CERTIFICATE-----
  42572. Comodo AAA Services root
  42573. ========================
  42574. -----BEGIN CERTIFICATE-----
  42575. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  42576. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  42577. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  42578. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  42579. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  42580. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  42581. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  42582. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  42583. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  42584. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  42585. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  42586. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  42587. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  42588. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  42589. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  42590. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  42591. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  42592. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  42593. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  42594. -----END CERTIFICATE-----
  42595. QuoVadis Root CA 2
  42596. ==================
  42597. -----BEGIN CERTIFICATE-----
  42598. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  42599. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  42600. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  42601. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  42602. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  42603. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  42604. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  42605. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  42606. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  42607. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  42608. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  42609. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  42610. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  42611. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  42612. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  42613. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  42614. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  42615. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  42616. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  42617. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  42618. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  42619. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  42620. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  42621. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  42622. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  42623. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  42624. -----END CERTIFICATE-----
  42625. QuoVadis Root CA 3
  42626. ==================
  42627. -----BEGIN CERTIFICATE-----
  42628. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  42629. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  42630. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  42631. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  42632. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  42633. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  42634. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  42635. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  42636. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  42637. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  42638. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  42639. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  42640. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  42641. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  42642. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  42643. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  42644. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  42645. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  42646. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  42647. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  42648. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  42649. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  42650. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  42651. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  42652. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  42653. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  42654. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  42655. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  42656. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  42657. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  42658. -----END CERTIFICATE-----
  42659. XRamp Global CA Root
  42660. ====================
  42661. -----BEGIN CERTIFICATE-----
  42662. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  42663. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  42664. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  42665. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  42666. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  42667. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  42668. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  42669. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  42670. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  42671. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  42672. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  42673. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  42674. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  42675. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  42676. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  42677. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  42678. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  42679. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  42680. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  42681. -----END CERTIFICATE-----
  42682. Go Daddy Class 2 CA
  42683. ===================
  42684. -----BEGIN CERTIFICATE-----
  42685. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  42686. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  42687. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  42688. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  42689. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  42690. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  42691. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  42692. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  42693. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  42694. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  42695. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  42696. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  42697. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  42698. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  42699. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  42700. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  42701. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  42702. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  42703. vZ8=
  42704. -----END CERTIFICATE-----
  42705. Starfield Class 2 CA
  42706. ====================
  42707. -----BEGIN CERTIFICATE-----
  42708. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  42709. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  42710. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  42711. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  42712. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  42713. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  42714. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  42715. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  42716. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  42717. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  42718. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  42719. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  42720. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  42721. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  42722. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  42723. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  42724. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  42725. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  42726. QBFGmh95DmK/D5fs4C8fF5Q=
  42727. -----END CERTIFICATE-----
  42728. DigiCert Assured ID Root CA
  42729. ===========================
  42730. -----BEGIN CERTIFICATE-----
  42731. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  42732. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  42733. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  42734. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  42735. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  42736. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  42737. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  42738. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  42739. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  42740. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  42741. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  42742. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  42743. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  42744. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  42745. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  42746. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  42747. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  42748. -----END CERTIFICATE-----
  42749. DigiCert Global Root CA
  42750. =======================
  42751. -----BEGIN CERTIFICATE-----
  42752. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  42753. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  42754. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  42755. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  42756. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  42757. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  42758. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  42759. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  42760. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  42761. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  42762. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  42763. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  42764. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  42765. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  42766. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  42767. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  42768. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  42769. -----END CERTIFICATE-----
  42770. DigiCert High Assurance EV Root CA
  42771. ==================================
  42772. -----BEGIN CERTIFICATE-----
  42773. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  42774. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  42775. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  42776. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  42777. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  42778. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  42779. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  42780. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  42781. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  42782. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  42783. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  42784. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  42785. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  42786. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  42787. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  42788. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  42789. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  42790. -----END CERTIFICATE-----
  42791. SwissSign Gold CA - G2
  42792. ======================
  42793. -----BEGIN CERTIFICATE-----
  42794. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  42795. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  42796. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  42797. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  42798. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  42799. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  42800. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  42801. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  42802. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  42803. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  42804. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  42805. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  42806. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  42807. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  42808. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  42809. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  42810. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  42811. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  42812. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  42813. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  42814. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  42815. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  42816. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  42817. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  42818. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  42819. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  42820. -----END CERTIFICATE-----
  42821. SwissSign Silver CA - G2
  42822. ========================
  42823. -----BEGIN CERTIFICATE-----
  42824. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  42825. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  42826. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  42827. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  42828. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  42829. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  42830. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  42831. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  42832. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  42833. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  42834. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  42835. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  42836. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  42837. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  42838. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  42839. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  42840. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  42841. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  42842. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  42843. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  42844. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  42845. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  42846. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  42847. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  42848. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  42849. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  42850. -----END CERTIFICATE-----
  42851. SecureTrust CA
  42852. ==============
  42853. -----BEGIN CERTIFICATE-----
  42854. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  42855. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  42856. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  42857. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  42858. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  42859. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  42860. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  42861. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  42862. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  42863. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  42864. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  42865. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  42866. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  42867. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  42868. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  42869. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  42870. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  42871. -----END CERTIFICATE-----
  42872. Secure Global CA
  42873. ================
  42874. -----BEGIN CERTIFICATE-----
  42875. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  42876. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  42877. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  42878. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  42879. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  42880. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  42881. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  42882. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  42883. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  42884. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  42885. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  42886. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  42887. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  42888. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  42889. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  42890. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  42891. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  42892. -----END CERTIFICATE-----
  42893. COMODO Certification Authority
  42894. ==============================
  42895. -----BEGIN CERTIFICATE-----
  42896. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  42897. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  42898. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  42899. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  42900. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  42901. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  42902. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  42903. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  42904. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  42905. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  42906. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  42907. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  42908. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  42909. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  42910. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  42911. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  42912. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  42913. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  42914. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  42915. -----END CERTIFICATE-----
  42916. COMODO ECC Certification Authority
  42917. ==================================
  42918. -----BEGIN CERTIFICATE-----
  42919. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  42920. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  42921. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  42922. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  42923. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  42924. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  42925. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  42926. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  42927. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  42928. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  42929. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  42930. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  42931. -----END CERTIFICATE-----
  42932. Certigna
  42933. ========
  42934. -----BEGIN CERTIFICATE-----
  42935. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  42936. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  42937. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  42938. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  42939. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  42940. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  42941. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  42942. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  42943. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  42944. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  42945. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  42946. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  42947. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  42948. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  42949. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  42950. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  42951. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  42952. -----END CERTIFICATE-----
  42953. ePKI Root Certification Authority
  42954. =================================
  42955. -----BEGIN CERTIFICATE-----
  42956. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  42957. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  42958. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  42959. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  42960. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  42961. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  42962. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  42963. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  42964. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  42965. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  42966. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  42967. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  42968. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  42969. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  42970. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  42971. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  42972. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  42973. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  42974. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  42975. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  42976. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  42977. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  42978. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  42979. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  42980. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  42981. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  42982. -----END CERTIFICATE-----
  42983. certSIGN ROOT CA
  42984. ================
  42985. -----BEGIN CERTIFICATE-----
  42986. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  42987. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  42988. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  42989. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  42990. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  42991. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  42992. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  42993. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  42994. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  42995. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  42996. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  42997. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  42998. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  42999. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  43000. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  43001. -----END CERTIFICATE-----
  43002. NetLock Arany (Class Gold) Főtanúsítvány
  43003. ========================================
  43004. -----BEGIN CERTIFICATE-----
  43005. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  43006. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  43007. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  43008. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  43009. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  43010. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  43011. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  43012. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  43013. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  43014. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  43015. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  43016. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  43017. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  43018. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  43019. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  43020. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  43021. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  43022. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  43023. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  43024. -----END CERTIFICATE-----
  43025. SecureSign RootCA11
  43026. ===================
  43027. -----BEGIN CERTIFICATE-----
  43028. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  43029. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  43030. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  43031. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  43032. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  43033. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  43034. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  43035. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  43036. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  43037. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  43038. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  43039. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  43040. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  43041. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  43042. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  43043. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  43044. -----END CERTIFICATE-----
  43045. Microsec e-Szigno Root CA 2009
  43046. ==============================
  43047. -----BEGIN CERTIFICATE-----
  43048. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  43049. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  43050. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  43051. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  43052. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  43053. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  43054. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  43055. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  43056. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  43057. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  43058. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  43059. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  43060. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  43061. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  43062. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  43063. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  43064. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  43065. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  43066. LXpUq3DDfSJlgnCW
  43067. -----END CERTIFICATE-----
  43068. GlobalSign Root CA - R3
  43069. =======================
  43070. -----BEGIN CERTIFICATE-----
  43071. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  43072. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  43073. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  43074. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  43075. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  43076. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  43077. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  43078. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  43079. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  43080. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  43081. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  43082. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  43083. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  43084. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  43085. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  43086. kpeDMdmztcpHWD9f
  43087. -----END CERTIFICATE-----
  43088. Izenpe.com
  43089. ==========
  43090. -----BEGIN CERTIFICATE-----
  43091. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  43092. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  43093. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  43094. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  43095. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  43096. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  43097. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  43098. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  43099. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  43100. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  43101. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  43102. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  43103. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  43104. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  43105. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  43106. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  43107. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  43108. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  43109. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  43110. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  43111. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  43112. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  43113. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  43114. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  43115. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  43116. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  43117. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  43118. -----END CERTIFICATE-----
  43119. Go Daddy Root Certificate Authority - G2
  43120. ========================================
  43121. -----BEGIN CERTIFICATE-----
  43122. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  43123. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  43124. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  43125. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  43126. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  43127. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  43128. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  43129. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  43130. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  43131. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  43132. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  43133. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  43134. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  43135. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  43136. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  43137. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  43138. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  43139. -----END CERTIFICATE-----
  43140. Starfield Root Certificate Authority - G2
  43141. =========================================
  43142. -----BEGIN CERTIFICATE-----
  43143. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  43144. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  43145. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  43146. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  43147. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  43148. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  43149. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  43150. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  43151. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  43152. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  43153. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  43154. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  43155. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  43156. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  43157. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  43158. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  43159. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  43160. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  43161. -----END CERTIFICATE-----
  43162. Starfield Services Root Certificate Authority - G2
  43163. ==================================================
  43164. -----BEGIN CERTIFICATE-----
  43165. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  43166. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  43167. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  43168. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  43169. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  43170. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  43171. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  43172. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  43173. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  43174. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  43175. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  43176. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  43177. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  43178. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  43179. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  43180. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  43181. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  43182. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  43183. -----END CERTIFICATE-----
  43184. AffirmTrust Commercial
  43185. ======================
  43186. -----BEGIN CERTIFICATE-----
  43187. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  43188. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  43189. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  43190. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  43191. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  43192. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  43193. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  43194. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  43195. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  43196. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  43197. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  43198. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  43199. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  43200. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  43201. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  43202. -----END CERTIFICATE-----
  43203. AffirmTrust Networking
  43204. ======================
  43205. -----BEGIN CERTIFICATE-----
  43206. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  43207. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  43208. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  43209. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  43210. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  43211. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  43212. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  43213. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  43214. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  43215. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  43216. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  43217. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  43218. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  43219. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  43220. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  43221. -----END CERTIFICATE-----
  43222. AffirmTrust Premium
  43223. ===================
  43224. -----BEGIN CERTIFICATE-----
  43225. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  43226. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  43227. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  43228. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  43229. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  43230. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  43231. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  43232. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  43233. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  43234. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  43235. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  43236. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  43237. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  43238. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  43239. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  43240. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  43241. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  43242. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  43243. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  43244. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  43245. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  43246. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  43247. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  43248. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  43249. -----END CERTIFICATE-----
  43250. AffirmTrust Premium ECC
  43251. =======================
  43252. -----BEGIN CERTIFICATE-----
  43253. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  43254. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  43255. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  43256. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  43257. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  43258. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  43259. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  43260. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  43261. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  43262. eQ==
  43263. -----END CERTIFICATE-----
  43264. Certum Trusted Network CA
  43265. =========================
  43266. -----BEGIN CERTIFICATE-----
  43267. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  43268. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  43269. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  43270. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  43271. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  43272. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  43273. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  43274. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  43275. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  43276. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  43277. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  43278. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  43279. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  43280. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  43281. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  43282. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  43283. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  43284. -----END CERTIFICATE-----
  43285. TWCA Root Certification Authority
  43286. =================================
  43287. -----BEGIN CERTIFICATE-----
  43288. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  43289. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  43290. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  43291. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  43292. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  43293. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  43294. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  43295. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  43296. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  43297. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  43298. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  43299. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  43300. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  43301. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  43302. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  43303. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  43304. -----END CERTIFICATE-----
  43305. Security Communication RootCA2
  43306. ==============================
  43307. -----BEGIN CERTIFICATE-----
  43308. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  43309. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  43310. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  43311. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  43312. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  43313. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  43314. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  43315. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  43316. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  43317. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  43318. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  43319. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  43320. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  43321. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  43322. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  43323. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  43324. -----END CERTIFICATE-----
  43325. Actalis Authentication Root CA
  43326. ==============================
  43327. -----BEGIN CERTIFICATE-----
  43328. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  43329. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  43330. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  43331. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  43332. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  43333. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  43334. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  43335. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  43336. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  43337. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  43338. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  43339. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  43340. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  43341. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  43342. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  43343. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  43344. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  43345. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  43346. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  43347. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  43348. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  43349. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  43350. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  43351. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  43352. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  43353. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  43354. -----END CERTIFICATE-----
  43355. Buypass Class 2 Root CA
  43356. =======================
  43357. -----BEGIN CERTIFICATE-----
  43358. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  43359. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  43360. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  43361. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  43362. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  43363. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  43364. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  43365. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  43366. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  43367. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  43368. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  43369. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  43370. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  43371. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  43372. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  43373. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  43374. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  43375. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  43376. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  43377. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  43378. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  43379. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  43380. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  43381. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  43382. rJgWVqA=
  43383. -----END CERTIFICATE-----
  43384. Buypass Class 3 Root CA
  43385. =======================
  43386. -----BEGIN CERTIFICATE-----
  43387. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  43388. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  43389. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  43390. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  43391. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  43392. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  43393. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  43394. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  43395. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  43396. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  43397. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  43398. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  43399. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  43400. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  43401. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  43402. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  43403. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  43404. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  43405. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  43406. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  43407. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  43408. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  43409. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  43410. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  43411. Cp/HuZc=
  43412. -----END CERTIFICATE-----
  43413. T-TeleSec GlobalRoot Class 3
  43414. ============================
  43415. -----BEGIN CERTIFICATE-----
  43416. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  43417. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  43418. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  43419. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  43420. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  43421. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  43422. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  43423. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  43424. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  43425. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  43426. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  43427. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  43428. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  43429. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  43430. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  43431. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  43432. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  43433. -----END CERTIFICATE-----
  43434. D-TRUST Root Class 3 CA 2 2009
  43435. ==============================
  43436. -----BEGIN CERTIFICATE-----
  43437. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  43438. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  43439. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  43440. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  43441. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  43442. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  43443. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  43444. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  43445. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  43446. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  43447. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  43448. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  43449. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  43450. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  43451. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  43452. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  43453. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  43454. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  43455. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  43456. -----END CERTIFICATE-----
  43457. D-TRUST Root Class 3 CA 2 EV 2009
  43458. =================================
  43459. -----BEGIN CERTIFICATE-----
  43460. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  43461. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  43462. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  43463. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  43464. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  43465. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  43466. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  43467. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  43468. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  43469. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  43470. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  43471. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  43472. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  43473. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  43474. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  43475. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  43476. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  43477. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  43478. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  43479. w9y4AyHqnxbxLFS1
  43480. -----END CERTIFICATE-----
  43481. CA Disig Root R2
  43482. ================
  43483. -----BEGIN CERTIFICATE-----
  43484. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  43485. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  43486. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  43487. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  43488. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  43489. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  43490. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  43491. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  43492. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  43493. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  43494. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  43495. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  43496. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  43497. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  43498. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  43499. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  43500. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  43501. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  43502. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  43503. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  43504. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  43505. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  43506. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  43507. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  43508. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  43509. -----END CERTIFICATE-----
  43510. ACCVRAIZ1
  43511. =========
  43512. -----BEGIN CERTIFICATE-----
  43513. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  43514. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  43515. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  43516. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  43517. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  43518. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  43519. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  43520. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  43521. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  43522. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  43523. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  43524. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  43525. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  43526. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  43527. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  43528. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  43529. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  43530. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  43531. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  43532. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  43533. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  43534. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  43535. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  43536. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  43537. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  43538. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  43539. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  43540. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  43541. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  43542. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  43543. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  43544. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  43545. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  43546. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  43547. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  43548. EfbRD0tVNEYqi4Y7
  43549. -----END CERTIFICATE-----
  43550. TWCA Global Root CA
  43551. ===================
  43552. -----BEGIN CERTIFICATE-----
  43553. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  43554. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  43555. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  43556. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  43557. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  43558. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  43559. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  43560. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  43561. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  43562. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  43563. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  43564. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  43565. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  43566. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  43567. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  43568. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  43569. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  43570. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  43571. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  43572. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  43573. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  43574. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  43575. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  43576. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  43577. -----END CERTIFICATE-----
  43578. TeliaSonera Root CA v1
  43579. ======================
  43580. -----BEGIN CERTIFICATE-----
  43581. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  43582. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  43583. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  43584. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  43585. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  43586. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  43587. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  43588. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  43589. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  43590. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  43591. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  43592. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  43593. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  43594. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  43595. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  43596. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  43597. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  43598. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  43599. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  43600. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  43601. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  43602. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  43603. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  43604. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  43605. -----END CERTIFICATE-----
  43606. T-TeleSec GlobalRoot Class 2
  43607. ============================
  43608. -----BEGIN CERTIFICATE-----
  43609. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  43610. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  43611. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  43612. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  43613. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  43614. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  43615. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  43616. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  43617. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  43618. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  43619. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  43620. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  43621. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  43622. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  43623. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  43624. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  43625. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  43626. -----END CERTIFICATE-----
  43627. Atos TrustedRoot 2011
  43628. =====================
  43629. -----BEGIN CERTIFICATE-----
  43630. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  43631. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  43632. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  43633. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  43634. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  43635. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  43636. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  43637. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  43638. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  43639. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  43640. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  43641. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  43642. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  43643. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  43644. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  43645. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  43646. -----END CERTIFICATE-----
  43647. QuoVadis Root CA 1 G3
  43648. =====================
  43649. -----BEGIN CERTIFICATE-----
  43650. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  43651. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  43652. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  43653. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  43654. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  43655. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  43656. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  43657. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  43658. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  43659. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  43660. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  43661. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  43662. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  43663. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  43664. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  43665. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  43666. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  43667. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  43668. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  43669. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  43670. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  43671. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  43672. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  43673. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  43674. hMJKzRwuJIczYOXD
  43675. -----END CERTIFICATE-----
  43676. QuoVadis Root CA 2 G3
  43677. =====================
  43678. -----BEGIN CERTIFICATE-----
  43679. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  43680. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  43681. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  43682. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  43683. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  43684. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  43685. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  43686. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  43687. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  43688. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  43689. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  43690. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  43691. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  43692. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  43693. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  43694. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  43695. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  43696. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  43697. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  43698. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  43699. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  43700. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  43701. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  43702. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  43703. O3jtZsSOeWmD3n+M
  43704. -----END CERTIFICATE-----
  43705. QuoVadis Root CA 3 G3
  43706. =====================
  43707. -----BEGIN CERTIFICATE-----
  43708. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  43709. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  43710. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  43711. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  43712. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  43713. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  43714. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  43715. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  43716. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  43717. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  43718. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  43719. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  43720. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  43721. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  43722. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  43723. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  43724. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  43725. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  43726. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  43727. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  43728. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  43729. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  43730. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  43731. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  43732. PpxxVJkES/1Y+Zj0
  43733. -----END CERTIFICATE-----
  43734. DigiCert Assured ID Root G2
  43735. ===========================
  43736. -----BEGIN CERTIFICATE-----
  43737. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  43738. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  43739. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  43740. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  43741. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  43742. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  43743. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  43744. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  43745. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  43746. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  43747. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  43748. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  43749. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  43750. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  43751. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  43752. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  43753. IhNzbM8m9Yop5w==
  43754. -----END CERTIFICATE-----
  43755. DigiCert Assured ID Root G3
  43756. ===========================
  43757. -----BEGIN CERTIFICATE-----
  43758. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  43759. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  43760. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  43761. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  43762. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  43763. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  43764. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  43765. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  43766. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  43767. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  43768. 1vUhZscv6pZjamVFkpUBtA==
  43769. -----END CERTIFICATE-----
  43770. DigiCert Global Root G2
  43771. =======================
  43772. -----BEGIN CERTIFICATE-----
  43773. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  43774. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  43775. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  43776. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  43777. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  43778. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  43779. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  43780. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  43781. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  43782. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  43783. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  43784. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  43785. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  43786. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  43787. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  43788. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  43789. MrY=
  43790. -----END CERTIFICATE-----
  43791. DigiCert Global Root G3
  43792. =======================
  43793. -----BEGIN CERTIFICATE-----
  43794. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  43795. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  43796. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  43797. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  43798. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  43799. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  43800. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  43801. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  43802. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  43803. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  43804. VOKa5Vt8sycX
  43805. -----END CERTIFICATE-----
  43806. DigiCert Trusted Root G4
  43807. ========================
  43808. -----BEGIN CERTIFICATE-----
  43809. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  43810. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  43811. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  43812. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  43813. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  43814. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  43815. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  43816. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  43817. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  43818. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  43819. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  43820. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  43821. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  43822. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  43823. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  43824. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  43825. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  43826. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  43827. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  43828. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  43829. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  43830. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  43831. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  43832. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  43833. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  43834. 82Z+
  43835. -----END CERTIFICATE-----
  43836. COMODO RSA Certification Authority
  43837. ==================================
  43838. -----BEGIN CERTIFICATE-----
  43839. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  43840. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  43841. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  43842. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  43843. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  43844. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  43845. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  43846. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  43847. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  43848. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  43849. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  43850. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  43851. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  43852. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  43853. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  43854. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  43855. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  43856. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  43857. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  43858. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  43859. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  43860. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  43861. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  43862. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  43863. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  43864. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  43865. LaZRfyHBNVOFBkpdn627G190
  43866. -----END CERTIFICATE-----
  43867. USERTrust RSA Certification Authority
  43868. =====================================
  43869. -----BEGIN CERTIFICATE-----
  43870. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  43871. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  43872. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  43873. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  43874. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  43875. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  43876. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  43877. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  43878. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  43879. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  43880. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  43881. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  43882. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  43883. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  43884. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  43885. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  43886. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  43887. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  43888. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  43889. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  43890. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  43891. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  43892. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  43893. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  43894. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  43895. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  43896. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  43897. -----END CERTIFICATE-----
  43898. USERTrust ECC Certification Authority
  43899. =====================================
  43900. -----BEGIN CERTIFICATE-----
  43901. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  43902. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  43903. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  43904. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  43905. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  43906. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  43907. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  43908. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  43909. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  43910. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  43911. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  43912. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  43913. -----END CERTIFICATE-----
  43914. GlobalSign ECC Root CA - R5
  43915. ===========================
  43916. -----BEGIN CERTIFICATE-----
  43917. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  43918. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  43919. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  43920. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  43921. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  43922. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  43923. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  43924. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  43925. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  43926. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  43927. -----END CERTIFICATE-----
  43928. IdenTrust Commercial Root CA 1
  43929. ==============================
  43930. -----BEGIN CERTIFICATE-----
  43931. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  43932. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  43933. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  43934. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  43935. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  43936. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  43937. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  43938. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  43939. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  43940. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  43941. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  43942. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  43943. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  43944. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  43945. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  43946. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  43947. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  43948. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  43949. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  43950. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  43951. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  43952. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  43953. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  43954. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  43955. cGzM7vRX+Bi6hG6H
  43956. -----END CERTIFICATE-----
  43957. IdenTrust Public Sector Root CA 1
  43958. =================================
  43959. -----BEGIN CERTIFICATE-----
  43960. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  43961. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  43962. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  43963. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  43964. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  43965. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  43966. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  43967. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  43968. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  43969. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  43970. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  43971. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  43972. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  43973. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  43974. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  43975. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  43976. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  43977. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  43978. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  43979. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  43980. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  43981. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  43982. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  43983. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  43984. 3Wl9af0AVqW3rLatt8o+Ae+c
  43985. -----END CERTIFICATE-----
  43986. Entrust Root Certification Authority - G2
  43987. =========================================
  43988. -----BEGIN CERTIFICATE-----
  43989. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  43990. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  43991. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  43992. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  43993. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  43994. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  43995. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  43996. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  43997. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  43998. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  43999. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  44000. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  44001. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  44002. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  44003. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  44004. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  44005. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  44006. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  44007. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  44008. e4pIb4tF9g==
  44009. -----END CERTIFICATE-----
  44010. Entrust Root Certification Authority - EC1
  44011. ==========================================
  44012. -----BEGIN CERTIFICATE-----
  44013. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  44014. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  44015. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  44016. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  44017. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  44018. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  44019. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  44020. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  44021. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  44022. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  44023. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  44024. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  44025. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  44026. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  44027. -----END CERTIFICATE-----
  44028. CFCA EV ROOT
  44029. ============
  44030. -----BEGIN CERTIFICATE-----
  44031. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  44032. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  44033. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  44034. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  44035. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  44036. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  44037. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  44038. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  44039. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  44040. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  44041. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  44042. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  44043. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  44044. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  44045. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  44046. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  44047. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  44048. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  44049. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  44050. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  44051. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  44052. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  44053. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  44054. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  44055. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  44056. -----END CERTIFICATE-----
  44057. OISTE WISeKey Global Root GB CA
  44058. ===============================
  44059. -----BEGIN CERTIFICATE-----
  44060. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  44061. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  44062. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  44063. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  44064. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  44065. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  44066. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  44067. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  44068. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  44069. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  44070. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  44071. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  44072. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  44073. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  44074. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  44075. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  44076. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  44077. -----END CERTIFICATE-----
  44078. SZAFIR ROOT CA2
  44079. ===============
  44080. -----BEGIN CERTIFICATE-----
  44081. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  44082. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  44083. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  44084. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  44085. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  44086. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  44087. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  44088. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  44089. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  44090. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  44091. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  44092. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  44093. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  44094. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  44095. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  44096. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  44097. -----END CERTIFICATE-----
  44098. Certum Trusted Network CA 2
  44099. ===========================
  44100. -----BEGIN CERTIFICATE-----
  44101. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  44102. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  44103. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  44104. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  44105. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  44106. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  44107. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  44108. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  44109. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  44110. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  44111. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  44112. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  44113. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  44114. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  44115. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  44116. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  44117. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  44118. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  44119. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  44120. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  44121. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  44122. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  44123. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  44124. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  44125. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  44126. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  44127. zAYspsbiDrW5viSP
  44128. -----END CERTIFICATE-----
  44129. Hellenic Academic and Research Institutions RootCA 2015
  44130. =======================================================
  44131. -----BEGIN CERTIFICATE-----
  44132. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  44133. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  44134. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  44135. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  44136. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  44137. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  44138. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  44139. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  44140. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  44141. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  44142. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  44143. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  44144. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  44145. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  44146. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  44147. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  44148. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  44149. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  44150. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  44151. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  44152. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  44153. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  44154. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  44155. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  44156. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  44157. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  44158. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  44159. p/UsQu0yrbYhnr68
  44160. -----END CERTIFICATE-----
  44161. Hellenic Academic and Research Institutions ECC RootCA 2015
  44162. ===========================================================
  44163. -----BEGIN CERTIFICATE-----
  44164. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  44165. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  44166. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  44167. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  44168. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  44169. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  44170. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  44171. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  44172. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  44173. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  44174. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  44175. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  44176. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  44177. -----END CERTIFICATE-----
  44178. ISRG Root X1
  44179. ============
  44180. -----BEGIN CERTIFICATE-----
  44181. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  44182. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  44183. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  44184. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  44185. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  44186. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  44187. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  44188. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  44189. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  44190. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  44191. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  44192. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  44193. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  44194. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  44195. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  44196. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  44197. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  44198. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  44199. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  44200. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  44201. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  44202. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  44203. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  44204. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  44205. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  44206. -----END CERTIFICATE-----
  44207. AC RAIZ FNMT-RCM
  44208. ================
  44209. -----BEGIN CERTIFICATE-----
  44210. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  44211. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  44212. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  44213. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  44214. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  44215. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  44216. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  44217. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  44218. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  44219. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  44220. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  44221. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  44222. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  44223. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  44224. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  44225. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  44226. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  44227. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  44228. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  44229. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  44230. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  44231. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  44232. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  44233. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  44234. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  44235. -----END CERTIFICATE-----
  44236. Amazon Root CA 1
  44237. ================
  44238. -----BEGIN CERTIFICATE-----
  44239. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  44240. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  44241. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  44242. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  44243. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  44244. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  44245. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  44246. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  44247. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  44248. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  44249. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  44250. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  44251. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  44252. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  44253. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  44254. -----END CERTIFICATE-----
  44255. Amazon Root CA 2
  44256. ================
  44257. -----BEGIN CERTIFICATE-----
  44258. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  44259. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  44260. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  44261. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  44262. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  44263. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  44264. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  44265. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  44266. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  44267. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  44268. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  44269. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  44270. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  44271. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  44272. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  44273. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  44274. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  44275. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  44276. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  44277. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  44278. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  44279. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  44280. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  44281. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  44282. -----END CERTIFICATE-----
  44283. Amazon Root CA 3
  44284. ================
  44285. -----BEGIN CERTIFICATE-----
  44286. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  44287. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  44288. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  44289. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  44290. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  44291. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  44292. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  44293. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  44294. -----END CERTIFICATE-----
  44295. Amazon Root CA 4
  44296. ================
  44297. -----BEGIN CERTIFICATE-----
  44298. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  44299. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  44300. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  44301. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  44302. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  44303. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  44304. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  44305. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  44306. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  44307. -----END CERTIFICATE-----
  44308. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  44309. =============================================
  44310. -----BEGIN CERTIFICATE-----
  44311. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  44312. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  44313. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  44314. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  44315. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  44316. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  44317. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  44318. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  44319. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  44320. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  44321. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  44322. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  44323. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  44324. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  44325. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  44326. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  44327. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  44328. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  44329. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  44330. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  44331. -----END CERTIFICATE-----
  44332. GDCA TrustAUTH R5 ROOT
  44333. ======================
  44334. -----BEGIN CERTIFICATE-----
  44335. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  44336. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  44337. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  44338. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  44339. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  44340. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  44341. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  44342. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  44343. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  44344. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  44345. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  44346. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  44347. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  44348. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  44349. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  44350. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  44351. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  44352. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  44353. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  44354. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  44355. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  44356. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  44357. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  44358. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  44359. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  44360. -----END CERTIFICATE-----
  44361. SSL.com Root Certification Authority RSA
  44362. ========================================
  44363. -----BEGIN CERTIFICATE-----
  44364. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  44365. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  44366. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  44367. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  44368. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  44369. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  44370. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  44371. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  44372. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  44373. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  44374. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  44375. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  44376. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  44377. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  44378. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  44379. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  44380. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  44381. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  44382. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  44383. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  44384. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  44385. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  44386. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  44387. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  44388. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  44389. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  44390. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  44391. -----END CERTIFICATE-----
  44392. SSL.com Root Certification Authority ECC
  44393. ========================================
  44394. -----BEGIN CERTIFICATE-----
  44395. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  44396. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  44397. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  44398. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  44399. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  44400. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  44401. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  44402. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  44403. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  44404. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  44405. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  44406. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  44407. -----END CERTIFICATE-----
  44408. SSL.com EV Root Certification Authority RSA R2
  44409. ==============================================
  44410. -----BEGIN CERTIFICATE-----
  44411. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  44412. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  44413. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  44414. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  44415. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  44416. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  44417. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  44418. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  44419. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  44420. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  44421. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  44422. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  44423. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  44424. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  44425. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  44426. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  44427. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  44428. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  44429. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  44430. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  44431. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  44432. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  44433. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  44434. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  44435. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  44436. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  44437. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  44438. -----END CERTIFICATE-----
  44439. SSL.com EV Root Certification Authority ECC
  44440. ===========================================
  44441. -----BEGIN CERTIFICATE-----
  44442. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  44443. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  44444. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  44445. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  44446. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  44447. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  44448. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  44449. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  44450. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  44451. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  44452. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  44453. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  44454. -----END CERTIFICATE-----
  44455. GlobalSign Root CA - R6
  44456. =======================
  44457. -----BEGIN CERTIFICATE-----
  44458. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  44459. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  44460. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  44461. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  44462. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  44463. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  44464. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  44465. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  44466. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  44467. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  44468. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  44469. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  44470. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  44471. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  44472. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  44473. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  44474. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  44475. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  44476. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  44477. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  44478. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  44479. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  44480. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  44481. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  44482. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  44483. -----END CERTIFICATE-----
  44484. OISTE WISeKey Global Root GC CA
  44485. ===============================
  44486. -----BEGIN CERTIFICATE-----
  44487. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  44488. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  44489. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  44490. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  44491. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  44492. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  44493. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  44494. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  44495. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  44496. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  44497. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  44498. -----END CERTIFICATE-----
  44499. UCA Global G2 Root
  44500. ==================
  44501. -----BEGIN CERTIFICATE-----
  44502. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  44503. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  44504. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  44505. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  44506. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  44507. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  44508. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  44509. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  44510. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  44511. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  44512. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  44513. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  44514. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  44515. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  44516. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  44517. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  44518. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  44519. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  44520. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  44521. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  44522. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  44523. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  44524. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  44525. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  44526. -----END CERTIFICATE-----
  44527. UCA Extended Validation Root
  44528. ============================
  44529. -----BEGIN CERTIFICATE-----
  44530. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  44531. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  44532. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  44533. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  44534. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  44535. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  44536. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  44537. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  44538. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  44539. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  44540. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  44541. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  44542. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  44543. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  44544. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  44545. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  44546. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  44547. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  44548. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  44549. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  44550. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  44551. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  44552. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  44553. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  44554. dhh2n1ax
  44555. -----END CERTIFICATE-----
  44556. Certigna Root CA
  44557. ================
  44558. -----BEGIN CERTIFICATE-----
  44559. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  44560. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  44561. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  44562. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  44563. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  44564. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  44565. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  44566. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  44567. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  44568. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  44569. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  44570. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  44571. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  44572. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  44573. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  44574. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  44575. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  44576. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  44577. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  44578. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  44579. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  44580. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  44581. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  44582. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  44583. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  44584. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  44585. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  44586. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  44587. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  44588. -----END CERTIFICATE-----
  44589. emSign Root CA - G1
  44590. ===================
  44591. -----BEGIN CERTIFICATE-----
  44592. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  44593. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  44594. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  44595. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  44596. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  44597. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  44598. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  44599. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  44600. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  44601. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  44602. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  44603. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  44604. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  44605. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  44606. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  44607. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  44608. iN66zB+Afko=
  44609. -----END CERTIFICATE-----
  44610. emSign ECC Root CA - G3
  44611. =======================
  44612. -----BEGIN CERTIFICATE-----
  44613. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  44614. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  44615. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  44616. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  44617. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  44618. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  44619. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  44620. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  44621. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  44622. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  44623. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  44624. -----END CERTIFICATE-----
  44625. emSign Root CA - C1
  44626. ===================
  44627. -----BEGIN CERTIFICATE-----
  44628. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  44629. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  44630. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  44631. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  44632. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  44633. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  44634. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  44635. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  44636. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  44637. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  44638. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  44639. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  44640. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  44641. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  44642. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  44643. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  44644. -----END CERTIFICATE-----
  44645. emSign ECC Root CA - C3
  44646. =======================
  44647. -----BEGIN CERTIFICATE-----
  44648. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  44649. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  44650. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  44651. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  44652. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  44653. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  44654. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  44655. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  44656. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  44657. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  44658. -----END CERTIFICATE-----
  44659. Hongkong Post Root CA 3
  44660. =======================
  44661. -----BEGIN CERTIFICATE-----
  44662. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  44663. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  44664. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  44665. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  44666. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  44667. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  44668. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  44669. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  44670. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  44671. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  44672. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  44673. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  44674. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  44675. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  44676. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  44677. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  44678. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  44679. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  44680. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  44681. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  44682. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  44683. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  44684. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  44685. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  44686. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  44687. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  44688. dBb9HxEGmpv0
  44689. -----END CERTIFICATE-----
  44690. Entrust Root Certification Authority - G4
  44691. =========================================
  44692. -----BEGIN CERTIFICATE-----
  44693. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  44694. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  44695. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  44696. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  44697. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  44698. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  44699. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  44700. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  44701. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  44702. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  44703. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  44704. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  44705. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  44706. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  44707. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  44708. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  44709. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  44710. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  44711. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  44712. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  44713. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  44714. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  44715. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  44716. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  44717. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  44718. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  44719. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  44720. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  44721. kcpG2om3PVODLAgfi49T3f+sHw==
  44722. -----END CERTIFICATE-----
  44723. Microsoft ECC Root Certificate Authority 2017
  44724. =============================================
  44725. -----BEGIN CERTIFICATE-----
  44726. MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  44727. UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND
  44728. IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4
  44729. MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw
  44730. NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQ
  44731. BgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZRogPZnZH6
  44732. thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYbhGBKia/teQ87zvH2RPUB
  44733. eMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTIy5lycFIM
  44734. +Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlf
  44735. Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR
  44736. eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
  44737. -----END CERTIFICATE-----
  44738. Microsoft RSA Root Certificate Authority 2017
  44739. =============================================
  44740. -----BEGIN CERTIFICATE-----
  44741. MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG
  44742. EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg
  44743. UlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIw
  44744. NzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
  44745. MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcw
  44746. ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZNt9GkMml
  44747. 7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0ZdDMbRnMlfl7rEqUrQ7e
  44748. S0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw7
  44749. 1VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+
  44750. dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49F
  44751. yGcohJUcaDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRS
  44752. MLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVr
  44753. lMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ
  44754. 0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJ
  44755. ClTUFLkqqNfs+avNJVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYw
  44756. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC
  44757. NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og
  44758. 6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80
  44759. dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk
  44760. +ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex
  44761. /2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDy
  44762. AmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGRxpl/j8nW
  44763. ZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiAppGWSZI1b7rCoucL5mxAyE
  44764. 7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKT
  44765. c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D
  44766. 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E
  44767. -----END CERTIFICATE-----
  44768. e-Szigno Root CA 2017
  44769. =====================
  44770. -----BEGIN CERTIFICATE-----
  44771. MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw
  44772. DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt
  44773. MjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZa
  44774. Fw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UE
  44775. CgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3pp
  44776. Z25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtvxie+RJCx
  44777. s1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+HWyx7xf58etqjYzBhMA8G
  44778. A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSHERUI0arBeAyxr87GyZDv
  44779. vzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEA
  44780. tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO
  44781. svxyqltZ+efcMQ==
  44782. -----END CERTIFICATE-----
  44783. certSIGN Root CA G2
  44784. ===================
  44785. -----BEGIN CERTIFICATE-----
  44786. MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw
  44787. EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy
  44788. MDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lH
  44789. TiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  44790. ADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05
  44791. N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZuIt4Imfk
  44792. abBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhpn+Sc8CnTXPnGFiWeI8Mg
  44793. wT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKscpc/I1mbySKEwQdPzH/iV8oScLumZfNp
  44794. dWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91Qqh
  44795. ngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732
  44796. jcZZroiFDsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf
  44797. 95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlc
  44798. z8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERL
  44799. iohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
  44800. DgQWBBSCIS1mxteg4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOB
  44801. ywaK8SJJ6ejqkX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC
  44802. b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB
  44803. /AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5
  44804. 8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5
  44805. BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklW
  44806. atKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tU
  44807. Sxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZkPuXaTH4M
  44808. NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N
  44809. 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc=
  44810. -----END CERTIFICATE-----
  44811. Trustwave Global Certification Authority
  44812. ========================================
  44813. -----BEGIN CERTIFICATE-----
  44814. MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV
  44815. UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
  44816. ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
  44817. IEF1dGhvcml0eTAeFw0xNzA4MjMxOTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJV
  44818. UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
  44819. ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
  44820. IEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALldUShLPDeS0YLOvR29
  44821. zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0XznswuvCAAJWX/NKSqIk4cXGIDtiLK0thAf
  44822. LdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4Bq
  44823. stTnoApTAbqOl5F2brz81Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9o
  44824. WN0EACyW80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotPJqX+
  44825. OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1lRtzuzWniTY+HKE40
  44826. Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfwhI0Vcnyh78zyiGG69Gm7DIwLdVcE
  44827. uE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm
  44828. +9jaJXLE9gCxInm943xZYkqcBW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqj
  44829. ifLJS3tBEW1ntwiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud
  44830. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1UdDwEB/wQEAwIB
  44831. BjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W0OhUKDtkLSGm+J1WE2pIPU/H
  44832. PinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfeuyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0H
  44833. ZJDmHvUqoai7PF35owgLEQzxPy0QlG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla
  44834. 4gt5kNdXElE1GYhBaCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5R
  44835. vbbEsLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPTMaCm/zjd
  44836. zyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qequ5AvzSxnI9O4fKSTx+O
  44837. 856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxhVicGaeVyQYHTtgGJoC86cnn+OjC/QezH
  44838. Yj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu
  44839. 3R3y4G5OBVixwJAWKqQ9EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP
  44840. 29FpHOTKyeC2nOnOcXHebD8WpHk=
  44841. -----END CERTIFICATE-----
  44842. Trustwave Global ECC P256 Certification Authority
  44843. =================================================
  44844. -----BEGIN CERTIFICATE-----
  44845. MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYDVQQGEwJVUzER
  44846. MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
  44847. b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZp
  44848. Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYD
  44849. VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
  44850. dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1
  44851. NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH77bOYj
  44852. 43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoNFWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqm
  44853. P62jQzBBMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt
  44854. 0UrrdaVKEJmzsaGLSvcwCgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjz
  44855. RM4q3wghDDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7
  44856. -----END CERTIFICATE-----
  44857. Trustwave Global ECC P384 Certification Authority
  44858. =================================================
  44859. -----BEGIN CERTIFICATE-----
  44860. MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYDVQQGEwJVUzER
  44861. MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
  44862. b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZp
  44863. Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYD
  44864. VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
  44865. dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4
  44866. NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuBBAAiA2IABGvaDXU1CDFH
  44867. Ba5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJj9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr
  44868. /TklZvFe/oyujUF5nQlgziip04pt89ZF1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNV
  44869. HQ8BAf8EBQMDBwYAMB0GA1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNn
  44870. ADBkAjA3AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsCMGcl
  44871. CrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVuSw==
  44872. -----END CERTIFICATE-----
  44873. NAVER Global Root Certification Authority
  44874. =========================================
  44875. -----BEGIN CERTIFICATE-----
  44876. MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEMBQAwaTELMAkG
  44877. A1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRGT1JNIENvcnAuMTIwMAYDVQQD
  44878. DClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4
  44879. NDJaFw0zNzA4MTgyMzU5NTlaMGkxCzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVT
  44880. UyBQTEFURk9STSBDb3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlv
  44881. biBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVAiQqrDZBb
  44882. UGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH38dq6SZeWYp34+hInDEW
  44883. +j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lEHoSTGEq0n+USZGnQJoViAbbJAh2+g1G7
  44884. XNr4rRVqmfeSVPc0W+m/6imBEtRTkZazkVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2
  44885. aacp+yPOiNgSnABIqKYPszuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4
  44886. Yb8ObtoqvC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHfnZ3z
  44887. VHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaGYQ5fG8Ir4ozVu53B
  44888. A0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo0es+nPxdGoMuK8u180SdOqcXYZai
  44889. cdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3aCJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejy
  44890. YhbLgGvtPe31HzClrkvJE+2KAQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNV
  44891. HQ4EFgQU0p+I36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB
  44892. Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoNqo0hV4/GPnrK
  44893. 21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatjcu3cvuzHV+YwIHHW1xDBE1UB
  44894. jCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm+LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bx
  44895. hYTeodoS76TiEJd6eN4MUZeoIUCLhr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTg
  44896. E34h5prCy8VCZLQelHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTH
  44897. D8z7p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8piKCk5XQ
  44898. A76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLRLBT/DShycpWbXgnbiUSY
  44899. qqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oG
  44900. I/hGoiLtk/bdmuYqh7GYVPEi92tF4+KOdh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmg
  44901. kpzNNIaRkPpkUZ3+/uul9XXeifdy
  44902. -----END CERTIFICATE-----
  44903. AC RAIZ FNMT-RCM SERVIDORES SEGUROS
  44904. ===================================
  44905. -----BEGIN CERTIFICATE-----
  44906. MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQswCQYDVQQGEwJF
  44907. UzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgwFgYDVQRhDA9WQVRFUy1RMjgy
  44908. NjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1SQ00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4
  44909. MTIyMDA5MzczM1oXDTQzMTIyMDA5MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQt
  44910. UkNNMQ4wDAYDVQQLDAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNB
  44911. QyBSQUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  44912. BPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LHsbI6GA60XYyzZl2hNPk2
  44913. LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oKUm8BA06Oi6NCMEAwDwYDVR0TAQH/BAUw
  44914. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqG
  44915. SM49BAMDA2kAMGYCMQCuSuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoD
  44916. zBOQn5ICMQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJyv+c=
  44917. -----END CERTIFICATE-----
  44918. GlobalSign Root R46
  44919. ===================
  44920. -----BEGIN CERTIFICATE-----
  44921. MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUAMEYxCzAJBgNV
  44922. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJv
  44923. b3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAX
  44924. BgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIi
  44925. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08Es
  44926. CVeJOaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQGvGIFAha/
  44927. r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud316HCkD7rRlr+/fKYIje
  44928. 2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo0q3v84RLHIf8E6M6cqJaESvWJ3En7YEt
  44929. bWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSEy132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvj
  44930. K8Cd+RTyG/FWaha/LIWFzXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD4
  44931. 12lPFzYE+cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCNI/on
  44932. ccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzsx2sZy/N78CsHpdls
  44933. eVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqaByFrgY/bxFn63iLABJzjqls2k+g9
  44934. vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYD
  44935. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEM
  44936. BQADggIBAHx47PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg
  44937. JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti2kM3S+LGteWy
  44938. gxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIkpnnpHs6i58FZFZ8d4kuaPp92
  44939. CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRFFRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZm
  44940. OUdkLG5NrmJ7v2B0GbhWrJKsFjLtrWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qq
  44941. JZ4d16GLuc1CLgSkZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwye
  44942. qiv5u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP4vkYxboz
  44943. nxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6N3ec592kD3ZDZopD8p/7
  44944. DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3vouXsXgxT7PntgMTzlSdriVZzH81Xwj3
  44945. QEUxeCp6
  44946. -----END CERTIFICATE-----
  44947. GlobalSign Root E46
  44948. ===================
  44949. -----BEGIN CERTIFICATE-----
  44950. MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYxCzAJBgNVBAYT
  44951. AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJvb3Qg
  44952. RTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNV
  44953. BAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcq
  44954. hkjOPQIBBgUrgQQAIgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkB
  44955. jtjqR+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGddyXqBPCCj
  44956. QjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQxCpCPtsad0kRL
  44957. gLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZk
  44958. vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+
  44959. CAezNIm8BZ/3Hobui3A=
  44960. -----END CERTIFICATE-----
  44961. GLOBALTRUST 2020
  44962. ================
  44963. -----BEGIN CERTIFICATE-----
  44964. MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkGA1UEBhMCQVQx
  44965. IzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVT
  44966. VCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYxMDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAh
  44967. BgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAy
  44968. MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWi
  44969. D59bRatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9ZYybNpyrO
  44970. VPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3QWPKzv9pj2gOlTblzLmM
  44971. CcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPwyJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCm
  44972. fecqQjuCgGOlYx8ZzHyyZqjC0203b+J+BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKA
  44973. A1GqtH6qRNdDYfOiaxaJSaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9OR
  44974. JitHHmkHr96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj04KlG
  44975. DfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9MedKZssCz3AwyIDMvU
  44976. clOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIwq7ejMZdnrY8XD2zHc+0klGvIg5rQ
  44977. mjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUw
  44978. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1Ud
  44979. IwQYMBaAFNwuH9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA
  44980. VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJCXtzoRlgHNQIw
  44981. 4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd6IwPS3BD0IL/qMy/pJTAvoe9
  44982. iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS
  44983. 8cE54+X1+NZK3TTN+2/BT+MAi1bikvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2
  44984. HcqtbepBEX4tdJP7wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxS
  44985. vTOBTI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6CMUO+1918
  44986. oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn4rnvyOL2NSl6dPrFf4IF
  44987. YqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+IaFvowdlxfv1k7/9nR4hYJS8+hge9+6jl
  44988. gqispdNpQ80xiEmEU5LAsTkbOYMBMMTyqfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
  44989. -----END CERTIFICATE-----
  44990. ANF Secure Server Root CA
  44991. =========================
  44992. -----BEGIN CERTIFICATE-----
  44993. MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNVBAUTCUc2MzI4
  44994. NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lv
  44995. bjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNVBAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3Qg
  44996. Q0EwHhcNMTkwOTA0MTAwMDM4WhcNMzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEw
  44997. MQswCQYDVQQGEwJFUzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQw
  44998. EgYDVQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9vdCBDQTCC
  44999. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCjcqQZAZ2cC4Ffc0m6p6zz
  45000. BE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9qyGFOtibBTI3/TO80sh9l2Ll49a2pcbnv
  45001. T1gdpd50IJeh7WhM3pIXS7yr/2WanvtH2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcv
  45002. B2VSAKduyK9o7PQUlrZXH1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXse
  45003. zx76W0OLzc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyRp1RM
  45004. VwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQzW7i1o0TJrH93PB0j
  45005. 7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/SiOL9V8BY9KHcyi1Swr1+KuCLH5z
  45006. JTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJnLNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe
  45007. 8TZBAQIvfXOn3kLMTOmJDVb3n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVO
  45008. Hj1tyRRM4y5Bu8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj
  45009. o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAOBgNVHQ8BAf8E
  45010. BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEATh65isagmD9uw2nAalxJ
  45011. UqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzx
  45012. j6ptBZNscsdW699QIyjlRRA96Gejrw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDt
  45013. dD+4E5UGUcjohybKpFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM
  45014. 5gf0vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjqOknkJjCb
  45015. 5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ/zo1PqVUSlJZS2Db7v54
  45016. EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ92zg/LFis6ELhDtjTO0wugumDLmsx2d1H
  45017. hk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGy
  45018. g77FGr8H6lnco4g175x2MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3
  45019. r5+qPeoott7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw=
  45020. -----END CERTIFICATE-----
  45021. Certum EC-384 CA
  45022. ================
  45023. -----BEGIN CERTIFICATE-----
  45024. MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQswCQYDVQQGEwJQ
  45025. TDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
  45026. dGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2
  45027. MDcyNDU0WhcNNDMwMzI2MDcyNDU0WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERh
  45028. dGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx
  45029. GTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATEKI6rGFtq
  45030. vm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7TmFy8as10CW4kjPMIRBSqn
  45031. iBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68KjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  45032. VR0OBBYEFI0GZnQkdjrzife81r1HfS+8EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNo
  45033. ADBlAjADVS2m5hjEfO/JUG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0
  45034. QoSZ/6vnnvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k=
  45035. -----END CERTIFICATE-----
  45036. Certum Trusted Root CA
  45037. ======================
  45038. -----BEGIN CERTIFICATE-----
  45039. MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQG
  45040. EwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0g
  45041. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0Ew
  45042. HhcNMTgwMzE2MTIxMDEzWhcNNDMwMzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMY
  45043. QXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBB
  45044. dXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEB
  45045. AQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZn0EGze2jusDbCSzBfN8p
  45046. fktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/qp1x4EaTByIVcJdPTsuclzxFUl6s1wB52
  45047. HO8AU5853BSlLCIls3Jy/I2z5T4IHhQqNwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2
  45048. fJmItdUDmj0VDT06qKhF8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGt
  45049. g/BKEiJ3HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGamqi4
  45050. NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi7VdNIuJGmj8PkTQk
  45051. fVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSFytKAQd8FqKPVhJBPC/PgP5sZ0jeJ
  45052. P/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0PqafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSY
  45053. njYJdmZm/Bo/6khUHL4wvYBQv3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHK
  45054. HRzQ+8S1h9E6Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1
  45055. vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIBAEii1QAL
  45056. LtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4WxmB82M+w85bj/UvXgF2Ez8s
  45057. ALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvozMrnadyHncI013nR03e4qllY/p0m+jiGPp2K
  45058. h2RX5Rc64vmNueMzeMGQ2Ljdt4NR5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8
  45059. CYyqOhNf6DR5UMEQGfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA
  45060. 4kZf5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq0Uc9Nneo
  45061. WWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7DP78v3DSk+yshzWePS/Tj
  45062. 6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTMqJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmT
  45063. OPQD8rv7gmsHINFSH5pkAnuYZttcTVoP0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZck
  45064. bxJF0WddCajJFdr60qZfE2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
  45065. -----END CERTIFICATE-----
  45066. TunTrust Root CA
  45067. ================
  45068. -----BEGIN CERTIFICATE-----
  45069. MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQELBQAwYTELMAkG
  45070. A1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUgQ2VydGlmaWNhdGlvbiBFbGVj
  45071. dHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJvb3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQw
  45072. NDI2MDg1NzU2WjBhMQswCQYDVQQGEwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBD
  45073. ZXJ0aWZpY2F0aW9uIEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIw
  45074. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZn56eY+hz
  45075. 2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd2JQDoOw05TDENX37Jk0b
  45076. bjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgFVwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7
  45077. NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZGoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAd
  45078. gjH8KcwAWJeRTIAAHDOFli/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViW
  45079. VSHbhlnUr8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2eY8f
  45080. Tpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIbMlEsPvLfe/ZdeikZ
  45081. juXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISgjwBUFfyRbVinljvrS5YnzWuioYas
  45082. DXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwS
  45083. VXAkPcvCFDVDXSdOvsC9qnyW5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI
  45084. 04Y+oXNZtPdEITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0
  45085. 90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+zxiD2BkewhpMl
  45086. 0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYuQEkHDVneixCwSQXi/5E/S7fd
  45087. Ao74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRY
  45088. YdZ2vyJ/0Adqp2RT8JeNnYA/u8EH22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJp
  45089. adbGNjHh/PqAulxPxOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65x
  45090. xBzndFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5Xc0yGYuP
  45091. jCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7bnV2UqL1g52KAdoGDDIzM
  45092. MEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQCvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9z
  45093. ZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZHu/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3r
  45094. AZ3r2OvEhJn7wAzMMujjd9qDRIueVSjAi1jTkD5OGwDxFa2DK5o=
  45095. -----END CERTIFICATE-----
  45096. HARICA TLS RSA Root CA 2021
  45097. ===========================
  45098. -----BEGIN CERTIFICATE-----
  45099. MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBsMQswCQYDVQQG
  45100. EwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  45101. cyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0EgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUz
  45102. OFoXDTQ1MDIxMzEwNTUzN1owbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRl
  45103. bWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNB
  45104. IFJvb3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569lmwVnlskN
  45105. JLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE4VGC/6zStGndLuwRo0Xu
  45106. a2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uva9of08WRiFukiZLRgeaMOVig1mlDqa2Y
  45107. Ulhu2wr7a89o+uOkXjpFc5gH6l8Cct4MpbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K
  45108. 5FrZx40d/JiZ+yykgmvwKh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEv
  45109. dmn8kN3bLW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcYAuUR
  45110. 0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqBAGMUuTNe3QvboEUH
  45111. GjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYqE613TBoYm5EPWNgGVMWX+Ko/IIqm
  45112. haZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHrW2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQ
  45113. CPxrvrNQKlr9qEgYRtaQQJKQCoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8G
  45114. A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE
  45115. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAUX15QvWiWkKQU
  45116. EapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3f5Z2EMVGpdAgS1D0NTsY9FVq
  45117. QRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxajaH6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxD
  45118. QpSbIPDRzbLrLFPCU3hKTwSUQZqPJzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcR
  45119. j88YxeMn/ibvBZ3PzzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5
  45120. vZStjBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0/L5H9MG0
  45121. qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pTBGIBnfHAT+7hOtSLIBD6
  45122. Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79aPib8qXPMThcFarmlwDB31qlpzmq6YR/
  45123. PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YWxw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnn
  45124. kf3/W9b3raYvAwtt41dU63ZTGI0RmLo=
  45125. -----END CERTIFICATE-----
  45126. HARICA TLS ECC Root CA 2021
  45127. ===========================
  45128. -----BEGIN CERTIFICATE-----
  45129. MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQswCQYDVQQGEwJH
  45130. UjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBD
  45131. QTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoX
  45132. DTQ1MDIxMzExMDEwOVowbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWlj
  45133. IGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJv
  45134. b3QgQ0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7KKrxcm1l
  45135. AEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9YSTHMmE5gEYd103KUkE+b
  45136. ECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW
  45137. 0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAi
  45138. rcJRQO9gcS3ujwLEXQNwSaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/Qw
  45139. CZ61IygNnxS2PFOiTAZpffpskcYqSUXm7LcT4Tps
  45140. -----END CERTIFICATE-----
  45141. Autoridad de Certificacion Firmaprofesional CIF A62634068
  45142. =========================================================
  45143. -----BEGIN CERTIFICATE-----
  45144. MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCRVMxQjBA
  45145. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  45146. MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIw
  45147. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  45148. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  45149. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  45150. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  45151. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  45152. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  45153. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  45154. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  45155. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  45156. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  45157. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1Ud
  45158. DgQWBBRlzeurNR4APn7VdMActHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4w
  45159. gZswgZgGBFUdIAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j
  45160. b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABCAG8AbgBhAG4A
  45161. bwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAwADEANzAOBgNVHQ8BAf8EBAMC
  45162. AQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9miWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL
  45163. 4QjbEwj4KKE1soCzC1HA01aajTNFSa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDb
  45164. LIpgD7dvlAceHabJhfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1il
  45165. I45PVf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZEEAEeiGaP
  45166. cjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV1aUsIC+nmCjuRfzxuIgA
  45167. LI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2tCsvMo2ebKHTEm9caPARYpoKdrcd7b/+A
  45168. lun4jWq9GJAd/0kakFI3ky88Al2CdgtR5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH
  45169. 9IBk9W6VULgRfhVwOEqwf9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpf
  45170. NIbnYrX9ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNKGbqE
  45171. ZycPvEJdvSRUDewdcAZfpLz6IHxV
  45172. -----END CERTIFICATE-----
  45173. vTrus ECC Root CA
  45174. =================
  45175. -----BEGIN CERTIFICATE-----
  45176. MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMwRzELMAkGA1UE
  45177. BhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBS
  45178. b290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDczMTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAa
  45179. BgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYw
  45180. EAYHKoZIzj0CAQYFK4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+c
  45181. ToL0v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUde4BdS49n
  45182. TPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYDVR0TAQH/BAUwAwEB/zAO
  45183. BgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIwV53dVvHH4+m4SVBrm2nDb+zDfSXkV5UT
  45184. QJtS0zvzQBm8JsctBp61ezaf9SXUY2sAAjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQL
  45185. YgmRWAD5Tfs0aNoJrSEGGJTO
  45186. -----END CERTIFICATE-----
  45187. vTrus Root CA
  45188. =============
  45189. -----BEGIN CERTIFICATE-----
  45190. MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQELBQAwQzELMAkG
  45191. A1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xFjAUBgNVBAMTDXZUcnVzIFJv
  45192. b3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMxMDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoG
  45193. A1UEChMTaVRydXNDaGluYSBDby4sTHRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJ
  45194. KoZIhvcNAQEBBQADggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZots
  45195. SKYcIrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykUAyyNJJrI
  45196. ZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+GrPSbcKvdmaVayqwlHeF
  45197. XgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z98Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KA
  45198. YPxMvDVTAWqXcoKv8R1w6Jz1717CbMdHflqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70
  45199. kLJrxLT5ZOrpGgrIDajtJ8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2
  45200. AXPKBlim0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZNpGvu
  45201. /9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQUqqzApVg+QxMaPnu
  45202. 1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHWOXSuTEGC2/KmSNGzm/MzqvOmwMVO
  45203. 9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMBAAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYg
  45204. scasGrz2iTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOC
  45205. AgEAKbqSSaet8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd
  45206. nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1jbhd47F18iMjr
  45207. jld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvMKar5CKXiNxTKsbhm7xqC5PD4
  45208. 8acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIivTDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJn
  45209. xDHO2zTlJQNgJXtxmOTAGytfdELSS8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554Wg
  45210. icEFOwE30z9J4nfrI8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4
  45211. sEb9b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNBUvupLnKW
  45212. nyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1PTi07NEPhmg4NpGaXutIc
  45213. SkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929vensBxXVsFy6K2ir40zSbofitzmdHxghm+H
  45214. l3s=
  45215. -----END CERTIFICATE-----
  45216. ISRG Root X2
  45217. ============
  45218. -----BEGIN CERTIFICATE-----
  45219. MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQswCQYDVQQGEwJV
  45220. UzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElT
  45221. UkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVT
  45222. MSkwJwYDVQQKEyBJbnRlcm5ldCBTZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNS
  45223. RyBSb290IFgyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0H
  45224. ttwW+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9ItgKbppb
  45225. d9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
  45226. HQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZIzj0EAwMDaAAwZQIwe3lORlCEwkSHRhtF
  45227. cP9Ymd70/aTSVaYgLXTWNLxBo1BfASdWtL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5
  45228. U6VR5CmD1/iQMVtCnwr1/q4AaOeMSQ+2b1tbFfLn
  45229. -----END CERTIFICATE-----
  45230. HiPKI Root CA - G1
  45231. ==================
  45232. -----BEGIN CERTIFICATE-----
  45233. MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBPMQswCQYDVQQG
  45234. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xGzAZBgNVBAMMEkhpUEtJ
  45235. IFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRaFw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYT
  45236. AlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kg
  45237. Um9vdCBDQSAtIEcxMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0
  45238. o9QwqNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twvVcg3Px+k
  45239. wJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6lZgRZq2XNdZ1AYDgr/SE
  45240. YYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnzQs7ZngyzsHeXZJzA9KMuH5UHsBffMNsA
  45241. GJZMoYFL3QRtU6M9/Aes1MU3guvklQgZKILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfd
  45242. hSi8MEyr48KxRURHH+CKFgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj
  45243. 1jOXTyFjHluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDry+K4
  45244. 9a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ/W3c1pzAtH2lsN0/
  45245. Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgMa/aOEmem8rJY5AIJEzypuxC00jBF
  45246. 8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYD
  45247. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQD
  45248. AgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi
  45249. 7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqcSE5XCV0vrPSl
  45250. tJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6FzaZsT0pPBWGTMpWmWSBUdGSquE
  45251. wx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9TcXzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07Q
  45252. JNBAsNB1CI69aO4I1258EHBGG3zgiLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv
  45253. 5wiZqAxeJoBF1PhoL5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+Gpz
  45254. jLrFNe85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wrkkVbbiVg
  45255. hUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+vhV4nYWBSipX3tUZQ9rb
  45256. yltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQUYDksswBVLuT1sw5XxJFBAJw/6KXf6vb/
  45257. yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
  45258. -----END CERTIFICATE-----
  45259. GlobalSign ECC Root CA - R4
  45260. ===========================
  45261. -----BEGIN CERTIFICATE-----
  45262. MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYDVQQLExtHbG9i
  45263. YWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  45264. b2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgwMTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9i
  45265. YWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  45266. b2JhbFNpZ24wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkW
  45267. ymOxuYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNVHQ8BAf8E
  45268. BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/+wpu+74zyTyjhNUwCgYI
  45269. KoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147bmF0774BxL4YSFlhgjICICadVGNA3jdg
  45270. UM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm
  45271. -----END CERTIFICATE-----
  45272. GTS Root R1
  45273. ===========
  45274. -----BEGIN CERTIFICATE-----
  45275. MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQGEwJV
  45276. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  45277. UjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  45278. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0G
  45279. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaM
  45280. f/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7raKb0
  45281. xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnWr4+w
  45282. B7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqMLnXW
  45283. nOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk
  45284. 9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zq
  45285. kUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92wO1A
  45286. K/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om3xPX
  45287. V2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNuJLDW
  45288. cfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0T
  45289. AQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQAD
  45290. ggIBAJ+qQibbC5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe
  45291. QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuyh6f88/qBVRRi
  45292. ClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM47HLwEXWdyzRSjeZ2axfG34ar
  45293. J45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8JZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYci
  45294. NuaCp+0KueIHoI17eko8cdLiA6EfMgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5me
  45295. LMFrUKTX5hgUvYU/Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJF
  45296. fbdT6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ0E6yove+
  45297. 7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm2tIMPNuzjsmhDYAPexZ3
  45298. FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bbbP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3
  45299. gm3c
  45300. -----END CERTIFICATE-----
  45301. GTS Root R2
  45302. ===========
  45303. -----BEGIN CERTIFICATE-----
  45304. MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQGEwJV
  45305. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  45306. UjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  45307. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0G
  45308. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv
  45309. CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo7JUl
  45310. e3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWIm8Wb
  45311. a96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS
  45312. +LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7M
  45313. kogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJG
  45314. r61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RWIr9q
  45315. S34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73VululycslaVNV
  45316. J1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy5okL
  45317. dWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0T
  45318. AQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQAD
  45319. ggIBAB/Kzt3HvqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8
  45320. 0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyCB19m3H0Q/gxh
  45321. swWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2uNmSRXbBoGOqKYcl3qJfEycel
  45322. /FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMgyALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVn
  45323. jWQye+mew4K6Ki3pHrTgSAai/GevHyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y5
  45324. 9PYjJbigapordwj6xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M
  45325. 7YNRTOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924SgJPFI/2R8
  45326. 0L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV7LXTWtiBmelDGDfrs7vR
  45327. WGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjW
  45328. HYbL
  45329. -----END CERTIFICATE-----
  45330. GTS Root R3
  45331. ===========
  45332. -----BEGIN CERTIFICATE-----
  45333. MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJVUzEi
  45334. MCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMw
  45335. HhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZ
  45336. R29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjO
  45337. PQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout
  45338. 736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24CejQjBA
  45339. MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP0/Eq
  45340. Er24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azT
  45341. L818+FsuVbu/3ZL3pAzcMeGiAjEA/JdmZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV
  45342. 11RZt+cRLInUue4X
  45343. -----END CERTIFICATE-----
  45344. GTS Root R4
  45345. ===========
  45346. -----BEGIN CERTIFICATE-----
  45347. MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJVUzEi
  45348. MCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQw
  45349. HhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZ
  45350. R29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjO
  45351. PQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzu
  45352. hXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqjQjBA
  45353. MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV2Py1
  45354. PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/C
  45355. r8deVl5c1RxYIigL9zC2L7F8AjEA8GE8p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh
  45356. 4rsUecrNIdSUtUlD
  45357. -----END CERTIFICATE-----
  45358. Telia Root CA v2
  45359. ================
  45360. -----BEGIN CERTIFICATE-----
  45361. MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQxCzAJBgNVBAYT
  45362. AkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2
  45363. MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQK
  45364. DBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZI
  45365. hvcNAQEBBQADggIPADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ7
  45366. 6zBqAMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9vVYiQJ3q
  45367. 9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9lRdU2HhE8Qx3FZLgmEKn
  45368. pNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTODn3WhUidhOPFZPY5Q4L15POdslv5e2QJl
  45369. tI5c0BE0312/UqeBAMN/mUWZFdUXyApT7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW
  45370. 5olWK8jjfN7j/4nlNW4o6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNr
  45371. RBH0pUPCTEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6WT0E
  45372. BXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63RDolUK5X6wK0dmBR4
  45373. M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZIpEYslOqodmJHixBTB0hXbOKSTbau
  45374. BcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGjYzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7W
  45375. xy+G2CQ5MB0GA1UdDgQWBBRyrOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYD
  45376. VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ
  45377. 8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi0f6X+J8wfBj5
  45378. tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMMA8iZGok1GTzTyVR8qPAs5m4H
  45379. eW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBSSRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+C
  45380. y748fdHif64W1lZYudogsYMVoe+KTTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygC
  45381. QMez2P2ccGrGKMOF6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15
  45382. h2Er3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMtTy3EHD70
  45383. sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pTVmBds9hCG1xLEooc6+t9
  45384. xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAWysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQ
  45385. raVplI/owd8k+BsHMYeB2F326CjYSlKArBPuUBQemMc=
  45386. -----END CERTIFICATE-----
  45387. D-TRUST BR Root CA 1 2020
  45388. =========================
  45389. -----BEGIN CERTIFICATE-----
  45390. MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQswCQYDVQQGEwJE
  45391. RTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRSVVNUIEJSIFJvb3QgQ0EgMSAy
  45392. MDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNV
  45393. BAoTDEQtVHJ1c3QgR21iSDEiMCAGA1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAG
  45394. ByqGSM49AgEGBSuBBAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7
  45395. dPYSzuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0QVK5buXu
  45396. QqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/VbNafAkl1bK6CKBrqx9t
  45397. MA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6gPKA6hjhodHRwOi8vY3JsLmQtdHJ1c3Qu
  45398. bmV0L2NybC9kLXRydXN0X2JyX3Jvb3RfY2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVj
  45399. dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxP
  45400. PUQtVHJ1c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjOPQQD
  45401. AwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFWwKrY7RjEsK70Pvom
  45402. AjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHVdWNbFJWcHwHP2NVypw87
  45403. -----END CERTIFICATE-----
  45404. D-TRUST EV Root CA 1 2020
  45405. =========================
  45406. -----BEGIN CERTIFICATE-----
  45407. MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQswCQYDVQQGEwJE
  45408. RTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRSVVNUIEVWIFJvb3QgQ0EgMSAy
  45409. MDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNV
  45410. BAoTDEQtVHJ1c3QgR21iSDEiMCAGA1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAG
  45411. ByqGSM49AgEGBSuBBAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8
  45412. ZRCC/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rDwpdhQntJ
  45413. raOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3OqQo5FD4pPfsazK2/umL
  45414. MA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6gPKA6hjhodHRwOi8vY3JsLmQtdHJ1c3Qu
  45415. bmV0L2NybC9kLXRydXN0X2V2X3Jvb3RfY2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVj
  45416. dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxP
  45417. PUQtVHJ1c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjOPQQD
  45418. AwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CAy/m0sRtW9XLS/BnR
  45419. AjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJbgfM0agPnIjhQW+0ZT0MW
  45420. -----END CERTIFICATE-----
  45421. DigiCert TLS ECC P384 Root G5
  45422. =============================
  45423. -----BEGIN CERTIFICATE-----
  45424. MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQswCQYDVQQGEwJV
  45425. UzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURpZ2lDZXJ0IFRMUyBFQ0MgUDM4
  45426. NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMx
  45427. FzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQg
  45428. Um9vdCBHNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1Tzvd
  45429. lHJS7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp0zVozptj
  45430. n4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICISB4CIfBFqMA4GA1UdDwEB
  45431. /wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQCJao1H5+z8blUD2Wds
  45432. Jk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQLgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIx
  45433. AJSdYsiJvRmEFOml+wG4DXZDjC5Ty3zfDBeWUA==
  45434. -----END CERTIFICATE-----
  45435. DigiCert TLS RSA4096 Root G5
  45436. ============================
  45437. -----BEGIN CERTIFICATE-----
  45438. MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBNMQswCQYDVQQG
  45439. EwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0
  45440. MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcNNDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJV
  45441. UzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2
  45442. IFJvb3QgRzUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS8
  45443. 7IE+ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG02C+JFvuU
  45444. AT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgpwgscONyfMXdcvyej/Ces
  45445. tyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZMpG2T6T867jp8nVid9E6P/DsjyG244gXa
  45446. zOvswzH016cpVIDPRFtMbzCe88zdH5RDnU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnV
  45447. DdXifBBiqmvwPXbzP6PosMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9q
  45448. TXeXAaDxZre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cdLvvy
  45449. z6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvXKyY//SovcfXWJL5/
  45450. MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNeXoVPzthwiHvOAbWWl9fNff2C+MIk
  45451. wcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPLtgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4E
  45452. FgQUUTMc7TZArxfTJc1paPKvTiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8w
  45453. DQYJKoZIhvcNAQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw
  45454. GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7HPNtQOa27PShN
  45455. lnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLFO4uJ+DQtpBflF+aZfTCIITfN
  45456. MBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQREtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/
  45457. u4cnYiWB39yhL/btp/96j1EuMPikAdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9G
  45458. OUrYU9DzLjtxpdRv/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh
  45459. 47a+p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilwMUc/dNAU
  45460. FvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WFqUITVuwhd4GTWgzqltlJ
  45461. yqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCKovfepEWFJqgejF0pW8hL2JpqA15w8oVP
  45462. bEtoL8pU9ozaMv7Da4M/OMZ+
  45463. -----END CERTIFICATE-----
  45464. Certainly Root R1
  45465. =================
  45466. -----BEGIN CERTIFICATE-----
  45467. MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAwPTELMAkGA1UE
  45468. BhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2VydGFpbmx5IFJvb3QgUjEwHhcN
  45469. MjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2Vy
  45470. dGFpbmx5MRowGAYDVQQDExFDZXJ0YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  45471. ADCCAgoCggIBANA21B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O
  45472. 5MQTvqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbedaFySpvXl
  45473. 8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b01C7jcvk2xusVtyWMOvwl
  45474. DbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGI
  45475. XsXwClTNSaa/ApzSRKft43jvRl5tcdF5cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkN
  45476. KPl6I7ENPT2a/Z2B7yyQwHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQ
  45477. AjeZjOVJ6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA2Cnb
  45478. rlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyHWyf5QBGenDPBt+U1
  45479. VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMReiFPCyEQtkA6qyI6BJyLm4SGcprS
  45480. p6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud
  45481. DgQWBBTgqj8ljZ9EXME66C6ud0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAsz
  45482. HQNTVfSVcOQrPbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d
  45483. 8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi1wrykXprOQ4v
  45484. MMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrdrRT90+7iIgXr0PK3aBLXWopB
  45485. GsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9ditaY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+
  45486. gjwN/KUD+nsa2UUeYNrEjvn8K8l7lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgH
  45487. JBu6haEaBQmAupVjyTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7
  45488. fpYnKx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLyyCwzk5Iw
  45489. x06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5nwXARPbv0+Em34yaXOp/S
  45490. X3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6OV+KmalBWQewLK8=
  45491. -----END CERTIFICATE-----
  45492. Certainly Root E1
  45493. =================
  45494. -----BEGIN CERTIFICATE-----
  45495. MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQswCQYDVQQGEwJV
  45496. UzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlubHkgUm9vdCBFMTAeFw0yMTA0
  45497. MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJBgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlu
  45498. bHkxGjAYBgNVBAMTEUNlcnRhaW5seSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4
  45499. fxzf7flHh4axpMCK+IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9
  45500. YBk2QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8EBAMCAQYw
  45501. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4hevIIgcwCgYIKoZIzj0E
  45502. AwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozmut6Dacpps6kFtZaSF4fC0urQe87YQVt8
  45503. rgIwRt7qy12a7DLCZRawTDBcMPPaTnOGBtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
  45504. -----END CERTIFICATE-----
  45505. Security Communication RootCA3
  45506. ==============================
  45507. -----BEGIN CERTIFICATE-----
  45508. MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNVBAYTAkpQMSUw
  45509. IwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScwJQYDVQQDEx5TZWN1cml0eSBD
  45510. b21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQsw
  45511. CQYDVQQGEwJKUDElMCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UE
  45512. AxMeU2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  45513. MIICCgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4rCmDvu20r
  45514. hvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzAlrenfna84xtSGc4RHwsE
  45515. NPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MGTfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2
  45516. /D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF79+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGm
  45517. npjKIG58u4iFW/vAEGK78vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtY
  45518. XLVqAvO4g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3weGVPK
  45519. p7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst+3A7caoreyYn8xrC
  45520. 3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M0V9hvqG8OmpI6iZVIhZdXw3/JzOf
  45521. GAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQT9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0Vcw
  45522. CBEF/VfR2ccCAwEAAaNCMEAwHQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB
  45523. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS
  45524. YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PAFNr0Y/Dq9HHu
  45525. Tofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd9XbXv8S2gVj/yP9kaWJ5rW4O
  45526. H3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQIUYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASx
  45527. YfQAW0q3nHE3GYV5v4GwxxMOdnE+OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZ
  45528. XSEIx2C/pHF7uNkegr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml
  45529. +LLfiAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUVnuiZIesn
  45530. KwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD2NCcnWXL0CsnMQMeNuE9
  45531. dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI//1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm
  45532. 6Vwdp6POXiUyK+OVrCoHzrQoeIY8LaadTdJ0MN1kURXbg4NR16/9M51NZg==
  45533. -----END CERTIFICATE-----
  45534. Security Communication ECC RootCA1
  45535. ==================================
  45536. -----BEGIN CERTIFICATE-----
  45537. MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYTAkpQMSUwIwYD
  45538. VQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYDVQQDEyJTZWN1cml0eSBDb21t
  45539. dW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYxNjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTEL
  45540. MAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNV
  45541. BAMTIlNlY3VyaXR5IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQA
  45542. IgNiAASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+CnnfdldB9sELLo
  45543. 5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpKULGjQjBAMB0GA1UdDgQW
  45544. BBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAK
  45545. BggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3L
  45546. snNdo4gIxwwCMQDAqy0Obe0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70e
  45547. N9k=
  45548. -----END CERTIFICATE-----
  45549. BJCA Global Root CA1
  45550. ====================
  45551. -----BEGIN CERTIFICATE-----
  45552. MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBUMQswCQYDVQQG
  45553. EwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJVFkxHTAbBgNVBAMMFEJK
  45554. Q0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAzMTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkG
  45555. A1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQD
  45556. DBRCSkNBIEdsb2JhbCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFm
  45557. CL3ZxRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZspDyRhyS
  45558. sTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O558dnJCNPYwpj9mZ9S1Wn
  45559. P3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgRat7GGPZHOiJBhyL8xIkoVNiMpTAK+BcW
  45560. yqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRj
  45561. eulumijWML3mG90Vr4TqnMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNn
  45562. MoH1V6XKV0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/pj+b
  45563. OT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZOz2nxbkRs1CTqjSSh
  45564. GL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXnjSXWgXSHRtQpdaJCbPdzied9v3pK
  45565. H9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMB
  45566. AAGjQjBAMB0GA1UdDgQWBBTF7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4G
  45567. A1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4
  45568. YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3KliawLwQ8hOnThJ
  45569. dMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u+2D2/VnGKhs/I0qUJDAnyIm8
  45570. 60Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuh
  45571. TaRjAv04l5U/BXCga99igUOLtFkNSoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW
  45572. 4AB+dAb/OMRyHdOoP2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmp
  45573. GQrI+pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRzznfSxqxx
  45574. 4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9eVzYH6Eze9mCUAyTF6ps
  45575. 3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4S
  45576. SPfSKcOYKMryMguTjClPPGAyzQWWYezyr/6zcCwupvI=
  45577. -----END CERTIFICATE-----
  45578. BJCA Global Root CA2
  45579. ====================
  45580. -----BEGIN CERTIFICATE-----
  45581. MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQswCQYDVQQGEwJD
  45582. TjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJVFkxHTAbBgNVBAMMFEJKQ0Eg
  45583. R2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgyMVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UE
  45584. BhMCQ04xJjAkBgNVBAoMHUJFSUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRC
  45585. SkNBIEdsb2JhbCBSb290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jl
  45586. SR9BIgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK++kpRuDCK
  45587. /eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJKsVF/BvDRgh9Obl+rg/xI
  45588. 1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8
  45589. W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8g
  45590. UXOQwKhbYdDFUDn9hf7B43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w==
  45591. -----END CERTIFICATE-----
  45592. Sectigo Public Server Authentication Root E46
  45593. =============================================
  45594. -----BEGIN CERTIFICATE-----
  45595. MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQswCQYDVQQGEwJH
  45596. QjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBTZXJ2
  45597. ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5
  45598. WjBfMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0
  45599. aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUr
  45600. gQQAIgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccCWvkEN/U0
  45601. NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+6xnOQ6OjQjBAMB0GA1Ud
  45602. DgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  45603. /zAKBggqhkjOPQQDAwNnADBkAjAn7qRaqCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RH
  45604. lAFWovgzJQxC36oCMB3q4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21U
  45605. SAGKcw==
  45606. -----END CERTIFICATE-----
  45607. Sectigo Public Server Authentication Root R46
  45608. =============================================
  45609. -----BEGIN CERTIFICATE-----
  45610. MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBfMQswCQYDVQQG
  45611. EwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT
  45612. ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwHhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1
  45613. OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T
  45614. ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3
  45615. DQEBAQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDaef0rty2k
  45616. 1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnzSDBh+oF8HqcIStw+Kxwf
  45617. GExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xfiOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMP
  45618. FF1bFOdLvt30yNoDN9HWOaEhUTCDsG3XME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vu
  45619. ZDCQOc2TZYEhMbUjUDM3IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5Qaz
  45620. Yw6A3OASVYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgESJ/A
  45621. wSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu+Zd4KKTIRJLpfSYF
  45622. plhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt8uaZFURww3y8nDnAtOFr94MlI1fZ
  45623. EoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+LHaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW
  45624. 6aWWrL3DkJiy4Pmi1KZHQ3xtzwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWI
  45625. IUkwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c
  45626. mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQYKlJfp/imTYp
  45627. E0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52gDY9hAaLMyZlbcp+nv4fjFg4
  45628. exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZAFv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M
  45629. 0ejf5lG5Nkc/kLnHvALcWxxPDkjBJYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI
  45630. 84HxZmduTILA7rpXDhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9m
  45631. pFuiTdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5dHn5Hrwd
  45632. Vw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65LvKRRFHQV80MNNVIIb/b
  45633. E/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmm
  45634. J1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAYQqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL
  45635. -----END CERTIFICATE-----
  45636. SSL.com TLS RSA Root CA 2022
  45637. ============================
  45638. -----BEGIN CERTIFICATE-----
  45639. MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQG
  45640. EwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxTU0wuY29tIFRMUyBSU0Eg
  45641. Um9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloXDTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMC
  45642. VVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJv
  45643. b3QgQ0EgMjAyMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u
  45644. 9nTPL3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OYt6/wNr/y
  45645. 7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0insS657Lb85/bRi3pZ7Qcac
  45646. oOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3PnxEX4MN8/HdIGkWCVDi1FW24IBydm5M
  45647. R7d1VVm0U3TZlMZBrViKMWYPHqIbKUBOL9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDG
  45648. D6C1vBdOSHtRwvzpXGk3R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEW
  45649. TO6Af77wdr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS+YCk
  45650. 8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYSd66UNHsef8JmAOSq
  45651. g+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoGAtUjHBPW6dvbxrB6y3snm/vg1UYk
  45652. 7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2fgTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1Ud
  45653. EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsu
  45654. N+7jhHonLs0ZNbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt
  45655. hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsMQtfhWsSWTVTN
  45656. j8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvfR4iyrT7gJ4eLSYwfqUdYe5by
  45657. iB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJDPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjU
  45658. o3KUQyxi4U5cMj29TH0ZR6LDSeeWP4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqo
  45659. ENjwuSfr98t67wVylrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7Egkaib
  45660. MOlqbLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2wAgDHbICi
  45661. vRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3qr5nsLFR+jM4uElZI7xc7
  45662. P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sjiMho6/4UIyYOf8kpIEFR3N+2ivEC+5BB0
  45663. 9+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA=
  45664. -----END CERTIFICATE-----
  45665. SSL.com TLS ECC Root CA 2022
  45666. ============================
  45667. -----BEGIN CERTIFICATE-----
  45668. MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQswCQYDVQQGEwJV
  45669. UzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxTU0wuY29tIFRMUyBFQ0MgUm9v
  45670. dCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMx
  45671. GDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3Qg
  45672. Q0EgMjAyMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWy
  45673. JGYmacCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFNSeR7T5v1
  45674. 5wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSJjy+j6CugFFR7
  45675. 81a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NWuCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGG
  45676. MAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w
  45677. 7deedWo1dlJF4AIxAMeNb0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5
  45678. Zn6g6g==
  45679. -----END CERTIFICATE-----
  45680. Atos TrustedRoot Root CA ECC TLS 2021
  45681. =====================================
  45682. -----BEGIN CERTIFICATE-----
  45683. MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4wLAYDVQQDDCVB
  45684. dG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0wCwYDVQQKDARBdG9zMQswCQYD
  45685. VQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3Mg
  45686. VHJ1c3RlZFJvb3QgUm9vdCBDQSBFQ0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYT
  45687. AkRFMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6K
  45688. DP/XtXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4AjJn8ZQS
  45689. b+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2KCXWfeBmmnoJsmo7jjPX
  45690. NtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMDaAAwZQIwW5kp85wxtolrbNa9d+F851F+
  45691. uDrNozZffPc8dz7kUK2o59JZDCaOMDtuCCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGY
  45692. a3cpetskz2VAv9LcjBHo9H1/IISpQuQo
  45693. -----END CERTIFICATE-----
  45694. Atos TrustedRoot Root CA RSA TLS 2021
  45695. =====================================
  45696. -----BEGIN CERTIFICATE-----
  45697. MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBMMS4wLAYDVQQD
  45698. DCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIxMQ0wCwYDVQQKDARBdG9zMQsw
  45699. CQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0
  45700. b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNV
  45701. BAYTAkRFMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BB
  45702. l01Z4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYvYe+W/CBG
  45703. vevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZkmGbzSoXfduP9LVq6hdK
  45704. ZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDsGY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt
  45705. 0xU6kGpn8bRrZtkh68rZYnxGEFzedUlnnkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVK
  45706. PNe0OwANwI8f4UDErmwh3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMY
  45707. sluMWuPD0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzygeBY
  45708. Br3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8ANSbhqRAvNncTFd+
  45709. rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezBc6eUWsuSZIKmAMFwoW4sKeFYV+xa
  45710. fJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lIpw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/
  45711. BAUwAwEB/zAdBgNVHQ4EFgQUdEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0G
  45712. CSqGSIb3DQEBDAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS
  45713. 4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPso0UvFJ/1TCpl
  45714. Q3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJqM7F78PRreBrAwA0JrRUITWX
  45715. AdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuywxfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9G
  45716. slA9hGCZcbUztVdF5kJHdWoOsAgMrr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2Vkt
  45717. afcxBPTy+av5EzH4AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9q
  45718. TFsR0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuYo7Ey7Nmj
  45719. 1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5dDTedk+SKlOxJTnbPP/l
  45720. PqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcEoji2jbDwN/zIIX8/syQbPYtuzE2wFg2W
  45721. HYMfRsCbvUOZ58SWLs5fyQ==
  45722. -----END CERTIFICATE-----
  45723. TrustAsia Global Root CA G3
  45724. ===========================
  45725. -----BEGIN CERTIFICATE-----
  45726. MIIFpTCCA42gAwIBAgIUZPYOZXdhaqs7tOqFhLuxibhxkw8wDQYJKoZIhvcNAQEMBQAwWjELMAkG
  45727. A1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIEluYy4xJDAiBgNVBAMM
  45728. G1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHMzAeFw0yMTA1MjAwMjEwMTlaFw00NjA1MTkwMjEw
  45729. MTlaMFoxCzAJBgNVBAYTAkNOMSUwIwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMu
  45730. MSQwIgYDVQQDDBtUcnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzMwggIiMA0GCSqGSIb3DQEBAQUA
  45731. A4ICDwAwggIKAoICAQDAMYJhkuSUGwoqZdC+BqmHO1ES6nBBruL7dOoKjbmzTNyPtxNST1QY4Sxz
  45732. lZHFZjtqz6xjbYdT8PfxObegQ2OwxANdV6nnRM7EoYNl9lA+sX4WuDqKAtCWHwDNBSHvBm3dIZwZ
  45733. Q0WhxeiAysKtQGIXBsaqvPPW5vxQfmZCHzyLpnl5hkA1nyDvP+uLRx+PjsXUjrYsyUQE49RDdT/V
  45734. P68czH5GX6zfZBCK70bwkPAPLfSIC7Epqq+FqklYqL9joDiR5rPmd2jE+SoZhLsO4fWvieylL1Ag
  45735. dB4SQXMeJNnKziyhWTXAyB1GJ2Faj/lN03J5Zh6fFZAhLf3ti1ZwA0pJPn9pMRJpxx5cynoTi+jm
  45736. 9WAPzJMshH/x/Gr8m0ed262IPfN2dTPXS6TIi/n1Q1hPy8gDVI+lhXgEGvNz8teHHUGf59gXzhqc
  45737. D0r83ERoVGjiQTz+LISGNzzNPy+i2+f3VANfWdP3kXjHi3dqFuVJhZBFcnAvkV34PmVACxmZySYg
  45738. WmjBNb9Pp1Hx2BErW+Canig7CjoKH8GB5S7wprlppYiU5msTf9FkPz2ccEblooV7WIQn3MSAPmea
  45739. mseaMQ4w7OYXQJXZRe0Blqq/DPNL0WP3E1jAuPP6Z92bfW1K/zJMtSU7/xxnD4UiWQWRkUF3gdCF
  45740. TIcQcf+eQxuulXUtgQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEDk5PIj
  45741. 7zjKsK5Xf/IhMBY027ySMB0GA1UdDgQWBBRA5OTyI+84yrCuV3/yITAWNNu8kjAOBgNVHQ8BAf8E
  45742. BAMCAQYwDQYJKoZIhvcNAQEMBQADggIBACY7UeFNOPMyGLS0XuFlXsSUT9SnYaP4wM8zAQLpw6o1
  45743. D/GUE3d3NZ4tVlFEbuHGLige/9rsR82XRBf34EzC4Xx8MnpmyFq2XFNFV1pF1AWZLy4jVe5jaN/T
  45744. G3inEpQGAHUNcoTpLrxaatXeL1nHo+zSh2bbt1S1JKv0Q3jbSwTEb93mPmY+KfJLaHEih6D4sTNj
  45745. duMNhXJEIlU/HHzp/LgV6FL6qj6jITk1dImmasI5+njPtqzn59ZW/yOSLlALqbUHM/Q4X6RJpstl
  45746. cHboCoWASzY9M/eVVHUl2qzEc4Jl6VL1XP04lQJqaTDFHApXB64ipCz5xUG3uOyfT0gA+QEEVcys
  45747. +TIxxHWVBqB/0Y0n3bOppHKH/lmLmnp0Ft0WpWIp6zqW3IunaFnT63eROfjXy9mPX1onAX1daBli
  45748. 2MjN9LdyR75bl87yraKZk62Uy5P2EgmVtqvXO9A/EcswFi55gORngS1d7XB4tmBZrOFdRWOPyN9y
  45749. aFvqHbgB8X7754qz41SgOAngPN5C8sLtLpvzHzW2NtjjgKGLzZlkD8Kqq7HK9W+eQ42EVJmzbsAS
  45750. ZthwEPEGNTNDqJwuuhQxzhB/HIbjj9LV+Hfsm6vxL2PZQl/gZ4FkkfGXL/xuJvYz+NO1+MRiqzFR
  45751. JQJ6+N1rZdVtTTDIZbpoFGWsJwt0ivKH
  45752. -----END CERTIFICATE-----
  45753. TrustAsia Global Root CA G4
  45754. ===========================
  45755. -----BEGIN CERTIFICATE-----
  45756. MIICVTCCAdygAwIBAgIUTyNkuI6XY57GU4HBdk7LKnQV1tcwCgYIKoZIzj0EAwMwWjELMAkGA1UE
  45757. BhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIEluYy4xJDAiBgNVBAMMG1Ry
  45758. dXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHNDAeFw0yMTA1MjAwMjEwMjJaFw00NjA1MTkwMjEwMjJa
  45759. MFoxCzAJBgNVBAYTAkNOMSUwIwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQw
  45760. IgYDVQQDDBtUcnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
  45761. AATxs8045CVD5d4ZCbuBeaIVXxVjAd7Cq92zphtnS4CDr5nLrBfbK5bKfFJV4hrhPVbwLxYI+hW8
  45762. m7tH5j/uqOFMjPXTNvk4XatwmkcN4oFBButJ+bAp3TPsUKV/eSm4IJijYzBhMA8GA1UdEwEB/wQF
  45763. MAMBAf8wHwYDVR0jBBgwFoAUpbtKl86zK3+kMd6Xg1mDpm9xy94wHQYDVR0OBBYEFKW7SpfOsyt/
  45764. pDHel4NZg6ZvccveMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjBe8usGzEkxn0AA
  45765. bbd+NvBNEU/zy4k6LHiRUKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xk
  45766. dUfFVZDj/bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA==
  45767. -----END CERTIFICATE-----
  45768. CommScope Public Trust ECC Root-01
  45769. ==================================
  45770. -----BEGIN CERTIFICATE-----
  45771. MIICHTCCAaOgAwIBAgIUQ3CCd89NXTTxyq4yLzf39H91oJ4wCgYIKoZIzj0EAwMwTjELMAkGA1UE
  45772. BhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBUcnVz
  45773. dCBFQ0MgUm9vdC0wMTAeFw0yMTA0MjgxNzM1NDNaFw00NjA0MjgxNzM1NDJaME4xCzAJBgNVBAYT
  45774. AlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3Qg
  45775. RUNDIFJvb3QtMDEwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARLNumuV16ocNfQj3Rid8NeeqrltqLx
  45776. eP0CflfdkXmcbLlSiFS8LwS+uM32ENEp7LXQoMPwiXAZu1FlxUOcw5tjnSCDPgYLpkJEhRGnSjot
  45777. 6dZoL0hOUysHP029uax3OVejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  45778. A1UdDgQWBBSOB2LAUN3GGQYARnQE9/OufXVNMDAKBggqhkjOPQQDAwNoADBlAjEAnDPfQeMjqEI2
  45779. Jpc1XHvr20v4qotzVRVcrHgpD7oh2MSg2NED3W3ROT3Ek2DS43KyAjB8xX6I01D1HiXo+k515liW
  45780. pDVfG2XqYZpwI7UNo5uSUm9poIyNStDuiw7LR47QjRE=
  45781. -----END CERTIFICATE-----
  45782. CommScope Public Trust ECC Root-02
  45783. ==================================
  45784. -----BEGIN CERTIFICATE-----
  45785. MIICHDCCAaOgAwIBAgIUKP2ZYEFHpgE6yhR7H+/5aAiDXX0wCgYIKoZIzj0EAwMwTjELMAkGA1UE
  45786. BhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBUcnVz
  45787. dCBFQ0MgUm9vdC0wMjAeFw0yMTA0MjgxNzQ0NTRaFw00NjA0MjgxNzQ0NTNaME4xCzAJBgNVBAYT
  45788. AlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3Qg
  45789. RUNDIFJvb3QtMDIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR4MIHoYx7l63FRD/cHB8o5mXxO1Q/M
  45790. MDALj2aTPs+9xYa9+bG3tD60B8jzljHz7aRP+KNOjSkVWLjVb3/ubCK1sK9IRQq9qEmUv4RDsNuE
  45791. SgMjGWdqb8FuvAY5N9GIIvejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  45792. A1UdDgQWBBTmGHX/72DehKT1RsfeSlXjMjZ59TAKBggqhkjOPQQDAwNnADBkAjAmc0l6tqvmSfR9
  45793. Uj/UQQSugEODZXW5hYA4O9Zv5JOGq4/nich/m35rChJVYaoR4HkCMHfoMXGsPHED1oQmHhS48zs7
  45794. 3u1Z/GtMMH9ZzkXpc2AVmkzw5l4lIhVtwodZ0LKOag==
  45795. -----END CERTIFICATE-----
  45796. CommScope Public Trust RSA Root-01
  45797. ==================================
  45798. -----BEGIN CERTIFICATE-----
  45799. MIIFbDCCA1SgAwIBAgIUPgNJgXUWdDGOTKvVxZAplsU5EN0wDQYJKoZIhvcNAQELBQAwTjELMAkG
  45800. A1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBU
  45801. cnVzdCBSU0EgUm9vdC0wMTAeFw0yMTA0MjgxNjQ1NTRaFw00NjA0MjgxNjQ1NTNaME4xCzAJBgNV
  45802. BAYTAlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1
  45803. c3QgUlNBIFJvb3QtMDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwSGWjDR1C45Ft
  45804. nYSkYZYSwu3D2iM0GXb26v1VWvZVAVMP8syMl0+5UMuzAURWlv2bKOx7dAvnQmtVzslhsuitQDy6
  45805. uUEKBU8bJoWPQ7VAtYXR1HHcg0Hz9kXHgKKEUJdGzqAMxGBWBB0HW0alDrJLpA6lfO741GIDuZNq
  45806. ihS4cPgugkY4Iw50x2tBt9Apo52AsH53k2NC+zSDO3OjWiE260f6GBfZumbCk6SP/F2krfxQapWs
  45807. vCQz0b2If4b19bJzKo98rwjyGpg/qYFlP8GMicWWMJoKz/TUyDTtnS+8jTiGU+6Xn6myY5QXjQ/c
  45808. Zip8UlF1y5mO6D1cv547KI2DAg+pn3LiLCuz3GaXAEDQpFSOm117RTYm1nJD68/A6g3czhLmfTif
  45809. BSeolz7pUcZsBSjBAg/pGG3svZwG1KdJ9FQFa2ww8esD1eo9anbCyxooSU1/ZOD6K9pzg4H/kQO9
  45810. lLvkuI6cMmPNn7togbGEW682v3fuHX/3SZtS7NJ3Wn2RnU3COS3kuoL4b/JOHg9O5j9ZpSPcPYeo
  45811. KFgo0fEbNttPxP/hjFtyjMcmAyejOQoBqsCyMWCDIqFPEgkBEa801M/XrmLTBQe0MXXgDW1XT2mH
  45812. +VepuhX2yFJtocucH+X8eKg1mp9BFM6ltM6UCBwJrVbl2rZJmkrqYxhTnCwuwwIDAQABo0IwQDAP
  45813. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUN12mmnQywsL5x6YVEFm4
  45814. 5P3luG0wDQYJKoZIhvcNAQELBQADggIBAK+nz97/4L1CjU3lIpbfaOp9TSp90K09FlxD533Ahuh6
  45815. NWPxzIHIxgvoLlI1pKZJkGNRrDSsBTtXAOnTYtPZKdVUvhwQkZyybf5Z/Xn36lbQnmhUQo8mUuJM
  45816. 3y+Xpi/SB5io82BdS5pYV4jvguX6r2yBS5KPQJqTRlnLX3gWsWc+QgvfKNmwrZggvkN80V4aCRck
  45817. jXtdlemrwWCrWxhkgPut4AZ9HcpZuPN4KWfGVh2vtrV0KnahP/t1MJ+UXjulYPPLXAziDslg+Mkf
  45818. Foom3ecnf+slpoq9uC02EJqxWE2aaE9gVOX2RhOOiKy8IUISrcZKiX2bwdgt6ZYD9KJ0DLwAHb/W
  45819. NyVntHKLr4W96ioDj8z7PEQkguIBpQtZtjSNMgsSDesnwv1B10A8ckYpwIzqug/xBpMu95yo9GA+
  45820. o/E4Xo4TwbM6l4c/ksp4qRyv0LAbJh6+cOx69TOY6lz/KwsETkPdY34Op054A5U+1C0wlREQKC6/
  45821. oAI+/15Z0wUOlV9TRe9rh9VIzRamloPh37MG88EU26fsHItdkJANclHnYfkUyq+Dj7+vsQpZXdxc
  45822. 1+SWrVtgHdqul7I52Qb1dgAT+GhMIbA1xNxVssnBQVocicCMb3SgazNNtQEo/a2tiRc7ppqEvOuM
  45823. 6sRxJKi6KfkIsidWNTJf6jn7MZrVGczw
  45824. -----END CERTIFICATE-----
  45825. CommScope Public Trust RSA Root-02
  45826. ==================================
  45827. -----BEGIN CERTIFICATE-----
  45828. MIIFbDCCA1SgAwIBAgIUVBa/O345lXGN0aoApYYNK496BU4wDQYJKoZIhvcNAQELBQAwTjELMAkG
  45829. A1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBU
  45830. cnVzdCBSU0EgUm9vdC0wMjAeFw0yMTA0MjgxNzE2NDNaFw00NjA0MjgxNzE2NDJaME4xCzAJBgNV
  45831. BAYTAlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1
  45832. c3QgUlNBIFJvb3QtMDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDh+g77aAASyE3V
  45833. rCLENQE7xVTlWXZjpX/rwcRqmL0yjReA61260WI9JSMZNRTpf4mnG2I81lDnNJUDMrG0kyI9p+Kx
  45834. 7eZ7Ti6Hmw0zdQreqjXnfuU2mKKuJZ6VszKWpCtYHu8//mI0SFHRtI1CrWDaSWqVcN3SAOLMV2MC
  45835. e5bdSZdbkk6V0/nLKR8YSvgBKtJjCW4k6YnS5cciTNxzhkcAqg2Ijq6FfUrpuzNPDlJwnZXjfG2W
  45836. Wy09X6GDRl224yW4fKcZgBzqZUPckXk2LHR88mcGyYnJ27/aaL8j7dxrrSiDeS/sOKUNNwFnJ5rp
  45837. M9kzXzehxfCrPfp4sOcsn/Y+n2Dg70jpkEUeBVF4GiwSLFworA2iI540jwXmojPOEXcT1A6kHkIf
  45838. hs1w/tkuFT0du7jyU1fbzMZ0KZwYszZ1OC4PVKH4kh+Jlk+71O6d6Ts2QrUKOyrUZHk2EOH5kQMr
  45839. eyBUzQ0ZGshBMjTRsJnhkB4BQDa1t/qp5Xd1pCKBXbCL5CcSD1SIxtuFdOa3wNemKfrb3vOTlycE
  45840. VS8KbzfFPROvCgCpLIscgSjX74Yxqa7ybrjKaixUR9gqiC6vwQcQeKwRoi9C8DfF8rhW3Q5iLc4t
  45841. Vn5V8qdE9isy9COoR+jUKgF4z2rDN6ieZdIs5fq6M8EGRPbmz6UNp2YINIos8wIDAQABo0IwQDAP
  45842. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUR9DnsSL/nSz12Vdgs7Gx
  45843. cJXvYXowDQYJKoZIhvcNAQELBQADggIBAIZpsU0v6Z9PIpNojuQhmaPORVMbc0RTAIFhzTHjCLqB
  45844. KCh6krm2qMhDnscTJk3C2OVVnJJdUNjCK9v+5qiXz1I6JMNlZFxHMaNlNRPDk7n3+VGXu6TwYofF
  45845. 1gbTl4MgqX67tiHCpQ2EAOHyJxCDut0DgdXdaMNmEMjRdrSzbymeAPnCKfWxkxlSaRosTKCL4BWa
  45846. MS/TiJVZbuXEs1DIFAhKm4sTg7GkcrI7djNB3NyqpgdvHSQSn8h2vS/ZjvQs7rfSOBAkNlEv41xd
  45847. gSGn2rtO/+YHqP65DSdsu3BaVXoT6fEqSWnHX4dXTEN5bTpl6TBcQe7rd6VzEojov32u5cSoHw2O
  45848. HG1QAk8mGEPej1WFsQs3BWDJVTkSBKEqz3EWnzZRSb9wO55nnPt7eck5HHisd5FUmrh1CoFSl+Nm
  45849. YWvtPjgelmFV4ZFUjO2MJB+ByRCac5krFk5yAD9UG/iNuovnFNa2RU9g7Jauwy8CTl2dlklyALKr
  45850. dVwPaFsdZcJfMw8eD/A7hvWwTruc9+olBdytoptLFwG+Qt81IR2tq670v64fG9PiO/yzcnMcmyiQ
  45851. iRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17Org3bhzjlP1v9mxnhMUF6cKojawHhRUzN
  45852. lM47ni3niAIi9G7oyOzWPPO5std3eqx7
  45853. -----END CERTIFICATE-----
  45854. <?php
  45855. namespace Composer\CaBundle;
  45856. use Psr\Log\LoggerInterface;
  45857. use Symfony\Component\Process\PhpProcess;
  45858. class CaBundle
  45859. {
  45860. private static $caPath;
  45861. private static $caFileValidity = array();
  45862. private static $useOpensslParse;
  45863. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  45864. {
  45865. if (self::$caPath !== null) {
  45866. return self::$caPath;
  45867. }
  45868. $caBundlePaths = array();
  45869. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  45870. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  45871. $caBundlePaths[] = ini_get('openssl.cafile');
  45872. $caBundlePaths[] = ini_get('openssl.capath');
  45873. $otherLocations = array(
  45874. '/etc/pki/tls/certs/ca-bundle.crt',
  45875. '/etc/ssl/certs/ca-certificates.crt',
  45876. '/etc/ssl/ca-bundle.pem',
  45877. '/usr/local/share/certs/ca-root-nss.crt',
  45878. '/usr/ssl/certs/ca-bundle.crt',
  45879. '/opt/local/share/curl/curl-ca-bundle.crt',
  45880. '/usr/local/share/curl/curl-ca-bundle.crt',
  45881. '/usr/share/ssl/certs/ca-bundle.crt',
  45882. '/etc/ssl/cert.pem',
  45883. '/usr/local/etc/ssl/cert.pem',
  45884. '/usr/local/etc/openssl/cert.pem',
  45885. '/usr/local/etc/openssl@1.1/cert.pem',
  45886. );
  45887. foreach($otherLocations as $location) {
  45888. $otherLocations[] = dirname($location);
  45889. }
  45890. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  45891. foreach ($caBundlePaths as $caBundle) {
  45892. if ($caBundle && self::caFileUsable($caBundle, $logger)) {
  45893. return self::$caPath = $caBundle;
  45894. }
  45895. if ($caBundle && self::caDirUsable($caBundle, $logger)) {
  45896. return self::$caPath = $caBundle;
  45897. }
  45898. }
  45899. return self::$caPath = static::getBundledCaBundlePath();
  45900. }
  45901. public static function getBundledCaBundlePath()
  45902. {
  45903. $caBundleFile = __DIR__.'/../res/cacert.pem';
  45904. if (0 === strpos($caBundleFile, 'phar://')) {
  45905. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-');
  45906. if (false === $tempCaBundleFile) {
  45907. throw new \RuntimeException('Could not create a temporary file to store the bundled CA file');
  45908. }
  45909. file_put_contents(
  45910. $tempCaBundleFile,
  45911. file_get_contents($caBundleFile)
  45912. );
  45913. register_shutdown_function(function() use ($tempCaBundleFile) {
  45914. @unlink($tempCaBundleFile);
  45915. });
  45916. $caBundleFile = $tempCaBundleFile;
  45917. }
  45918. return $caBundleFile;
  45919. }
  45920. public static function validateCaFile($filename, LoggerInterface $logger = null)
  45921. {
  45922. static $warned = false;
  45923. if (isset(self::$caFileValidity[$filename])) {
  45924. return self::$caFileValidity[$filename];
  45925. }
  45926. $contents = file_get_contents($filename);
  45927. if (!static::isOpensslParseSafe()) {
  45928. if (!$warned && $logger) {
  45929. $logger->warning(sprintf(
  45930. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  45931. PHP_VERSION
  45932. ));
  45933. $warned = true;
  45934. }
  45935. $isValid = !empty($contents);
  45936. } elseif (is_string($contents) && strlen($contents) > 0) {
  45937. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  45938. if (null === $contents) {
  45939. $isValid = false;
  45940. } else {
  45941. $isValid = (bool) openssl_x509_parse($contents);
  45942. }
  45943. } else {
  45944. $isValid = false;
  45945. }
  45946. if ($logger) {
  45947. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  45948. }
  45949. return self::$caFileValidity[$filename] = $isValid;
  45950. }
  45951. public static function isOpensslParseSafe()
  45952. {
  45953. if (null !== self::$useOpensslParse) {
  45954. return self::$useOpensslParse;
  45955. }
  45956. if (PHP_VERSION_ID >= 50600) {
  45957. return self::$useOpensslParse = true;
  45958. }
  45959. if (
  45960. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  45961. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  45962. || PHP_VERSION_ID >= 50507
  45963. ) {
  45964. return self::$useOpensslParse = true;
  45965. }
  45966. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  45967. return self::$useOpensslParse = false;
  45968. }
  45969. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  45970. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  45971. if (preg_match($regex, PHP_VERSION, $m)) {
  45972. return ((int) $m[1]) >= $fixedVersion;
  45973. }
  45974. return false;
  45975. };
  45976. if (
  45977. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  45978. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  45979. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  45980. ) {
  45981. return self::$useOpensslParse = true;
  45982. }
  45983. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  45984. return self::$useOpensslParse = false;
  45985. }
  45986. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  45987. $script = <<<'EOT'
  45988. error_reporting(-1);
  45989. $info = openssl_x509_parse(base64_decode('%s'));
  45990. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  45991. EOT;
  45992. $script = '<'."?php\n".sprintf($script, $cert);
  45993. try {
  45994. $process = new PhpProcess($script);
  45995. $process->mustRun();
  45996. } catch (\Exception $e) {
  45997. return self::$useOpensslParse = false;
  45998. }
  45999. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  46000. $errorOutput = trim($process->getErrorOutput());
  46001. if (
  46002. is_array($output)
  46003. && count($output) === 3
  46004. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  46005. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  46006. && $output[2] === 'int(-1)'
  46007. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  46008. ) {
  46009. return self::$useOpensslParse = true;
  46010. }
  46011. return self::$useOpensslParse = false;
  46012. }
  46013. public static function reset()
  46014. {
  46015. self::$caFileValidity = array();
  46016. self::$caPath = null;
  46017. self::$useOpensslParse = null;
  46018. }
  46019. private static function getEnvVariable($name)
  46020. {
  46021. if (isset($_SERVER[$name])) {
  46022. return (string) $_SERVER[$name];
  46023. }
  46024. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  46025. return (string) $value;
  46026. }
  46027. return false;
  46028. }
  46029. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  46030. {
  46031. return $certFile
  46032. && static::isFile($certFile, $logger)
  46033. && static::isReadable($certFile, $logger)
  46034. && static::validateCaFile($certFile, $logger);
  46035. }
  46036. private static function caDirUsable($certDir, LoggerInterface $logger = null)
  46037. {
  46038. return $certDir
  46039. && static::isDir($certDir, $logger)
  46040. && static::isReadable($certDir, $logger)
  46041. && static::glob($certDir . '/*', $logger);
  46042. }
  46043. private static function isFile($certFile, LoggerInterface $logger = null)
  46044. {
  46045. $isFile = @is_file($certFile);
  46046. if (!$isFile && $logger) {
  46047. $logger->debug(sprintf('Checked CA file %s does not exist or it is not a file.', $certFile));
  46048. }
  46049. return $isFile;
  46050. }
  46051. private static function isDir($certDir, LoggerInterface $logger = null)
  46052. {
  46053. $isDir = @is_dir($certDir);
  46054. if (!$isDir && $logger) {
  46055. $logger->debug(sprintf('Checked directory %s does not exist or it is not a directory.', $certDir));
  46056. }
  46057. return $isDir;
  46058. }
  46059. private static function isReadable($certFileOrDir, LoggerInterface $logger = null)
  46060. {
  46061. $isReadable = @is_readable($certFileOrDir);
  46062. if (!$isReadable && $logger) {
  46063. $logger->debug(sprintf('Checked file or directory %s is not readable.', $certFileOrDir));
  46064. }
  46065. return $isReadable;
  46066. }
  46067. private static function glob($pattern, LoggerInterface $logger = null)
  46068. {
  46069. $certs = glob($pattern);
  46070. if ($certs === false) {
  46071. if ($logger) {
  46072. $logger->debug(sprintf("An error occurred while trying to find certificates for pattern: %s", $pattern));
  46073. }
  46074. return false;
  46075. }
  46076. if (count($certs) === 0) {
  46077. if ($logger) {
  46078. $logger->debug(sprintf("No CA files found for pattern: %s", $pattern));
  46079. }
  46080. return false;
  46081. }
  46082. return true;
  46083. }
  46084. }
  46085. Copyright (C) 2022 Composer
  46086. Permission is hereby granted, free of charge, to any person obtaining a copy of
  46087. this software and associated documentation files (the "Software"), to deal in
  46088. the Software without restriction, including without limitation the rights to
  46089. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  46090. of the Software, and to permit persons to whom the Software is furnished to do
  46091. so, subject to the following conditions:
  46092. The above copyright notice and this permission notice shall be included in all
  46093. copies or substantial portions of the Software.
  46094. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46095. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46096. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46097. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46098. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46099. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46100. SOFTWARE.
  46101. <?php declare(strict_types=1);
  46102. namespace Composer\ClassMapGenerator;
  46103. class ClassMap implements \Countable
  46104. {
  46105. public $map = [];
  46106. private $ambiguousClasses = [];
  46107. private $psrViolations = [];
  46108. public function getMap(): array
  46109. {
  46110. return $this->map;
  46111. }
  46112. public function getPsrViolations(): array
  46113. {
  46114. return $this->psrViolations;
  46115. }
  46116. public function getAmbiguousClasses(): array
  46117. {
  46118. return $this->ambiguousClasses;
  46119. }
  46120. public function sort(): void
  46121. {
  46122. ksort($this->map);
  46123. }
  46124. public function addClass(string $className, string $path): void
  46125. {
  46126. $this->map[$className] = $path;
  46127. }
  46128. public function getClassPath(string $className): string
  46129. {
  46130. if (!isset($this->map[$className])) {
  46131. throw new \OutOfBoundsException('Class '.$className.' is not present in the map');
  46132. }
  46133. return $this->map[$className];
  46134. }
  46135. public function hasClass(string $className): bool
  46136. {
  46137. return isset($this->map[$className]);
  46138. }
  46139. public function addPsrViolation(string $warning): void
  46140. {
  46141. $this->psrViolations[] = $warning;
  46142. }
  46143. public function addAmbiguousClass(string $className, string $path): void
  46144. {
  46145. $this->ambiguousClasses[$className][] = $path;
  46146. }
  46147. public function count(): int
  46148. {
  46149. return \count($this->map);
  46150. }
  46151. }
  46152. <?php declare(strict_types=1);
  46153. namespace Composer\ClassMapGenerator;
  46154. use Composer\Pcre\Preg;
  46155. use Symfony\Component\Finder\Finder;
  46156. use Composer\IO\IOInterface;
  46157. class ClassMapGenerator
  46158. {
  46159. private $extensions;
  46160. private $scannedFiles = null;
  46161. private $classMap;
  46162. public function __construct(array $extensions = ['php', 'inc'])
  46163. {
  46164. $this->extensions = $extensions;
  46165. $this->classMap = new ClassMap;
  46166. }
  46167. public function avoidDuplicateScans(FileList $scannedFiles = null): self
  46168. {
  46169. $this->scannedFiles = $scannedFiles ?? new FileList;
  46170. return $this;
  46171. }
  46172. public static function createMap($path): array
  46173. {
  46174. $generator = new self();
  46175. $generator->scanPaths($path);
  46176. return $generator->getClassMap()->getMap();
  46177. }
  46178. public function getClassMap(): ClassMap
  46179. {
  46180. return $this->classMap;
  46181. }
  46182. public function scanPaths($path, string $excluded = null, string $autoloadType = 'classmap', ?string $namespace = null): void
  46183. {
  46184. if (!in_array($autoloadType, ['psr-0', 'psr-4', 'classmap'], true)) {
  46185. throw new \InvalidArgumentException('$autoloadType must be one of: "psr-0", "psr-4" or "classmap"');
  46186. }
  46187. if ('classmap' !== $autoloadType) {
  46188. if (!is_string($path)) {
  46189. throw new \InvalidArgumentException('$path must be a string when specifying a psr-0 or psr-4 autoload type');
  46190. }
  46191. if (!is_string($namespace)) {
  46192. throw new \InvalidArgumentException('$namespace must be given (even if it is an empty string if you do not want to filter) when specifying a psr-0 or psr-4 autoload type');
  46193. }
  46194. $basePath = $path;
  46195. }
  46196. if (is_string($path)) {
  46197. if (is_file($path)) {
  46198. $path = [new \SplFileInfo($path)];
  46199. } elseif (is_dir($path) || strpos($path, '*') !== false) {
  46200. $path = Finder::create()
  46201. ->files()
  46202. ->followLinks()
  46203. ->name('/\.(?:'.implode('|', array_map('preg_quote', $this->extensions)).')$/')
  46204. ->in($path);
  46205. } else {
  46206. throw new \RuntimeException(
  46207. 'Could not scan for classes inside "'.$path.'" which does not appear to be a file nor a folder'
  46208. );
  46209. }
  46210. }
  46211. $cwd = realpath(self::getCwd());
  46212. foreach ($path as $file) {
  46213. $filePath = $file->getPathname();
  46214. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), $this->extensions, true)) {
  46215. continue;
  46216. }
  46217. if (!self::isAbsolutePath($filePath)) {
  46218. $filePath = $cwd . '/' . $filePath;
  46219. $filePath = self::normalizePath($filePath);
  46220. } else {
  46221. $filePath = Preg::replace('{[\\\\/]{2,}}', '/', $filePath);
  46222. }
  46223. if ('' === $filePath) {
  46224. throw new \LogicException('Got an empty $filePath for '.$file->getPathname());
  46225. }
  46226. $realPath = realpath($filePath);
  46227. if (false === $realPath) {
  46228. throw new \RuntimeException('realpath of '.$filePath.' failed to resolve, got false');
  46229. }
  46230. if ($this->scannedFiles !== null && $this->scannedFiles->contains($realPath)) {
  46231. continue;
  46232. }
  46233. if (null !== $excluded && Preg::isMatch($excluded, strtr($realPath, '\\', '/'))) {
  46234. continue;
  46235. }
  46236. if (null !== $excluded && Preg::isMatch($excluded, strtr($filePath, '\\', '/'))) {
  46237. continue;
  46238. }
  46239. $classes = PhpFileParser::findClasses($filePath);
  46240. if ('classmap' !== $autoloadType && isset($namespace)) {
  46241. $classes = $this->filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath);
  46242. if (\count($classes) > 0 && $this->scannedFiles !== null) {
  46243. $this->scannedFiles->add($realPath);
  46244. }
  46245. } elseif ($this->scannedFiles !== null) {
  46246. $this->scannedFiles->add($realPath);
  46247. }
  46248. foreach ($classes as $class) {
  46249. if (!$this->classMap->hasClass($class)) {
  46250. $this->classMap->addClass($class, $filePath);
  46251. } elseif ($filePath !== $this->classMap->getClassPath($class) && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($this->classMap->getClassPath($class).' '.$filePath, '\\', '/'))) {
  46252. $this->classMap->addAmbiguousClass($class, $filePath);
  46253. }
  46254. }
  46255. }
  46256. }
  46257. private function filterByNamespace(array $classes, string $filePath, string $baseNamespace, string $namespaceType, string $basePath): array
  46258. {
  46259. $validClasses = [];
  46260. $rejectedClasses = [];
  46261. $realSubPath = substr($filePath, strlen($basePath) + 1);
  46262. $dotPosition = strrpos($realSubPath, '.');
  46263. $realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);
  46264. foreach ($classes as $class) {
  46265. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  46266. continue;
  46267. }
  46268. if ('psr-0' === $namespaceType) {
  46269. $namespaceLength = strrpos($class, '\\');
  46270. if (false !== $namespaceLength) {
  46271. $namespace = substr($class, 0, $namespaceLength + 1);
  46272. $className = substr($class, $namespaceLength + 1);
  46273. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  46274. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  46275. } else {
  46276. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  46277. }
  46278. } elseif ('psr-4' === $namespaceType) {
  46279. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  46280. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  46281. } else {
  46282. throw new \InvalidArgumentException('$namespaceType must be "psr-0" or "psr-4"');
  46283. }
  46284. if ($subPath === $realSubPath) {
  46285. $validClasses[] = $class;
  46286. } else {
  46287. $rejectedClasses[] = $class;
  46288. }
  46289. }
  46290. if (\count($validClasses) === 0) {
  46291. foreach ($rejectedClasses as $class) {
  46292. $this->classMap->addPsrViolation("Class $class located in ".Preg::replace('{^'.preg_quote(self::getCwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping.");
  46293. }
  46294. return [];
  46295. }
  46296. return $validClasses;
  46297. }
  46298. private static function isAbsolutePath(string $path)
  46299. {
  46300. return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
  46301. }
  46302. private static function normalizePath(string $path)
  46303. {
  46304. $parts = [];
  46305. $path = strtr($path, '\\', '/');
  46306. $prefix = '';
  46307. $absolute = '';
  46308. if (strpos($path, '//') === 0 && \strlen($path) > 2) {
  46309. $absolute = '//';
  46310. $path = substr($path, 2);
  46311. }
  46312. if (Preg::isMatchStrictGroups('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  46313. $prefix = $match[1];
  46314. $path = substr($path, \strlen($prefix));
  46315. }
  46316. if (strpos($path, '/') === 0) {
  46317. $absolute = '/';
  46318. $path = substr($path, 1);
  46319. }
  46320. $up = false;
  46321. foreach (explode('/', $path) as $chunk) {
  46322. if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
  46323. array_pop($parts);
  46324. $up = !(\count($parts) === 0 || '..' === end($parts));
  46325. } elseif ('.' !== $chunk && '' !== $chunk) {
  46326. $parts[] = $chunk;
  46327. $up = '..' !== $chunk;
  46328. }
  46329. }
  46330. $prefix = Preg::replaceCallback('{(?:^|://)[a-z]:$}i', function (array $m) { return strtoupper((string) $m[0]); }, $prefix);
  46331. return $prefix.$absolute.implode('/', $parts);
  46332. }
  46333. private static function getCwd(): string
  46334. {
  46335. $cwd = getcwd();
  46336. if (false === $cwd) {
  46337. throw new \RuntimeException('Could not determine the current working directory');
  46338. }
  46339. return $cwd;
  46340. }
  46341. }
  46342. <?php declare(strict_types=1);
  46343. namespace Composer\ClassMapGenerator;
  46344. class FileList
  46345. {
  46346. public $files = [];
  46347. public function add(string $path): void
  46348. {
  46349. $this->files[$path] = true;
  46350. }
  46351. public function contains(string $path): bool
  46352. {
  46353. return isset($this->files[$path]);
  46354. }
  46355. }
  46356. <?php declare(strict_types=1);
  46357. namespace Composer\ClassMapGenerator;
  46358. use Composer\Pcre\Preg;
  46359. class PhpFileCleaner
  46360. {
  46361. private static $typeConfig;
  46362. private static $restPattern;
  46363. private $contents;
  46364. private $len;
  46365. private $maxMatches;
  46366. private $index = 0;
  46367. public static function setTypeConfig(array $types): void
  46368. {
  46369. foreach ($types as $type) {
  46370. self::$typeConfig[$type[0]] = array(
  46371. 'name' => $type,
  46372. 'length' => \strlen($type),
  46373. 'pattern' => '{.\b(?<![\$:>])'.$type.'\s++[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+}Ais',
  46374. );
  46375. }
  46376. self::$restPattern = '{[^?"\'</'.implode('', array_keys(self::$typeConfig)).']+}A';
  46377. }
  46378. public function __construct(string $contents, int $maxMatches)
  46379. {
  46380. $this->contents = $contents;
  46381. $this->len = \strlen($this->contents);
  46382. $this->maxMatches = $maxMatches;
  46383. }
  46384. public function clean(): string
  46385. {
  46386. $clean = '';
  46387. while ($this->index < $this->len) {
  46388. $this->skipToPhp();
  46389. $clean .= '<?';
  46390. while ($this->index < $this->len) {
  46391. $char = $this->contents[$this->index];
  46392. if ($char === '?' && $this->peek('>')) {
  46393. $clean .= '?>';
  46394. $this->index += 2;
  46395. continue 2;
  46396. }
  46397. if ($char === '"') {
  46398. $this->skipString('"');
  46399. $clean .= 'null';
  46400. continue;
  46401. }
  46402. if ($char === "'") {
  46403. $this->skipString("'");
  46404. $clean .= 'null';
  46405. continue;
  46406. }
  46407. if ($char === "<" && $this->peek('<') && $this->match('{<<<[ \t]*+([\'"]?)([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*+)\\1(?:\r\n|\n|\r)}A', $match)) {
  46408. $this->index += \strlen($match[0]);
  46409. $this->skipHeredoc($match[2]);
  46410. $clean .= 'null';
  46411. continue;
  46412. }
  46413. if ($char === '/') {
  46414. if ($this->peek('/')) {
  46415. $this->skipToNewline();
  46416. continue;
  46417. }
  46418. if ($this->peek('*')) {
  46419. $this->skipComment();
  46420. continue;
  46421. }
  46422. }
  46423. if ($this->maxMatches === 1 && isset(self::$typeConfig[$char])) {
  46424. $type = self::$typeConfig[$char];
  46425. if (
  46426. \substr($this->contents, $this->index, $type['length']) === $type['name']
  46427. && Preg::isMatch($type['pattern'], $this->contents, $match, 0, $this->index - 1)
  46428. ) {
  46429. $clean .= $match[0];
  46430. return $clean;
  46431. }
  46432. }
  46433. $this->index += 1;
  46434. if ($this->match(self::$restPattern, $match)) {
  46435. $clean .= $char . $match[0];
  46436. $this->index += \strlen($match[0]);
  46437. } else {
  46438. $clean .= $char;
  46439. }
  46440. }
  46441. }
  46442. return $clean;
  46443. }
  46444. private function skipToPhp(): void
  46445. {
  46446. while ($this->index < $this->len) {
  46447. if ($this->contents[$this->index] === '<' && $this->peek('?')) {
  46448. $this->index += 2;
  46449. break;
  46450. }
  46451. $this->index += 1;
  46452. }
  46453. }
  46454. private function skipString(string $delimiter): void
  46455. {
  46456. $this->index += 1;
  46457. while ($this->index < $this->len) {
  46458. if ($this->contents[$this->index] === '\\' && ($this->peek('\\') || $this->peek($delimiter))) {
  46459. $this->index += 2;
  46460. continue;
  46461. }
  46462. if ($this->contents[$this->index] === $delimiter) {
  46463. $this->index += 1;
  46464. break;
  46465. }
  46466. $this->index += 1;
  46467. }
  46468. }
  46469. private function skipComment(): void
  46470. {
  46471. $this->index += 2;
  46472. while ($this->index < $this->len) {
  46473. if ($this->contents[$this->index] === '*' && $this->peek('/')) {
  46474. $this->index += 2;
  46475. break;
  46476. }
  46477. $this->index += 1;
  46478. }
  46479. }
  46480. private function skipToNewline(): void
  46481. {
  46482. while ($this->index < $this->len) {
  46483. if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") {
  46484. return;
  46485. }
  46486. $this->index += 1;
  46487. }
  46488. }
  46489. private function skipHeredoc(string $delimiter): void
  46490. {
  46491. $firstDelimiterChar = $delimiter[0];
  46492. $delimiterLength = \strlen($delimiter);
  46493. $delimiterPattern = '{'.preg_quote($delimiter).'(?![a-zA-Z0-9_\x80-\xff])}A';
  46494. while ($this->index < $this->len) {
  46495. switch ($this->contents[$this->index]) {
  46496. case "\t":
  46497. case " ":
  46498. $this->index += 1;
  46499. continue 2;
  46500. case $firstDelimiterChar:
  46501. if (
  46502. \substr($this->contents, $this->index, $delimiterLength) === $delimiter
  46503. && $this->match($delimiterPattern)
  46504. ) {
  46505. $this->index += $delimiterLength;
  46506. return;
  46507. }
  46508. break;
  46509. }
  46510. while ($this->index < $this->len) {
  46511. $this->skipToNewline();
  46512. while ($this->index < $this->len && ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n")) {
  46513. $this->index += 1;
  46514. }
  46515. break;
  46516. }
  46517. }
  46518. }
  46519. private function peek(string $char): bool
  46520. {
  46521. return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
  46522. }
  46523. private function match(string $regex, array &$match = null): bool
  46524. {
  46525. return Preg::isMatch($regex, $this->contents, $match, 0, $this->index);
  46526. }
  46527. }
  46528. <?php declare(strict_types=1);
  46529. namespace Composer\ClassMapGenerator;
  46530. use Composer\Pcre\Preg;
  46531. class PhpFileParser
  46532. {
  46533. public static function findClasses(string $path): array
  46534. {
  46535. $extraTypes = self::getExtraTypes();
  46536. $contents = @php_strip_whitespace($path);
  46537. if ('' === $contents) {
  46538. if (!file_exists($path)) {
  46539. $message = 'File at "%s" does not exist, check your classmap definitions';
  46540. } elseif (!self::isReadable($path)) {
  46541. $message = 'File at "%s" is not readable, check its permissions';
  46542. } elseif ('' === trim((string) file_get_contents($path))) {
  46543. return array();
  46544. } else {
  46545. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  46546. }
  46547. $error = error_get_last();
  46548. if (isset($error['message'])) {
  46549. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  46550. }
  46551. throw new \RuntimeException(sprintf($message, $path));
  46552. }
  46553. Preg::matchAllStrictGroups('{\b(?:class|interface|trait'.$extraTypes.')\s}i', $contents, $matches);
  46554. if (0 === \count($matches)) {
  46555. return array();
  46556. }
  46557. $p = new PhpFileCleaner($contents, count($matches[0]));
  46558. $contents = $p->clean();
  46559. unset($p);
  46560. Preg::matchAll('{
  46561. (?:
  46562. \b(?<![\$:>])(?P<type>class|interface|trait'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  46563. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  46564. )
  46565. }ix', $contents, $matches);
  46566. $classes = array();
  46567. $namespace = '';
  46568. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  46569. if (isset($matches['ns'][$i]) && $matches['ns'][$i] !== '') {
  46570. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', (string) $matches['nsname'][$i]) . '\\';
  46571. } else {
  46572. $name = $matches['name'][$i];
  46573. assert(is_string($name));
  46574. if ($name === 'extends' || $name === 'implements') {
  46575. continue;
  46576. }
  46577. if ($name[0] === ':') {
  46578. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  46579. } elseif (strtolower((string) $matches['type'][$i]) === 'enum') {
  46580. $colonPos = strrpos($name, ':');
  46581. if (false !== $colonPos) {
  46582. $name = substr($name, 0, $colonPos);
  46583. }
  46584. }
  46585. $classes[] = ltrim($namespace . $name, '\\');
  46586. }
  46587. }
  46588. return $classes;
  46589. }
  46590. private static function getExtraTypes(): string
  46591. {
  46592. static $extraTypes = null;
  46593. if (null === $extraTypes) {
  46594. $extraTypes = '';
  46595. if (PHP_VERSION_ID >= 80100 || (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>='))) {
  46596. $extraTypes .= '|enum';
  46597. }
  46598. PhpFileCleaner::setTypeConfig(array_merge(['class', 'interface', 'trait'], array_filter(explode('|', $extraTypes))));
  46599. }
  46600. return $extraTypes;
  46601. }
  46602. private static function isReadable(string $path)
  46603. {
  46604. if (is_readable($path)) {
  46605. return true;
  46606. }
  46607. if (is_file($path)) {
  46608. return false !== @file_get_contents($path, false, null, 0, 1);
  46609. }
  46610. return false;
  46611. }
  46612. }
  46613. {
  46614. "packages": [
  46615. {
  46616. "name": "composer/ca-bundle",
  46617. "version": "1.4.0",
  46618. "version_normalized": "1.4.0.0",
  46619. "source": {
  46620. "type": "git",
  46621. "url": "https://github.com/composer/ca-bundle.git",
  46622. "reference": "b66d11b7479109ab547f9405b97205640b17d385"
  46623. },
  46624. "dist": {
  46625. "type": "zip",
  46626. "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385",
  46627. "reference": "b66d11b7479109ab547f9405b97205640b17d385",
  46628. "shasum": ""
  46629. },
  46630. "require": {
  46631. "ext-openssl": "*",
  46632. "ext-pcre": "*",
  46633. "php": "^5.3.2 || ^7.0 || ^8.0"
  46634. },
  46635. "require-dev": {
  46636. "phpstan/phpstan": "^0.12.55",
  46637. "psr/log": "^1.0",
  46638. "symfony/phpunit-bridge": "^4.2 || ^5",
  46639. "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
  46640. },
  46641. "time": "2023-12-18T12:05:55+00:00",
  46642. "type": "library",
  46643. "extra": {
  46644. "branch-alias": {
  46645. "dev-main": "1.x-dev"
  46646. }
  46647. },
  46648. "installation-source": "dist",
  46649. "autoload": {
  46650. "psr-4": {
  46651. "Composer\\CaBundle\\": "src"
  46652. }
  46653. },
  46654. "notification-url": "https://packagist.org/downloads/",
  46655. "license": [
  46656. "MIT"
  46657. ],
  46658. "authors": [
  46659. {
  46660. "name": "Jordi Boggiano",
  46661. "email": "j.boggiano@seld.be",
  46662. "homepage": "http://seld.be"
  46663. }
  46664. ],
  46665. "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
  46666. "keywords": [
  46667. "cabundle",
  46668. "cacert",
  46669. "certificate",
  46670. "ssl",
  46671. "tls"
  46672. ],
  46673. "support": {
  46674. "irc": "irc://irc.freenode.org/composer",
  46675. "issues": "https://github.com/composer/ca-bundle/issues",
  46676. "source": "https://github.com/composer/ca-bundle/tree/1.4.0"
  46677. },
  46678. "funding": [
  46679. {
  46680. "url": "https://packagist.com",
  46681. "type": "custom"
  46682. },
  46683. {
  46684. "url": "https://github.com/composer",
  46685. "type": "github"
  46686. },
  46687. {
  46688. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  46689. "type": "tidelift"
  46690. }
  46691. ],
  46692. "install-path": "./ca-bundle"
  46693. },
  46694. {
  46695. "name": "composer/class-map-generator",
  46696. "version": "1.1.0",
  46697. "version_normalized": "1.1.0.0",
  46698. "source": {
  46699. "type": "git",
  46700. "url": "https://github.com/composer/class-map-generator.git",
  46701. "reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9"
  46702. },
  46703. "dist": {
  46704. "type": "zip",
  46705. "url": "https://api.github.com/repos/composer/class-map-generator/zipball/953cc4ea32e0c31f2185549c7d216d7921f03da9",
  46706. "reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9",
  46707. "shasum": ""
  46708. },
  46709. "require": {
  46710. "composer/pcre": "^2.1 || ^3.1",
  46711. "php": "^7.2 || ^8.0",
  46712. "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7"
  46713. },
  46714. "require-dev": {
  46715. "phpstan/phpstan": "^1.6",
  46716. "phpstan/phpstan-deprecation-rules": "^1",
  46717. "phpstan/phpstan-phpunit": "^1",
  46718. "phpstan/phpstan-strict-rules": "^1.1",
  46719. "symfony/filesystem": "^5.4 || ^6",
  46720. "symfony/phpunit-bridge": "^5"
  46721. },
  46722. "time": "2023-06-30T13:58:57+00:00",
  46723. "type": "library",
  46724. "extra": {
  46725. "branch-alias": {
  46726. "dev-main": "1.x-dev"
  46727. }
  46728. },
  46729. "installation-source": "dist",
  46730. "autoload": {
  46731. "psr-4": {
  46732. "Composer\\ClassMapGenerator\\": "src"
  46733. }
  46734. },
  46735. "notification-url": "https://packagist.org/downloads/",
  46736. "license": [
  46737. "MIT"
  46738. ],
  46739. "authors": [
  46740. {
  46741. "name": "Jordi Boggiano",
  46742. "email": "j.boggiano@seld.be",
  46743. "homepage": "https://seld.be"
  46744. }
  46745. ],
  46746. "description": "Utilities to scan PHP code and generate class maps.",
  46747. "keywords": [
  46748. "classmap"
  46749. ],
  46750. "support": {
  46751. "issues": "https://github.com/composer/class-map-generator/issues",
  46752. "source": "https://github.com/composer/class-map-generator/tree/1.1.0"
  46753. },
  46754. "funding": [
  46755. {
  46756. "url": "https://packagist.com",
  46757. "type": "custom"
  46758. },
  46759. {
  46760. "url": "https://github.com/composer",
  46761. "type": "github"
  46762. },
  46763. {
  46764. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  46765. "type": "tidelift"
  46766. }
  46767. ],
  46768. "install-path": "./class-map-generator"
  46769. },
  46770. {
  46771. "name": "composer/metadata-minifier",
  46772. "version": "1.0.0",
  46773. "version_normalized": "1.0.0.0",
  46774. "source": {
  46775. "type": "git",
  46776. "url": "https://github.com/composer/metadata-minifier.git",
  46777. "reference": "c549d23829536f0d0e984aaabbf02af91f443207"
  46778. },
  46779. "dist": {
  46780. "type": "zip",
  46781. "url": "https://api.github.com/repos/composer/metadata-minifier/zipball/c549d23829536f0d0e984aaabbf02af91f443207",
  46782. "reference": "c549d23829536f0d0e984aaabbf02af91f443207",
  46783. "shasum": ""
  46784. },
  46785. "require": {
  46786. "php": "^5.3.2 || ^7.0 || ^8.0"
  46787. },
  46788. "require-dev": {
  46789. "composer/composer": "^2",
  46790. "phpstan/phpstan": "^0.12.55",
  46791. "symfony/phpunit-bridge": "^4.2 || ^5"
  46792. },
  46793. "time": "2021-04-07T13:37:33+00:00",
  46794. "type": "library",
  46795. "extra": {
  46796. "branch-alias": {
  46797. "dev-main": "1.x-dev"
  46798. }
  46799. },
  46800. "installation-source": "dist",
  46801. "autoload": {
  46802. "psr-4": {
  46803. "Composer\\MetadataMinifier\\": "src"
  46804. }
  46805. },
  46806. "notification-url": "https://packagist.org/downloads/",
  46807. "license": [
  46808. "MIT"
  46809. ],
  46810. "authors": [
  46811. {
  46812. "name": "Jordi Boggiano",
  46813. "email": "j.boggiano@seld.be",
  46814. "homepage": "http://seld.be"
  46815. }
  46816. ],
  46817. "description": "Small utility library that handles metadata minification and expansion.",
  46818. "keywords": [
  46819. "composer",
  46820. "compression"
  46821. ],
  46822. "support": {
  46823. "issues": "https://github.com/composer/metadata-minifier/issues",
  46824. "source": "https://github.com/composer/metadata-minifier/tree/1.0.0"
  46825. },
  46826. "funding": [
  46827. {
  46828. "url": "https://packagist.com",
  46829. "type": "custom"
  46830. },
  46831. {
  46832. "url": "https://github.com/composer",
  46833. "type": "github"
  46834. },
  46835. {
  46836. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  46837. "type": "tidelift"
  46838. }
  46839. ],
  46840. "install-path": "./metadata-minifier"
  46841. },
  46842. {
  46843. "name": "composer/pcre",
  46844. "version": "2.1.1",
  46845. "version_normalized": "2.1.1.0",
  46846. "source": {
  46847. "type": "git",
  46848. "url": "https://github.com/composer/pcre.git",
  46849. "reference": "b439557066cd445732fa57cbc8d905394b4db8a0"
  46850. },
  46851. "dist": {
  46852. "type": "zip",
  46853. "url": "https://api.github.com/repos/composer/pcre/zipball/b439557066cd445732fa57cbc8d905394b4db8a0",
  46854. "reference": "b439557066cd445732fa57cbc8d905394b4db8a0",
  46855. "shasum": ""
  46856. },
  46857. "require": {
  46858. "php": "^7.2 || ^8.0"
  46859. },
  46860. "require-dev": {
  46861. "phpstan/phpstan": "^1.3",
  46862. "phpstan/phpstan-strict-rules": "^1.1",
  46863. "symfony/phpunit-bridge": "^5"
  46864. },
  46865. "time": "2023-10-11T07:10:55+00:00",
  46866. "type": "library",
  46867. "extra": {
  46868. "branch-alias": {
  46869. "dev-main": "2.x-dev"
  46870. }
  46871. },
  46872. "installation-source": "dist",
  46873. "autoload": {
  46874. "psr-4": {
  46875. "Composer\\Pcre\\": "src"
  46876. }
  46877. },
  46878. "notification-url": "https://packagist.org/downloads/",
  46879. "license": [
  46880. "MIT"
  46881. ],
  46882. "authors": [
  46883. {
  46884. "name": "Jordi Boggiano",
  46885. "email": "j.boggiano@seld.be",
  46886. "homepage": "http://seld.be"
  46887. }
  46888. ],
  46889. "description": "PCRE wrapping library that offers type-safe preg_* replacements.",
  46890. "keywords": [
  46891. "PCRE",
  46892. "preg",
  46893. "regex",
  46894. "regular expression"
  46895. ],
  46896. "support": {
  46897. "issues": "https://github.com/composer/pcre/issues",
  46898. "source": "https://github.com/composer/pcre/tree/2.1.1"
  46899. },
  46900. "funding": [
  46901. {
  46902. "url": "https://packagist.com",
  46903. "type": "custom"
  46904. },
  46905. {
  46906. "url": "https://github.com/composer",
  46907. "type": "github"
  46908. },
  46909. {
  46910. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  46911. "type": "tidelift"
  46912. }
  46913. ],
  46914. "install-path": "./pcre"
  46915. },
  46916. {
  46917. "name": "composer/semver",
  46918. "version": "3.4.0",
  46919. "version_normalized": "3.4.0.0",
  46920. "source": {
  46921. "type": "git",
  46922. "url": "https://github.com/composer/semver.git",
  46923. "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32"
  46924. },
  46925. "dist": {
  46926. "type": "zip",
  46927. "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32",
  46928. "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32",
  46929. "shasum": ""
  46930. },
  46931. "require": {
  46932. "php": "^5.3.2 || ^7.0 || ^8.0"
  46933. },
  46934. "require-dev": {
  46935. "phpstan/phpstan": "^1.4",
  46936. "symfony/phpunit-bridge": "^4.2 || ^5"
  46937. },
  46938. "time": "2023-08-31T09:50:34+00:00",
  46939. "type": "library",
  46940. "extra": {
  46941. "branch-alias": {
  46942. "dev-main": "3.x-dev"
  46943. }
  46944. },
  46945. "installation-source": "dist",
  46946. "autoload": {
  46947. "psr-4": {
  46948. "Composer\\Semver\\": "src"
  46949. }
  46950. },
  46951. "notification-url": "https://packagist.org/downloads/",
  46952. "license": [
  46953. "MIT"
  46954. ],
  46955. "authors": [
  46956. {
  46957. "name": "Nils Adermann",
  46958. "email": "naderman@naderman.de",
  46959. "homepage": "http://www.naderman.de"
  46960. },
  46961. {
  46962. "name": "Jordi Boggiano",
  46963. "email": "j.boggiano@seld.be",
  46964. "homepage": "http://seld.be"
  46965. },
  46966. {
  46967. "name": "Rob Bast",
  46968. "email": "rob.bast@gmail.com",
  46969. "homepage": "http://robbast.nl"
  46970. }
  46971. ],
  46972. "description": "Semver library that offers utilities, version constraint parsing and validation.",
  46973. "keywords": [
  46974. "semantic",
  46975. "semver",
  46976. "validation",
  46977. "versioning"
  46978. ],
  46979. "support": {
  46980. "irc": "ircs://irc.libera.chat:6697/composer",
  46981. "issues": "https://github.com/composer/semver/issues",
  46982. "source": "https://github.com/composer/semver/tree/3.4.0"
  46983. },
  46984. "funding": [
  46985. {
  46986. "url": "https://packagist.com",
  46987. "type": "custom"
  46988. },
  46989. {
  46990. "url": "https://github.com/composer",
  46991. "type": "github"
  46992. },
  46993. {
  46994. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  46995. "type": "tidelift"
  46996. }
  46997. ],
  46998. "install-path": "./semver"
  46999. },
  47000. {
  47001. "name": "composer/spdx-licenses",
  47002. "version": "1.5.8",
  47003. "version_normalized": "1.5.8.0",
  47004. "source": {
  47005. "type": "git",
  47006. "url": "https://github.com/composer/spdx-licenses.git",
  47007. "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a"
  47008. },
  47009. "dist": {
  47010. "type": "zip",
  47011. "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a",
  47012. "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a",
  47013. "shasum": ""
  47014. },
  47015. "require": {
  47016. "php": "^5.3.2 || ^7.0 || ^8.0"
  47017. },
  47018. "require-dev": {
  47019. "phpstan/phpstan": "^0.12.55",
  47020. "symfony/phpunit-bridge": "^4.2 || ^5"
  47021. },
  47022. "time": "2023-11-20T07:44:33+00:00",
  47023. "type": "library",
  47024. "extra": {
  47025. "branch-alias": {
  47026. "dev-main": "1.x-dev"
  47027. }
  47028. },
  47029. "installation-source": "dist",
  47030. "autoload": {
  47031. "psr-4": {
  47032. "Composer\\Spdx\\": "src"
  47033. }
  47034. },
  47035. "notification-url": "https://packagist.org/downloads/",
  47036. "license": [
  47037. "MIT"
  47038. ],
  47039. "authors": [
  47040. {
  47041. "name": "Nils Adermann",
  47042. "email": "naderman@naderman.de",
  47043. "homepage": "http://www.naderman.de"
  47044. },
  47045. {
  47046. "name": "Jordi Boggiano",
  47047. "email": "j.boggiano@seld.be",
  47048. "homepage": "http://seld.be"
  47049. },
  47050. {
  47051. "name": "Rob Bast",
  47052. "email": "rob.bast@gmail.com",
  47053. "homepage": "http://robbast.nl"
  47054. }
  47055. ],
  47056. "description": "SPDX licenses list and validation library.",
  47057. "keywords": [
  47058. "license",
  47059. "spdx",
  47060. "validator"
  47061. ],
  47062. "support": {
  47063. "irc": "ircs://irc.libera.chat:6697/composer",
  47064. "issues": "https://github.com/composer/spdx-licenses/issues",
  47065. "source": "https://github.com/composer/spdx-licenses/tree/1.5.8"
  47066. },
  47067. "funding": [
  47068. {
  47069. "url": "https://packagist.com",
  47070. "type": "custom"
  47071. },
  47072. {
  47073. "url": "https://github.com/composer",
  47074. "type": "github"
  47075. },
  47076. {
  47077. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  47078. "type": "tidelift"
  47079. }
  47080. ],
  47081. "install-path": "./spdx-licenses"
  47082. },
  47083. {
  47084. "name": "composer/xdebug-handler",
  47085. "version": "3.0.3",
  47086. "version_normalized": "3.0.3.0",
  47087. "source": {
  47088. "type": "git",
  47089. "url": "https://github.com/composer/xdebug-handler.git",
  47090. "reference": "ced299686f41dce890debac69273b47ffe98a40c"
  47091. },
  47092. "dist": {
  47093. "type": "zip",
  47094. "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c",
  47095. "reference": "ced299686f41dce890debac69273b47ffe98a40c",
  47096. "shasum": ""
  47097. },
  47098. "require": {
  47099. "composer/pcre": "^1 || ^2 || ^3",
  47100. "php": "^7.2.5 || ^8.0",
  47101. "psr/log": "^1 || ^2 || ^3"
  47102. },
  47103. "require-dev": {
  47104. "phpstan/phpstan": "^1.0",
  47105. "phpstan/phpstan-strict-rules": "^1.1",
  47106. "symfony/phpunit-bridge": "^6.0"
  47107. },
  47108. "time": "2022-02-25T21:32:43+00:00",
  47109. "type": "library",
  47110. "installation-source": "dist",
  47111. "autoload": {
  47112. "psr-4": {
  47113. "Composer\\XdebugHandler\\": "src"
  47114. }
  47115. },
  47116. "notification-url": "https://packagist.org/downloads/",
  47117. "license": [
  47118. "MIT"
  47119. ],
  47120. "authors": [
  47121. {
  47122. "name": "John Stevenson",
  47123. "email": "john-stevenson@blueyonder.co.uk"
  47124. }
  47125. ],
  47126. "description": "Restarts a process without Xdebug.",
  47127. "keywords": [
  47128. "Xdebug",
  47129. "performance"
  47130. ],
  47131. "support": {
  47132. "irc": "irc://irc.freenode.org/composer",
  47133. "issues": "https://github.com/composer/xdebug-handler/issues",
  47134. "source": "https://github.com/composer/xdebug-handler/tree/3.0.3"
  47135. },
  47136. "funding": [
  47137. {
  47138. "url": "https://packagist.com",
  47139. "type": "custom"
  47140. },
  47141. {
  47142. "url": "https://github.com/composer",
  47143. "type": "github"
  47144. },
  47145. {
  47146. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  47147. "type": "tidelift"
  47148. }
  47149. ],
  47150. "install-path": "./xdebug-handler"
  47151. },
  47152. {
  47153. "name": "justinrainbow/json-schema",
  47154. "version": "v5.2.13",
  47155. "version_normalized": "5.2.13.0",
  47156. "source": {
  47157. "type": "git",
  47158. "url": "https://github.com/justinrainbow/json-schema.git",
  47159. "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793"
  47160. },
  47161. "dist": {
  47162. "type": "zip",
  47163. "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793",
  47164. "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793",
  47165. "shasum": ""
  47166. },
  47167. "require": {
  47168. "php": ">=5.3.3"
  47169. },
  47170. "require-dev": {
  47171. "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1",
  47172. "json-schema/json-schema-test-suite": "1.2.0",
  47173. "phpunit/phpunit": "^4.8.35"
  47174. },
  47175. "time": "2023-09-26T02:20:38+00:00",
  47176. "bin": [
  47177. "bin/validate-json"
  47178. ],
  47179. "type": "library",
  47180. "extra": {
  47181. "branch-alias": {
  47182. "dev-master": "5.0.x-dev"
  47183. }
  47184. },
  47185. "installation-source": "dist",
  47186. "autoload": {
  47187. "psr-4": {
  47188. "JsonSchema\\": "src/JsonSchema/"
  47189. }
  47190. },
  47191. "notification-url": "https://packagist.org/downloads/",
  47192. "license": [
  47193. "MIT"
  47194. ],
  47195. "authors": [
  47196. {
  47197. "name": "Bruno Prieto Reis",
  47198. "email": "bruno.p.reis@gmail.com"
  47199. },
  47200. {
  47201. "name": "Justin Rainbow",
  47202. "email": "justin.rainbow@gmail.com"
  47203. },
  47204. {
  47205. "name": "Igor Wiedler",
  47206. "email": "igor@wiedler.ch"
  47207. },
  47208. {
  47209. "name": "Robert Schönthal",
  47210. "email": "seroscho@googlemail.com"
  47211. }
  47212. ],
  47213. "description": "A library to validate a json schema.",
  47214. "homepage": "https://github.com/justinrainbow/json-schema",
  47215. "keywords": [
  47216. "json",
  47217. "schema"
  47218. ],
  47219. "support": {
  47220. "issues": "https://github.com/justinrainbow/json-schema/issues",
  47221. "source": "https://github.com/justinrainbow/json-schema/tree/v5.2.13"
  47222. },
  47223. "install-path": "../justinrainbow/json-schema"
  47224. },
  47225. {
  47226. "name": "psr/container",
  47227. "version": "1.1.1",
  47228. "version_normalized": "1.1.1.0",
  47229. "source": {
  47230. "type": "git",
  47231. "url": "https://github.com/php-fig/container.git",
  47232. "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
  47233. },
  47234. "dist": {
  47235. "type": "zip",
  47236. "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
  47237. "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
  47238. "shasum": ""
  47239. },
  47240. "require": {
  47241. "php": ">=7.2.0"
  47242. },
  47243. "time": "2021-03-05T17:36:06+00:00",
  47244. "type": "library",
  47245. "installation-source": "dist",
  47246. "autoload": {
  47247. "psr-4": {
  47248. "Psr\\Container\\": "src/"
  47249. }
  47250. },
  47251. "notification-url": "https://packagist.org/downloads/",
  47252. "license": [
  47253. "MIT"
  47254. ],
  47255. "authors": [
  47256. {
  47257. "name": "PHP-FIG",
  47258. "homepage": "https://www.php-fig.org/"
  47259. }
  47260. ],
  47261. "description": "Common Container Interface (PHP FIG PSR-11)",
  47262. "homepage": "https://github.com/php-fig/container",
  47263. "keywords": [
  47264. "PSR-11",
  47265. "container",
  47266. "container-interface",
  47267. "container-interop",
  47268. "psr"
  47269. ],
  47270. "support": {
  47271. "issues": "https://github.com/php-fig/container/issues",
  47272. "source": "https://github.com/php-fig/container/tree/1.1.1"
  47273. },
  47274. "install-path": "../psr/container"
  47275. },
  47276. {
  47277. "name": "psr/log",
  47278. "version": "1.1.4",
  47279. "version_normalized": "1.1.4.0",
  47280. "source": {
  47281. "type": "git",
  47282. "url": "https://github.com/php-fig/log.git",
  47283. "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
  47284. },
  47285. "dist": {
  47286. "type": "zip",
  47287. "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
  47288. "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
  47289. "shasum": ""
  47290. },
  47291. "require": {
  47292. "php": ">=5.3.0"
  47293. },
  47294. "time": "2021-05-03T11:20:27+00:00",
  47295. "type": "library",
  47296. "extra": {
  47297. "branch-alias": {
  47298. "dev-master": "1.1.x-dev"
  47299. }
  47300. },
  47301. "installation-source": "dist",
  47302. "autoload": {
  47303. "psr-4": {
  47304. "Psr\\Log\\": "Psr/Log/"
  47305. }
  47306. },
  47307. "notification-url": "https://packagist.org/downloads/",
  47308. "license": [
  47309. "MIT"
  47310. ],
  47311. "authors": [
  47312. {
  47313. "name": "PHP-FIG",
  47314. "homepage": "https://www.php-fig.org/"
  47315. }
  47316. ],
  47317. "description": "Common interface for logging libraries",
  47318. "homepage": "https://github.com/php-fig/log",
  47319. "keywords": [
  47320. "log",
  47321. "psr",
  47322. "psr-3"
  47323. ],
  47324. "support": {
  47325. "source": "https://github.com/php-fig/log/tree/1.1.4"
  47326. },
  47327. "install-path": "../psr/log"
  47328. },
  47329. {
  47330. "name": "react/promise",
  47331. "version": "v3.1.0",
  47332. "version_normalized": "3.1.0.0",
  47333. "source": {
  47334. "type": "git",
  47335. "url": "https://github.com/reactphp/promise.git",
  47336. "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c"
  47337. },
  47338. "dist": {
  47339. "type": "zip",
  47340. "url": "https://api.github.com/repos/reactphp/promise/zipball/e563d55d1641de1dea9f5e84f3cccc66d2bfe02c",
  47341. "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c",
  47342. "shasum": ""
  47343. },
  47344. "require": {
  47345. "php": ">=7.1.0"
  47346. },
  47347. "require-dev": {
  47348. "phpstan/phpstan": "1.10.39 || 1.4.10",
  47349. "phpunit/phpunit": "^9.6 || ^7.5"
  47350. },
  47351. "time": "2023-11-16T16:21:57+00:00",
  47352. "type": "library",
  47353. "installation-source": "dist",
  47354. "autoload": {
  47355. "files": [
  47356. "src/functions_include.php"
  47357. ],
  47358. "psr-4": {
  47359. "React\\Promise\\": "src/"
  47360. }
  47361. },
  47362. "notification-url": "https://packagist.org/downloads/",
  47363. "license": [
  47364. "MIT"
  47365. ],
  47366. "authors": [
  47367. {
  47368. "name": "Jan Sorgalla",
  47369. "email": "jsorgalla@gmail.com",
  47370. "homepage": "https://sorgalla.com/"
  47371. },
  47372. {
  47373. "name": "Christian Lück",
  47374. "email": "christian@clue.engineering",
  47375. "homepage": "https://clue.engineering/"
  47376. },
  47377. {
  47378. "name": "Cees-Jan Kiewiet",
  47379. "email": "reactphp@ceesjankiewiet.nl",
  47380. "homepage": "https://wyrihaximus.net/"
  47381. },
  47382. {
  47383. "name": "Chris Boden",
  47384. "email": "cboden@gmail.com",
  47385. "homepage": "https://cboden.dev/"
  47386. }
  47387. ],
  47388. "description": "A lightweight implementation of CommonJS Promises/A for PHP",
  47389. "keywords": [
  47390. "promise",
  47391. "promises"
  47392. ],
  47393. "support": {
  47394. "issues": "https://github.com/reactphp/promise/issues",
  47395. "source": "https://github.com/reactphp/promise/tree/v3.1.0"
  47396. },
  47397. "funding": [
  47398. {
  47399. "url": "https://opencollective.com/reactphp",
  47400. "type": "open_collective"
  47401. }
  47402. ],
  47403. "install-path": "../react/promise"
  47404. },
  47405. {
  47406. "name": "seld/jsonlint",
  47407. "version": "1.10.2",
  47408. "version_normalized": "1.10.2.0",
  47409. "source": {
  47410. "type": "git",
  47411. "url": "https://github.com/Seldaek/jsonlint.git",
  47412. "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259"
  47413. },
  47414. "dist": {
  47415. "type": "zip",
  47416. "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9bb7db07b5d66d90f6ebf542f09fc67d800e5259",
  47417. "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259",
  47418. "shasum": ""
  47419. },
  47420. "require": {
  47421. "php": "^5.3 || ^7.0 || ^8.0"
  47422. },
  47423. "require-dev": {
  47424. "phpstan/phpstan": "^1.5",
  47425. "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13"
  47426. },
  47427. "time": "2024-02-07T12:57:50+00:00",
  47428. "bin": [
  47429. "bin/jsonlint"
  47430. ],
  47431. "type": "library",
  47432. "installation-source": "dist",
  47433. "autoload": {
  47434. "psr-4": {
  47435. "Seld\\JsonLint\\": "src/Seld/JsonLint/"
  47436. }
  47437. },
  47438. "notification-url": "https://packagist.org/downloads/",
  47439. "license": [
  47440. "MIT"
  47441. ],
  47442. "authors": [
  47443. {
  47444. "name": "Jordi Boggiano",
  47445. "email": "j.boggiano@seld.be",
  47446. "homepage": "https://seld.be"
  47447. }
  47448. ],
  47449. "description": "JSON Linter",
  47450. "keywords": [
  47451. "json",
  47452. "linter",
  47453. "parser",
  47454. "validator"
  47455. ],
  47456. "support": {
  47457. "issues": "https://github.com/Seldaek/jsonlint/issues",
  47458. "source": "https://github.com/Seldaek/jsonlint/tree/1.10.2"
  47459. },
  47460. "funding": [
  47461. {
  47462. "url": "https://github.com/Seldaek",
  47463. "type": "github"
  47464. },
  47465. {
  47466. "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint",
  47467. "type": "tidelift"
  47468. }
  47469. ],
  47470. "install-path": "../seld/jsonlint"
  47471. },
  47472. {
  47473. "name": "seld/phar-utils",
  47474. "version": "1.2.1",
  47475. "version_normalized": "1.2.1.0",
  47476. "source": {
  47477. "type": "git",
  47478. "url": "https://github.com/Seldaek/phar-utils.git",
  47479. "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c"
  47480. },
  47481. "dist": {
  47482. "type": "zip",
  47483. "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/ea2f4014f163c1be4c601b9b7bd6af81ba8d701c",
  47484. "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c",
  47485. "shasum": ""
  47486. },
  47487. "require": {
  47488. "php": ">=5.3"
  47489. },
  47490. "time": "2022-08-31T10:31:18+00:00",
  47491. "type": "library",
  47492. "extra": {
  47493. "branch-alias": {
  47494. "dev-master": "1.x-dev"
  47495. }
  47496. },
  47497. "installation-source": "dist",
  47498. "autoload": {
  47499. "psr-4": {
  47500. "Seld\\PharUtils\\": "src/"
  47501. }
  47502. },
  47503. "notification-url": "https://packagist.org/downloads/",
  47504. "license": [
  47505. "MIT"
  47506. ],
  47507. "authors": [
  47508. {
  47509. "name": "Jordi Boggiano",
  47510. "email": "j.boggiano@seld.be"
  47511. }
  47512. ],
  47513. "description": "PHAR file format utilities, for when PHP phars you up",
  47514. "keywords": [
  47515. "phar"
  47516. ],
  47517. "support": {
  47518. "issues": "https://github.com/Seldaek/phar-utils/issues",
  47519. "source": "https://github.com/Seldaek/phar-utils/tree/1.2.1"
  47520. },
  47521. "install-path": "../seld/phar-utils"
  47522. },
  47523. {
  47524. "name": "seld/signal-handler",
  47525. "version": "2.0.2",
  47526. "version_normalized": "2.0.2.0",
  47527. "source": {
  47528. "type": "git",
  47529. "url": "https://github.com/Seldaek/signal-handler.git",
  47530. "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98"
  47531. },
  47532. "dist": {
  47533. "type": "zip",
  47534. "url": "https://api.github.com/repos/Seldaek/signal-handler/zipball/04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98",
  47535. "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98",
  47536. "shasum": ""
  47537. },
  47538. "require": {
  47539. "php": ">=7.2.0"
  47540. },
  47541. "require-dev": {
  47542. "phpstan/phpstan": "^1",
  47543. "phpstan/phpstan-deprecation-rules": "^1.0",
  47544. "phpstan/phpstan-phpunit": "^1",
  47545. "phpstan/phpstan-strict-rules": "^1.3",
  47546. "phpunit/phpunit": "^7.5.20 || ^8.5.23",
  47547. "psr/log": "^1 || ^2 || ^3"
  47548. },
  47549. "time": "2023-09-03T09:24:00+00:00",
  47550. "type": "library",
  47551. "extra": {
  47552. "branch-alias": {
  47553. "dev-main": "2.x-dev"
  47554. }
  47555. },
  47556. "installation-source": "dist",
  47557. "autoload": {
  47558. "psr-4": {
  47559. "Seld\\Signal\\": "src/"
  47560. }
  47561. },
  47562. "notification-url": "https://packagist.org/downloads/",
  47563. "license": [
  47564. "MIT"
  47565. ],
  47566. "authors": [
  47567. {
  47568. "name": "Jordi Boggiano",
  47569. "email": "j.boggiano@seld.be",
  47570. "homepage": "http://seld.be"
  47571. }
  47572. ],
  47573. "description": "Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development",
  47574. "keywords": [
  47575. "posix",
  47576. "sigint",
  47577. "signal",
  47578. "sigterm",
  47579. "unix"
  47580. ],
  47581. "support": {
  47582. "issues": "https://github.com/Seldaek/signal-handler/issues",
  47583. "source": "https://github.com/Seldaek/signal-handler/tree/2.0.2"
  47584. },
  47585. "install-path": "../seld/signal-handler"
  47586. },
  47587. {
  47588. "name": "symfony/console",
  47589. "version": "v5.4.35",
  47590. "version_normalized": "5.4.35.0",
  47591. "source": {
  47592. "type": "git",
  47593. "url": "https://github.com/symfony/console.git",
  47594. "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931"
  47595. },
  47596. "dist": {
  47597. "type": "zip",
  47598. "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931",
  47599. "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931",
  47600. "shasum": ""
  47601. },
  47602. "require": {
  47603. "php": ">=7.2.5",
  47604. "symfony/deprecation-contracts": "^2.1|^3",
  47605. "symfony/polyfill-mbstring": "~1.0",
  47606. "symfony/polyfill-php73": "^1.9",
  47607. "symfony/polyfill-php80": "^1.16",
  47608. "symfony/service-contracts": "^1.1|^2|^3",
  47609. "symfony/string": "^5.1|^6.0"
  47610. },
  47611. "conflict": {
  47612. "psr/log": ">=3",
  47613. "symfony/dependency-injection": "<4.4",
  47614. "symfony/dotenv": "<5.1",
  47615. "symfony/event-dispatcher": "<4.4",
  47616. "symfony/lock": "<4.4",
  47617. "symfony/process": "<4.4"
  47618. },
  47619. "provide": {
  47620. "psr/log-implementation": "1.0|2.0"
  47621. },
  47622. "require-dev": {
  47623. "psr/log": "^1|^2",
  47624. "symfony/config": "^4.4|^5.0|^6.0",
  47625. "symfony/dependency-injection": "^4.4|^5.0|^6.0",
  47626. "symfony/event-dispatcher": "^4.4|^5.0|^6.0",
  47627. "symfony/lock": "^4.4|^5.0|^6.0",
  47628. "symfony/process": "^4.4|^5.0|^6.0",
  47629. "symfony/var-dumper": "^4.4|^5.0|^6.0"
  47630. },
  47631. "suggest": {
  47632. "psr/log": "For using the console logger",
  47633. "symfony/event-dispatcher": "",
  47634. "symfony/lock": "",
  47635. "symfony/process": ""
  47636. },
  47637. "time": "2024-01-23T14:28:09+00:00",
  47638. "type": "library",
  47639. "installation-source": "dist",
  47640. "autoload": {
  47641. "psr-4": {
  47642. "Symfony\\Component\\Console\\": ""
  47643. },
  47644. "exclude-from-classmap": [
  47645. "/Tests/"
  47646. ]
  47647. },
  47648. "notification-url": "https://packagist.org/downloads/",
  47649. "license": [
  47650. "MIT"
  47651. ],
  47652. "authors": [
  47653. {
  47654. "name": "Fabien Potencier",
  47655. "email": "fabien@symfony.com"
  47656. },
  47657. {
  47658. "name": "Symfony Community",
  47659. "homepage": "https://symfony.com/contributors"
  47660. }
  47661. ],
  47662. "description": "Eases the creation of beautiful and testable command line interfaces",
  47663. "homepage": "https://symfony.com",
  47664. "keywords": [
  47665. "cli",
  47666. "command-line",
  47667. "console",
  47668. "terminal"
  47669. ],
  47670. "support": {
  47671. "source": "https://github.com/symfony/console/tree/v5.4.35"
  47672. },
  47673. "funding": [
  47674. {
  47675. "url": "https://symfony.com/sponsor",
  47676. "type": "custom"
  47677. },
  47678. {
  47679. "url": "https://github.com/fabpot",
  47680. "type": "github"
  47681. },
  47682. {
  47683. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  47684. "type": "tidelift"
  47685. }
  47686. ],
  47687. "install-path": "../symfony/console"
  47688. },
  47689. {
  47690. "name": "symfony/deprecation-contracts",
  47691. "version": "v2.5.2",
  47692. "version_normalized": "2.5.2.0",
  47693. "source": {
  47694. "type": "git",
  47695. "url": "https://github.com/symfony/deprecation-contracts.git",
  47696. "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
  47697. },
  47698. "dist": {
  47699. "type": "zip",
  47700. "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
  47701. "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
  47702. "shasum": ""
  47703. },
  47704. "require": {
  47705. "php": ">=7.1"
  47706. },
  47707. "time": "2022-01-02T09:53:40+00:00",
  47708. "type": "library",
  47709. "extra": {
  47710. "branch-alias": {
  47711. "dev-main": "2.5-dev"
  47712. },
  47713. "thanks": {
  47714. "name": "symfony/contracts",
  47715. "url": "https://github.com/symfony/contracts"
  47716. }
  47717. },
  47718. "installation-source": "dist",
  47719. "autoload": {
  47720. "files": [
  47721. "function.php"
  47722. ]
  47723. },
  47724. "notification-url": "https://packagist.org/downloads/",
  47725. "license": [
  47726. "MIT"
  47727. ],
  47728. "authors": [
  47729. {
  47730. "name": "Nicolas Grekas",
  47731. "email": "p@tchwork.com"
  47732. },
  47733. {
  47734. "name": "Symfony Community",
  47735. "homepage": "https://symfony.com/contributors"
  47736. }
  47737. ],
  47738. "description": "A generic function and convention to trigger deprecation notices",
  47739. "homepage": "https://symfony.com",
  47740. "support": {
  47741. "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
  47742. },
  47743. "funding": [
  47744. {
  47745. "url": "https://symfony.com/sponsor",
  47746. "type": "custom"
  47747. },
  47748. {
  47749. "url": "https://github.com/fabpot",
  47750. "type": "github"
  47751. },
  47752. {
  47753. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  47754. "type": "tidelift"
  47755. }
  47756. ],
  47757. "install-path": "../symfony/deprecation-contracts"
  47758. },
  47759. {
  47760. "name": "symfony/filesystem",
  47761. "version": "v5.4.35",
  47762. "version_normalized": "5.4.35.0",
  47763. "source": {
  47764. "type": "git",
  47765. "url": "https://github.com/symfony/filesystem.git",
  47766. "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086"
  47767. },
  47768. "dist": {
  47769. "type": "zip",
  47770. "url": "https://api.github.com/repos/symfony/filesystem/zipball/5a553607d4ffbfa9c0ab62facadea296c9db7086",
  47771. "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086",
  47772. "shasum": ""
  47773. },
  47774. "require": {
  47775. "php": ">=7.2.5",
  47776. "symfony/polyfill-ctype": "~1.8",
  47777. "symfony/polyfill-mbstring": "~1.8",
  47778. "symfony/polyfill-php80": "^1.16"
  47779. },
  47780. "time": "2024-01-23T13:51:25+00:00",
  47781. "type": "library",
  47782. "installation-source": "dist",
  47783. "autoload": {
  47784. "psr-4": {
  47785. "Symfony\\Component\\Filesystem\\": ""
  47786. },
  47787. "exclude-from-classmap": [
  47788. "/Tests/"
  47789. ]
  47790. },
  47791. "notification-url": "https://packagist.org/downloads/",
  47792. "license": [
  47793. "MIT"
  47794. ],
  47795. "authors": [
  47796. {
  47797. "name": "Fabien Potencier",
  47798. "email": "fabien@symfony.com"
  47799. },
  47800. {
  47801. "name": "Symfony Community",
  47802. "homepage": "https://symfony.com/contributors"
  47803. }
  47804. ],
  47805. "description": "Provides basic utilities for the filesystem",
  47806. "homepage": "https://symfony.com",
  47807. "support": {
  47808. "source": "https://github.com/symfony/filesystem/tree/v5.4.35"
  47809. },
  47810. "funding": [
  47811. {
  47812. "url": "https://symfony.com/sponsor",
  47813. "type": "custom"
  47814. },
  47815. {
  47816. "url": "https://github.com/fabpot",
  47817. "type": "github"
  47818. },
  47819. {
  47820. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  47821. "type": "tidelift"
  47822. }
  47823. ],
  47824. "install-path": "../symfony/filesystem"
  47825. },
  47826. {
  47827. "name": "symfony/finder",
  47828. "version": "v5.4.35",
  47829. "version_normalized": "5.4.35.0",
  47830. "source": {
  47831. "type": "git",
  47832. "url": "https://github.com/symfony/finder.git",
  47833. "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435"
  47834. },
  47835. "dist": {
  47836. "type": "zip",
  47837. "url": "https://api.github.com/repos/symfony/finder/zipball/abe6d6f77d9465fed3cd2d029b29d03b56b56435",
  47838. "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435",
  47839. "shasum": ""
  47840. },
  47841. "require": {
  47842. "php": ">=7.2.5",
  47843. "symfony/deprecation-contracts": "^2.1|^3",
  47844. "symfony/polyfill-php80": "^1.16"
  47845. },
  47846. "time": "2024-01-23T13:51:25+00:00",
  47847. "type": "library",
  47848. "installation-source": "dist",
  47849. "autoload": {
  47850. "psr-4": {
  47851. "Symfony\\Component\\Finder\\": ""
  47852. },
  47853. "exclude-from-classmap": [
  47854. "/Tests/"
  47855. ]
  47856. },
  47857. "notification-url": "https://packagist.org/downloads/",
  47858. "license": [
  47859. "MIT"
  47860. ],
  47861. "authors": [
  47862. {
  47863. "name": "Fabien Potencier",
  47864. "email": "fabien@symfony.com"
  47865. },
  47866. {
  47867. "name": "Symfony Community",
  47868. "homepage": "https://symfony.com/contributors"
  47869. }
  47870. ],
  47871. "description": "Finds files and directories via an intuitive fluent interface",
  47872. "homepage": "https://symfony.com",
  47873. "support": {
  47874. "source": "https://github.com/symfony/finder/tree/v5.4.35"
  47875. },
  47876. "funding": [
  47877. {
  47878. "url": "https://symfony.com/sponsor",
  47879. "type": "custom"
  47880. },
  47881. {
  47882. "url": "https://github.com/fabpot",
  47883. "type": "github"
  47884. },
  47885. {
  47886. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  47887. "type": "tidelift"
  47888. }
  47889. ],
  47890. "install-path": "../symfony/finder"
  47891. },
  47892. {
  47893. "name": "symfony/polyfill-ctype",
  47894. "version": "v1.29.0",
  47895. "version_normalized": "1.29.0.0",
  47896. "source": {
  47897. "type": "git",
  47898. "url": "https://github.com/symfony/polyfill-ctype.git",
  47899. "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
  47900. },
  47901. "dist": {
  47902. "type": "zip",
  47903. "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
  47904. "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
  47905. "shasum": ""
  47906. },
  47907. "require": {
  47908. "php": ">=7.1"
  47909. },
  47910. "provide": {
  47911. "ext-ctype": "*"
  47912. },
  47913. "suggest": {
  47914. "ext-ctype": "For best performance"
  47915. },
  47916. "time": "2024-01-29T20:11:03+00:00",
  47917. "type": "library",
  47918. "extra": {
  47919. "thanks": {
  47920. "name": "symfony/polyfill",
  47921. "url": "https://github.com/symfony/polyfill"
  47922. }
  47923. },
  47924. "installation-source": "dist",
  47925. "autoload": {
  47926. "files": [
  47927. "bootstrap.php"
  47928. ],
  47929. "psr-4": {
  47930. "Symfony\\Polyfill\\Ctype\\": ""
  47931. }
  47932. },
  47933. "notification-url": "https://packagist.org/downloads/",
  47934. "license": [
  47935. "MIT"
  47936. ],
  47937. "authors": [
  47938. {
  47939. "name": "Gert de Pagter",
  47940. "email": "BackEndTea@gmail.com"
  47941. },
  47942. {
  47943. "name": "Symfony Community",
  47944. "homepage": "https://symfony.com/contributors"
  47945. }
  47946. ],
  47947. "description": "Symfony polyfill for ctype functions",
  47948. "homepage": "https://symfony.com",
  47949. "keywords": [
  47950. "compatibility",
  47951. "ctype",
  47952. "polyfill",
  47953. "portable"
  47954. ],
  47955. "support": {
  47956. "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
  47957. },
  47958. "funding": [
  47959. {
  47960. "url": "https://symfony.com/sponsor",
  47961. "type": "custom"
  47962. },
  47963. {
  47964. "url": "https://github.com/fabpot",
  47965. "type": "github"
  47966. },
  47967. {
  47968. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  47969. "type": "tidelift"
  47970. }
  47971. ],
  47972. "install-path": "../symfony/polyfill-ctype"
  47973. },
  47974. {
  47975. "name": "symfony/polyfill-intl-grapheme",
  47976. "version": "v1.29.0",
  47977. "version_normalized": "1.29.0.0",
  47978. "source": {
  47979. "type": "git",
  47980. "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
  47981. "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f"
  47982. },
  47983. "dist": {
  47984. "type": "zip",
  47985. "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f",
  47986. "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f",
  47987. "shasum": ""
  47988. },
  47989. "require": {
  47990. "php": ">=7.1"
  47991. },
  47992. "suggest": {
  47993. "ext-intl": "For best performance"
  47994. },
  47995. "time": "2024-01-29T20:11:03+00:00",
  47996. "type": "library",
  47997. "extra": {
  47998. "thanks": {
  47999. "name": "symfony/polyfill",
  48000. "url": "https://github.com/symfony/polyfill"
  48001. }
  48002. },
  48003. "installation-source": "dist",
  48004. "autoload": {
  48005. "files": [
  48006. "bootstrap.php"
  48007. ],
  48008. "psr-4": {
  48009. "Symfony\\Polyfill\\Intl\\Grapheme\\": ""
  48010. }
  48011. },
  48012. "notification-url": "https://packagist.org/downloads/",
  48013. "license": [
  48014. "MIT"
  48015. ],
  48016. "authors": [
  48017. {
  48018. "name": "Nicolas Grekas",
  48019. "email": "p@tchwork.com"
  48020. },
  48021. {
  48022. "name": "Symfony Community",
  48023. "homepage": "https://symfony.com/contributors"
  48024. }
  48025. ],
  48026. "description": "Symfony polyfill for intl's grapheme_* functions",
  48027. "homepage": "https://symfony.com",
  48028. "keywords": [
  48029. "compatibility",
  48030. "grapheme",
  48031. "intl",
  48032. "polyfill",
  48033. "portable",
  48034. "shim"
  48035. ],
  48036. "support": {
  48037. "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0"
  48038. },
  48039. "funding": [
  48040. {
  48041. "url": "https://symfony.com/sponsor",
  48042. "type": "custom"
  48043. },
  48044. {
  48045. "url": "https://github.com/fabpot",
  48046. "type": "github"
  48047. },
  48048. {
  48049. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48050. "type": "tidelift"
  48051. }
  48052. ],
  48053. "install-path": "../symfony/polyfill-intl-grapheme"
  48054. },
  48055. {
  48056. "name": "symfony/polyfill-intl-normalizer",
  48057. "version": "v1.29.0",
  48058. "version_normalized": "1.29.0.0",
  48059. "source": {
  48060. "type": "git",
  48061. "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
  48062. "reference": "bc45c394692b948b4d383a08d7753968bed9a83d"
  48063. },
  48064. "dist": {
  48065. "type": "zip",
  48066. "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d",
  48067. "reference": "bc45c394692b948b4d383a08d7753968bed9a83d",
  48068. "shasum": ""
  48069. },
  48070. "require": {
  48071. "php": ">=7.1"
  48072. },
  48073. "suggest": {
  48074. "ext-intl": "For best performance"
  48075. },
  48076. "time": "2024-01-29T20:11:03+00:00",
  48077. "type": "library",
  48078. "extra": {
  48079. "thanks": {
  48080. "name": "symfony/polyfill",
  48081. "url": "https://github.com/symfony/polyfill"
  48082. }
  48083. },
  48084. "installation-source": "dist",
  48085. "autoload": {
  48086. "files": [
  48087. "bootstrap.php"
  48088. ],
  48089. "psr-4": {
  48090. "Symfony\\Polyfill\\Intl\\Normalizer\\": ""
  48091. },
  48092. "classmap": [
  48093. "Resources/stubs"
  48094. ]
  48095. },
  48096. "notification-url": "https://packagist.org/downloads/",
  48097. "license": [
  48098. "MIT"
  48099. ],
  48100. "authors": [
  48101. {
  48102. "name": "Nicolas Grekas",
  48103. "email": "p@tchwork.com"
  48104. },
  48105. {
  48106. "name": "Symfony Community",
  48107. "homepage": "https://symfony.com/contributors"
  48108. }
  48109. ],
  48110. "description": "Symfony polyfill for intl's Normalizer class and related functions",
  48111. "homepage": "https://symfony.com",
  48112. "keywords": [
  48113. "compatibility",
  48114. "intl",
  48115. "normalizer",
  48116. "polyfill",
  48117. "portable",
  48118. "shim"
  48119. ],
  48120. "support": {
  48121. "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0"
  48122. },
  48123. "funding": [
  48124. {
  48125. "url": "https://symfony.com/sponsor",
  48126. "type": "custom"
  48127. },
  48128. {
  48129. "url": "https://github.com/fabpot",
  48130. "type": "github"
  48131. },
  48132. {
  48133. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48134. "type": "tidelift"
  48135. }
  48136. ],
  48137. "install-path": "../symfony/polyfill-intl-normalizer"
  48138. },
  48139. {
  48140. "name": "symfony/polyfill-mbstring",
  48141. "version": "v1.29.0",
  48142. "version_normalized": "1.29.0.0",
  48143. "source": {
  48144. "type": "git",
  48145. "url": "https://github.com/symfony/polyfill-mbstring.git",
  48146. "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
  48147. },
  48148. "dist": {
  48149. "type": "zip",
  48150. "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
  48151. "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
  48152. "shasum": ""
  48153. },
  48154. "require": {
  48155. "php": ">=7.1"
  48156. },
  48157. "provide": {
  48158. "ext-mbstring": "*"
  48159. },
  48160. "suggest": {
  48161. "ext-mbstring": "For best performance"
  48162. },
  48163. "time": "2024-01-29T20:11:03+00:00",
  48164. "type": "library",
  48165. "extra": {
  48166. "thanks": {
  48167. "name": "symfony/polyfill",
  48168. "url": "https://github.com/symfony/polyfill"
  48169. }
  48170. },
  48171. "installation-source": "dist",
  48172. "autoload": {
  48173. "files": [
  48174. "bootstrap.php"
  48175. ],
  48176. "psr-4": {
  48177. "Symfony\\Polyfill\\Mbstring\\": ""
  48178. }
  48179. },
  48180. "notification-url": "https://packagist.org/downloads/",
  48181. "license": [
  48182. "MIT"
  48183. ],
  48184. "authors": [
  48185. {
  48186. "name": "Nicolas Grekas",
  48187. "email": "p@tchwork.com"
  48188. },
  48189. {
  48190. "name": "Symfony Community",
  48191. "homepage": "https://symfony.com/contributors"
  48192. }
  48193. ],
  48194. "description": "Symfony polyfill for the Mbstring extension",
  48195. "homepage": "https://symfony.com",
  48196. "keywords": [
  48197. "compatibility",
  48198. "mbstring",
  48199. "polyfill",
  48200. "portable",
  48201. "shim"
  48202. ],
  48203. "support": {
  48204. "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
  48205. },
  48206. "funding": [
  48207. {
  48208. "url": "https://symfony.com/sponsor",
  48209. "type": "custom"
  48210. },
  48211. {
  48212. "url": "https://github.com/fabpot",
  48213. "type": "github"
  48214. },
  48215. {
  48216. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48217. "type": "tidelift"
  48218. }
  48219. ],
  48220. "install-path": "../symfony/polyfill-mbstring"
  48221. },
  48222. {
  48223. "name": "symfony/polyfill-php73",
  48224. "version": "v1.29.0",
  48225. "version_normalized": "1.29.0.0",
  48226. "source": {
  48227. "type": "git",
  48228. "url": "https://github.com/symfony/polyfill-php73.git",
  48229. "reference": "21bd091060673a1177ae842c0ef8fe30893114d2"
  48230. },
  48231. "dist": {
  48232. "type": "zip",
  48233. "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2",
  48234. "reference": "21bd091060673a1177ae842c0ef8fe30893114d2",
  48235. "shasum": ""
  48236. },
  48237. "require": {
  48238. "php": ">=7.1"
  48239. },
  48240. "time": "2024-01-29T20:11:03+00:00",
  48241. "type": "library",
  48242. "extra": {
  48243. "thanks": {
  48244. "name": "symfony/polyfill",
  48245. "url": "https://github.com/symfony/polyfill"
  48246. }
  48247. },
  48248. "installation-source": "dist",
  48249. "autoload": {
  48250. "files": [
  48251. "bootstrap.php"
  48252. ],
  48253. "psr-4": {
  48254. "Symfony\\Polyfill\\Php73\\": ""
  48255. },
  48256. "classmap": [
  48257. "Resources/stubs"
  48258. ]
  48259. },
  48260. "notification-url": "https://packagist.org/downloads/",
  48261. "license": [
  48262. "MIT"
  48263. ],
  48264. "authors": [
  48265. {
  48266. "name": "Nicolas Grekas",
  48267. "email": "p@tchwork.com"
  48268. },
  48269. {
  48270. "name": "Symfony Community",
  48271. "homepage": "https://symfony.com/contributors"
  48272. }
  48273. ],
  48274. "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
  48275. "homepage": "https://symfony.com",
  48276. "keywords": [
  48277. "compatibility",
  48278. "polyfill",
  48279. "portable",
  48280. "shim"
  48281. ],
  48282. "support": {
  48283. "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0"
  48284. },
  48285. "funding": [
  48286. {
  48287. "url": "https://symfony.com/sponsor",
  48288. "type": "custom"
  48289. },
  48290. {
  48291. "url": "https://github.com/fabpot",
  48292. "type": "github"
  48293. },
  48294. {
  48295. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48296. "type": "tidelift"
  48297. }
  48298. ],
  48299. "install-path": "../symfony/polyfill-php73"
  48300. },
  48301. {
  48302. "name": "symfony/polyfill-php80",
  48303. "version": "v1.29.0",
  48304. "version_normalized": "1.29.0.0",
  48305. "source": {
  48306. "type": "git",
  48307. "url": "https://github.com/symfony/polyfill-php80.git",
  48308. "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b"
  48309. },
  48310. "dist": {
  48311. "type": "zip",
  48312. "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
  48313. "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
  48314. "shasum": ""
  48315. },
  48316. "require": {
  48317. "php": ">=7.1"
  48318. },
  48319. "time": "2024-01-29T20:11:03+00:00",
  48320. "type": "library",
  48321. "extra": {
  48322. "thanks": {
  48323. "name": "symfony/polyfill",
  48324. "url": "https://github.com/symfony/polyfill"
  48325. }
  48326. },
  48327. "installation-source": "dist",
  48328. "autoload": {
  48329. "files": [
  48330. "bootstrap.php"
  48331. ],
  48332. "psr-4": {
  48333. "Symfony\\Polyfill\\Php80\\": ""
  48334. },
  48335. "classmap": [
  48336. "Resources/stubs"
  48337. ]
  48338. },
  48339. "notification-url": "https://packagist.org/downloads/",
  48340. "license": [
  48341. "MIT"
  48342. ],
  48343. "authors": [
  48344. {
  48345. "name": "Ion Bazan",
  48346. "email": "ion.bazan@gmail.com"
  48347. },
  48348. {
  48349. "name": "Nicolas Grekas",
  48350. "email": "p@tchwork.com"
  48351. },
  48352. {
  48353. "name": "Symfony Community",
  48354. "homepage": "https://symfony.com/contributors"
  48355. }
  48356. ],
  48357. "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
  48358. "homepage": "https://symfony.com",
  48359. "keywords": [
  48360. "compatibility",
  48361. "polyfill",
  48362. "portable",
  48363. "shim"
  48364. ],
  48365. "support": {
  48366. "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0"
  48367. },
  48368. "funding": [
  48369. {
  48370. "url": "https://symfony.com/sponsor",
  48371. "type": "custom"
  48372. },
  48373. {
  48374. "url": "https://github.com/fabpot",
  48375. "type": "github"
  48376. },
  48377. {
  48378. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48379. "type": "tidelift"
  48380. }
  48381. ],
  48382. "install-path": "../symfony/polyfill-php80"
  48383. },
  48384. {
  48385. "name": "symfony/polyfill-php81",
  48386. "version": "v1.29.0",
  48387. "version_normalized": "1.29.0.0",
  48388. "source": {
  48389. "type": "git",
  48390. "url": "https://github.com/symfony/polyfill-php81.git",
  48391. "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d"
  48392. },
  48393. "dist": {
  48394. "type": "zip",
  48395. "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/c565ad1e63f30e7477fc40738343c62b40bc672d",
  48396. "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d",
  48397. "shasum": ""
  48398. },
  48399. "require": {
  48400. "php": ">=7.1"
  48401. },
  48402. "time": "2024-01-29T20:11:03+00:00",
  48403. "type": "library",
  48404. "extra": {
  48405. "thanks": {
  48406. "name": "symfony/polyfill",
  48407. "url": "https://github.com/symfony/polyfill"
  48408. }
  48409. },
  48410. "installation-source": "dist",
  48411. "autoload": {
  48412. "files": [
  48413. "bootstrap.php"
  48414. ],
  48415. "psr-4": {
  48416. "Symfony\\Polyfill\\Php81\\": ""
  48417. },
  48418. "classmap": [
  48419. "Resources/stubs"
  48420. ]
  48421. },
  48422. "notification-url": "https://packagist.org/downloads/",
  48423. "license": [
  48424. "MIT"
  48425. ],
  48426. "authors": [
  48427. {
  48428. "name": "Nicolas Grekas",
  48429. "email": "p@tchwork.com"
  48430. },
  48431. {
  48432. "name": "Symfony Community",
  48433. "homepage": "https://symfony.com/contributors"
  48434. }
  48435. ],
  48436. "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
  48437. "homepage": "https://symfony.com",
  48438. "keywords": [
  48439. "compatibility",
  48440. "polyfill",
  48441. "portable",
  48442. "shim"
  48443. ],
  48444. "support": {
  48445. "source": "https://github.com/symfony/polyfill-php81/tree/v1.29.0"
  48446. },
  48447. "funding": [
  48448. {
  48449. "url": "https://symfony.com/sponsor",
  48450. "type": "custom"
  48451. },
  48452. {
  48453. "url": "https://github.com/fabpot",
  48454. "type": "github"
  48455. },
  48456. {
  48457. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48458. "type": "tidelift"
  48459. }
  48460. ],
  48461. "install-path": "../symfony/polyfill-php81"
  48462. },
  48463. {
  48464. "name": "symfony/process",
  48465. "version": "v5.4.35",
  48466. "version_normalized": "5.4.35.0",
  48467. "source": {
  48468. "type": "git",
  48469. "url": "https://github.com/symfony/process.git",
  48470. "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb"
  48471. },
  48472. "dist": {
  48473. "type": "zip",
  48474. "url": "https://api.github.com/repos/symfony/process/zipball/cbc28e34015ad50166fc2f9c8962d28d0fe861eb",
  48475. "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb",
  48476. "shasum": ""
  48477. },
  48478. "require": {
  48479. "php": ">=7.2.5",
  48480. "symfony/polyfill-php80": "^1.16"
  48481. },
  48482. "time": "2024-01-23T13:51:25+00:00",
  48483. "type": "library",
  48484. "installation-source": "dist",
  48485. "autoload": {
  48486. "psr-4": {
  48487. "Symfony\\Component\\Process\\": ""
  48488. },
  48489. "exclude-from-classmap": [
  48490. "/Tests/"
  48491. ]
  48492. },
  48493. "notification-url": "https://packagist.org/downloads/",
  48494. "license": [
  48495. "MIT"
  48496. ],
  48497. "authors": [
  48498. {
  48499. "name": "Fabien Potencier",
  48500. "email": "fabien@symfony.com"
  48501. },
  48502. {
  48503. "name": "Symfony Community",
  48504. "homepage": "https://symfony.com/contributors"
  48505. }
  48506. ],
  48507. "description": "Executes commands in sub-processes",
  48508. "homepage": "https://symfony.com",
  48509. "support": {
  48510. "source": "https://github.com/symfony/process/tree/v5.4.35"
  48511. },
  48512. "funding": [
  48513. {
  48514. "url": "https://symfony.com/sponsor",
  48515. "type": "custom"
  48516. },
  48517. {
  48518. "url": "https://github.com/fabpot",
  48519. "type": "github"
  48520. },
  48521. {
  48522. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48523. "type": "tidelift"
  48524. }
  48525. ],
  48526. "install-path": "../symfony/process"
  48527. },
  48528. {
  48529. "name": "symfony/service-contracts",
  48530. "version": "v2.5.2",
  48531. "version_normalized": "2.5.2.0",
  48532. "source": {
  48533. "type": "git",
  48534. "url": "https://github.com/symfony/service-contracts.git",
  48535. "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c"
  48536. },
  48537. "dist": {
  48538. "type": "zip",
  48539. "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
  48540. "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
  48541. "shasum": ""
  48542. },
  48543. "require": {
  48544. "php": ">=7.2.5",
  48545. "psr/container": "^1.1",
  48546. "symfony/deprecation-contracts": "^2.1|^3"
  48547. },
  48548. "conflict": {
  48549. "ext-psr": "<1.1|>=2"
  48550. },
  48551. "suggest": {
  48552. "symfony/service-implementation": ""
  48553. },
  48554. "time": "2022-05-30T19:17:29+00:00",
  48555. "type": "library",
  48556. "extra": {
  48557. "branch-alias": {
  48558. "dev-main": "2.5-dev"
  48559. },
  48560. "thanks": {
  48561. "name": "symfony/contracts",
  48562. "url": "https://github.com/symfony/contracts"
  48563. }
  48564. },
  48565. "installation-source": "dist",
  48566. "autoload": {
  48567. "psr-4": {
  48568. "Symfony\\Contracts\\Service\\": ""
  48569. }
  48570. },
  48571. "notification-url": "https://packagist.org/downloads/",
  48572. "license": [
  48573. "MIT"
  48574. ],
  48575. "authors": [
  48576. {
  48577. "name": "Nicolas Grekas",
  48578. "email": "p@tchwork.com"
  48579. },
  48580. {
  48581. "name": "Symfony Community",
  48582. "homepage": "https://symfony.com/contributors"
  48583. }
  48584. ],
  48585. "description": "Generic abstractions related to writing services",
  48586. "homepage": "https://symfony.com",
  48587. "keywords": [
  48588. "abstractions",
  48589. "contracts",
  48590. "decoupling",
  48591. "interfaces",
  48592. "interoperability",
  48593. "standards"
  48594. ],
  48595. "support": {
  48596. "source": "https://github.com/symfony/service-contracts/tree/v2.5.2"
  48597. },
  48598. "funding": [
  48599. {
  48600. "url": "https://symfony.com/sponsor",
  48601. "type": "custom"
  48602. },
  48603. {
  48604. "url": "https://github.com/fabpot",
  48605. "type": "github"
  48606. },
  48607. {
  48608. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48609. "type": "tidelift"
  48610. }
  48611. ],
  48612. "install-path": "../symfony/service-contracts"
  48613. },
  48614. {
  48615. "name": "symfony/string",
  48616. "version": "v5.4.35",
  48617. "version_normalized": "5.4.35.0",
  48618. "source": {
  48619. "type": "git",
  48620. "url": "https://github.com/symfony/string.git",
  48621. "reference": "c209c4d0559acce1c9a2067612cfb5d35756edc2"
  48622. },
  48623. "dist": {
  48624. "type": "zip",
  48625. "url": "https://api.github.com/repos/symfony/string/zipball/c209c4d0559acce1c9a2067612cfb5d35756edc2",
  48626. "reference": "c209c4d0559acce1c9a2067612cfb5d35756edc2",
  48627. "shasum": ""
  48628. },
  48629. "require": {
  48630. "php": ">=7.2.5",
  48631. "symfony/polyfill-ctype": "~1.8",
  48632. "symfony/polyfill-intl-grapheme": "~1.0",
  48633. "symfony/polyfill-intl-normalizer": "~1.0",
  48634. "symfony/polyfill-mbstring": "~1.0",
  48635. "symfony/polyfill-php80": "~1.15"
  48636. },
  48637. "conflict": {
  48638. "symfony/translation-contracts": ">=3.0"
  48639. },
  48640. "require-dev": {
  48641. "symfony/error-handler": "^4.4|^5.0|^6.0",
  48642. "symfony/http-client": "^4.4|^5.0|^6.0",
  48643. "symfony/translation-contracts": "^1.1|^2",
  48644. "symfony/var-exporter": "^4.4|^5.0|^6.0"
  48645. },
  48646. "time": "2024-01-23T13:51:25+00:00",
  48647. "type": "library",
  48648. "installation-source": "dist",
  48649. "autoload": {
  48650. "files": [
  48651. "Resources/functions.php"
  48652. ],
  48653. "psr-4": {
  48654. "Symfony\\Component\\String\\": ""
  48655. },
  48656. "exclude-from-classmap": [
  48657. "/Tests/"
  48658. ]
  48659. },
  48660. "notification-url": "https://packagist.org/downloads/",
  48661. "license": [
  48662. "MIT"
  48663. ],
  48664. "authors": [
  48665. {
  48666. "name": "Nicolas Grekas",
  48667. "email": "p@tchwork.com"
  48668. },
  48669. {
  48670. "name": "Symfony Community",
  48671. "homepage": "https://symfony.com/contributors"
  48672. }
  48673. ],
  48674. "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
  48675. "homepage": "https://symfony.com",
  48676. "keywords": [
  48677. "grapheme",
  48678. "i18n",
  48679. "string",
  48680. "unicode",
  48681. "utf-8",
  48682. "utf8"
  48683. ],
  48684. "support": {
  48685. "source": "https://github.com/symfony/string/tree/v5.4.35"
  48686. },
  48687. "funding": [
  48688. {
  48689. "url": "https://symfony.com/sponsor",
  48690. "type": "custom"
  48691. },
  48692. {
  48693. "url": "https://github.com/fabpot",
  48694. "type": "github"
  48695. },
  48696. {
  48697. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  48698. "type": "tidelift"
  48699. }
  48700. ],
  48701. "install-path": "../symfony/string"
  48702. }
  48703. ],
  48704. "dev": false,
  48705. "dev-package-names": []
  48706. }
  48707. <?php return array(
  48708. 'root' => array(
  48709. 'name' => 'composer/composer',
  48710. 'pretty_version' => '2.7.1',
  48711. 'version' => '2.7.1.0',
  48712. 'reference' => 'aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc',
  48713. 'type' => 'library',
  48714. 'install_path' => __DIR__ . '/../../',
  48715. 'aliases' => array(),
  48716. 'dev' => false,
  48717. ),
  48718. 'versions' => array(
  48719. 'composer/ca-bundle' => array(
  48720. 'pretty_version' => '1.4.0',
  48721. 'version' => '1.4.0.0',
  48722. 'reference' => 'b66d11b7479109ab547f9405b97205640b17d385',
  48723. 'type' => 'library',
  48724. 'install_path' => __DIR__ . '/./ca-bundle',
  48725. 'aliases' => array(),
  48726. 'dev_requirement' => false,
  48727. ),
  48728. 'composer/class-map-generator' => array(
  48729. 'pretty_version' => '1.1.0',
  48730. 'version' => '1.1.0.0',
  48731. 'reference' => '953cc4ea32e0c31f2185549c7d216d7921f03da9',
  48732. 'type' => 'library',
  48733. 'install_path' => __DIR__ . '/./class-map-generator',
  48734. 'aliases' => array(),
  48735. 'dev_requirement' => false,
  48736. ),
  48737. 'composer/composer' => array(
  48738. 'pretty_version' => '2.7.1',
  48739. 'version' => '2.7.1.0',
  48740. 'reference' => 'aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc',
  48741. 'type' => 'library',
  48742. 'install_path' => __DIR__ . '/../../',
  48743. 'aliases' => array(),
  48744. 'dev_requirement' => false,
  48745. ),
  48746. 'composer/metadata-minifier' => array(
  48747. 'pretty_version' => '1.0.0',
  48748. 'version' => '1.0.0.0',
  48749. 'reference' => 'c549d23829536f0d0e984aaabbf02af91f443207',
  48750. 'type' => 'library',
  48751. 'install_path' => __DIR__ . '/./metadata-minifier',
  48752. 'aliases' => array(),
  48753. 'dev_requirement' => false,
  48754. ),
  48755. 'composer/pcre' => array(
  48756. 'pretty_version' => '2.1.1',
  48757. 'version' => '2.1.1.0',
  48758. 'reference' => 'b439557066cd445732fa57cbc8d905394b4db8a0',
  48759. 'type' => 'library',
  48760. 'install_path' => __DIR__ . '/./pcre',
  48761. 'aliases' => array(),
  48762. 'dev_requirement' => false,
  48763. ),
  48764. 'composer/semver' => array(
  48765. 'pretty_version' => '3.4.0',
  48766. 'version' => '3.4.0.0',
  48767. 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32',
  48768. 'type' => 'library',
  48769. 'install_path' => __DIR__ . '/./semver',
  48770. 'aliases' => array(),
  48771. 'dev_requirement' => false,
  48772. ),
  48773. 'composer/spdx-licenses' => array(
  48774. 'pretty_version' => '1.5.8',
  48775. 'version' => '1.5.8.0',
  48776. 'reference' => '560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a',
  48777. 'type' => 'library',
  48778. 'install_path' => __DIR__ . '/./spdx-licenses',
  48779. 'aliases' => array(),
  48780. 'dev_requirement' => false,
  48781. ),
  48782. 'composer/xdebug-handler' => array(
  48783. 'pretty_version' => '3.0.3',
  48784. 'version' => '3.0.3.0',
  48785. 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c',
  48786. 'type' => 'library',
  48787. 'install_path' => __DIR__ . '/./xdebug-handler',
  48788. 'aliases' => array(),
  48789. 'dev_requirement' => false,
  48790. ),
  48791. 'justinrainbow/json-schema' => array(
  48792. 'pretty_version' => 'v5.2.13',
  48793. 'version' => '5.2.13.0',
  48794. 'reference' => 'fbbe7e5d79f618997bc3332a6f49246036c45793',
  48795. 'type' => 'library',
  48796. 'install_path' => __DIR__ . '/../justinrainbow/json-schema',
  48797. 'aliases' => array(),
  48798. 'dev_requirement' => false,
  48799. ),
  48800. 'psr/container' => array(
  48801. 'pretty_version' => '1.1.1',
  48802. 'version' => '1.1.1.0',
  48803. 'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf',
  48804. 'type' => 'library',
  48805. 'install_path' => __DIR__ . '/../psr/container',
  48806. 'aliases' => array(),
  48807. 'dev_requirement' => false,
  48808. ),
  48809. 'psr/log' => array(
  48810. 'pretty_version' => '1.1.4',
  48811. 'version' => '1.1.4.0',
  48812. 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
  48813. 'type' => 'library',
  48814. 'install_path' => __DIR__ . '/../psr/log',
  48815. 'aliases' => array(),
  48816. 'dev_requirement' => false,
  48817. ),
  48818. 'psr/log-implementation' => array(
  48819. 'dev_requirement' => false,
  48820. 'provided' => array(
  48821. 0 => '1.0|2.0',
  48822. ),
  48823. ),
  48824. 'react/promise' => array(
  48825. 'pretty_version' => 'v3.1.0',
  48826. 'version' => '3.1.0.0',
  48827. 'reference' => 'e563d55d1641de1dea9f5e84f3cccc66d2bfe02c',
  48828. 'type' => 'library',
  48829. 'install_path' => __DIR__ . '/../react/promise',
  48830. 'aliases' => array(),
  48831. 'dev_requirement' => false,
  48832. ),
  48833. 'seld/jsonlint' => array(
  48834. 'pretty_version' => '1.10.2',
  48835. 'version' => '1.10.2.0',
  48836. 'reference' => '9bb7db07b5d66d90f6ebf542f09fc67d800e5259',
  48837. 'type' => 'library',
  48838. 'install_path' => __DIR__ . '/../seld/jsonlint',
  48839. 'aliases' => array(),
  48840. 'dev_requirement' => false,
  48841. ),
  48842. 'seld/phar-utils' => array(
  48843. 'pretty_version' => '1.2.1',
  48844. 'version' => '1.2.1.0',
  48845. 'reference' => 'ea2f4014f163c1be4c601b9b7bd6af81ba8d701c',
  48846. 'type' => 'library',
  48847. 'install_path' => __DIR__ . '/../seld/phar-utils',
  48848. 'aliases' => array(),
  48849. 'dev_requirement' => false,
  48850. ),
  48851. 'seld/signal-handler' => array(
  48852. 'pretty_version' => '2.0.2',
  48853. 'version' => '2.0.2.0',
  48854. 'reference' => '04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98',
  48855. 'type' => 'library',
  48856. 'install_path' => __DIR__ . '/../seld/signal-handler',
  48857. 'aliases' => array(),
  48858. 'dev_requirement' => false,
  48859. ),
  48860. 'symfony/console' => array(
  48861. 'pretty_version' => 'v5.4.35',
  48862. 'version' => '5.4.35.0',
  48863. 'reference' => 'dbdf6adcb88d5f83790e1efb57ef4074309d3931',
  48864. 'type' => 'library',
  48865. 'install_path' => __DIR__ . '/../symfony/console',
  48866. 'aliases' => array(),
  48867. 'dev_requirement' => false,
  48868. ),
  48869. 'symfony/deprecation-contracts' => array(
  48870. 'pretty_version' => 'v2.5.2',
  48871. 'version' => '2.5.2.0',
  48872. 'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
  48873. 'type' => 'library',
  48874. 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
  48875. 'aliases' => array(),
  48876. 'dev_requirement' => false,
  48877. ),
  48878. 'symfony/filesystem' => array(
  48879. 'pretty_version' => 'v5.4.35',
  48880. 'version' => '5.4.35.0',
  48881. 'reference' => '5a553607d4ffbfa9c0ab62facadea296c9db7086',
  48882. 'type' => 'library',
  48883. 'install_path' => __DIR__ . '/../symfony/filesystem',
  48884. 'aliases' => array(),
  48885. 'dev_requirement' => false,
  48886. ),
  48887. 'symfony/finder' => array(
  48888. 'pretty_version' => 'v5.4.35',
  48889. 'version' => '5.4.35.0',
  48890. 'reference' => 'abe6d6f77d9465fed3cd2d029b29d03b56b56435',
  48891. 'type' => 'library',
  48892. 'install_path' => __DIR__ . '/../symfony/finder',
  48893. 'aliases' => array(),
  48894. 'dev_requirement' => false,
  48895. ),
  48896. 'symfony/polyfill-ctype' => array(
  48897. 'pretty_version' => 'v1.29.0',
  48898. 'version' => '1.29.0.0',
  48899. 'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4',
  48900. 'type' => 'library',
  48901. 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
  48902. 'aliases' => array(),
  48903. 'dev_requirement' => false,
  48904. ),
  48905. 'symfony/polyfill-intl-grapheme' => array(
  48906. 'pretty_version' => 'v1.29.0',
  48907. 'version' => '1.29.0.0',
  48908. 'reference' => '32a9da87d7b3245e09ac426c83d334ae9f06f80f',
  48909. 'type' => 'library',
  48910. 'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
  48911. 'aliases' => array(),
  48912. 'dev_requirement' => false,
  48913. ),
  48914. 'symfony/polyfill-intl-normalizer' => array(
  48915. 'pretty_version' => 'v1.29.0',
  48916. 'version' => '1.29.0.0',
  48917. 'reference' => 'bc45c394692b948b4d383a08d7753968bed9a83d',
  48918. 'type' => 'library',
  48919. 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
  48920. 'aliases' => array(),
  48921. 'dev_requirement' => false,
  48922. ),
  48923. 'symfony/polyfill-mbstring' => array(
  48924. 'pretty_version' => 'v1.29.0',
  48925. 'version' => '1.29.0.0',
  48926. 'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec',
  48927. 'type' => 'library',
  48928. 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
  48929. 'aliases' => array(),
  48930. 'dev_requirement' => false,
  48931. ),
  48932. 'symfony/polyfill-php73' => array(
  48933. 'pretty_version' => 'v1.29.0',
  48934. 'version' => '1.29.0.0',
  48935. 'reference' => '21bd091060673a1177ae842c0ef8fe30893114d2',
  48936. 'type' => 'library',
  48937. 'install_path' => __DIR__ . '/../symfony/polyfill-php73',
  48938. 'aliases' => array(),
  48939. 'dev_requirement' => false,
  48940. ),
  48941. 'symfony/polyfill-php80' => array(
  48942. 'pretty_version' => 'v1.29.0',
  48943. 'version' => '1.29.0.0',
  48944. 'reference' => '87b68208d5c1188808dd7839ee1e6c8ec3b02f1b',
  48945. 'type' => 'library',
  48946. 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
  48947. 'aliases' => array(),
  48948. 'dev_requirement' => false,
  48949. ),
  48950. 'symfony/polyfill-php81' => array(
  48951. 'pretty_version' => 'v1.29.0',
  48952. 'version' => '1.29.0.0',
  48953. 'reference' => 'c565ad1e63f30e7477fc40738343c62b40bc672d',
  48954. 'type' => 'library',
  48955. 'install_path' => __DIR__ . '/../symfony/polyfill-php81',
  48956. 'aliases' => array(),
  48957. 'dev_requirement' => false,
  48958. ),
  48959. 'symfony/process' => array(
  48960. 'pretty_version' => 'v5.4.35',
  48961. 'version' => '5.4.35.0',
  48962. 'reference' => 'cbc28e34015ad50166fc2f9c8962d28d0fe861eb',
  48963. 'type' => 'library',
  48964. 'install_path' => __DIR__ . '/../symfony/process',
  48965. 'aliases' => array(),
  48966. 'dev_requirement' => false,
  48967. ),
  48968. 'symfony/service-contracts' => array(
  48969. 'pretty_version' => 'v2.5.2',
  48970. 'version' => '2.5.2.0',
  48971. 'reference' => '4b426aac47d6427cc1a1d0f7e2ac724627f5966c',
  48972. 'type' => 'library',
  48973. 'install_path' => __DIR__ . '/../symfony/service-contracts',
  48974. 'aliases' => array(),
  48975. 'dev_requirement' => false,
  48976. ),
  48977. 'symfony/string' => array(
  48978. 'pretty_version' => 'v5.4.35',
  48979. 'version' => '5.4.35.0',
  48980. 'reference' => 'c209c4d0559acce1c9a2067612cfb5d35756edc2',
  48981. 'type' => 'library',
  48982. 'install_path' => __DIR__ . '/../symfony/string',
  48983. 'aliases' => array(),
  48984. 'dev_requirement' => false,
  48985. ),
  48986. ),
  48987. );
  48988. Copyright (C) 2021 Composer
  48989. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48990. this software and associated documentation files (the "Software"), to deal in
  48991. the Software without restriction, including without limitation the rights to
  48992. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48993. of the Software, and to permit persons to whom the Software is furnished to do
  48994. so, subject to the following conditions:
  48995. The above copyright notice and this permission notice shall be included in all
  48996. copies or substantial portions of the Software.
  48997. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48998. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48999. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49000. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49001. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49002. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49003. SOFTWARE.
  49004. <?php
  49005. namespace Composer\MetadataMinifier;
  49006. class MetadataMinifier
  49007. {
  49008. public static function expand(array $versions)
  49009. {
  49010. $expanded = array();
  49011. $expandedVersion = null;
  49012. foreach ($versions as $versionData) {
  49013. if (!$expandedVersion) {
  49014. $expandedVersion = $versionData;
  49015. $expanded[] = $expandedVersion;
  49016. continue;
  49017. }
  49018. foreach ($versionData as $key => $val) {
  49019. if ($val === '__unset') {
  49020. unset($expandedVersion[$key]);
  49021. } else {
  49022. $expandedVersion[$key] = $val;
  49023. }
  49024. }
  49025. $expanded[] = $expandedVersion;
  49026. }
  49027. return $expanded;
  49028. }
  49029. public static function minify(array $versions)
  49030. {
  49031. $minifiedVersions = array();
  49032. $lastKnownVersionData = null;
  49033. foreach ($versions as $version) {
  49034. if (!$lastKnownVersionData) {
  49035. $lastKnownVersionData = $version;
  49036. $minifiedVersions[] = $version;
  49037. continue;
  49038. }
  49039. $minifiedVersion = array();
  49040. foreach ($version as $key => $val) {
  49041. if (!isset($lastKnownVersionData[$key]) || $lastKnownVersionData[$key] !== $val) {
  49042. $minifiedVersion[$key] = $val;
  49043. $lastKnownVersionData[$key] = $val;
  49044. }
  49045. }
  49046. foreach ($lastKnownVersionData as $key => $val) {
  49047. if (!isset($version[$key])) {
  49048. $minifiedVersion[$key] = "__unset";
  49049. unset($lastKnownVersionData[$key]);
  49050. }
  49051. }
  49052. $minifiedVersions[] = $minifiedVersion;
  49053. }
  49054. return $minifiedVersions;
  49055. }
  49056. }
  49057. Copyright (C) 2021 Composer
  49058. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49059. this software and associated documentation files (the "Software"), to deal in
  49060. the Software without restriction, including without limitation the rights to
  49061. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49062. of the Software, and to permit persons to whom the Software is furnished to do
  49063. so, subject to the following conditions:
  49064. The above copyright notice and this permission notice shall be included in all
  49065. copies or substantial portions of the Software.
  49066. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49067. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49068. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49069. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49070. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49071. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49072. SOFTWARE.
  49073. <?php
  49074. namespace Composer\Pcre;
  49075. final class MatchAllResult
  49076. {
  49077. public $matches;
  49078. public $count;
  49079. public $matched;
  49080. public function __construct(int $count, array $matches)
  49081. {
  49082. $this->matches = $matches;
  49083. $this->matched = (bool) $count;
  49084. $this->count = $count;
  49085. }
  49086. }
  49087. <?php
  49088. namespace Composer\Pcre;
  49089. final class MatchAllStrictGroupsResult
  49090. {
  49091. public $matches;
  49092. public $count;
  49093. public $matched;
  49094. public function __construct(int $count, array $matches)
  49095. {
  49096. $this->matches = $matches;
  49097. $this->matched = (bool) $count;
  49098. $this->count = $count;
  49099. }
  49100. }
  49101. <?php
  49102. namespace Composer\Pcre;
  49103. final class MatchAllWithOffsetsResult
  49104. {
  49105. public $matches;
  49106. public $count;
  49107. public $matched;
  49108. public function __construct(int $count, array $matches)
  49109. {
  49110. $this->matches = $matches;
  49111. $this->matched = (bool) $count;
  49112. $this->count = $count;
  49113. }
  49114. }
  49115. <?php
  49116. namespace Composer\Pcre;
  49117. final class MatchResult
  49118. {
  49119. public $matches;
  49120. public $matched;
  49121. public function __construct(int $count, array $matches)
  49122. {
  49123. $this->matches = $matches;
  49124. $this->matched = (bool) $count;
  49125. }
  49126. }
  49127. <?php
  49128. namespace Composer\Pcre;
  49129. final class MatchStrictGroupsResult
  49130. {
  49131. public $matches;
  49132. public $matched;
  49133. public function __construct(int $count, array $matches)
  49134. {
  49135. $this->matches = $matches;
  49136. $this->matched = (bool) $count;
  49137. }
  49138. }
  49139. <?php
  49140. namespace Composer\Pcre;
  49141. final class MatchWithOffsetsResult
  49142. {
  49143. public $matches;
  49144. public $matched;
  49145. public function __construct(int $count, array $matches)
  49146. {
  49147. $this->matches = $matches;
  49148. $this->matched = (bool) $count;
  49149. }
  49150. }
  49151. <?php
  49152. namespace Composer\Pcre;
  49153. class PcreException extends \RuntimeException
  49154. {
  49155. public static function fromFunction($function, $pattern)
  49156. {
  49157. $code = preg_last_error();
  49158. if (is_array($pattern)) {
  49159. $pattern = implode(', ', $pattern);
  49160. }
  49161. return new PcreException($function.'(): failed executing "'.$pattern.'": '.self::pcreLastErrorMessage($code), $code);
  49162. }
  49163. private static function pcreLastErrorMessage($code)
  49164. {
  49165. if (function_exists('preg_last_error_msg')) {
  49166. return preg_last_error_msg();
  49167. }
  49168. if (PHP_VERSION_ID < 70201 && $code === 0) {
  49169. return 'UNDEFINED_ERROR';
  49170. }
  49171. $constants = get_defined_constants(true);
  49172. if (!isset($constants['pcre'])) {
  49173. return 'UNDEFINED_ERROR';
  49174. }
  49175. foreach ($constants['pcre'] as $const => $val) {
  49176. if ($val === $code && substr($const, -6) === '_ERROR') {
  49177. return $const;
  49178. }
  49179. }
  49180. return 'UNDEFINED_ERROR';
  49181. }
  49182. }
  49183. <?php
  49184. namespace Composer\Pcre;
  49185. class Preg
  49186. {
  49187. public const ARRAY_MSG = '$subject as an array is not supported. You can use \'foreach\' instead.';
  49188. public const INVALID_TYPE_MSG = '$subject must be a string, %s given.';
  49189. public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  49190. {
  49191. self::checkOffsetCapture($flags, 'matchWithOffsets');
  49192. $result = self::pregMatch($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
  49193. if ($result === false) {
  49194. throw PcreException::fromFunction('preg_match', $pattern);
  49195. }
  49196. return $result;
  49197. }
  49198. public static function matchStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  49199. {
  49200. $result = self::match($pattern, $subject, $matchesInternal, $flags, $offset);
  49201. $matches = self::enforceNonNullMatches($pattern, $matchesInternal, 'match');
  49202. return $result;
  49203. }
  49204. public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
  49205. {
  49206. $result = self::pregMatch($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
  49207. if ($result === false) {
  49208. throw PcreException::fromFunction('preg_match', $pattern);
  49209. }
  49210. return $result;
  49211. }
  49212. public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  49213. {
  49214. self::checkOffsetCapture($flags, 'matchAllWithOffsets');
  49215. self::checkSetOrder($flags);
  49216. $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
  49217. if (!is_int($result)) {
  49218. throw PcreException::fromFunction('preg_match_all', $pattern);
  49219. }
  49220. return $result;
  49221. }
  49222. public static function matchAllStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  49223. {
  49224. $result = self::matchAll($pattern, $subject, $matchesInternal, $flags, $offset);
  49225. $matches = self::enforceNonNullMatchAll($pattern, $matchesInternal, 'matchAll');
  49226. return $result;
  49227. }
  49228. public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
  49229. {
  49230. self::checkSetOrder($flags);
  49231. $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
  49232. if (!is_int($result)) {
  49233. throw PcreException::fromFunction('preg_match_all', $pattern);
  49234. }
  49235. return $result;
  49236. }
  49237. public static function replace($pattern, $replacement, $subject, int $limit = -1, int &$count = null): string
  49238. {
  49239. if (!is_scalar($subject)) {
  49240. if (is_array($subject)) {
  49241. throw new \InvalidArgumentException(static::ARRAY_MSG);
  49242. }
  49243. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  49244. }
  49245. $result = preg_replace($pattern, $replacement, $subject, $limit, $count);
  49246. if ($result === null) {
  49247. throw PcreException::fromFunction('preg_replace', $pattern);
  49248. }
  49249. return $result;
  49250. }
  49251. public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
  49252. {
  49253. if (!is_scalar($subject)) {
  49254. if (is_array($subject)) {
  49255. throw new \InvalidArgumentException(static::ARRAY_MSG);
  49256. }
  49257. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  49258. }
  49259. if (PHP_VERSION_ID >= 70400) {
  49260. $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count, $flags);
  49261. } else {
  49262. $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count);
  49263. }
  49264. if ($result === null) {
  49265. throw PcreException::fromFunction('preg_replace_callback', $pattern);
  49266. }
  49267. return $result;
  49268. }
  49269. public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
  49270. {
  49271. if (!is_scalar($subject)) {
  49272. if (is_array($subject)) {
  49273. throw new \InvalidArgumentException(static::ARRAY_MSG);
  49274. }
  49275. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  49276. }
  49277. if (PHP_VERSION_ID >= 70400) {
  49278. $result = preg_replace_callback_array($pattern, $subject, $limit, $count, $flags);
  49279. } else {
  49280. $result = preg_replace_callback_array($pattern, $subject, $limit, $count);
  49281. }
  49282. if ($result === null) {
  49283. $pattern = array_keys($pattern);
  49284. throw PcreException::fromFunction('preg_replace_callback_array', $pattern);
  49285. }
  49286. return $result;
  49287. }
  49288. public static function split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
  49289. {
  49290. if (($flags & PREG_SPLIT_OFFSET_CAPTURE) !== 0) {
  49291. throw new \InvalidArgumentException('PREG_SPLIT_OFFSET_CAPTURE is not supported as it changes the type of $matches, use splitWithOffsets() instead');
  49292. }
  49293. $result = preg_split($pattern, $subject, $limit, $flags);
  49294. if ($result === false) {
  49295. throw PcreException::fromFunction('preg_split', $pattern);
  49296. }
  49297. return $result;
  49298. }
  49299. public static function splitWithOffsets(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
  49300. {
  49301. $result = preg_split($pattern, $subject, $limit, $flags | PREG_SPLIT_OFFSET_CAPTURE);
  49302. if ($result === false) {
  49303. throw PcreException::fromFunction('preg_split', $pattern);
  49304. }
  49305. return $result;
  49306. }
  49307. public static function grep(string $pattern, array $array, int $flags = 0): array
  49308. {
  49309. $result = preg_grep($pattern, $array, $flags);
  49310. if ($result === false) {
  49311. throw PcreException::fromFunction('preg_grep', $pattern);
  49312. }
  49313. return $result;
  49314. }
  49315. public static function isMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  49316. {
  49317. return (bool) static::match($pattern, $subject, $matches, $flags, $offset);
  49318. }
  49319. public static function isMatchStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  49320. {
  49321. return (bool) self::matchStrictGroups($pattern, $subject, $matches, $flags, $offset);
  49322. }
  49323. public static function isMatchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  49324. {
  49325. return (bool) static::matchAll($pattern, $subject, $matches, $flags, $offset);
  49326. }
  49327. public static function isMatchAllStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  49328. {
  49329. return (bool) self::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset);
  49330. }
  49331. public static function isMatchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
  49332. {
  49333. return (bool) static::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
  49334. }
  49335. public static function isMatchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
  49336. {
  49337. return (bool) static::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
  49338. }
  49339. private static function checkOffsetCapture(int $flags, string $useFunctionName): void
  49340. {
  49341. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  49342. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use ' . $useFunctionName . '() instead');
  49343. }
  49344. }
  49345. private static function checkSetOrder(int $flags): void
  49346. {
  49347. if (($flags & PREG_SET_ORDER) !== 0) {
  49348. throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the type of $matches');
  49349. }
  49350. }
  49351. private static function enforceNonNullMatches(string $pattern, array $matches, string $variantMethod)
  49352. {
  49353. foreach ($matches as $group => $match) {
  49354. if (null === $match) {
  49355. throw new UnexpectedNullMatchException('Pattern "'.$pattern.'" had an unexpected unmatched group "'.$group.'", make sure the pattern always matches or use '.$variantMethod.'() instead.');
  49356. }
  49357. }
  49358. return $matches;
  49359. }
  49360. private static function enforceNonNullMatchAll(string $pattern, array $matches, string $variantMethod)
  49361. {
  49362. foreach ($matches as $group => $groupMatches) {
  49363. foreach ($groupMatches as $match) {
  49364. if (null === $match) {
  49365. throw new UnexpectedNullMatchException('Pattern "'.$pattern.'" had an unexpected unmatched group "'.$group.'", make sure the pattern always matches or use '.$variantMethod.'() instead.');
  49366. }
  49367. }
  49368. }
  49369. return $matches;
  49370. }
  49371. private static function pregMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0)
  49372. {
  49373. if (PHP_VERSION_ID >= 70400) {
  49374. return preg_match($pattern, $subject, $matches, $flags, $offset);
  49375. }
  49376. $result = preg_match_all($pattern, $subject, $matchesInternal, $flags, $offset);
  49377. if (!is_int($result)) {
  49378. throw PcreException::fromFunction('preg_match', $pattern);
  49379. }
  49380. if ($result === 0) {
  49381. $matches = [];
  49382. } else {
  49383. $matches = array_map(function ($m) { return reset($m); }, $matchesInternal);
  49384. $result = min($result, 1);
  49385. }
  49386. return $result;
  49387. }
  49388. }
  49389. <?php
  49390. namespace Composer\Pcre;
  49391. class Regex
  49392. {
  49393. public static function isMatch(string $pattern, string $subject, int $offset = 0): bool
  49394. {
  49395. return (bool) Preg::match($pattern, $subject, $matches, 0, $offset);
  49396. }
  49397. public static function match(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchResult
  49398. {
  49399. self::checkOffsetCapture($flags, 'matchWithOffsets');
  49400. $count = Preg::match($pattern, $subject, $matches, $flags, $offset);
  49401. return new MatchResult($count, $matches);
  49402. }
  49403. public static function matchStrictGroups(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchStrictGroupsResult
  49404. {
  49405. $count = Preg::matchStrictGroups($pattern, $subject, $matches, $flags, $offset);
  49406. return new MatchStrictGroupsResult($count, $matches);
  49407. }
  49408. public static function matchWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchWithOffsetsResult
  49409. {
  49410. $count = Preg::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
  49411. return new MatchWithOffsetsResult($count, $matches);
  49412. }
  49413. public static function matchAll(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllResult
  49414. {
  49415. self::checkOffsetCapture($flags, 'matchAllWithOffsets');
  49416. self::checkSetOrder($flags);
  49417. $count = Preg::matchAll($pattern, $subject, $matches, $flags, $offset);
  49418. return new MatchAllResult($count, $matches);
  49419. }
  49420. public static function matchAllStrictGroups(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllStrictGroupsResult
  49421. {
  49422. self::checkOffsetCapture($flags, 'matchAllWithOffsets');
  49423. self::checkSetOrder($flags);
  49424. $count = Preg::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset);
  49425. return new MatchAllStrictGroupsResult($count, $matches);
  49426. }
  49427. public static function matchAllWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllWithOffsetsResult
  49428. {
  49429. self::checkSetOrder($flags);
  49430. $count = Preg::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
  49431. return new MatchAllWithOffsetsResult($count, $matches);
  49432. }
  49433. public static function replace($pattern, $replacement, $subject, int $limit = -1): ReplaceResult
  49434. {
  49435. $result = Preg::replace($pattern, $replacement, $subject, $limit, $count);
  49436. return new ReplaceResult($count, $result);
  49437. }
  49438. public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0): ReplaceResult
  49439. {
  49440. $result = Preg::replaceCallback($pattern, $replacement, $subject, $limit, $count, $flags);
  49441. return new ReplaceResult($count, $result);
  49442. }
  49443. public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int $flags = 0): ReplaceResult
  49444. {
  49445. $result = Preg::replaceCallbackArray($pattern, $subject, $limit, $count, $flags);
  49446. return new ReplaceResult($count, $result);
  49447. }
  49448. private static function checkOffsetCapture(int $flags, string $useFunctionName): void
  49449. {
  49450. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  49451. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use '.$useFunctionName.'() instead');
  49452. }
  49453. }
  49454. private static function checkSetOrder(int $flags): void
  49455. {
  49456. if (($flags & PREG_SET_ORDER) !== 0) {
  49457. throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the return type');
  49458. }
  49459. }
  49460. }
  49461. <?php
  49462. namespace Composer\Pcre;
  49463. final class ReplaceResult
  49464. {
  49465. public $result;
  49466. public $count;
  49467. public $matched;
  49468. public function __construct(int $count, string $result)
  49469. {
  49470. $this->count = $count;
  49471. $this->matched = (bool) $count;
  49472. $this->result = $result;
  49473. }
  49474. }
  49475. <?php
  49476. namespace Composer\Pcre;
  49477. class UnexpectedNullMatchException extends PcreException
  49478. {
  49479. public static function fromFunction($function, $pattern)
  49480. {
  49481. throw new \LogicException('fromFunction should not be called on '.self::class.', use '.PcreException::class);
  49482. }
  49483. }
  49484. Copyright (C) 2015 Composer
  49485. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49486. this software and associated documentation files (the "Software"), to deal in
  49487. the Software without restriction, including without limitation the rights to
  49488. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49489. of the Software, and to permit persons to whom the Software is furnished to do
  49490. so, subject to the following conditions:
  49491. The above copyright notice and this permission notice shall be included in all
  49492. copies or substantial portions of the Software.
  49493. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49494. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49495. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49496. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49497. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49498. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49499. SOFTWARE.
  49500. <?php
  49501. namespace Composer\Semver;
  49502. use Composer\Semver\Constraint\Constraint;
  49503. class Comparator
  49504. {
  49505. public static function greaterThan($version1, $version2)
  49506. {
  49507. return self::compare($version1, '>', $version2);
  49508. }
  49509. public static function greaterThanOrEqualTo($version1, $version2)
  49510. {
  49511. return self::compare($version1, '>=', $version2);
  49512. }
  49513. public static function lessThan($version1, $version2)
  49514. {
  49515. return self::compare($version1, '<', $version2);
  49516. }
  49517. public static function lessThanOrEqualTo($version1, $version2)
  49518. {
  49519. return self::compare($version1, '<=', $version2);
  49520. }
  49521. public static function equalTo($version1, $version2)
  49522. {
  49523. return self::compare($version1, '==', $version2);
  49524. }
  49525. public static function notEqualTo($version1, $version2)
  49526. {
  49527. return self::compare($version1, '!=', $version2);
  49528. }
  49529. public static function compare($version1, $operator, $version2)
  49530. {
  49531. $constraint = new Constraint($operator, $version2);
  49532. return $constraint->matchSpecific(new Constraint('==', $version1), true);
  49533. }
  49534. }
  49535. <?php
  49536. namespace Composer\Semver;
  49537. use Composer\Semver\Constraint\Constraint;
  49538. use Composer\Semver\Constraint\ConstraintInterface;
  49539. class CompilingMatcher
  49540. {
  49541. private static $compiledCheckerCache = array();
  49542. private static $resultCache = array();
  49543. private static $enabled;
  49544. private static $transOpInt = array(
  49545. Constraint::OP_EQ => Constraint::STR_OP_EQ,
  49546. Constraint::OP_LT => Constraint::STR_OP_LT,
  49547. Constraint::OP_LE => Constraint::STR_OP_LE,
  49548. Constraint::OP_GT => Constraint::STR_OP_GT,
  49549. Constraint::OP_GE => Constraint::STR_OP_GE,
  49550. Constraint::OP_NE => Constraint::STR_OP_NE,
  49551. );
  49552. public static function clear()
  49553. {
  49554. self::$resultCache = array();
  49555. self::$compiledCheckerCache = array();
  49556. }
  49557. public static function match(ConstraintInterface $constraint, $operator, $version)
  49558. {
  49559. $resultCacheKey = $operator.$constraint.';'.$version;
  49560. if (isset(self::$resultCache[$resultCacheKey])) {
  49561. return self::$resultCache[$resultCacheKey];
  49562. }
  49563. if (self::$enabled === null) {
  49564. self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true);
  49565. }
  49566. if (!self::$enabled) {
  49567. return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version));
  49568. }
  49569. $cacheKey = $operator.$constraint;
  49570. if (!isset(self::$compiledCheckerCache[$cacheKey])) {
  49571. $code = $constraint->compile($operator);
  49572. self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};');
  49573. } else {
  49574. $function = self::$compiledCheckerCache[$cacheKey];
  49575. }
  49576. return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0);
  49577. }
  49578. }
  49579. <?php
  49580. namespace Composer\Semver\Constraint;
  49581. class Bound
  49582. {
  49583. private $version;
  49584. private $isInclusive;
  49585. public function __construct($version, $isInclusive)
  49586. {
  49587. $this->version = $version;
  49588. $this->isInclusive = $isInclusive;
  49589. }
  49590. public function getVersion()
  49591. {
  49592. return $this->version;
  49593. }
  49594. public function isInclusive()
  49595. {
  49596. return $this->isInclusive;
  49597. }
  49598. public function isZero()
  49599. {
  49600. return $this->getVersion() === '0.0.0.0-dev' && $this->isInclusive();
  49601. }
  49602. public function isPositiveInfinity()
  49603. {
  49604. return $this->getVersion() === PHP_INT_MAX.'.0.0.0' && !$this->isInclusive();
  49605. }
  49606. public function compareTo(Bound $other, $operator)
  49607. {
  49608. if (!\in_array($operator, array('<', '>'), true)) {
  49609. throw new \InvalidArgumentException('Does not support any other operator other than > or <.');
  49610. }
  49611. if ($this == $other) {
  49612. return false;
  49613. }
  49614. $compareResult = version_compare($this->getVersion(), $other->getVersion());
  49615. if (0 !== $compareResult) {
  49616. return (('>' === $operator) ? 1 : -1) === $compareResult;
  49617. }
  49618. return '>' === $operator ? $other->isInclusive() : !$other->isInclusive();
  49619. }
  49620. public function __toString()
  49621. {
  49622. return sprintf(
  49623. '%s [%s]',
  49624. $this->getVersion(),
  49625. $this->isInclusive() ? 'inclusive' : 'exclusive'
  49626. );
  49627. }
  49628. public static function zero()
  49629. {
  49630. return new Bound('0.0.0.0-dev', true);
  49631. }
  49632. public static function positiveInfinity()
  49633. {
  49634. return new Bound(PHP_INT_MAX.'.0.0.0', false);
  49635. }
  49636. }
  49637. <?php
  49638. namespace Composer\Semver\Constraint;
  49639. class Constraint implements ConstraintInterface
  49640. {
  49641. const OP_EQ = 0;
  49642. const OP_LT = 1;
  49643. const OP_LE = 2;
  49644. const OP_GT = 3;
  49645. const OP_GE = 4;
  49646. const OP_NE = 5;
  49647. const STR_OP_EQ = '==';
  49648. const STR_OP_EQ_ALT = '=';
  49649. const STR_OP_LT = '<';
  49650. const STR_OP_LE = '<=';
  49651. const STR_OP_GT = '>';
  49652. const STR_OP_GE = '>=';
  49653. const STR_OP_NE = '!=';
  49654. const STR_OP_NE_ALT = '<>';
  49655. private static $transOpStr = array(
  49656. '=' => self::OP_EQ,
  49657. '==' => self::OP_EQ,
  49658. '<' => self::OP_LT,
  49659. '<=' => self::OP_LE,
  49660. '>' => self::OP_GT,
  49661. '>=' => self::OP_GE,
  49662. '<>' => self::OP_NE,
  49663. '!=' => self::OP_NE,
  49664. );
  49665. private static $transOpInt = array(
  49666. self::OP_EQ => '==',
  49667. self::OP_LT => '<',
  49668. self::OP_LE => '<=',
  49669. self::OP_GT => '>',
  49670. self::OP_GE => '>=',
  49671. self::OP_NE => '!=',
  49672. );
  49673. protected $operator;
  49674. protected $version;
  49675. protected $prettyString;
  49676. protected $lowerBound;
  49677. protected $upperBound;
  49678. public function __construct($operator, $version)
  49679. {
  49680. if (!isset(self::$transOpStr[$operator])) {
  49681. throw new \InvalidArgumentException(sprintf(
  49682. 'Invalid operator "%s" given, expected one of: %s',
  49683. $operator,
  49684. implode(', ', self::getSupportedOperators())
  49685. ));
  49686. }
  49687. $this->operator = self::$transOpStr[$operator];
  49688. $this->version = $version;
  49689. }
  49690. public function getVersion()
  49691. {
  49692. return $this->version;
  49693. }
  49694. public function getOperator()
  49695. {
  49696. return self::$transOpInt[$this->operator];
  49697. }
  49698. public function matches(ConstraintInterface $provider)
  49699. {
  49700. if ($provider instanceof self) {
  49701. return $this->matchSpecific($provider);
  49702. }
  49703. return $provider->matches($this);
  49704. }
  49705. public function setPrettyString($prettyString)
  49706. {
  49707. $this->prettyString = $prettyString;
  49708. }
  49709. public function getPrettyString()
  49710. {
  49711. if ($this->prettyString) {
  49712. return $this->prettyString;
  49713. }
  49714. return $this->__toString();
  49715. }
  49716. public static function getSupportedOperators()
  49717. {
  49718. return array_keys(self::$transOpStr);
  49719. }
  49720. public static function getOperatorConstant($operator)
  49721. {
  49722. return self::$transOpStr[$operator];
  49723. }
  49724. public function versionCompare($a, $b, $operator, $compareBranches = false)
  49725. {
  49726. if (!isset(self::$transOpStr[$operator])) {
  49727. throw new \InvalidArgumentException(sprintf(
  49728. 'Invalid operator "%s" given, expected one of: %s',
  49729. $operator,
  49730. implode(', ', self::getSupportedOperators())
  49731. ));
  49732. }
  49733. $aIsBranch = strpos($a, 'dev-') === 0;
  49734. $bIsBranch = strpos($b, 'dev-') === 0;
  49735. if ($operator === '!=' && ($aIsBranch || $bIsBranch)) {
  49736. return $a !== $b;
  49737. }
  49738. if ($aIsBranch && $bIsBranch) {
  49739. return $operator === '==' && $a === $b;
  49740. }
  49741. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  49742. return false;
  49743. }
  49744. return \version_compare($a, $b, $operator);
  49745. }
  49746. public function compile($otherOperator)
  49747. {
  49748. if (strpos($this->version, 'dev-') === 0) {
  49749. if (self::OP_EQ === $this->operator) {
  49750. if (self::OP_EQ === $otherOperator) {
  49751. return sprintf('$b && $v === %s', \var_export($this->version, true));
  49752. }
  49753. if (self::OP_NE === $otherOperator) {
  49754. return sprintf('!$b || $v !== %s', \var_export($this->version, true));
  49755. }
  49756. return 'false';
  49757. }
  49758. if (self::OP_NE === $this->operator) {
  49759. if (self::OP_EQ === $otherOperator) {
  49760. return sprintf('!$b || $v !== %s', \var_export($this->version, true));
  49761. }
  49762. if (self::OP_NE === $otherOperator) {
  49763. return 'true';
  49764. }
  49765. return '!$b';
  49766. }
  49767. return 'false';
  49768. }
  49769. if (self::OP_EQ === $this->operator) {
  49770. if (self::OP_EQ === $otherOperator) {
  49771. return sprintf('\version_compare($v, %s, \'==\')', \var_export($this->version, true));
  49772. }
  49773. if (self::OP_NE === $otherOperator) {
  49774. return sprintf('$b || \version_compare($v, %s, \'!=\')', \var_export($this->version, true));
  49775. }
  49776. return sprintf('!$b && \version_compare(%s, $v, \'%s\')', \var_export($this->version, true), self::$transOpInt[$otherOperator]);
  49777. }
  49778. if (self::OP_NE === $this->operator) {
  49779. if (self::OP_EQ === $otherOperator) {
  49780. return sprintf('$b || (!$b && \version_compare($v, %s, \'!=\'))', \var_export($this->version, true));
  49781. }
  49782. if (self::OP_NE === $otherOperator) {
  49783. return 'true';
  49784. }
  49785. return '!$b';
  49786. }
  49787. if (self::OP_LT === $this->operator || self::OP_LE === $this->operator) {
  49788. if (self::OP_LT === $otherOperator || self::OP_LE === $otherOperator) {
  49789. return '!$b';
  49790. }
  49791. } else {
  49792. if (self::OP_GT === $otherOperator || self::OP_GE === $otherOperator) {
  49793. return '!$b';
  49794. }
  49795. }
  49796. if (self::OP_NE === $otherOperator) {
  49797. return 'true';
  49798. }
  49799. $codeComparison = sprintf('\version_compare($v, %s, \'%s\')', \var_export($this->version, true), self::$transOpInt[$this->operator]);
  49800. if ($this->operator === self::OP_LE) {
  49801. if ($otherOperator === self::OP_GT) {
  49802. return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
  49803. }
  49804. } elseif ($this->operator === self::OP_GE) {
  49805. if ($otherOperator === self::OP_LT) {
  49806. return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
  49807. }
  49808. }
  49809. return sprintf('!$b && %s', $codeComparison);
  49810. }
  49811. public function matchSpecific(Constraint $provider, $compareBranches = false)
  49812. {
  49813. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  49814. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  49815. $isEqualOp = self::OP_EQ === $this->operator;
  49816. $isNonEqualOp = self::OP_NE === $this->operator;
  49817. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  49818. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  49819. if ($isNonEqualOp || $isProviderNonEqualOp) {
  49820. if ($isNonEqualOp && !$isProviderNonEqualOp && !$isProviderEqualOp && strpos($provider->version, 'dev-') === 0) {
  49821. return false;
  49822. }
  49823. if ($isProviderNonEqualOp && !$isNonEqualOp && !$isEqualOp && strpos($this->version, 'dev-') === 0) {
  49824. return false;
  49825. }
  49826. if (!$isEqualOp && !$isProviderEqualOp) {
  49827. return true;
  49828. }
  49829. return $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  49830. }
  49831. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  49832. return !(strpos($this->version, 'dev-') === 0 || strpos($provider->version, 'dev-') === 0);
  49833. }
  49834. $version1 = $isEqualOp ? $this->version : $provider->version;
  49835. $version2 = $isEqualOp ? $provider->version : $this->version;
  49836. $operator = $isEqualOp ? $provider->operator : $this->operator;
  49837. if ($this->versionCompare($version1, $version2, self::$transOpInt[$operator], $compareBranches)) {
  49838. return !(self::$transOpInt[$provider->operator] === $providerNoEqualOp
  49839. && self::$transOpInt[$this->operator] !== $noEqualOp
  49840. && \version_compare($provider->version, $this->version, '=='));
  49841. }
  49842. return false;
  49843. }
  49844. public function __toString()
  49845. {
  49846. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  49847. }
  49848. public function getLowerBound()
  49849. {
  49850. $this->extractBounds();
  49851. return $this->lowerBound;
  49852. }
  49853. public function getUpperBound()
  49854. {
  49855. $this->extractBounds();
  49856. return $this->upperBound;
  49857. }
  49858. private function extractBounds()
  49859. {
  49860. if (null !== $this->lowerBound) {
  49861. return;
  49862. }
  49863. if (strpos($this->version, 'dev-') === 0) {
  49864. $this->lowerBound = Bound::zero();
  49865. $this->upperBound = Bound::positiveInfinity();
  49866. return;
  49867. }
  49868. switch ($this->operator) {
  49869. case self::OP_EQ:
  49870. $this->lowerBound = new Bound($this->version, true);
  49871. $this->upperBound = new Bound($this->version, true);
  49872. break;
  49873. case self::OP_LT:
  49874. $this->lowerBound = Bound::zero();
  49875. $this->upperBound = new Bound($this->version, false);
  49876. break;
  49877. case self::OP_LE:
  49878. $this->lowerBound = Bound::zero();
  49879. $this->upperBound = new Bound($this->version, true);
  49880. break;
  49881. case self::OP_GT:
  49882. $this->lowerBound = new Bound($this->version, false);
  49883. $this->upperBound = Bound::positiveInfinity();
  49884. break;
  49885. case self::OP_GE:
  49886. $this->lowerBound = new Bound($this->version, true);
  49887. $this->upperBound = Bound::positiveInfinity();
  49888. break;
  49889. case self::OP_NE:
  49890. $this->lowerBound = Bound::zero();
  49891. $this->upperBound = Bound::positiveInfinity();
  49892. break;
  49893. }
  49894. }
  49895. }
  49896. <?php
  49897. namespace Composer\Semver\Constraint;
  49898. interface ConstraintInterface
  49899. {
  49900. public function matches(ConstraintInterface $provider);
  49901. public function compile($otherOperator);
  49902. public function getUpperBound();
  49903. public function getLowerBound();
  49904. public function getPrettyString();
  49905. public function setPrettyString($prettyString);
  49906. public function __toString();
  49907. }
  49908. <?php
  49909. namespace Composer\Semver\Constraint;
  49910. class MatchAllConstraint implements ConstraintInterface
  49911. {
  49912. protected $prettyString;
  49913. public function matches(ConstraintInterface $provider)
  49914. {
  49915. return true;
  49916. }
  49917. public function compile($otherOperator)
  49918. {
  49919. return 'true';
  49920. }
  49921. public function setPrettyString($prettyString)
  49922. {
  49923. $this->prettyString = $prettyString;
  49924. }
  49925. public function getPrettyString()
  49926. {
  49927. if ($this->prettyString) {
  49928. return $this->prettyString;
  49929. }
  49930. return (string) $this;
  49931. }
  49932. public function __toString()
  49933. {
  49934. return '*';
  49935. }
  49936. public function getUpperBound()
  49937. {
  49938. return Bound::positiveInfinity();
  49939. }
  49940. public function getLowerBound()
  49941. {
  49942. return Bound::zero();
  49943. }
  49944. }
  49945. <?php
  49946. namespace Composer\Semver\Constraint;
  49947. class MatchNoneConstraint implements ConstraintInterface
  49948. {
  49949. protected $prettyString;
  49950. public function matches(ConstraintInterface $provider)
  49951. {
  49952. return false;
  49953. }
  49954. public function compile($otherOperator)
  49955. {
  49956. return 'false';
  49957. }
  49958. public function setPrettyString($prettyString)
  49959. {
  49960. $this->prettyString = $prettyString;
  49961. }
  49962. public function getPrettyString()
  49963. {
  49964. if ($this->prettyString) {
  49965. return $this->prettyString;
  49966. }
  49967. return (string) $this;
  49968. }
  49969. public function __toString()
  49970. {
  49971. return '[]';
  49972. }
  49973. public function getUpperBound()
  49974. {
  49975. return new Bound('0.0.0.0-dev', false);
  49976. }
  49977. public function getLowerBound()
  49978. {
  49979. return new Bound('0.0.0.0-dev', false);
  49980. }
  49981. }
  49982. <?php
  49983. namespace Composer\Semver\Constraint;
  49984. class MultiConstraint implements ConstraintInterface
  49985. {
  49986. protected $constraints;
  49987. protected $prettyString;
  49988. protected $string;
  49989. protected $conjunctive;
  49990. protected $lowerBound;
  49991. protected $upperBound;
  49992. public function __construct(array $constraints, $conjunctive = true)
  49993. {
  49994. if (\count($constraints) < 2) {
  49995. throw new \InvalidArgumentException(
  49996. 'Must provide at least two constraints for a MultiConstraint. Use '.
  49997. 'the regular Constraint class for one constraint only or MatchAllConstraint for none. You may use '.
  49998. 'MultiConstraint::create() which optimizes and handles those cases automatically.'
  49999. );
  50000. }
  50001. $this->constraints = $constraints;
  50002. $this->conjunctive = $conjunctive;
  50003. }
  50004. public function getConstraints()
  50005. {
  50006. return $this->constraints;
  50007. }
  50008. public function isConjunctive()
  50009. {
  50010. return $this->conjunctive;
  50011. }
  50012. public function isDisjunctive()
  50013. {
  50014. return !$this->conjunctive;
  50015. }
  50016. public function compile($otherOperator)
  50017. {
  50018. $parts = array();
  50019. foreach ($this->constraints as $constraint) {
  50020. $code = $constraint->compile($otherOperator);
  50021. if ($code === 'true') {
  50022. if (!$this->conjunctive) {
  50023. return 'true';
  50024. }
  50025. } elseif ($code === 'false') {
  50026. if ($this->conjunctive) {
  50027. return 'false';
  50028. }
  50029. } else {
  50030. $parts[] = '('.$code.')';
  50031. }
  50032. }
  50033. if (!$parts) {
  50034. return $this->conjunctive ? 'true' : 'false';
  50035. }
  50036. return $this->conjunctive ? implode('&&', $parts) : implode('||', $parts);
  50037. }
  50038. public function matches(ConstraintInterface $provider)
  50039. {
  50040. if (false === $this->conjunctive) {
  50041. foreach ($this->constraints as $constraint) {
  50042. if ($provider->matches($constraint)) {
  50043. return true;
  50044. }
  50045. }
  50046. return false;
  50047. }
  50048. if ($provider instanceof MultiConstraint && $provider->isDisjunctive()) {
  50049. return $provider->matches($this);
  50050. }
  50051. foreach ($this->constraints as $constraint) {
  50052. if (!$provider->matches($constraint)) {
  50053. return false;
  50054. }
  50055. }
  50056. return true;
  50057. }
  50058. public function setPrettyString($prettyString)
  50059. {
  50060. $this->prettyString = $prettyString;
  50061. }
  50062. public function getPrettyString()
  50063. {
  50064. if ($this->prettyString) {
  50065. return $this->prettyString;
  50066. }
  50067. return (string) $this;
  50068. }
  50069. public function __toString()
  50070. {
  50071. if ($this->string !== null) {
  50072. return $this->string;
  50073. }
  50074. $constraints = array();
  50075. foreach ($this->constraints as $constraint) {
  50076. $constraints[] = (string) $constraint;
  50077. }
  50078. return $this->string = '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  50079. }
  50080. public function getLowerBound()
  50081. {
  50082. $this->extractBounds();
  50083. if (null === $this->lowerBound) {
  50084. throw new \LogicException('extractBounds should have populated the lowerBound property');
  50085. }
  50086. return $this->lowerBound;
  50087. }
  50088. public function getUpperBound()
  50089. {
  50090. $this->extractBounds();
  50091. if (null === $this->upperBound) {
  50092. throw new \LogicException('extractBounds should have populated the upperBound property');
  50093. }
  50094. return $this->upperBound;
  50095. }
  50096. public static function create(array $constraints, $conjunctive = true)
  50097. {
  50098. if (0 === \count($constraints)) {
  50099. return new MatchAllConstraint();
  50100. }
  50101. if (1 === \count($constraints)) {
  50102. return $constraints[0];
  50103. }
  50104. $optimized = self::optimizeConstraints($constraints, $conjunctive);
  50105. if ($optimized !== null) {
  50106. list($constraints, $conjunctive) = $optimized;
  50107. if (\count($constraints) === 1) {
  50108. return $constraints[0];
  50109. }
  50110. }
  50111. return new self($constraints, $conjunctive);
  50112. }
  50113. private static function optimizeConstraints(array $constraints, $conjunctive)
  50114. {
  50115. if (!$conjunctive) {
  50116. $left = $constraints[0];
  50117. $mergedConstraints = array();
  50118. $optimized = false;
  50119. for ($i = 1, $l = \count($constraints); $i < $l; $i++) {
  50120. $right = $constraints[$i];
  50121. if (
  50122. $left instanceof self
  50123. && $left->conjunctive
  50124. && $right instanceof self
  50125. && $right->conjunctive
  50126. && \count($left->constraints) === 2
  50127. && \count($right->constraints) === 2
  50128. && ($left0 = (string) $left->constraints[0])
  50129. && $left0[0] === '>' && $left0[1] === '='
  50130. && ($left1 = (string) $left->constraints[1])
  50131. && $left1[0] === '<'
  50132. && ($right0 = (string) $right->constraints[0])
  50133. && $right0[0] === '>' && $right0[1] === '='
  50134. && ($right1 = (string) $right->constraints[1])
  50135. && $right1[0] === '<'
  50136. && substr($left1, 2) === substr($right0, 3)
  50137. ) {
  50138. $optimized = true;
  50139. $left = new MultiConstraint(
  50140. array(
  50141. $left->constraints[0],
  50142. $right->constraints[1],
  50143. ),
  50144. true);
  50145. } else {
  50146. $mergedConstraints[] = $left;
  50147. $left = $right;
  50148. }
  50149. }
  50150. if ($optimized) {
  50151. $mergedConstraints[] = $left;
  50152. return array($mergedConstraints, false);
  50153. }
  50154. }
  50155. return null;
  50156. }
  50157. private function extractBounds()
  50158. {
  50159. if (null !== $this->lowerBound) {
  50160. return;
  50161. }
  50162. foreach ($this->constraints as $constraint) {
  50163. if (null === $this->lowerBound || null === $this->upperBound) {
  50164. $this->lowerBound = $constraint->getLowerBound();
  50165. $this->upperBound = $constraint->getUpperBound();
  50166. continue;
  50167. }
  50168. if ($constraint->getLowerBound()->compareTo($this->lowerBound, $this->isConjunctive() ? '>' : '<')) {
  50169. $this->lowerBound = $constraint->getLowerBound();
  50170. }
  50171. if ($constraint->getUpperBound()->compareTo($this->upperBound, $this->isConjunctive() ? '<' : '>')) {
  50172. $this->upperBound = $constraint->getUpperBound();
  50173. }
  50174. }
  50175. }
  50176. }
  50177. <?php
  50178. namespace Composer\Semver;
  50179. use Composer\Semver\Constraint\Constraint;
  50180. class Interval
  50181. {
  50182. private $start;
  50183. private $end;
  50184. public function __construct(Constraint $start, Constraint $end)
  50185. {
  50186. $this->start = $start;
  50187. $this->end = $end;
  50188. }
  50189. public function getStart()
  50190. {
  50191. return $this->start;
  50192. }
  50193. public function getEnd()
  50194. {
  50195. return $this->end;
  50196. }
  50197. public static function fromZero()
  50198. {
  50199. static $zero;
  50200. if (null === $zero) {
  50201. $zero = new Constraint('>=', '0.0.0.0-dev');
  50202. }
  50203. return $zero;
  50204. }
  50205. public static function untilPositiveInfinity()
  50206. {
  50207. static $positiveInfinity;
  50208. if (null === $positiveInfinity) {
  50209. $positiveInfinity = new Constraint('<', PHP_INT_MAX.'.0.0.0');
  50210. }
  50211. return $positiveInfinity;
  50212. }
  50213. public static function any()
  50214. {
  50215. return new self(self::fromZero(), self::untilPositiveInfinity());
  50216. }
  50217. public static function anyDev()
  50218. {
  50219. return array('names' => array(), 'exclude' => true);
  50220. }
  50221. public static function noDev()
  50222. {
  50223. return array('names' => array(), 'exclude' => false);
  50224. }
  50225. }
  50226. <?php
  50227. namespace Composer\Semver;
  50228. use Composer\Semver\Constraint\Constraint;
  50229. use Composer\Semver\Constraint\ConstraintInterface;
  50230. use Composer\Semver\Constraint\MatchAllConstraint;
  50231. use Composer\Semver\Constraint\MatchNoneConstraint;
  50232. use Composer\Semver\Constraint\MultiConstraint;
  50233. class Intervals
  50234. {
  50235. private static $intervalsCache = array();
  50236. private static $opSortOrder = array(
  50237. '>=' => -3,
  50238. '<' => -2,
  50239. '>' => 2,
  50240. '<=' => 3,
  50241. );
  50242. public static function clear()
  50243. {
  50244. self::$intervalsCache = array();
  50245. }
  50246. public static function isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint)
  50247. {
  50248. if ($constraint instanceof MatchAllConstraint) {
  50249. return true;
  50250. }
  50251. if ($candidate instanceof MatchNoneConstraint || $constraint instanceof MatchNoneConstraint) {
  50252. return false;
  50253. }
  50254. $intersectionIntervals = self::get(new MultiConstraint(array($candidate, $constraint), true));
  50255. $candidateIntervals = self::get($candidate);
  50256. if (\count($intersectionIntervals['numeric']) !== \count($candidateIntervals['numeric'])) {
  50257. return false;
  50258. }
  50259. foreach ($intersectionIntervals['numeric'] as $index => $interval) {
  50260. if (!isset($candidateIntervals['numeric'][$index])) {
  50261. return false;
  50262. }
  50263. if ((string) $candidateIntervals['numeric'][$index]->getStart() !== (string) $interval->getStart()) {
  50264. return false;
  50265. }
  50266. if ((string) $candidateIntervals['numeric'][$index]->getEnd() !== (string) $interval->getEnd()) {
  50267. return false;
  50268. }
  50269. }
  50270. if ($intersectionIntervals['branches']['exclude'] !== $candidateIntervals['branches']['exclude']) {
  50271. return false;
  50272. }
  50273. if (\count($intersectionIntervals['branches']['names']) !== \count($candidateIntervals['branches']['names'])) {
  50274. return false;
  50275. }
  50276. foreach ($intersectionIntervals['branches']['names'] as $index => $name) {
  50277. if ($name !== $candidateIntervals['branches']['names'][$index]) {
  50278. return false;
  50279. }
  50280. }
  50281. return true;
  50282. }
  50283. public static function haveIntersections(ConstraintInterface $a, ConstraintInterface $b)
  50284. {
  50285. if ($a instanceof MatchAllConstraint || $b instanceof MatchAllConstraint) {
  50286. return true;
  50287. }
  50288. if ($a instanceof MatchNoneConstraint || $b instanceof MatchNoneConstraint) {
  50289. return false;
  50290. }
  50291. $intersectionIntervals = self::generateIntervals(new MultiConstraint(array($a, $b), true), true);
  50292. return \count($intersectionIntervals['numeric']) > 0 || $intersectionIntervals['branches']['exclude'] || \count($intersectionIntervals['branches']['names']) > 0;
  50293. }
  50294. public static function compactConstraint(ConstraintInterface $constraint)
  50295. {
  50296. if (!$constraint instanceof MultiConstraint) {
  50297. return $constraint;
  50298. }
  50299. $intervals = self::generateIntervals($constraint);
  50300. $constraints = array();
  50301. $hasNumericMatchAll = false;
  50302. if (\count($intervals['numeric']) === 1 && (string) $intervals['numeric'][0]->getStart() === (string) Interval::fromZero() && (string) $intervals['numeric'][0]->getEnd() === (string) Interval::untilPositiveInfinity()) {
  50303. $constraints[] = $intervals['numeric'][0]->getStart();
  50304. $hasNumericMatchAll = true;
  50305. } else {
  50306. $unEqualConstraints = array();
  50307. for ($i = 0, $count = \count($intervals['numeric']); $i < $count; $i++) {
  50308. $interval = $intervals['numeric'][$i];
  50309. if ($interval->getEnd()->getOperator() === '<' && $i+1 < $count) {
  50310. $nextInterval = $intervals['numeric'][$i+1];
  50311. if ($interval->getEnd()->getVersion() === $nextInterval->getStart()->getVersion() && $nextInterval->getStart()->getOperator() === '>') {
  50312. if (\count($unEqualConstraints) === 0 && (string) $interval->getStart() !== (string) Interval::fromZero()) {
  50313. $unEqualConstraints[] = $interval->getStart();
  50314. }
  50315. $unEqualConstraints[] = new Constraint('!=', $interval->getEnd()->getVersion());
  50316. continue;
  50317. }
  50318. }
  50319. if (\count($unEqualConstraints) > 0) {
  50320. if ((string) $interval->getEnd() !== (string) Interval::untilPositiveInfinity()) {
  50321. $unEqualConstraints[] = $interval->getEnd();
  50322. }
  50323. if (\count($unEqualConstraints) > 1) {
  50324. $constraints[] = new MultiConstraint($unEqualConstraints, true);
  50325. } else {
  50326. $constraints[] = $unEqualConstraints[0];
  50327. }
  50328. $unEqualConstraints = array();
  50329. continue;
  50330. }
  50331. if ($interval->getStart()->getVersion() === $interval->getEnd()->getVersion() && $interval->getStart()->getOperator() === '>=' && $interval->getEnd()->getOperator() === '<=') {
  50332. $constraints[] = new Constraint('==', $interval->getStart()->getVersion());
  50333. continue;
  50334. }
  50335. if ((string) $interval->getStart() === (string) Interval::fromZero()) {
  50336. $constraints[] = $interval->getEnd();
  50337. } elseif ((string) $interval->getEnd() === (string) Interval::untilPositiveInfinity()) {
  50338. $constraints[] = $interval->getStart();
  50339. } else {
  50340. $constraints[] = new MultiConstraint(array($interval->getStart(), $interval->getEnd()), true);
  50341. }
  50342. }
  50343. }
  50344. $devConstraints = array();
  50345. if (0 === \count($intervals['branches']['names'])) {
  50346. if ($intervals['branches']['exclude']) {
  50347. if ($hasNumericMatchAll) {
  50348. return new MatchAllConstraint;
  50349. }
  50350. }
  50351. } else {
  50352. foreach ($intervals['branches']['names'] as $branchName) {
  50353. if ($intervals['branches']['exclude']) {
  50354. $devConstraints[] = new Constraint('!=', $branchName);
  50355. } else {
  50356. $devConstraints[] = new Constraint('==', $branchName);
  50357. }
  50358. }
  50359. if ($intervals['branches']['exclude']) {
  50360. if (\count($constraints) > 1) {
  50361. return new MultiConstraint(array_merge(
  50362. array(new MultiConstraint($constraints, false)),
  50363. $devConstraints
  50364. ), true);
  50365. }
  50366. if (\count($constraints) === 1 && (string)$constraints[0] === (string)Interval::fromZero()) {
  50367. if (\count($devConstraints) > 1) {
  50368. return new MultiConstraint($devConstraints, true);
  50369. }
  50370. return $devConstraints[0];
  50371. }
  50372. return new MultiConstraint(array_merge($constraints, $devConstraints), true);
  50373. }
  50374. $constraints = array_merge($constraints, $devConstraints);
  50375. }
  50376. if (\count($constraints) > 1) {
  50377. return new MultiConstraint($constraints, false);
  50378. }
  50379. if (\count($constraints) === 1) {
  50380. return $constraints[0];
  50381. }
  50382. return new MatchNoneConstraint;
  50383. }
  50384. public static function get(ConstraintInterface $constraint)
  50385. {
  50386. $key = (string) $constraint;
  50387. if (!isset(self::$intervalsCache[$key])) {
  50388. self::$intervalsCache[$key] = self::generateIntervals($constraint);
  50389. }
  50390. return self::$intervalsCache[$key];
  50391. }
  50392. private static function generateIntervals(ConstraintInterface $constraint, $stopOnFirstValidInterval = false)
  50393. {
  50394. if ($constraint instanceof MatchAllConstraint) {
  50395. return array('numeric' => array(new Interval(Interval::fromZero(), Interval::untilPositiveInfinity())), 'branches' => Interval::anyDev());
  50396. }
  50397. if ($constraint instanceof MatchNoneConstraint) {
  50398. return array('numeric' => array(), 'branches' => array('names' => array(), 'exclude' => false));
  50399. }
  50400. if ($constraint instanceof Constraint) {
  50401. return self::generateSingleConstraintIntervals($constraint);
  50402. }
  50403. if (!$constraint instanceof MultiConstraint) {
  50404. throw new \UnexpectedValueException('The constraint passed in should be an MatchAllConstraint, Constraint or MultiConstraint instance, got '.\get_class($constraint).'.');
  50405. }
  50406. $constraints = $constraint->getConstraints();
  50407. $numericGroups = array();
  50408. $constraintBranches = array();
  50409. foreach ($constraints as $c) {
  50410. $res = self::get($c);
  50411. $numericGroups[] = $res['numeric'];
  50412. $constraintBranches[] = $res['branches'];
  50413. }
  50414. if ($constraint->isDisjunctive()) {
  50415. $branches = Interval::noDev();
  50416. foreach ($constraintBranches as $b) {
  50417. if ($b['exclude']) {
  50418. if ($branches['exclude']) {
  50419. $branches['names'] = array_intersect($branches['names'], $b['names']);
  50420. } else {
  50421. $branches['exclude'] = true;
  50422. $branches['names'] = array_diff($b['names'], $branches['names']);
  50423. }
  50424. } else {
  50425. if ($branches['exclude']) {
  50426. $branches['names'] = array_diff($branches['names'], $b['names']);
  50427. } else {
  50428. $branches['names'] = array_merge($branches['names'], $b['names']);
  50429. }
  50430. }
  50431. }
  50432. } else {
  50433. $branches = Interval::anyDev();
  50434. foreach ($constraintBranches as $b) {
  50435. if ($b['exclude']) {
  50436. if ($branches['exclude']) {
  50437. $branches['names'] = array_merge($branches['names'], $b['names']);
  50438. } else {
  50439. $branches['names'] = array_diff($branches['names'], $b['names']);
  50440. }
  50441. } else {
  50442. if ($branches['exclude']) {
  50443. $branches['names'] = array_diff($b['names'], $branches['names']);
  50444. $branches['exclude'] = false;
  50445. } else {
  50446. $branches['names'] = array_intersect($branches['names'], $b['names']);
  50447. }
  50448. }
  50449. }
  50450. }
  50451. $branches['names'] = array_unique($branches['names']);
  50452. if (\count($numericGroups) === 1) {
  50453. return array('numeric' => $numericGroups[0], 'branches' => $branches);
  50454. }
  50455. $borders = array();
  50456. foreach ($numericGroups as $group) {
  50457. foreach ($group as $interval) {
  50458. $borders[] = array('version' => $interval->getStart()->getVersion(), 'operator' => $interval->getStart()->getOperator(), 'side' => 'start');
  50459. $borders[] = array('version' => $interval->getEnd()->getVersion(), 'operator' => $interval->getEnd()->getOperator(), 'side' => 'end');
  50460. }
  50461. }
  50462. $opSortOrder = self::$opSortOrder;
  50463. usort($borders, function ($a, $b) use ($opSortOrder) {
  50464. $order = version_compare($a['version'], $b['version']);
  50465. if ($order === 0) {
  50466. return $opSortOrder[$a['operator']] - $opSortOrder[$b['operator']];
  50467. }
  50468. return $order;
  50469. });
  50470. $activeIntervals = 0;
  50471. $intervals = array();
  50472. $index = 0;
  50473. $activationThreshold = $constraint->isConjunctive() ? \count($numericGroups) : 1;
  50474. $start = null;
  50475. foreach ($borders as $border) {
  50476. if ($border['side'] === 'start') {
  50477. $activeIntervals++;
  50478. } else {
  50479. $activeIntervals--;
  50480. }
  50481. if (!$start && $activeIntervals >= $activationThreshold) {
  50482. $start = new Constraint($border['operator'], $border['version']);
  50483. } elseif ($start && $activeIntervals < $activationThreshold) {
  50484. if (
  50485. version_compare($start->getVersion(), $border['version'], '=')
  50486. && (
  50487. ($start->getOperator() === '>' && $border['operator'] === '<=')
  50488. || ($start->getOperator() === '>=' && $border['operator'] === '<')
  50489. )
  50490. ) {
  50491. unset($intervals[$index]);
  50492. } else {
  50493. $intervals[$index] = new Interval($start, new Constraint($border['operator'], $border['version']));
  50494. $index++;
  50495. if ($stopOnFirstValidInterval) {
  50496. break;
  50497. }
  50498. }
  50499. $start = null;
  50500. }
  50501. }
  50502. return array('numeric' => $intervals, 'branches' => $branches);
  50503. }
  50504. private static function generateSingleConstraintIntervals(Constraint $constraint)
  50505. {
  50506. $op = $constraint->getOperator();
  50507. if (strpos($constraint->getVersion(), 'dev-') === 0) {
  50508. $intervals = array();
  50509. $branches = array('names' => array(), 'exclude' => false);
  50510. if ($op === '!=') {
  50511. $intervals[] = new Interval(Interval::fromZero(), Interval::untilPositiveInfinity());
  50512. $branches = array('names' => array($constraint->getVersion()), 'exclude' => true);
  50513. } elseif ($op === '==') {
  50514. $branches['names'][] = $constraint->getVersion();
  50515. }
  50516. return array(
  50517. 'numeric' => $intervals,
  50518. 'branches' => $branches,
  50519. );
  50520. }
  50521. if ($op[0] === '>') {
  50522. return array('numeric' => array(new Interval($constraint, Interval::untilPositiveInfinity())), 'branches' => Interval::noDev());
  50523. }
  50524. if ($op[0] === '<') {
  50525. return array('numeric' => array(new Interval(Interval::fromZero(), $constraint)), 'branches' => Interval::noDev());
  50526. }
  50527. if ($op === '!=') {
  50528. return array('numeric' => array(
  50529. new Interval(Interval::fromZero(), new Constraint('<', $constraint->getVersion())),
  50530. new Interval(new Constraint('>', $constraint->getVersion()), Interval::untilPositiveInfinity()),
  50531. ), 'branches' => Interval::anyDev());
  50532. }
  50533. return array('numeric' => array(
  50534. new Interval(new Constraint('>=', $constraint->getVersion()), new Constraint('<=', $constraint->getVersion())),
  50535. ), 'branches' => Interval::noDev());
  50536. }
  50537. }
  50538. <?php
  50539. namespace Composer\Semver;
  50540. use Composer\Semver\Constraint\Constraint;
  50541. class Semver
  50542. {
  50543. const SORT_ASC = 1;
  50544. const SORT_DESC = -1;
  50545. private static $versionParser;
  50546. public static function satisfies($version, $constraints)
  50547. {
  50548. if (null === self::$versionParser) {
  50549. self::$versionParser = new VersionParser();
  50550. }
  50551. $versionParser = self::$versionParser;
  50552. $provider = new Constraint('==', $versionParser->normalize($version));
  50553. $parsedConstraints = $versionParser->parseConstraints($constraints);
  50554. return $parsedConstraints->matches($provider);
  50555. }
  50556. public static function satisfiedBy(array $versions, $constraints)
  50557. {
  50558. $versions = array_filter($versions, function ($version) use ($constraints) {
  50559. return Semver::satisfies($version, $constraints);
  50560. });
  50561. return array_values($versions);
  50562. }
  50563. public static function sort(array $versions)
  50564. {
  50565. return self::usort($versions, self::SORT_ASC);
  50566. }
  50567. public static function rsort(array $versions)
  50568. {
  50569. return self::usort($versions, self::SORT_DESC);
  50570. }
  50571. private static function usort(array $versions, $direction)
  50572. {
  50573. if (null === self::$versionParser) {
  50574. self::$versionParser = new VersionParser();
  50575. }
  50576. $versionParser = self::$versionParser;
  50577. $normalized = array();
  50578. foreach ($versions as $key => $version) {
  50579. $normalizedVersion = $versionParser->normalize($version);
  50580. $normalizedVersion = $versionParser->normalizeDefaultBranch($normalizedVersion);
  50581. $normalized[] = array($normalizedVersion, $key);
  50582. }
  50583. usort($normalized, function (array $left, array $right) use ($direction) {
  50584. if ($left[0] === $right[0]) {
  50585. return 0;
  50586. }
  50587. if (Comparator::lessThan($left[0], $right[0])) {
  50588. return -$direction;
  50589. }
  50590. return $direction;
  50591. });
  50592. $sorted = array();
  50593. foreach ($normalized as $item) {
  50594. $sorted[] = $versions[$item[1]];
  50595. }
  50596. return $sorted;
  50597. }
  50598. }
  50599. <?php
  50600. namespace Composer\Semver;
  50601. use Composer\Semver\Constraint\ConstraintInterface;
  50602. use Composer\Semver\Constraint\MatchAllConstraint;
  50603. use Composer\Semver\Constraint\MultiConstraint;
  50604. use Composer\Semver\Constraint\Constraint;
  50605. class VersionParser
  50606. {
  50607. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  50608. private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev';
  50609. public static function parseStability($version)
  50610. {
  50611. $version = (string) preg_replace('{#.+$}', '', (string) $version);
  50612. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  50613. return 'dev';
  50614. }
  50615. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  50616. if (!empty($match[3])) {
  50617. return 'dev';
  50618. }
  50619. if (!empty($match[1])) {
  50620. if ('beta' === $match[1] || 'b' === $match[1]) {
  50621. return 'beta';
  50622. }
  50623. if ('alpha' === $match[1] || 'a' === $match[1]) {
  50624. return 'alpha';
  50625. }
  50626. if ('rc' === $match[1]) {
  50627. return 'RC';
  50628. }
  50629. }
  50630. return 'stable';
  50631. }
  50632. public static function normalizeStability($stability)
  50633. {
  50634. $stability = strtolower((string) $stability);
  50635. return $stability === 'rc' ? 'RC' : $stability;
  50636. }
  50637. public function normalize($version, $fullVersion = null)
  50638. {
  50639. $version = trim((string) $version);
  50640. $origVersion = $version;
  50641. if (null === $fullVersion) {
  50642. $fullVersion = $version;
  50643. }
  50644. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  50645. $version = $match[1];
  50646. }
  50647. if (preg_match('{@(?:' . self::$stabilitiesRegex . ')$}i', $version, $match)) {
  50648. $version = substr($version, 0, strlen($version) - strlen($match[0]));
  50649. }
  50650. if (\in_array($version, array('master', 'trunk', 'default'), true)) {
  50651. $version = 'dev-' . $version;
  50652. }
  50653. if (stripos($version, 'dev-') === 0) {
  50654. return 'dev-' . substr($version, 4);
  50655. }
  50656. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  50657. $version = $match[1];
  50658. }
  50659. if (preg_match('{^v?(\d{1,5}+)(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  50660. $version = $matches[1]
  50661. . (!empty($matches[2]) ? $matches[2] : '.0')
  50662. . (!empty($matches[3]) ? $matches[3] : '.0')
  50663. . (!empty($matches[4]) ? $matches[4] : '.0');
  50664. $index = 5;
  50665. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3}){0,2})' . self::$modifierRegex . '$}i', $version, $matches)) {
  50666. $version = (string) preg_replace('{\D}', '.', $matches[1]);
  50667. $index = 2;
  50668. }
  50669. if (isset($index)) {
  50670. if (!empty($matches[$index])) {
  50671. if ('stable' === $matches[$index]) {
  50672. return $version;
  50673. }
  50674. $version .= '-' . $this->expandStability($matches[$index]) . (isset($matches[$index + 1]) && '' !== $matches[$index + 1] ? ltrim($matches[$index + 1], '.-') : '');
  50675. }
  50676. if (!empty($matches[$index + 2])) {
  50677. $version .= '-dev';
  50678. }
  50679. return $version;
  50680. }
  50681. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  50682. try {
  50683. $normalized = $this->normalizeBranch($match[1]);
  50684. if (strpos($normalized, 'dev-') === false) {
  50685. return $normalized;
  50686. }
  50687. } catch (\Exception $e) {
  50688. }
  50689. }
  50690. $extraMessage = '';
  50691. if (preg_match('{ +as +' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))?$}', $fullVersion)) {
  50692. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  50693. } elseif (preg_match('{^' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))? +as +}', $fullVersion)) {
  50694. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  50695. }
  50696. throw new \UnexpectedValueException('Invalid version string "' . $origVersion . '"' . $extraMessage);
  50697. }
  50698. public function parseNumericAliasPrefix($branch)
  50699. {
  50700. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', (string) $branch, $matches)) {
  50701. return $matches['version'] . '.';
  50702. }
  50703. return false;
  50704. }
  50705. public function normalizeBranch($name)
  50706. {
  50707. $name = trim((string) $name);
  50708. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  50709. $version = '';
  50710. for ($i = 1; $i < 5; ++$i) {
  50711. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  50712. }
  50713. return str_replace('x', '9999999', $version) . '-dev';
  50714. }
  50715. return 'dev-' . $name;
  50716. }
  50717. public function normalizeDefaultBranch($name)
  50718. {
  50719. if ($name === 'dev-master' || $name === 'dev-default' || $name === 'dev-trunk') {
  50720. return '9999999-dev';
  50721. }
  50722. return (string) $name;
  50723. }
  50724. public function parseConstraints($constraints)
  50725. {
  50726. $prettyConstraint = (string) $constraints;
  50727. $orConstraints = preg_split('{\s*\|\|?\s*}', trim((string) $constraints));
  50728. if (false === $orConstraints) {
  50729. throw new \RuntimeException('Failed to preg_split string: '.$constraints);
  50730. }
  50731. $orGroups = array();
  50732. foreach ($orConstraints as $orConstraint) {
  50733. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  50734. if (false === $andConstraints) {
  50735. throw new \RuntimeException('Failed to preg_split string: '.$orConstraint);
  50736. }
  50737. if (\count($andConstraints) > 1) {
  50738. $constraintObjects = array();
  50739. foreach ($andConstraints as $andConstraint) {
  50740. foreach ($this->parseConstraint($andConstraint) as $parsedAndConstraint) {
  50741. $constraintObjects[] = $parsedAndConstraint;
  50742. }
  50743. }
  50744. } else {
  50745. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  50746. }
  50747. if (1 === \count($constraintObjects)) {
  50748. $constraint = $constraintObjects[0];
  50749. } else {
  50750. $constraint = new MultiConstraint($constraintObjects);
  50751. }
  50752. $orGroups[] = $constraint;
  50753. }
  50754. $parsedConstraint = MultiConstraint::create($orGroups, false);
  50755. $parsedConstraint->setPrettyString($prettyConstraint);
  50756. return $parsedConstraint;
  50757. }
  50758. private function parseConstraint($constraint)
  50759. {
  50760. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $constraint, $match)) {
  50761. $constraint = $match[1];
  50762. }
  50763. if (preg_match('{^([^,\s]*?)@(' . self::$stabilitiesRegex . ')$}i', $constraint, $match)) {
  50764. $constraint = '' !== $match[1] ? $match[1] : '*';
  50765. if ($match[2] !== 'stable') {
  50766. $stabilityModifier = $match[2];
  50767. }
  50768. }
  50769. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraint, $match)) {
  50770. $constraint = $match[1];
  50771. }
  50772. if (preg_match('{^(v)?[xX*](\.[xX*])*$}i', $constraint, $match)) {
  50773. if (!empty($match[1]) || !empty($match[2])) {
  50774. return array(new Constraint('>=', '0.0.0.0-dev'));
  50775. }
  50776. return array(new MatchAllConstraint());
  50777. }
  50778. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?(?:' . self::$modifierRegex . '|\.([xX*][.-]?dev))(?:\+[^\s]+)?';
  50779. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  50780. if (strpos($constraint, '~>') === 0) {
  50781. throw new \UnexpectedValueException(
  50782. 'Could not parse version constraint ' . $constraint . ': ' .
  50783. 'Invalid operator "~>", you probably meant to use the "~" operator'
  50784. );
  50785. }
  50786. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  50787. $position = 4;
  50788. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50789. $position = 3;
  50790. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50791. $position = 2;
  50792. } else {
  50793. $position = 1;
  50794. }
  50795. if (!empty($matches[8])) {
  50796. $position++;
  50797. }
  50798. $stabilitySuffix = '';
  50799. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  50800. $stabilitySuffix .= '-dev';
  50801. }
  50802. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50803. $lowerBound = new Constraint('>=', $lowVersion);
  50804. $highPosition = max(1, $position - 1);
  50805. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  50806. $upperBound = new Constraint('<', $highVersion);
  50807. return array(
  50808. $lowerBound,
  50809. $upperBound,
  50810. );
  50811. }
  50812. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  50813. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  50814. $position = 1;
  50815. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  50816. $position = 2;
  50817. } else {
  50818. $position = 3;
  50819. }
  50820. $stabilitySuffix = '';
  50821. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  50822. $stabilitySuffix .= '-dev';
  50823. }
  50824. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50825. $lowerBound = new Constraint('>=', $lowVersion);
  50826. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50827. $upperBound = new Constraint('<', $highVersion);
  50828. return array(
  50829. $lowerBound,
  50830. $upperBound,
  50831. );
  50832. }
  50833. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  50834. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50835. $position = 3;
  50836. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50837. $position = 2;
  50838. } else {
  50839. $position = 1;
  50840. }
  50841. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50842. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50843. if ($lowVersion === '0.0.0.0-dev') {
  50844. return array(new Constraint('<', $highVersion));
  50845. }
  50846. return array(
  50847. new Constraint('>=', $lowVersion),
  50848. new Constraint('<', $highVersion),
  50849. );
  50850. }
  50851. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  50852. $lowStabilitySuffix = '';
  50853. if (empty($matches[6]) && empty($matches[8]) && empty($matches[9])) {
  50854. $lowStabilitySuffix = '-dev';
  50855. }
  50856. $lowVersion = $this->normalize($matches['from']);
  50857. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  50858. $empty = function ($x) {
  50859. return ($x === 0 || $x === '0') ? false : empty($x);
  50860. };
  50861. if ((!$empty($matches[12]) && !$empty($matches[13])) || !empty($matches[15]) || !empty($matches[17]) || !empty($matches[18])) {
  50862. $highVersion = $this->normalize($matches['to']);
  50863. $upperBound = new Constraint('<=', $highVersion);
  50864. } else {
  50865. $highMatch = array('', $matches[11], $matches[12], $matches[13], $matches[14]);
  50866. $this->normalize($matches['to']);
  50867. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[12]) ? 1 : 2, 1) . '-dev';
  50868. $upperBound = new Constraint('<', $highVersion);
  50869. }
  50870. return array(
  50871. $lowerBound,
  50872. $upperBound,
  50873. );
  50874. }
  50875. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  50876. try {
  50877. try {
  50878. $version = $this->normalize($matches[2]);
  50879. } catch (\UnexpectedValueException $e) {
  50880. if (substr($matches[2], -4) === '-dev' && preg_match('{^[0-9a-zA-Z-./]+$}', $matches[2])) {
  50881. $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
  50882. } else {
  50883. throw $e;
  50884. }
  50885. }
  50886. $op = $matches[1] ?: '=';
  50887. if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  50888. $version .= '-' . $stabilityModifier;
  50889. } elseif ('<' === $op || '>=' === $op) {
  50890. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  50891. if (strpos($matches[2], 'dev-') !== 0) {
  50892. $version .= '-dev';
  50893. }
  50894. }
  50895. }
  50896. return array(new Constraint($matches[1] ?: '=', $version));
  50897. } catch (\Exception $e) {
  50898. }
  50899. }
  50900. $message = 'Could not parse version constraint ' . $constraint;
  50901. if (isset($e)) {
  50902. $message .= ': ' . $e->getMessage();
  50903. }
  50904. throw new \UnexpectedValueException($message);
  50905. }
  50906. private function manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0')
  50907. {
  50908. for ($i = 4; $i > 0; --$i) {
  50909. if ($i > $position) {
  50910. $matches[$i] = $pad;
  50911. } elseif ($i === $position && $increment) {
  50912. $matches[$i] += $increment;
  50913. if ($matches[$i] < 0) {
  50914. $matches[$i] = $pad;
  50915. --$position;
  50916. if ($i === 1) {
  50917. return null;
  50918. }
  50919. }
  50920. }
  50921. }
  50922. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  50923. }
  50924. private function expandStability($stability)
  50925. {
  50926. $stability = strtolower($stability);
  50927. switch ($stability) {
  50928. case 'a':
  50929. return 'alpha';
  50930. case 'b':
  50931. return 'beta';
  50932. case 'p':
  50933. case 'pl':
  50934. return 'patch';
  50935. case 'rc':
  50936. return 'RC';
  50937. default:
  50938. return $stability;
  50939. }
  50940. }
  50941. }
  50942. Copyright (C) 2015 Composer
  50943. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50944. this software and associated documentation files (the "Software"), to deal in
  50945. the Software without restriction, including without limitation the rights to
  50946. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50947. of the Software, and to permit persons to whom the Software is furnished to do
  50948. so, subject to the following conditions:
  50949. The above copyright notice and this permission notice shall be included in all
  50950. copies or substantial portions of the Software.
  50951. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50952. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50953. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50954. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50955. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50956. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50957. SOFTWARE.
  50958. {
  50959. "389-exception": [
  50960. "389 Directory Server Exception"
  50961. ],
  50962. "Asterisk-exception": [
  50963. "Asterisk exception"
  50964. ],
  50965. "Autoconf-exception-2.0": [
  50966. "Autoconf exception 2.0"
  50967. ],
  50968. "Autoconf-exception-3.0": [
  50969. "Autoconf exception 3.0"
  50970. ],
  50971. "Autoconf-exception-generic": [
  50972. "Autoconf generic exception"
  50973. ],
  50974. "Autoconf-exception-generic-3.0": [
  50975. "Autoconf generic exception for GPL-3.0"
  50976. ],
  50977. "Autoconf-exception-macro": [
  50978. "Autoconf macro exception"
  50979. ],
  50980. "Bison-exception-2.2": [
  50981. "Bison exception 2.2"
  50982. ],
  50983. "Bootloader-exception": [
  50984. "Bootloader Distribution Exception"
  50985. ],
  50986. "Classpath-exception-2.0": [
  50987. "Classpath exception 2.0"
  50988. ],
  50989. "CLISP-exception-2.0": [
  50990. "CLISP exception 2.0"
  50991. ],
  50992. "cryptsetup-OpenSSL-exception": [
  50993. "cryptsetup OpenSSL exception"
  50994. ],
  50995. "DigiRule-FOSS-exception": [
  50996. "DigiRule FOSS License Exception"
  50997. ],
  50998. "eCos-exception-2.0": [
  50999. "eCos exception 2.0"
  51000. ],
  51001. "Fawkes-Runtime-exception": [
  51002. "Fawkes Runtime Exception"
  51003. ],
  51004. "FLTK-exception": [
  51005. "FLTK exception"
  51006. ],
  51007. "Font-exception-2.0": [
  51008. "Font exception 2.0"
  51009. ],
  51010. "freertos-exception-2.0": [
  51011. "FreeRTOS Exception 2.0"
  51012. ],
  51013. "GCC-exception-2.0": [
  51014. "GCC Runtime Library exception 2.0"
  51015. ],
  51016. "GCC-exception-2.0-note": [
  51017. "GCC Runtime Library exception 2.0 - note variant"
  51018. ],
  51019. "GCC-exception-3.1": [
  51020. "GCC Runtime Library exception 3.1"
  51021. ],
  51022. "GNAT-exception": [
  51023. "GNAT exception"
  51024. ],
  51025. "GNU-compiler-exception": [
  51026. "GNU Compiler Exception"
  51027. ],
  51028. "gnu-javamail-exception": [
  51029. "GNU JavaMail exception"
  51030. ],
  51031. "GPL-3.0-interface-exception": [
  51032. "GPL-3.0 Interface Exception"
  51033. ],
  51034. "GPL-3.0-linking-exception": [
  51035. "GPL-3.0 Linking Exception"
  51036. ],
  51037. "GPL-3.0-linking-source-exception": [
  51038. "GPL-3.0 Linking Exception (with Corresponding Source)"
  51039. ],
  51040. "GPL-CC-1.0": [
  51041. "GPL Cooperation Commitment 1.0"
  51042. ],
  51043. "GStreamer-exception-2005": [
  51044. "GStreamer Exception (2005)"
  51045. ],
  51046. "GStreamer-exception-2008": [
  51047. "GStreamer Exception (2008)"
  51048. ],
  51049. "i2p-gpl-java-exception": [
  51050. "i2p GPL+Java Exception"
  51051. ],
  51052. "KiCad-libraries-exception": [
  51053. "KiCad Libraries Exception"
  51054. ],
  51055. "LGPL-3.0-linking-exception": [
  51056. "LGPL-3.0 Linking Exception"
  51057. ],
  51058. "libpri-OpenH323-exception": [
  51059. "libpri OpenH323 exception"
  51060. ],
  51061. "Libtool-exception": [
  51062. "Libtool Exception"
  51063. ],
  51064. "Linux-syscall-note": [
  51065. "Linux Syscall Note"
  51066. ],
  51067. "LLGPL": [
  51068. "LLGPL Preamble"
  51069. ],
  51070. "LLVM-exception": [
  51071. "LLVM Exception"
  51072. ],
  51073. "LZMA-exception": [
  51074. "LZMA exception"
  51075. ],
  51076. "mif-exception": [
  51077. "Macros and Inline Functions Exception"
  51078. ],
  51079. "Nokia-Qt-exception-1.1": [
  51080. "Nokia Qt LGPL exception 1.1"
  51081. ],
  51082. "OCaml-LGPL-linking-exception": [
  51083. "OCaml LGPL Linking Exception"
  51084. ],
  51085. "OCCT-exception-1.0": [
  51086. "Open CASCADE Exception 1.0"
  51087. ],
  51088. "OpenJDK-assembly-exception-1.0": [
  51089. "OpenJDK Assembly exception 1.0"
  51090. ],
  51091. "openvpn-openssl-exception": [
  51092. "OpenVPN OpenSSL Exception"
  51093. ],
  51094. "PS-or-PDF-font-exception-20170817": [
  51095. "PS/PDF font exception (2017-08-17)"
  51096. ],
  51097. "QPL-1.0-INRIA-2004-exception": [
  51098. "INRIA QPL 1.0 2004 variant exception"
  51099. ],
  51100. "Qt-GPL-exception-1.0": [
  51101. "Qt GPL exception 1.0"
  51102. ],
  51103. "Qt-LGPL-exception-1.1": [
  51104. "Qt LGPL exception 1.1"
  51105. ],
  51106. "Qwt-exception-1.0": [
  51107. "Qwt exception 1.0"
  51108. ],
  51109. "SANE-exception": [
  51110. "SANE Exception"
  51111. ],
  51112. "SHL-2.0": [
  51113. "Solderpad Hardware License v2.0"
  51114. ],
  51115. "SHL-2.1": [
  51116. "Solderpad Hardware License v2.1"
  51117. ],
  51118. "stunnel-exception": [
  51119. "stunnel Exception"
  51120. ],
  51121. "SWI-exception": [
  51122. "SWI exception"
  51123. ],
  51124. "Swift-exception": [
  51125. "Swift Exception"
  51126. ],
  51127. "Texinfo-exception": [
  51128. "Texinfo exception"
  51129. ],
  51130. "u-boot-exception-2.0": [
  51131. "U-Boot exception 2.0"
  51132. ],
  51133. "UBDL-exception": [
  51134. "Unmodified Binary Distribution exception"
  51135. ],
  51136. "Universal-FOSS-exception-1.0": [
  51137. "Universal FOSS Exception, Version 1.0"
  51138. ],
  51139. "vsftpd-openssl-exception": [
  51140. "vsftpd OpenSSL exception"
  51141. ],
  51142. "WxWindows-exception-3.1": [
  51143. "WxWindows Library Exception 3.1"
  51144. ],
  51145. "x11vnc-openssl-exception": [
  51146. "x11vnc OpenSSL Exception"
  51147. ]
  51148. }{
  51149. "0BSD": [
  51150. "BSD Zero Clause License",
  51151. true,
  51152. false
  51153. ],
  51154. "AAL": [
  51155. "Attribution Assurance License",
  51156. true,
  51157. false
  51158. ],
  51159. "Abstyles": [
  51160. "Abstyles License",
  51161. false,
  51162. false
  51163. ],
  51164. "AdaCore-doc": [
  51165. "AdaCore Doc License",
  51166. false,
  51167. false
  51168. ],
  51169. "Adobe-2006": [
  51170. "Adobe Systems Incorporated Source Code License Agreement",
  51171. false,
  51172. false
  51173. ],
  51174. "Adobe-Display-PostScript": [
  51175. "Adobe Display PostScript License",
  51176. false,
  51177. false
  51178. ],
  51179. "Adobe-Glyph": [
  51180. "Adobe Glyph List License",
  51181. false,
  51182. false
  51183. ],
  51184. "Adobe-Utopia": [
  51185. "Adobe Utopia Font License",
  51186. false,
  51187. false
  51188. ],
  51189. "ADSL": [
  51190. "Amazon Digital Services License",
  51191. false,
  51192. false
  51193. ],
  51194. "AFL-1.1": [
  51195. "Academic Free License v1.1",
  51196. true,
  51197. false
  51198. ],
  51199. "AFL-1.2": [
  51200. "Academic Free License v1.2",
  51201. true,
  51202. false
  51203. ],
  51204. "AFL-2.0": [
  51205. "Academic Free License v2.0",
  51206. true,
  51207. false
  51208. ],
  51209. "AFL-2.1": [
  51210. "Academic Free License v2.1",
  51211. true,
  51212. false
  51213. ],
  51214. "AFL-3.0": [
  51215. "Academic Free License v3.0",
  51216. true,
  51217. false
  51218. ],
  51219. "Afmparse": [
  51220. "Afmparse License",
  51221. false,
  51222. false
  51223. ],
  51224. "AGPL-1.0": [
  51225. "Affero General Public License v1.0",
  51226. false,
  51227. true
  51228. ],
  51229. "AGPL-1.0-only": [
  51230. "Affero General Public License v1.0 only",
  51231. false,
  51232. false
  51233. ],
  51234. "AGPL-1.0-or-later": [
  51235. "Affero General Public License v1.0 or later",
  51236. false,
  51237. false
  51238. ],
  51239. "AGPL-3.0": [
  51240. "GNU Affero General Public License v3.0",
  51241. true,
  51242. true
  51243. ],
  51244. "AGPL-3.0-only": [
  51245. "GNU Affero General Public License v3.0 only",
  51246. true,
  51247. false
  51248. ],
  51249. "AGPL-3.0-or-later": [
  51250. "GNU Affero General Public License v3.0 or later",
  51251. true,
  51252. false
  51253. ],
  51254. "Aladdin": [
  51255. "Aladdin Free Public License",
  51256. false,
  51257. false
  51258. ],
  51259. "AMDPLPA": [
  51260. "AMD's plpa_map.c License",
  51261. false,
  51262. false
  51263. ],
  51264. "AML": [
  51265. "Apple MIT License",
  51266. false,
  51267. false
  51268. ],
  51269. "AML-glslang": [
  51270. "AML glslang variant License",
  51271. false,
  51272. false
  51273. ],
  51274. "AMPAS": [
  51275. "Academy of Motion Picture Arts and Sciences BSD",
  51276. false,
  51277. false
  51278. ],
  51279. "ANTLR-PD": [
  51280. "ANTLR Software Rights Notice",
  51281. false,
  51282. false
  51283. ],
  51284. "ANTLR-PD-fallback": [
  51285. "ANTLR Software Rights Notice with license fallback",
  51286. false,
  51287. false
  51288. ],
  51289. "Apache-1.0": [
  51290. "Apache License 1.0",
  51291. false,
  51292. false
  51293. ],
  51294. "Apache-1.1": [
  51295. "Apache License 1.1",
  51296. true,
  51297. false
  51298. ],
  51299. "Apache-2.0": [
  51300. "Apache License 2.0",
  51301. true,
  51302. false
  51303. ],
  51304. "APAFML": [
  51305. "Adobe Postscript AFM License",
  51306. false,
  51307. false
  51308. ],
  51309. "APL-1.0": [
  51310. "Adaptive Public License 1.0",
  51311. true,
  51312. false
  51313. ],
  51314. "App-s2p": [
  51315. "App::s2p License",
  51316. false,
  51317. false
  51318. ],
  51319. "APSL-1.0": [
  51320. "Apple Public Source License 1.0",
  51321. true,
  51322. false
  51323. ],
  51324. "APSL-1.1": [
  51325. "Apple Public Source License 1.1",
  51326. true,
  51327. false
  51328. ],
  51329. "APSL-1.2": [
  51330. "Apple Public Source License 1.2",
  51331. true,
  51332. false
  51333. ],
  51334. "APSL-2.0": [
  51335. "Apple Public Source License 2.0",
  51336. true,
  51337. false
  51338. ],
  51339. "Arphic-1999": [
  51340. "Arphic Public License",
  51341. false,
  51342. false
  51343. ],
  51344. "Artistic-1.0": [
  51345. "Artistic License 1.0",
  51346. true,
  51347. false
  51348. ],
  51349. "Artistic-1.0-cl8": [
  51350. "Artistic License 1.0 w/clause 8",
  51351. true,
  51352. false
  51353. ],
  51354. "Artistic-1.0-Perl": [
  51355. "Artistic License 1.0 (Perl)",
  51356. true,
  51357. false
  51358. ],
  51359. "Artistic-2.0": [
  51360. "Artistic License 2.0",
  51361. true,
  51362. false
  51363. ],
  51364. "ASWF-Digital-Assets-1.0": [
  51365. "ASWF Digital Assets License version 1.0",
  51366. false,
  51367. false
  51368. ],
  51369. "ASWF-Digital-Assets-1.1": [
  51370. "ASWF Digital Assets License 1.1",
  51371. false,
  51372. false
  51373. ],
  51374. "Baekmuk": [
  51375. "Baekmuk License",
  51376. false,
  51377. false
  51378. ],
  51379. "Bahyph": [
  51380. "Bahyph License",
  51381. false,
  51382. false
  51383. ],
  51384. "Barr": [
  51385. "Barr License",
  51386. false,
  51387. false
  51388. ],
  51389. "Beerware": [
  51390. "Beerware License",
  51391. false,
  51392. false
  51393. ],
  51394. "Bitstream-Charter": [
  51395. "Bitstream Charter Font License",
  51396. false,
  51397. false
  51398. ],
  51399. "Bitstream-Vera": [
  51400. "Bitstream Vera Font License",
  51401. false,
  51402. false
  51403. ],
  51404. "BitTorrent-1.0": [
  51405. "BitTorrent Open Source License v1.0",
  51406. false,
  51407. false
  51408. ],
  51409. "BitTorrent-1.1": [
  51410. "BitTorrent Open Source License v1.1",
  51411. false,
  51412. false
  51413. ],
  51414. "blessing": [
  51415. "SQLite Blessing",
  51416. false,
  51417. false
  51418. ],
  51419. "BlueOak-1.0.0": [
  51420. "Blue Oak Model License 1.0.0",
  51421. false,
  51422. false
  51423. ],
  51424. "Boehm-GC": [
  51425. "Boehm-Demers-Weiser GC License",
  51426. false,
  51427. false
  51428. ],
  51429. "Borceux": [
  51430. "Borceux license",
  51431. false,
  51432. false
  51433. ],
  51434. "Brian-Gladman-3-Clause": [
  51435. "Brian Gladman 3-Clause License",
  51436. false,
  51437. false
  51438. ],
  51439. "BSD-1-Clause": [
  51440. "BSD 1-Clause License",
  51441. true,
  51442. false
  51443. ],
  51444. "BSD-2-Clause": [
  51445. "BSD 2-Clause \"Simplified\" License",
  51446. true,
  51447. false
  51448. ],
  51449. "BSD-2-Clause-FreeBSD": [
  51450. "BSD 2-Clause FreeBSD License",
  51451. false,
  51452. true
  51453. ],
  51454. "BSD-2-Clause-NetBSD": [
  51455. "BSD 2-Clause NetBSD License",
  51456. false,
  51457. true
  51458. ],
  51459. "BSD-2-Clause-Patent": [
  51460. "BSD-2-Clause Plus Patent License",
  51461. true,
  51462. false
  51463. ],
  51464. "BSD-2-Clause-Views": [
  51465. "BSD 2-Clause with views sentence",
  51466. false,
  51467. false
  51468. ],
  51469. "BSD-3-Clause": [
  51470. "BSD 3-Clause \"New\" or \"Revised\" License",
  51471. true,
  51472. false
  51473. ],
  51474. "BSD-3-Clause-Attribution": [
  51475. "BSD with attribution",
  51476. false,
  51477. false
  51478. ],
  51479. "BSD-3-Clause-Clear": [
  51480. "BSD 3-Clause Clear License",
  51481. false,
  51482. false
  51483. ],
  51484. "BSD-3-Clause-flex": [
  51485. "BSD 3-Clause Flex variant",
  51486. false,
  51487. false
  51488. ],
  51489. "BSD-3-Clause-HP": [
  51490. "Hewlett-Packard BSD variant license",
  51491. false,
  51492. false
  51493. ],
  51494. "BSD-3-Clause-LBNL": [
  51495. "Lawrence Berkeley National Labs BSD variant license",
  51496. true,
  51497. false
  51498. ],
  51499. "BSD-3-Clause-Modification": [
  51500. "BSD 3-Clause Modification",
  51501. false,
  51502. false
  51503. ],
  51504. "BSD-3-Clause-No-Military-License": [
  51505. "BSD 3-Clause No Military License",
  51506. false,
  51507. false
  51508. ],
  51509. "BSD-3-Clause-No-Nuclear-License": [
  51510. "BSD 3-Clause No Nuclear License",
  51511. false,
  51512. false
  51513. ],
  51514. "BSD-3-Clause-No-Nuclear-License-2014": [
  51515. "BSD 3-Clause No Nuclear License 2014",
  51516. false,
  51517. false
  51518. ],
  51519. "BSD-3-Clause-No-Nuclear-Warranty": [
  51520. "BSD 3-Clause No Nuclear Warranty",
  51521. false,
  51522. false
  51523. ],
  51524. "BSD-3-Clause-Open-MPI": [
  51525. "BSD 3-Clause Open MPI variant",
  51526. false,
  51527. false
  51528. ],
  51529. "BSD-3-Clause-Sun": [
  51530. "BSD 3-Clause Sun Microsystems",
  51531. false,
  51532. false
  51533. ],
  51534. "BSD-4-Clause": [
  51535. "BSD 4-Clause \"Original\" or \"Old\" License",
  51536. false,
  51537. false
  51538. ],
  51539. "BSD-4-Clause-Shortened": [
  51540. "BSD 4 Clause Shortened",
  51541. false,
  51542. false
  51543. ],
  51544. "BSD-4-Clause-UC": [
  51545. "BSD-4-Clause (University of California-Specific)",
  51546. false,
  51547. false
  51548. ],
  51549. "BSD-4.3RENO": [
  51550. "BSD 4.3 RENO License",
  51551. false,
  51552. false
  51553. ],
  51554. "BSD-4.3TAHOE": [
  51555. "BSD 4.3 TAHOE License",
  51556. false,
  51557. false
  51558. ],
  51559. "BSD-Advertising-Acknowledgement": [
  51560. "BSD Advertising Acknowledgement License",
  51561. false,
  51562. false
  51563. ],
  51564. "BSD-Attribution-HPND-disclaimer": [
  51565. "BSD with Attribution and HPND disclaimer",
  51566. false,
  51567. false
  51568. ],
  51569. "BSD-Inferno-Nettverk": [
  51570. "BSD-Inferno-Nettverk",
  51571. false,
  51572. false
  51573. ],
  51574. "BSD-Protection": [
  51575. "BSD Protection License",
  51576. false,
  51577. false
  51578. ],
  51579. "BSD-Source-Code": [
  51580. "BSD Source Code Attribution",
  51581. false,
  51582. false
  51583. ],
  51584. "BSD-Systemics": [
  51585. "Systemics BSD variant license",
  51586. false,
  51587. false
  51588. ],
  51589. "BSL-1.0": [
  51590. "Boost Software License 1.0",
  51591. true,
  51592. false
  51593. ],
  51594. "BUSL-1.1": [
  51595. "Business Source License 1.1",
  51596. false,
  51597. false
  51598. ],
  51599. "bzip2-1.0.5": [
  51600. "bzip2 and libbzip2 License v1.0.5",
  51601. false,
  51602. true
  51603. ],
  51604. "bzip2-1.0.6": [
  51605. "bzip2 and libbzip2 License v1.0.6",
  51606. false,
  51607. false
  51608. ],
  51609. "C-UDA-1.0": [
  51610. "Computational Use of Data Agreement v1.0",
  51611. false,
  51612. false
  51613. ],
  51614. "CAL-1.0": [
  51615. "Cryptographic Autonomy License 1.0",
  51616. true,
  51617. false
  51618. ],
  51619. "CAL-1.0-Combined-Work-Exception": [
  51620. "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
  51621. true,
  51622. false
  51623. ],
  51624. "Caldera": [
  51625. "Caldera License",
  51626. false,
  51627. false
  51628. ],
  51629. "CATOSL-1.1": [
  51630. "Computer Associates Trusted Open Source License 1.1",
  51631. true,
  51632. false
  51633. ],
  51634. "CC-BY-1.0": [
  51635. "Creative Commons Attribution 1.0 Generic",
  51636. false,
  51637. false
  51638. ],
  51639. "CC-BY-2.0": [
  51640. "Creative Commons Attribution 2.0 Generic",
  51641. false,
  51642. false
  51643. ],
  51644. "CC-BY-2.5": [
  51645. "Creative Commons Attribution 2.5 Generic",
  51646. false,
  51647. false
  51648. ],
  51649. "CC-BY-2.5-AU": [
  51650. "Creative Commons Attribution 2.5 Australia",
  51651. false,
  51652. false
  51653. ],
  51654. "CC-BY-3.0": [
  51655. "Creative Commons Attribution 3.0 Unported",
  51656. false,
  51657. false
  51658. ],
  51659. "CC-BY-3.0-AT": [
  51660. "Creative Commons Attribution 3.0 Austria",
  51661. false,
  51662. false
  51663. ],
  51664. "CC-BY-3.0-DE": [
  51665. "Creative Commons Attribution 3.0 Germany",
  51666. false,
  51667. false
  51668. ],
  51669. "CC-BY-3.0-IGO": [
  51670. "Creative Commons Attribution 3.0 IGO",
  51671. false,
  51672. false
  51673. ],
  51674. "CC-BY-3.0-NL": [
  51675. "Creative Commons Attribution 3.0 Netherlands",
  51676. false,
  51677. false
  51678. ],
  51679. "CC-BY-3.0-US": [
  51680. "Creative Commons Attribution 3.0 United States",
  51681. false,
  51682. false
  51683. ],
  51684. "CC-BY-4.0": [
  51685. "Creative Commons Attribution 4.0 International",
  51686. false,
  51687. false
  51688. ],
  51689. "CC-BY-NC-1.0": [
  51690. "Creative Commons Attribution Non Commercial 1.0 Generic",
  51691. false,
  51692. false
  51693. ],
  51694. "CC-BY-NC-2.0": [
  51695. "Creative Commons Attribution Non Commercial 2.0 Generic",
  51696. false,
  51697. false
  51698. ],
  51699. "CC-BY-NC-2.5": [
  51700. "Creative Commons Attribution Non Commercial 2.5 Generic",
  51701. false,
  51702. false
  51703. ],
  51704. "CC-BY-NC-3.0": [
  51705. "Creative Commons Attribution Non Commercial 3.0 Unported",
  51706. false,
  51707. false
  51708. ],
  51709. "CC-BY-NC-3.0-DE": [
  51710. "Creative Commons Attribution Non Commercial 3.0 Germany",
  51711. false,
  51712. false
  51713. ],
  51714. "CC-BY-NC-4.0": [
  51715. "Creative Commons Attribution Non Commercial 4.0 International",
  51716. false,
  51717. false
  51718. ],
  51719. "CC-BY-NC-ND-1.0": [
  51720. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  51721. false,
  51722. false
  51723. ],
  51724. "CC-BY-NC-ND-2.0": [
  51725. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  51726. false,
  51727. false
  51728. ],
  51729. "CC-BY-NC-ND-2.5": [
  51730. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  51731. false,
  51732. false
  51733. ],
  51734. "CC-BY-NC-ND-3.0": [
  51735. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  51736. false,
  51737. false
  51738. ],
  51739. "CC-BY-NC-ND-3.0-DE": [
  51740. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany",
  51741. false,
  51742. false
  51743. ],
  51744. "CC-BY-NC-ND-3.0-IGO": [
  51745. "Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO",
  51746. false,
  51747. false
  51748. ],
  51749. "CC-BY-NC-ND-4.0": [
  51750. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  51751. false,
  51752. false
  51753. ],
  51754. "CC-BY-NC-SA-1.0": [
  51755. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  51756. false,
  51757. false
  51758. ],
  51759. "CC-BY-NC-SA-2.0": [
  51760. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  51761. false,
  51762. false
  51763. ],
  51764. "CC-BY-NC-SA-2.0-DE": [
  51765. "Creative Commons Attribution Non Commercial Share Alike 2.0 Germany",
  51766. false,
  51767. false
  51768. ],
  51769. "CC-BY-NC-SA-2.0-FR": [
  51770. "Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France",
  51771. false,
  51772. false
  51773. ],
  51774. "CC-BY-NC-SA-2.0-UK": [
  51775. "Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales",
  51776. false,
  51777. false
  51778. ],
  51779. "CC-BY-NC-SA-2.5": [
  51780. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  51781. false,
  51782. false
  51783. ],
  51784. "CC-BY-NC-SA-3.0": [
  51785. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  51786. false,
  51787. false
  51788. ],
  51789. "CC-BY-NC-SA-3.0-DE": [
  51790. "Creative Commons Attribution Non Commercial Share Alike 3.0 Germany",
  51791. false,
  51792. false
  51793. ],
  51794. "CC-BY-NC-SA-3.0-IGO": [
  51795. "Creative Commons Attribution Non Commercial Share Alike 3.0 IGO",
  51796. false,
  51797. false
  51798. ],
  51799. "CC-BY-NC-SA-4.0": [
  51800. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  51801. false,
  51802. false
  51803. ],
  51804. "CC-BY-ND-1.0": [
  51805. "Creative Commons Attribution No Derivatives 1.0 Generic",
  51806. false,
  51807. false
  51808. ],
  51809. "CC-BY-ND-2.0": [
  51810. "Creative Commons Attribution No Derivatives 2.0 Generic",
  51811. false,
  51812. false
  51813. ],
  51814. "CC-BY-ND-2.5": [
  51815. "Creative Commons Attribution No Derivatives 2.5 Generic",
  51816. false,
  51817. false
  51818. ],
  51819. "CC-BY-ND-3.0": [
  51820. "Creative Commons Attribution No Derivatives 3.0 Unported",
  51821. false,
  51822. false
  51823. ],
  51824. "CC-BY-ND-3.0-DE": [
  51825. "Creative Commons Attribution No Derivatives 3.0 Germany",
  51826. false,
  51827. false
  51828. ],
  51829. "CC-BY-ND-4.0": [
  51830. "Creative Commons Attribution No Derivatives 4.0 International",
  51831. false,
  51832. false
  51833. ],
  51834. "CC-BY-SA-1.0": [
  51835. "Creative Commons Attribution Share Alike 1.0 Generic",
  51836. false,
  51837. false
  51838. ],
  51839. "CC-BY-SA-2.0": [
  51840. "Creative Commons Attribution Share Alike 2.0 Generic",
  51841. false,
  51842. false
  51843. ],
  51844. "CC-BY-SA-2.0-UK": [
  51845. "Creative Commons Attribution Share Alike 2.0 England and Wales",
  51846. false,
  51847. false
  51848. ],
  51849. "CC-BY-SA-2.1-JP": [
  51850. "Creative Commons Attribution Share Alike 2.1 Japan",
  51851. false,
  51852. false
  51853. ],
  51854. "CC-BY-SA-2.5": [
  51855. "Creative Commons Attribution Share Alike 2.5 Generic",
  51856. false,
  51857. false
  51858. ],
  51859. "CC-BY-SA-3.0": [
  51860. "Creative Commons Attribution Share Alike 3.0 Unported",
  51861. false,
  51862. false
  51863. ],
  51864. "CC-BY-SA-3.0-AT": [
  51865. "Creative Commons Attribution Share Alike 3.0 Austria",
  51866. false,
  51867. false
  51868. ],
  51869. "CC-BY-SA-3.0-DE": [
  51870. "Creative Commons Attribution Share Alike 3.0 Germany",
  51871. false,
  51872. false
  51873. ],
  51874. "CC-BY-SA-3.0-IGO": [
  51875. "Creative Commons Attribution-ShareAlike 3.0 IGO",
  51876. false,
  51877. false
  51878. ],
  51879. "CC-BY-SA-4.0": [
  51880. "Creative Commons Attribution Share Alike 4.0 International",
  51881. false,
  51882. false
  51883. ],
  51884. "CC-PDDC": [
  51885. "Creative Commons Public Domain Dedication and Certification",
  51886. false,
  51887. false
  51888. ],
  51889. "CC0-1.0": [
  51890. "Creative Commons Zero v1.0 Universal",
  51891. false,
  51892. false
  51893. ],
  51894. "CDDL-1.0": [
  51895. "Common Development and Distribution License 1.0",
  51896. true,
  51897. false
  51898. ],
  51899. "CDDL-1.1": [
  51900. "Common Development and Distribution License 1.1",
  51901. false,
  51902. false
  51903. ],
  51904. "CDL-1.0": [
  51905. "Common Documentation License 1.0",
  51906. false,
  51907. false
  51908. ],
  51909. "CDLA-Permissive-1.0": [
  51910. "Community Data License Agreement Permissive 1.0",
  51911. false,
  51912. false
  51913. ],
  51914. "CDLA-Permissive-2.0": [
  51915. "Community Data License Agreement Permissive 2.0",
  51916. false,
  51917. false
  51918. ],
  51919. "CDLA-Sharing-1.0": [
  51920. "Community Data License Agreement Sharing 1.0",
  51921. false,
  51922. false
  51923. ],
  51924. "CECILL-1.0": [
  51925. "CeCILL Free Software License Agreement v1.0",
  51926. false,
  51927. false
  51928. ],
  51929. "CECILL-1.1": [
  51930. "CeCILL Free Software License Agreement v1.1",
  51931. false,
  51932. false
  51933. ],
  51934. "CECILL-2.0": [
  51935. "CeCILL Free Software License Agreement v2.0",
  51936. false,
  51937. false
  51938. ],
  51939. "CECILL-2.1": [
  51940. "CeCILL Free Software License Agreement v2.1",
  51941. true,
  51942. false
  51943. ],
  51944. "CECILL-B": [
  51945. "CeCILL-B Free Software License Agreement",
  51946. false,
  51947. false
  51948. ],
  51949. "CECILL-C": [
  51950. "CeCILL-C Free Software License Agreement",
  51951. false,
  51952. false
  51953. ],
  51954. "CERN-OHL-1.1": [
  51955. "CERN Open Hardware Licence v1.1",
  51956. false,
  51957. false
  51958. ],
  51959. "CERN-OHL-1.2": [
  51960. "CERN Open Hardware Licence v1.2",
  51961. false,
  51962. false
  51963. ],
  51964. "CERN-OHL-P-2.0": [
  51965. "CERN Open Hardware Licence Version 2 - Permissive",
  51966. true,
  51967. false
  51968. ],
  51969. "CERN-OHL-S-2.0": [
  51970. "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
  51971. true,
  51972. false
  51973. ],
  51974. "CERN-OHL-W-2.0": [
  51975. "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
  51976. true,
  51977. false
  51978. ],
  51979. "CFITSIO": [
  51980. "CFITSIO License",
  51981. false,
  51982. false
  51983. ],
  51984. "check-cvs": [
  51985. "check-cvs License",
  51986. false,
  51987. false
  51988. ],
  51989. "checkmk": [
  51990. "Checkmk License",
  51991. false,
  51992. false
  51993. ],
  51994. "ClArtistic": [
  51995. "Clarified Artistic License",
  51996. false,
  51997. false
  51998. ],
  51999. "Clips": [
  52000. "Clips License",
  52001. false,
  52002. false
  52003. ],
  52004. "CMU-Mach": [
  52005. "CMU Mach License",
  52006. false,
  52007. false
  52008. ],
  52009. "CNRI-Jython": [
  52010. "CNRI Jython License",
  52011. false,
  52012. false
  52013. ],
  52014. "CNRI-Python": [
  52015. "CNRI Python License",
  52016. true,
  52017. false
  52018. ],
  52019. "CNRI-Python-GPL-Compatible": [
  52020. "CNRI Python Open Source GPL Compatible License Agreement",
  52021. false,
  52022. false
  52023. ],
  52024. "COIL-1.0": [
  52025. "Copyfree Open Innovation License",
  52026. false,
  52027. false
  52028. ],
  52029. "Community-Spec-1.0": [
  52030. "Community Specification License 1.0",
  52031. false,
  52032. false
  52033. ],
  52034. "Condor-1.1": [
  52035. "Condor Public License v1.1",
  52036. false,
  52037. false
  52038. ],
  52039. "copyleft-next-0.3.0": [
  52040. "copyleft-next 0.3.0",
  52041. false,
  52042. false
  52043. ],
  52044. "copyleft-next-0.3.1": [
  52045. "copyleft-next 0.3.1",
  52046. false,
  52047. false
  52048. ],
  52049. "Cornell-Lossless-JPEG": [
  52050. "Cornell Lossless JPEG License",
  52051. false,
  52052. false
  52053. ],
  52054. "CPAL-1.0": [
  52055. "Common Public Attribution License 1.0",
  52056. true,
  52057. false
  52058. ],
  52059. "CPL-1.0": [
  52060. "Common Public License 1.0",
  52061. true,
  52062. false
  52063. ],
  52064. "CPOL-1.02": [
  52065. "Code Project Open License 1.02",
  52066. false,
  52067. false
  52068. ],
  52069. "Cronyx": [
  52070. "Cronyx License",
  52071. false,
  52072. false
  52073. ],
  52074. "Crossword": [
  52075. "Crossword License",
  52076. false,
  52077. false
  52078. ],
  52079. "CrystalStacker": [
  52080. "CrystalStacker License",
  52081. false,
  52082. false
  52083. ],
  52084. "CUA-OPL-1.0": [
  52085. "CUA Office Public License v1.0",
  52086. true,
  52087. false
  52088. ],
  52089. "Cube": [
  52090. "Cube License",
  52091. false,
  52092. false
  52093. ],
  52094. "curl": [
  52095. "curl License",
  52096. false,
  52097. false
  52098. ],
  52099. "D-FSL-1.0": [
  52100. "Deutsche Freie Software Lizenz",
  52101. false,
  52102. false
  52103. ],
  52104. "DEC-3-Clause": [
  52105. "DEC 3-Clause License",
  52106. false,
  52107. false
  52108. ],
  52109. "diffmark": [
  52110. "diffmark license",
  52111. false,
  52112. false
  52113. ],
  52114. "DL-DE-BY-2.0": [
  52115. "Data licence Germany \u2013 attribution \u2013 version 2.0",
  52116. false,
  52117. false
  52118. ],
  52119. "DL-DE-ZERO-2.0": [
  52120. "Data licence Germany \u2013 zero \u2013 version 2.0",
  52121. false,
  52122. false
  52123. ],
  52124. "DOC": [
  52125. "DOC License",
  52126. false,
  52127. false
  52128. ],
  52129. "Dotseqn": [
  52130. "Dotseqn License",
  52131. false,
  52132. false
  52133. ],
  52134. "DRL-1.0": [
  52135. "Detection Rule License 1.0",
  52136. false,
  52137. false
  52138. ],
  52139. "DRL-1.1": [
  52140. "Detection Rule License 1.1",
  52141. false,
  52142. false
  52143. ],
  52144. "DSDP": [
  52145. "DSDP License",
  52146. false,
  52147. false
  52148. ],
  52149. "dtoa": [
  52150. "David M. Gay dtoa License",
  52151. false,
  52152. false
  52153. ],
  52154. "dvipdfm": [
  52155. "dvipdfm License",
  52156. false,
  52157. false
  52158. ],
  52159. "ECL-1.0": [
  52160. "Educational Community License v1.0",
  52161. true,
  52162. false
  52163. ],
  52164. "ECL-2.0": [
  52165. "Educational Community License v2.0",
  52166. true,
  52167. false
  52168. ],
  52169. "eCos-2.0": [
  52170. "eCos license version 2.0",
  52171. false,
  52172. true
  52173. ],
  52174. "EFL-1.0": [
  52175. "Eiffel Forum License v1.0",
  52176. true,
  52177. false
  52178. ],
  52179. "EFL-2.0": [
  52180. "Eiffel Forum License v2.0",
  52181. true,
  52182. false
  52183. ],
  52184. "eGenix": [
  52185. "eGenix.com Public License 1.1.0",
  52186. false,
  52187. false
  52188. ],
  52189. "Elastic-2.0": [
  52190. "Elastic License 2.0",
  52191. false,
  52192. false
  52193. ],
  52194. "Entessa": [
  52195. "Entessa Public License v1.0",
  52196. true,
  52197. false
  52198. ],
  52199. "EPICS": [
  52200. "EPICS Open License",
  52201. false,
  52202. false
  52203. ],
  52204. "EPL-1.0": [
  52205. "Eclipse Public License 1.0",
  52206. true,
  52207. false
  52208. ],
  52209. "EPL-2.0": [
  52210. "Eclipse Public License 2.0",
  52211. true,
  52212. false
  52213. ],
  52214. "ErlPL-1.1": [
  52215. "Erlang Public License v1.1",
  52216. false,
  52217. false
  52218. ],
  52219. "etalab-2.0": [
  52220. "Etalab Open License 2.0",
  52221. false,
  52222. false
  52223. ],
  52224. "EUDatagrid": [
  52225. "EU DataGrid Software License",
  52226. true,
  52227. false
  52228. ],
  52229. "EUPL-1.0": [
  52230. "European Union Public License 1.0",
  52231. false,
  52232. false
  52233. ],
  52234. "EUPL-1.1": [
  52235. "European Union Public License 1.1",
  52236. true,
  52237. false
  52238. ],
  52239. "EUPL-1.2": [
  52240. "European Union Public License 1.2",
  52241. true,
  52242. false
  52243. ],
  52244. "Eurosym": [
  52245. "Eurosym License",
  52246. false,
  52247. false
  52248. ],
  52249. "Fair": [
  52250. "Fair License",
  52251. true,
  52252. false
  52253. ],
  52254. "FBM": [
  52255. "Fuzzy Bitmap License",
  52256. false,
  52257. false
  52258. ],
  52259. "FDK-AAC": [
  52260. "Fraunhofer FDK AAC Codec Library",
  52261. false,
  52262. false
  52263. ],
  52264. "Ferguson-Twofish": [
  52265. "Ferguson Twofish License",
  52266. false,
  52267. false
  52268. ],
  52269. "Frameworx-1.0": [
  52270. "Frameworx Open License 1.0",
  52271. true,
  52272. false
  52273. ],
  52274. "FreeBSD-DOC": [
  52275. "FreeBSD Documentation License",
  52276. false,
  52277. false
  52278. ],
  52279. "FreeImage": [
  52280. "FreeImage Public License v1.0",
  52281. false,
  52282. false
  52283. ],
  52284. "FSFAP": [
  52285. "FSF All Permissive License",
  52286. false,
  52287. false
  52288. ],
  52289. "FSFUL": [
  52290. "FSF Unlimited License",
  52291. false,
  52292. false
  52293. ],
  52294. "FSFULLR": [
  52295. "FSF Unlimited License (with License Retention)",
  52296. false,
  52297. false
  52298. ],
  52299. "FSFULLRWD": [
  52300. "FSF Unlimited License (With License Retention and Warranty Disclaimer)",
  52301. false,
  52302. false
  52303. ],
  52304. "FTL": [
  52305. "Freetype Project License",
  52306. false,
  52307. false
  52308. ],
  52309. "Furuseth": [
  52310. "Furuseth License",
  52311. false,
  52312. false
  52313. ],
  52314. "fwlw": [
  52315. "fwlw License",
  52316. false,
  52317. false
  52318. ],
  52319. "GCR-docs": [
  52320. "Gnome GCR Documentation License",
  52321. false,
  52322. false
  52323. ],
  52324. "GD": [
  52325. "GD License",
  52326. false,
  52327. false
  52328. ],
  52329. "GFDL-1.1": [
  52330. "GNU Free Documentation License v1.1",
  52331. false,
  52332. true
  52333. ],
  52334. "GFDL-1.1-invariants-only": [
  52335. "GNU Free Documentation License v1.1 only - invariants",
  52336. false,
  52337. false
  52338. ],
  52339. "GFDL-1.1-invariants-or-later": [
  52340. "GNU Free Documentation License v1.1 or later - invariants",
  52341. false,
  52342. false
  52343. ],
  52344. "GFDL-1.1-no-invariants-only": [
  52345. "GNU Free Documentation License v1.1 only - no invariants",
  52346. false,
  52347. false
  52348. ],
  52349. "GFDL-1.1-no-invariants-or-later": [
  52350. "GNU Free Documentation License v1.1 or later - no invariants",
  52351. false,
  52352. false
  52353. ],
  52354. "GFDL-1.1-only": [
  52355. "GNU Free Documentation License v1.1 only",
  52356. false,
  52357. false
  52358. ],
  52359. "GFDL-1.1-or-later": [
  52360. "GNU Free Documentation License v1.1 or later",
  52361. false,
  52362. false
  52363. ],
  52364. "GFDL-1.2": [
  52365. "GNU Free Documentation License v1.2",
  52366. false,
  52367. true
  52368. ],
  52369. "GFDL-1.2-invariants-only": [
  52370. "GNU Free Documentation License v1.2 only - invariants",
  52371. false,
  52372. false
  52373. ],
  52374. "GFDL-1.2-invariants-or-later": [
  52375. "GNU Free Documentation License v1.2 or later - invariants",
  52376. false,
  52377. false
  52378. ],
  52379. "GFDL-1.2-no-invariants-only": [
  52380. "GNU Free Documentation License v1.2 only - no invariants",
  52381. false,
  52382. false
  52383. ],
  52384. "GFDL-1.2-no-invariants-or-later": [
  52385. "GNU Free Documentation License v1.2 or later - no invariants",
  52386. false,
  52387. false
  52388. ],
  52389. "GFDL-1.2-only": [
  52390. "GNU Free Documentation License v1.2 only",
  52391. false,
  52392. false
  52393. ],
  52394. "GFDL-1.2-or-later": [
  52395. "GNU Free Documentation License v1.2 or later",
  52396. false,
  52397. false
  52398. ],
  52399. "GFDL-1.3": [
  52400. "GNU Free Documentation License v1.3",
  52401. false,
  52402. true
  52403. ],
  52404. "GFDL-1.3-invariants-only": [
  52405. "GNU Free Documentation License v1.3 only - invariants",
  52406. false,
  52407. false
  52408. ],
  52409. "GFDL-1.3-invariants-or-later": [
  52410. "GNU Free Documentation License v1.3 or later - invariants",
  52411. false,
  52412. false
  52413. ],
  52414. "GFDL-1.3-no-invariants-only": [
  52415. "GNU Free Documentation License v1.3 only - no invariants",
  52416. false,
  52417. false
  52418. ],
  52419. "GFDL-1.3-no-invariants-or-later": [
  52420. "GNU Free Documentation License v1.3 or later - no invariants",
  52421. false,
  52422. false
  52423. ],
  52424. "GFDL-1.3-only": [
  52425. "GNU Free Documentation License v1.3 only",
  52426. false,
  52427. false
  52428. ],
  52429. "GFDL-1.3-or-later": [
  52430. "GNU Free Documentation License v1.3 or later",
  52431. false,
  52432. false
  52433. ],
  52434. "Giftware": [
  52435. "Giftware License",
  52436. false,
  52437. false
  52438. ],
  52439. "GL2PS": [
  52440. "GL2PS License",
  52441. false,
  52442. false
  52443. ],
  52444. "Glide": [
  52445. "3dfx Glide License",
  52446. false,
  52447. false
  52448. ],
  52449. "Glulxe": [
  52450. "Glulxe License",
  52451. false,
  52452. false
  52453. ],
  52454. "GLWTPL": [
  52455. "Good Luck With That Public License",
  52456. false,
  52457. false
  52458. ],
  52459. "gnuplot": [
  52460. "gnuplot License",
  52461. false,
  52462. false
  52463. ],
  52464. "GPL-1.0": [
  52465. "GNU General Public License v1.0 only",
  52466. false,
  52467. true
  52468. ],
  52469. "GPL-1.0+": [
  52470. "GNU General Public License v1.0 or later",
  52471. false,
  52472. true
  52473. ],
  52474. "GPL-1.0-only": [
  52475. "GNU General Public License v1.0 only",
  52476. false,
  52477. false
  52478. ],
  52479. "GPL-1.0-or-later": [
  52480. "GNU General Public License v1.0 or later",
  52481. false,
  52482. false
  52483. ],
  52484. "GPL-2.0": [
  52485. "GNU General Public License v2.0 only",
  52486. true,
  52487. true
  52488. ],
  52489. "GPL-2.0+": [
  52490. "GNU General Public License v2.0 or later",
  52491. true,
  52492. true
  52493. ],
  52494. "GPL-2.0-only": [
  52495. "GNU General Public License v2.0 only",
  52496. true,
  52497. false
  52498. ],
  52499. "GPL-2.0-or-later": [
  52500. "GNU General Public License v2.0 or later",
  52501. true,
  52502. false
  52503. ],
  52504. "GPL-2.0-with-autoconf-exception": [
  52505. "GNU General Public License v2.0 w/Autoconf exception",
  52506. false,
  52507. true
  52508. ],
  52509. "GPL-2.0-with-bison-exception": [
  52510. "GNU General Public License v2.0 w/Bison exception",
  52511. false,
  52512. true
  52513. ],
  52514. "GPL-2.0-with-classpath-exception": [
  52515. "GNU General Public License v2.0 w/Classpath exception",
  52516. false,
  52517. true
  52518. ],
  52519. "GPL-2.0-with-font-exception": [
  52520. "GNU General Public License v2.0 w/Font exception",
  52521. false,
  52522. true
  52523. ],
  52524. "GPL-2.0-with-GCC-exception": [
  52525. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  52526. false,
  52527. true
  52528. ],
  52529. "GPL-3.0": [
  52530. "GNU General Public License v3.0 only",
  52531. true,
  52532. true
  52533. ],
  52534. "GPL-3.0+": [
  52535. "GNU General Public License v3.0 or later",
  52536. true,
  52537. true
  52538. ],
  52539. "GPL-3.0-only": [
  52540. "GNU General Public License v3.0 only",
  52541. true,
  52542. false
  52543. ],
  52544. "GPL-3.0-or-later": [
  52545. "GNU General Public License v3.0 or later",
  52546. true,
  52547. false
  52548. ],
  52549. "GPL-3.0-with-autoconf-exception": [
  52550. "GNU General Public License v3.0 w/Autoconf exception",
  52551. false,
  52552. true
  52553. ],
  52554. "GPL-3.0-with-GCC-exception": [
  52555. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  52556. true,
  52557. true
  52558. ],
  52559. "Graphics-Gems": [
  52560. "Graphics Gems License",
  52561. false,
  52562. false
  52563. ],
  52564. "gSOAP-1.3b": [
  52565. "gSOAP Public License v1.3b",
  52566. false,
  52567. false
  52568. ],
  52569. "HaskellReport": [
  52570. "Haskell Language Report License",
  52571. false,
  52572. false
  52573. ],
  52574. "hdparm": [
  52575. "hdparm License",
  52576. false,
  52577. false
  52578. ],
  52579. "Hippocratic-2.1": [
  52580. "Hippocratic License 2.1",
  52581. false,
  52582. false
  52583. ],
  52584. "HP-1986": [
  52585. "Hewlett-Packard 1986 License",
  52586. false,
  52587. false
  52588. ],
  52589. "HP-1989": [
  52590. "Hewlett-Packard 1989 License",
  52591. false,
  52592. false
  52593. ],
  52594. "HPND": [
  52595. "Historical Permission Notice and Disclaimer",
  52596. true,
  52597. false
  52598. ],
  52599. "HPND-DEC": [
  52600. "Historical Permission Notice and Disclaimer - DEC variant",
  52601. false,
  52602. false
  52603. ],
  52604. "HPND-doc": [
  52605. "Historical Permission Notice and Disclaimer - documentation variant",
  52606. false,
  52607. false
  52608. ],
  52609. "HPND-doc-sell": [
  52610. "Historical Permission Notice and Disclaimer - documentation sell variant",
  52611. false,
  52612. false
  52613. ],
  52614. "HPND-export-US": [
  52615. "HPND with US Government export control warning",
  52616. false,
  52617. false
  52618. ],
  52619. "HPND-export-US-modify": [
  52620. "HPND with US Government export control warning and modification rqmt",
  52621. false,
  52622. false
  52623. ],
  52624. "HPND-Markus-Kuhn": [
  52625. "Historical Permission Notice and Disclaimer - Markus Kuhn variant",
  52626. false,
  52627. false
  52628. ],
  52629. "HPND-Pbmplus": [
  52630. "Historical Permission Notice and Disclaimer - Pbmplus variant",
  52631. false,
  52632. false
  52633. ],
  52634. "HPND-sell-MIT-disclaimer-xserver": [
  52635. "Historical Permission Notice and Disclaimer - sell xserver variant with MIT disclaimer",
  52636. false,
  52637. false
  52638. ],
  52639. "HPND-sell-regexpr": [
  52640. "Historical Permission Notice and Disclaimer - sell regexpr variant",
  52641. false,
  52642. false
  52643. ],
  52644. "HPND-sell-variant": [
  52645. "Historical Permission Notice and Disclaimer - sell variant",
  52646. false,
  52647. false
  52648. ],
  52649. "HPND-sell-variant-MIT-disclaimer": [
  52650. "HPND sell variant with MIT disclaimer",
  52651. false,
  52652. false
  52653. ],
  52654. "HPND-UC": [
  52655. "Historical Permission Notice and Disclaimer - University of California variant",
  52656. false,
  52657. false
  52658. ],
  52659. "HTMLTIDY": [
  52660. "HTML Tidy License",
  52661. false,
  52662. false
  52663. ],
  52664. "IBM-pibs": [
  52665. "IBM PowerPC Initialization and Boot Software",
  52666. false,
  52667. false
  52668. ],
  52669. "ICU": [
  52670. "ICU License",
  52671. true,
  52672. false
  52673. ],
  52674. "IEC-Code-Components-EULA": [
  52675. "IEC Code Components End-user licence agreement",
  52676. false,
  52677. false
  52678. ],
  52679. "IJG": [
  52680. "Independent JPEG Group License",
  52681. false,
  52682. false
  52683. ],
  52684. "IJG-short": [
  52685. "Independent JPEG Group License - short",
  52686. false,
  52687. false
  52688. ],
  52689. "ImageMagick": [
  52690. "ImageMagick License",
  52691. false,
  52692. false
  52693. ],
  52694. "iMatix": [
  52695. "iMatix Standard Function Library Agreement",
  52696. false,
  52697. false
  52698. ],
  52699. "Imlib2": [
  52700. "Imlib2 License",
  52701. false,
  52702. false
  52703. ],
  52704. "Info-ZIP": [
  52705. "Info-ZIP License",
  52706. false,
  52707. false
  52708. ],
  52709. "Inner-Net-2.0": [
  52710. "Inner Net License v2.0",
  52711. false,
  52712. false
  52713. ],
  52714. "Intel": [
  52715. "Intel Open Source License",
  52716. true,
  52717. false
  52718. ],
  52719. "Intel-ACPI": [
  52720. "Intel ACPI Software License Agreement",
  52721. false,
  52722. false
  52723. ],
  52724. "Interbase-1.0": [
  52725. "Interbase Public License v1.0",
  52726. false,
  52727. false
  52728. ],
  52729. "IPA": [
  52730. "IPA Font License",
  52731. true,
  52732. false
  52733. ],
  52734. "IPL-1.0": [
  52735. "IBM Public License v1.0",
  52736. true,
  52737. false
  52738. ],
  52739. "ISC": [
  52740. "ISC License",
  52741. true,
  52742. false
  52743. ],
  52744. "Jam": [
  52745. "Jam License",
  52746. true,
  52747. false
  52748. ],
  52749. "JasPer-2.0": [
  52750. "JasPer License",
  52751. false,
  52752. false
  52753. ],
  52754. "JPL-image": [
  52755. "JPL Image Use Policy",
  52756. false,
  52757. false
  52758. ],
  52759. "JPNIC": [
  52760. "Japan Network Information Center License",
  52761. false,
  52762. false
  52763. ],
  52764. "JSON": [
  52765. "JSON License",
  52766. false,
  52767. false
  52768. ],
  52769. "Kastrup": [
  52770. "Kastrup License",
  52771. false,
  52772. false
  52773. ],
  52774. "Kazlib": [
  52775. "Kazlib License",
  52776. false,
  52777. false
  52778. ],
  52779. "Knuth-CTAN": [
  52780. "Knuth CTAN License",
  52781. false,
  52782. false
  52783. ],
  52784. "LAL-1.2": [
  52785. "Licence Art Libre 1.2",
  52786. false,
  52787. false
  52788. ],
  52789. "LAL-1.3": [
  52790. "Licence Art Libre 1.3",
  52791. false,
  52792. false
  52793. ],
  52794. "Latex2e": [
  52795. "Latex2e License",
  52796. false,
  52797. false
  52798. ],
  52799. "Latex2e-translated-notice": [
  52800. "Latex2e with translated notice permission",
  52801. false,
  52802. false
  52803. ],
  52804. "Leptonica": [
  52805. "Leptonica License",
  52806. false,
  52807. false
  52808. ],
  52809. "LGPL-2.0": [
  52810. "GNU Library General Public License v2 only",
  52811. true,
  52812. true
  52813. ],
  52814. "LGPL-2.0+": [
  52815. "GNU Library General Public License v2 or later",
  52816. true,
  52817. true
  52818. ],
  52819. "LGPL-2.0-only": [
  52820. "GNU Library General Public License v2 only",
  52821. true,
  52822. false
  52823. ],
  52824. "LGPL-2.0-or-later": [
  52825. "GNU Library General Public License v2 or later",
  52826. true,
  52827. false
  52828. ],
  52829. "LGPL-2.1": [
  52830. "GNU Lesser General Public License v2.1 only",
  52831. true,
  52832. true
  52833. ],
  52834. "LGPL-2.1+": [
  52835. "GNU Lesser General Public License v2.1 or later",
  52836. true,
  52837. true
  52838. ],
  52839. "LGPL-2.1-only": [
  52840. "GNU Lesser General Public License v2.1 only",
  52841. true,
  52842. false
  52843. ],
  52844. "LGPL-2.1-or-later": [
  52845. "GNU Lesser General Public License v2.1 or later",
  52846. true,
  52847. false
  52848. ],
  52849. "LGPL-3.0": [
  52850. "GNU Lesser General Public License v3.0 only",
  52851. true,
  52852. true
  52853. ],
  52854. "LGPL-3.0+": [
  52855. "GNU Lesser General Public License v3.0 or later",
  52856. true,
  52857. true
  52858. ],
  52859. "LGPL-3.0-only": [
  52860. "GNU Lesser General Public License v3.0 only",
  52861. true,
  52862. false
  52863. ],
  52864. "LGPL-3.0-or-later": [
  52865. "GNU Lesser General Public License v3.0 or later",
  52866. true,
  52867. false
  52868. ],
  52869. "LGPLLR": [
  52870. "Lesser General Public License For Linguistic Resources",
  52871. false,
  52872. false
  52873. ],
  52874. "Libpng": [
  52875. "libpng License",
  52876. false,
  52877. false
  52878. ],
  52879. "libpng-2.0": [
  52880. "PNG Reference Library version 2",
  52881. false,
  52882. false
  52883. ],
  52884. "libselinux-1.0": [
  52885. "libselinux public domain notice",
  52886. false,
  52887. false
  52888. ],
  52889. "libtiff": [
  52890. "libtiff License",
  52891. false,
  52892. false
  52893. ],
  52894. "libutil-David-Nugent": [
  52895. "libutil David Nugent License",
  52896. false,
  52897. false
  52898. ],
  52899. "LiLiQ-P-1.1": [
  52900. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  52901. true,
  52902. false
  52903. ],
  52904. "LiLiQ-R-1.1": [
  52905. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  52906. true,
  52907. false
  52908. ],
  52909. "LiLiQ-Rplus-1.1": [
  52910. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  52911. true,
  52912. false
  52913. ],
  52914. "Linux-man-pages-1-para": [
  52915. "Linux man-pages - 1 paragraph",
  52916. false,
  52917. false
  52918. ],
  52919. "Linux-man-pages-copyleft": [
  52920. "Linux man-pages Copyleft",
  52921. false,
  52922. false
  52923. ],
  52924. "Linux-man-pages-copyleft-2-para": [
  52925. "Linux man-pages Copyleft - 2 paragraphs",
  52926. false,
  52927. false
  52928. ],
  52929. "Linux-man-pages-copyleft-var": [
  52930. "Linux man-pages Copyleft Variant",
  52931. false,
  52932. false
  52933. ],
  52934. "Linux-OpenIB": [
  52935. "Linux Kernel Variant of OpenIB.org license",
  52936. false,
  52937. false
  52938. ],
  52939. "LOOP": [
  52940. "Common Lisp LOOP License",
  52941. false,
  52942. false
  52943. ],
  52944. "LPL-1.0": [
  52945. "Lucent Public License Version 1.0",
  52946. true,
  52947. false
  52948. ],
  52949. "LPL-1.02": [
  52950. "Lucent Public License v1.02",
  52951. true,
  52952. false
  52953. ],
  52954. "LPPL-1.0": [
  52955. "LaTeX Project Public License v1.0",
  52956. false,
  52957. false
  52958. ],
  52959. "LPPL-1.1": [
  52960. "LaTeX Project Public License v1.1",
  52961. false,
  52962. false
  52963. ],
  52964. "LPPL-1.2": [
  52965. "LaTeX Project Public License v1.2",
  52966. false,
  52967. false
  52968. ],
  52969. "LPPL-1.3a": [
  52970. "LaTeX Project Public License v1.3a",
  52971. false,
  52972. false
  52973. ],
  52974. "LPPL-1.3c": [
  52975. "LaTeX Project Public License v1.3c",
  52976. true,
  52977. false
  52978. ],
  52979. "lsof": [
  52980. "lsof License",
  52981. false,
  52982. false
  52983. ],
  52984. "Lucida-Bitmap-Fonts": [
  52985. "Lucida Bitmap Fonts License",
  52986. false,
  52987. false
  52988. ],
  52989. "LZMA-SDK-9.11-to-9.20": [
  52990. "LZMA SDK License (versions 9.11 to 9.20)",
  52991. false,
  52992. false
  52993. ],
  52994. "LZMA-SDK-9.22": [
  52995. "LZMA SDK License (versions 9.22 and beyond)",
  52996. false,
  52997. false
  52998. ],
  52999. "magaz": [
  53000. "magaz License",
  53001. false,
  53002. false
  53003. ],
  53004. "MakeIndex": [
  53005. "MakeIndex License",
  53006. false,
  53007. false
  53008. ],
  53009. "Martin-Birgmeier": [
  53010. "Martin Birgmeier License",
  53011. false,
  53012. false
  53013. ],
  53014. "McPhee-slideshow": [
  53015. "McPhee Slideshow License",
  53016. false,
  53017. false
  53018. ],
  53019. "metamail": [
  53020. "metamail License",
  53021. false,
  53022. false
  53023. ],
  53024. "Minpack": [
  53025. "Minpack License",
  53026. false,
  53027. false
  53028. ],
  53029. "MirOS": [
  53030. "The MirOS Licence",
  53031. true,
  53032. false
  53033. ],
  53034. "MIT": [
  53035. "MIT License",
  53036. true,
  53037. false
  53038. ],
  53039. "MIT-0": [
  53040. "MIT No Attribution",
  53041. true,
  53042. false
  53043. ],
  53044. "MIT-advertising": [
  53045. "Enlightenment License (e16)",
  53046. false,
  53047. false
  53048. ],
  53049. "MIT-CMU": [
  53050. "CMU License",
  53051. false,
  53052. false
  53053. ],
  53054. "MIT-enna": [
  53055. "enna License",
  53056. false,
  53057. false
  53058. ],
  53059. "MIT-feh": [
  53060. "feh License",
  53061. false,
  53062. false
  53063. ],
  53064. "MIT-Festival": [
  53065. "MIT Festival Variant",
  53066. false,
  53067. false
  53068. ],
  53069. "MIT-Modern-Variant": [
  53070. "MIT License Modern Variant",
  53071. true,
  53072. false
  53073. ],
  53074. "MIT-open-group": [
  53075. "MIT Open Group variant",
  53076. false,
  53077. false
  53078. ],
  53079. "MIT-testregex": [
  53080. "MIT testregex Variant",
  53081. false,
  53082. false
  53083. ],
  53084. "MIT-Wu": [
  53085. "MIT Tom Wu Variant",
  53086. false,
  53087. false
  53088. ],
  53089. "MITNFA": [
  53090. "MIT +no-false-attribs license",
  53091. false,
  53092. false
  53093. ],
  53094. "MMIXware": [
  53095. "MMIXware License",
  53096. false,
  53097. false
  53098. ],
  53099. "Motosoto": [
  53100. "Motosoto License",
  53101. true,
  53102. false
  53103. ],
  53104. "MPEG-SSG": [
  53105. "MPEG Software Simulation",
  53106. false,
  53107. false
  53108. ],
  53109. "mpi-permissive": [
  53110. "mpi Permissive License",
  53111. false,
  53112. false
  53113. ],
  53114. "mpich2": [
  53115. "mpich2 License",
  53116. false,
  53117. false
  53118. ],
  53119. "MPL-1.0": [
  53120. "Mozilla Public License 1.0",
  53121. true,
  53122. false
  53123. ],
  53124. "MPL-1.1": [
  53125. "Mozilla Public License 1.1",
  53126. true,
  53127. false
  53128. ],
  53129. "MPL-2.0": [
  53130. "Mozilla Public License 2.0",
  53131. true,
  53132. false
  53133. ],
  53134. "MPL-2.0-no-copyleft-exception": [
  53135. "Mozilla Public License 2.0 (no copyleft exception)",
  53136. true,
  53137. false
  53138. ],
  53139. "mplus": [
  53140. "mplus Font License",
  53141. false,
  53142. false
  53143. ],
  53144. "MS-LPL": [
  53145. "Microsoft Limited Public License",
  53146. false,
  53147. false
  53148. ],
  53149. "MS-PL": [
  53150. "Microsoft Public License",
  53151. true,
  53152. false
  53153. ],
  53154. "MS-RL": [
  53155. "Microsoft Reciprocal License",
  53156. true,
  53157. false
  53158. ],
  53159. "MTLL": [
  53160. "Matrix Template Library License",
  53161. false,
  53162. false
  53163. ],
  53164. "MulanPSL-1.0": [
  53165. "Mulan Permissive Software License, Version 1",
  53166. false,
  53167. false
  53168. ],
  53169. "MulanPSL-2.0": [
  53170. "Mulan Permissive Software License, Version 2",
  53171. true,
  53172. false
  53173. ],
  53174. "Multics": [
  53175. "Multics License",
  53176. true,
  53177. false
  53178. ],
  53179. "Mup": [
  53180. "Mup License",
  53181. false,
  53182. false
  53183. ],
  53184. "NAIST-2003": [
  53185. "Nara Institute of Science and Technology License (2003)",
  53186. false,
  53187. false
  53188. ],
  53189. "NASA-1.3": [
  53190. "NASA Open Source Agreement 1.3",
  53191. true,
  53192. false
  53193. ],
  53194. "Naumen": [
  53195. "Naumen Public License",
  53196. true,
  53197. false
  53198. ],
  53199. "NBPL-1.0": [
  53200. "Net Boolean Public License v1",
  53201. false,
  53202. false
  53203. ],
  53204. "NCGL-UK-2.0": [
  53205. "Non-Commercial Government Licence",
  53206. false,
  53207. false
  53208. ],
  53209. "NCSA": [
  53210. "University of Illinois/NCSA Open Source License",
  53211. true,
  53212. false
  53213. ],
  53214. "Net-SNMP": [
  53215. "Net-SNMP License",
  53216. false,
  53217. false
  53218. ],
  53219. "NetCDF": [
  53220. "NetCDF license",
  53221. false,
  53222. false
  53223. ],
  53224. "Newsletr": [
  53225. "Newsletr License",
  53226. false,
  53227. false
  53228. ],
  53229. "NGPL": [
  53230. "Nethack General Public License",
  53231. true,
  53232. false
  53233. ],
  53234. "NICTA-1.0": [
  53235. "NICTA Public Software License, Version 1.0",
  53236. false,
  53237. false
  53238. ],
  53239. "NIST-PD": [
  53240. "NIST Public Domain Notice",
  53241. false,
  53242. false
  53243. ],
  53244. "NIST-PD-fallback": [
  53245. "NIST Public Domain Notice with license fallback",
  53246. false,
  53247. false
  53248. ],
  53249. "NIST-Software": [
  53250. "NIST Software License",
  53251. false,
  53252. false
  53253. ],
  53254. "NLOD-1.0": [
  53255. "Norwegian Licence for Open Government Data (NLOD) 1.0",
  53256. false,
  53257. false
  53258. ],
  53259. "NLOD-2.0": [
  53260. "Norwegian Licence for Open Government Data (NLOD) 2.0",
  53261. false,
  53262. false
  53263. ],
  53264. "NLPL": [
  53265. "No Limit Public License",
  53266. false,
  53267. false
  53268. ],
  53269. "Nokia": [
  53270. "Nokia Open Source License",
  53271. true,
  53272. false
  53273. ],
  53274. "NOSL": [
  53275. "Netizen Open Source License",
  53276. false,
  53277. false
  53278. ],
  53279. "Noweb": [
  53280. "Noweb License",
  53281. false,
  53282. false
  53283. ],
  53284. "NPL-1.0": [
  53285. "Netscape Public License v1.0",
  53286. false,
  53287. false
  53288. ],
  53289. "NPL-1.1": [
  53290. "Netscape Public License v1.1",
  53291. false,
  53292. false
  53293. ],
  53294. "NPOSL-3.0": [
  53295. "Non-Profit Open Software License 3.0",
  53296. true,
  53297. false
  53298. ],
  53299. "NRL": [
  53300. "NRL License",
  53301. false,
  53302. false
  53303. ],
  53304. "NTP": [
  53305. "NTP License",
  53306. true,
  53307. false
  53308. ],
  53309. "NTP-0": [
  53310. "NTP No Attribution",
  53311. false,
  53312. false
  53313. ],
  53314. "Nunit": [
  53315. "Nunit License",
  53316. false,
  53317. true
  53318. ],
  53319. "O-UDA-1.0": [
  53320. "Open Use of Data Agreement v1.0",
  53321. false,
  53322. false
  53323. ],
  53324. "OCCT-PL": [
  53325. "Open CASCADE Technology Public License",
  53326. false,
  53327. false
  53328. ],
  53329. "OCLC-2.0": [
  53330. "OCLC Research Public License 2.0",
  53331. true,
  53332. false
  53333. ],
  53334. "ODbL-1.0": [
  53335. "Open Data Commons Open Database License v1.0",
  53336. false,
  53337. false
  53338. ],
  53339. "ODC-By-1.0": [
  53340. "Open Data Commons Attribution License v1.0",
  53341. false,
  53342. false
  53343. ],
  53344. "OFFIS": [
  53345. "OFFIS License",
  53346. false,
  53347. false
  53348. ],
  53349. "OFL-1.0": [
  53350. "SIL Open Font License 1.0",
  53351. false,
  53352. false
  53353. ],
  53354. "OFL-1.0-no-RFN": [
  53355. "SIL Open Font License 1.0 with no Reserved Font Name",
  53356. false,
  53357. false
  53358. ],
  53359. "OFL-1.0-RFN": [
  53360. "SIL Open Font License 1.0 with Reserved Font Name",
  53361. false,
  53362. false
  53363. ],
  53364. "OFL-1.1": [
  53365. "SIL Open Font License 1.1",
  53366. true,
  53367. false
  53368. ],
  53369. "OFL-1.1-no-RFN": [
  53370. "SIL Open Font License 1.1 with no Reserved Font Name",
  53371. true,
  53372. false
  53373. ],
  53374. "OFL-1.1-RFN": [
  53375. "SIL Open Font License 1.1 with Reserved Font Name",
  53376. true,
  53377. false
  53378. ],
  53379. "OGC-1.0": [
  53380. "OGC Software License, Version 1.0",
  53381. false,
  53382. false
  53383. ],
  53384. "OGDL-Taiwan-1.0": [
  53385. "Taiwan Open Government Data License, version 1.0",
  53386. false,
  53387. false
  53388. ],
  53389. "OGL-Canada-2.0": [
  53390. "Open Government Licence - Canada",
  53391. false,
  53392. false
  53393. ],
  53394. "OGL-UK-1.0": [
  53395. "Open Government Licence v1.0",
  53396. false,
  53397. false
  53398. ],
  53399. "OGL-UK-2.0": [
  53400. "Open Government Licence v2.0",
  53401. false,
  53402. false
  53403. ],
  53404. "OGL-UK-3.0": [
  53405. "Open Government Licence v3.0",
  53406. false,
  53407. false
  53408. ],
  53409. "OGTSL": [
  53410. "Open Group Test Suite License",
  53411. true,
  53412. false
  53413. ],
  53414. "OLDAP-1.1": [
  53415. "Open LDAP Public License v1.1",
  53416. false,
  53417. false
  53418. ],
  53419. "OLDAP-1.2": [
  53420. "Open LDAP Public License v1.2",
  53421. false,
  53422. false
  53423. ],
  53424. "OLDAP-1.3": [
  53425. "Open LDAP Public License v1.3",
  53426. false,
  53427. false
  53428. ],
  53429. "OLDAP-1.4": [
  53430. "Open LDAP Public License v1.4",
  53431. false,
  53432. false
  53433. ],
  53434. "OLDAP-2.0": [
  53435. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  53436. false,
  53437. false
  53438. ],
  53439. "OLDAP-2.0.1": [
  53440. "Open LDAP Public License v2.0.1",
  53441. false,
  53442. false
  53443. ],
  53444. "OLDAP-2.1": [
  53445. "Open LDAP Public License v2.1",
  53446. false,
  53447. false
  53448. ],
  53449. "OLDAP-2.2": [
  53450. "Open LDAP Public License v2.2",
  53451. false,
  53452. false
  53453. ],
  53454. "OLDAP-2.2.1": [
  53455. "Open LDAP Public License v2.2.1",
  53456. false,
  53457. false
  53458. ],
  53459. "OLDAP-2.2.2": [
  53460. "Open LDAP Public License 2.2.2",
  53461. false,
  53462. false
  53463. ],
  53464. "OLDAP-2.3": [
  53465. "Open LDAP Public License v2.3",
  53466. false,
  53467. false
  53468. ],
  53469. "OLDAP-2.4": [
  53470. "Open LDAP Public License v2.4",
  53471. false,
  53472. false
  53473. ],
  53474. "OLDAP-2.5": [
  53475. "Open LDAP Public License v2.5",
  53476. false,
  53477. false
  53478. ],
  53479. "OLDAP-2.6": [
  53480. "Open LDAP Public License v2.6",
  53481. false,
  53482. false
  53483. ],
  53484. "OLDAP-2.7": [
  53485. "Open LDAP Public License v2.7",
  53486. false,
  53487. false
  53488. ],
  53489. "OLDAP-2.8": [
  53490. "Open LDAP Public License v2.8",
  53491. true,
  53492. false
  53493. ],
  53494. "OLFL-1.3": [
  53495. "Open Logistics Foundation License Version 1.3",
  53496. true,
  53497. false
  53498. ],
  53499. "OML": [
  53500. "Open Market License",
  53501. false,
  53502. false
  53503. ],
  53504. "OpenPBS-2.3": [
  53505. "OpenPBS v2.3 Software License",
  53506. false,
  53507. false
  53508. ],
  53509. "OpenSSL": [
  53510. "OpenSSL License",
  53511. false,
  53512. false
  53513. ],
  53514. "OPL-1.0": [
  53515. "Open Public License v1.0",
  53516. false,
  53517. false
  53518. ],
  53519. "OPL-UK-3.0": [
  53520. "United Kingdom Open Parliament Licence v3.0",
  53521. false,
  53522. false
  53523. ],
  53524. "OPUBL-1.0": [
  53525. "Open Publication License v1.0",
  53526. false,
  53527. false
  53528. ],
  53529. "OSET-PL-2.1": [
  53530. "OSET Public License version 2.1",
  53531. true,
  53532. false
  53533. ],
  53534. "OSL-1.0": [
  53535. "Open Software License 1.0",
  53536. true,
  53537. false
  53538. ],
  53539. "OSL-1.1": [
  53540. "Open Software License 1.1",
  53541. false,
  53542. false
  53543. ],
  53544. "OSL-2.0": [
  53545. "Open Software License 2.0",
  53546. true,
  53547. false
  53548. ],
  53549. "OSL-2.1": [
  53550. "Open Software License 2.1",
  53551. true,
  53552. false
  53553. ],
  53554. "OSL-3.0": [
  53555. "Open Software License 3.0",
  53556. true,
  53557. false
  53558. ],
  53559. "PADL": [
  53560. "PADL License",
  53561. false,
  53562. false
  53563. ],
  53564. "Parity-6.0.0": [
  53565. "The Parity Public License 6.0.0",
  53566. false,
  53567. false
  53568. ],
  53569. "Parity-7.0.0": [
  53570. "The Parity Public License 7.0.0",
  53571. false,
  53572. false
  53573. ],
  53574. "PDDL-1.0": [
  53575. "Open Data Commons Public Domain Dedication & License 1.0",
  53576. false,
  53577. false
  53578. ],
  53579. "PHP-3.0": [
  53580. "PHP License v3.0",
  53581. true,
  53582. false
  53583. ],
  53584. "PHP-3.01": [
  53585. "PHP License v3.01",
  53586. true,
  53587. false
  53588. ],
  53589. "Pixar": [
  53590. "Pixar License",
  53591. false,
  53592. false
  53593. ],
  53594. "Plexus": [
  53595. "Plexus Classworlds License",
  53596. false,
  53597. false
  53598. ],
  53599. "pnmstitch": [
  53600. "pnmstitch License",
  53601. false,
  53602. false
  53603. ],
  53604. "PolyForm-Noncommercial-1.0.0": [
  53605. "PolyForm Noncommercial License 1.0.0",
  53606. false,
  53607. false
  53608. ],
  53609. "PolyForm-Small-Business-1.0.0": [
  53610. "PolyForm Small Business License 1.0.0",
  53611. false,
  53612. false
  53613. ],
  53614. "PostgreSQL": [
  53615. "PostgreSQL License",
  53616. true,
  53617. false
  53618. ],
  53619. "PSF-2.0": [
  53620. "Python Software Foundation License 2.0",
  53621. false,
  53622. false
  53623. ],
  53624. "psfrag": [
  53625. "psfrag License",
  53626. false,
  53627. false
  53628. ],
  53629. "psutils": [
  53630. "psutils License",
  53631. false,
  53632. false
  53633. ],
  53634. "Python-2.0": [
  53635. "Python License 2.0",
  53636. true,
  53637. false
  53638. ],
  53639. "Python-2.0.1": [
  53640. "Python License 2.0.1",
  53641. false,
  53642. false
  53643. ],
  53644. "python-ldap": [
  53645. "Python ldap License",
  53646. false,
  53647. false
  53648. ],
  53649. "Qhull": [
  53650. "Qhull License",
  53651. false,
  53652. false
  53653. ],
  53654. "QPL-1.0": [
  53655. "Q Public License 1.0",
  53656. true,
  53657. false
  53658. ],
  53659. "QPL-1.0-INRIA-2004": [
  53660. "Q Public License 1.0 - INRIA 2004 variant",
  53661. false,
  53662. false
  53663. ],
  53664. "Rdisc": [
  53665. "Rdisc License",
  53666. false,
  53667. false
  53668. ],
  53669. "RHeCos-1.1": [
  53670. "Red Hat eCos Public License v1.1",
  53671. false,
  53672. false
  53673. ],
  53674. "RPL-1.1": [
  53675. "Reciprocal Public License 1.1",
  53676. true,
  53677. false
  53678. ],
  53679. "RPL-1.5": [
  53680. "Reciprocal Public License 1.5",
  53681. true,
  53682. false
  53683. ],
  53684. "RPSL-1.0": [
  53685. "RealNetworks Public Source License v1.0",
  53686. true,
  53687. false
  53688. ],
  53689. "RSA-MD": [
  53690. "RSA Message-Digest License",
  53691. false,
  53692. false
  53693. ],
  53694. "RSCPL": [
  53695. "Ricoh Source Code Public License",
  53696. true,
  53697. false
  53698. ],
  53699. "Ruby": [
  53700. "Ruby License",
  53701. false,
  53702. false
  53703. ],
  53704. "SAX-PD": [
  53705. "Sax Public Domain Notice",
  53706. false,
  53707. false
  53708. ],
  53709. "Saxpath": [
  53710. "Saxpath License",
  53711. false,
  53712. false
  53713. ],
  53714. "SCEA": [
  53715. "SCEA Shared Source License",
  53716. false,
  53717. false
  53718. ],
  53719. "SchemeReport": [
  53720. "Scheme Language Report License",
  53721. false,
  53722. false
  53723. ],
  53724. "Sendmail": [
  53725. "Sendmail License",
  53726. false,
  53727. false
  53728. ],
  53729. "Sendmail-8.23": [
  53730. "Sendmail License 8.23",
  53731. false,
  53732. false
  53733. ],
  53734. "SGI-B-1.0": [
  53735. "SGI Free Software License B v1.0",
  53736. false,
  53737. false
  53738. ],
  53739. "SGI-B-1.1": [
  53740. "SGI Free Software License B v1.1",
  53741. false,
  53742. false
  53743. ],
  53744. "SGI-B-2.0": [
  53745. "SGI Free Software License B v2.0",
  53746. false,
  53747. false
  53748. ],
  53749. "SGI-OpenGL": [
  53750. "SGI OpenGL License",
  53751. false,
  53752. false
  53753. ],
  53754. "SGP4": [
  53755. "SGP4 Permission Notice",
  53756. false,
  53757. false
  53758. ],
  53759. "SHL-0.5": [
  53760. "Solderpad Hardware License v0.5",
  53761. false,
  53762. false
  53763. ],
  53764. "SHL-0.51": [
  53765. "Solderpad Hardware License, Version 0.51",
  53766. false,
  53767. false
  53768. ],
  53769. "SimPL-2.0": [
  53770. "Simple Public License 2.0",
  53771. true,
  53772. false
  53773. ],
  53774. "SISSL": [
  53775. "Sun Industry Standards Source License v1.1",
  53776. true,
  53777. false
  53778. ],
  53779. "SISSL-1.2": [
  53780. "Sun Industry Standards Source License v1.2",
  53781. false,
  53782. false
  53783. ],
  53784. "SL": [
  53785. "SL License",
  53786. false,
  53787. false
  53788. ],
  53789. "Sleepycat": [
  53790. "Sleepycat License",
  53791. true,
  53792. false
  53793. ],
  53794. "SMLNJ": [
  53795. "Standard ML of New Jersey License",
  53796. false,
  53797. false
  53798. ],
  53799. "SMPPL": [
  53800. "Secure Messaging Protocol Public License",
  53801. false,
  53802. false
  53803. ],
  53804. "SNIA": [
  53805. "SNIA Public License 1.1",
  53806. false,
  53807. false
  53808. ],
  53809. "snprintf": [
  53810. "snprintf License",
  53811. false,
  53812. false
  53813. ],
  53814. "Soundex": [
  53815. "Soundex License",
  53816. false,
  53817. false
  53818. ],
  53819. "Spencer-86": [
  53820. "Spencer License 86",
  53821. false,
  53822. false
  53823. ],
  53824. "Spencer-94": [
  53825. "Spencer License 94",
  53826. false,
  53827. false
  53828. ],
  53829. "Spencer-99": [
  53830. "Spencer License 99",
  53831. false,
  53832. false
  53833. ],
  53834. "SPL-1.0": [
  53835. "Sun Public License v1.0",
  53836. true,
  53837. false
  53838. ],
  53839. "ssh-keyscan": [
  53840. "ssh-keyscan License",
  53841. false,
  53842. false
  53843. ],
  53844. "SSH-OpenSSH": [
  53845. "SSH OpenSSH license",
  53846. false,
  53847. false
  53848. ],
  53849. "SSH-short": [
  53850. "SSH short notice",
  53851. false,
  53852. false
  53853. ],
  53854. "SSPL-1.0": [
  53855. "Server Side Public License, v 1",
  53856. false,
  53857. false
  53858. ],
  53859. "StandardML-NJ": [
  53860. "Standard ML of New Jersey License",
  53861. false,
  53862. true
  53863. ],
  53864. "SugarCRM-1.1.3": [
  53865. "SugarCRM Public License v1.1.3",
  53866. false,
  53867. false
  53868. ],
  53869. "SunPro": [
  53870. "SunPro License",
  53871. false,
  53872. false
  53873. ],
  53874. "SWL": [
  53875. "Scheme Widget Library (SWL) Software License Agreement",
  53876. false,
  53877. false
  53878. ],
  53879. "swrule": [
  53880. "swrule License",
  53881. false,
  53882. false
  53883. ],
  53884. "Symlinks": [
  53885. "Symlinks License",
  53886. false,
  53887. false
  53888. ],
  53889. "TAPR-OHL-1.0": [
  53890. "TAPR Open Hardware License v1.0",
  53891. false,
  53892. false
  53893. ],
  53894. "TCL": [
  53895. "TCL/TK License",
  53896. false,
  53897. false
  53898. ],
  53899. "TCP-wrappers": [
  53900. "TCP Wrappers License",
  53901. false,
  53902. false
  53903. ],
  53904. "TermReadKey": [
  53905. "TermReadKey License",
  53906. false,
  53907. false
  53908. ],
  53909. "TMate": [
  53910. "TMate Open Source License",
  53911. false,
  53912. false
  53913. ],
  53914. "TORQUE-1.1": [
  53915. "TORQUE v2.5+ Software License v1.1",
  53916. false,
  53917. false
  53918. ],
  53919. "TOSL": [
  53920. "Trusster Open Source License",
  53921. false,
  53922. false
  53923. ],
  53924. "TPDL": [
  53925. "Time::ParseDate License",
  53926. false,
  53927. false
  53928. ],
  53929. "TPL-1.0": [
  53930. "THOR Public License 1.0",
  53931. false,
  53932. false
  53933. ],
  53934. "TTWL": [
  53935. "Text-Tabs+Wrap License",
  53936. false,
  53937. false
  53938. ],
  53939. "TTYP0": [
  53940. "TTYP0 License",
  53941. false,
  53942. false
  53943. ],
  53944. "TU-Berlin-1.0": [
  53945. "Technische Universitaet Berlin License 1.0",
  53946. false,
  53947. false
  53948. ],
  53949. "TU-Berlin-2.0": [
  53950. "Technische Universitaet Berlin License 2.0",
  53951. false,
  53952. false
  53953. ],
  53954. "UCAR": [
  53955. "UCAR License",
  53956. false,
  53957. false
  53958. ],
  53959. "UCL-1.0": [
  53960. "Upstream Compatibility License v1.0",
  53961. true,
  53962. false
  53963. ],
  53964. "ulem": [
  53965. "ulem License",
  53966. false,
  53967. false
  53968. ],
  53969. "Unicode-DFS-2015": [
  53970. "Unicode License Agreement - Data Files and Software (2015)",
  53971. false,
  53972. false
  53973. ],
  53974. "Unicode-DFS-2016": [
  53975. "Unicode License Agreement - Data Files and Software (2016)",
  53976. true,
  53977. false
  53978. ],
  53979. "Unicode-TOU": [
  53980. "Unicode Terms of Use",
  53981. false,
  53982. false
  53983. ],
  53984. "UnixCrypt": [
  53985. "UnixCrypt License",
  53986. false,
  53987. false
  53988. ],
  53989. "Unlicense": [
  53990. "The Unlicense",
  53991. true,
  53992. false
  53993. ],
  53994. "UPL-1.0": [
  53995. "Universal Permissive License v1.0",
  53996. true,
  53997. false
  53998. ],
  53999. "URT-RLE": [
  54000. "Utah Raster Toolkit Run Length Encoded License",
  54001. false,
  54002. false
  54003. ],
  54004. "Vim": [
  54005. "Vim License",
  54006. false,
  54007. false
  54008. ],
  54009. "VOSTROM": [
  54010. "VOSTROM Public License for Open Source",
  54011. false,
  54012. false
  54013. ],
  54014. "VSL-1.0": [
  54015. "Vovida Software License v1.0",
  54016. true,
  54017. false
  54018. ],
  54019. "W3C": [
  54020. "W3C Software Notice and License (2002-12-31)",
  54021. true,
  54022. false
  54023. ],
  54024. "W3C-19980720": [
  54025. "W3C Software Notice and License (1998-07-20)",
  54026. false,
  54027. false
  54028. ],
  54029. "W3C-20150513": [
  54030. "W3C Software Notice and Document License (2015-05-13)",
  54031. false,
  54032. false
  54033. ],
  54034. "w3m": [
  54035. "w3m License",
  54036. false,
  54037. false
  54038. ],
  54039. "Watcom-1.0": [
  54040. "Sybase Open Watcom Public License 1.0",
  54041. true,
  54042. false
  54043. ],
  54044. "Widget-Workshop": [
  54045. "Widget Workshop License",
  54046. false,
  54047. false
  54048. ],
  54049. "Wsuipa": [
  54050. "Wsuipa License",
  54051. false,
  54052. false
  54053. ],
  54054. "WTFPL": [
  54055. "Do What The F*ck You Want To Public License",
  54056. false,
  54057. false
  54058. ],
  54059. "wxWindows": [
  54060. "wxWindows Library License",
  54061. true,
  54062. true
  54063. ],
  54064. "X11": [
  54065. "X11 License",
  54066. false,
  54067. false
  54068. ],
  54069. "X11-distribute-modifications-variant": [
  54070. "X11 License Distribution Modification Variant",
  54071. false,
  54072. false
  54073. ],
  54074. "Xdebug-1.03": [
  54075. "Xdebug License v 1.03",
  54076. false,
  54077. false
  54078. ],
  54079. "Xerox": [
  54080. "Xerox License",
  54081. false,
  54082. false
  54083. ],
  54084. "Xfig": [
  54085. "Xfig License",
  54086. false,
  54087. false
  54088. ],
  54089. "XFree86-1.1": [
  54090. "XFree86 License 1.1",
  54091. false,
  54092. false
  54093. ],
  54094. "xinetd": [
  54095. "xinetd License",
  54096. false,
  54097. false
  54098. ],
  54099. "xlock": [
  54100. "xlock License",
  54101. false,
  54102. false
  54103. ],
  54104. "Xnet": [
  54105. "X.Net License",
  54106. true,
  54107. false
  54108. ],
  54109. "xpp": [
  54110. "XPP License",
  54111. false,
  54112. false
  54113. ],
  54114. "XSkat": [
  54115. "XSkat License",
  54116. false,
  54117. false
  54118. ],
  54119. "YPL-1.0": [
  54120. "Yahoo! Public License v1.0",
  54121. false,
  54122. false
  54123. ],
  54124. "YPL-1.1": [
  54125. "Yahoo! Public License v1.1",
  54126. false,
  54127. false
  54128. ],
  54129. "Zed": [
  54130. "Zed License",
  54131. false,
  54132. false
  54133. ],
  54134. "Zeeff": [
  54135. "Zeeff License",
  54136. false,
  54137. false
  54138. ],
  54139. "Zend-2.0": [
  54140. "Zend License v2.0",
  54141. false,
  54142. false
  54143. ],
  54144. "Zimbra-1.3": [
  54145. "Zimbra Public License v1.3",
  54146. false,
  54147. false
  54148. ],
  54149. "Zimbra-1.4": [
  54150. "Zimbra Public License v1.4",
  54151. false,
  54152. false
  54153. ],
  54154. "Zlib": [
  54155. "zlib License",
  54156. true,
  54157. false
  54158. ],
  54159. "zlib-acknowledgement": [
  54160. "zlib/libpng License with Acknowledgement",
  54161. false,
  54162. false
  54163. ],
  54164. "ZPL-1.1": [
  54165. "Zope Public License 1.1",
  54166. false,
  54167. false
  54168. ],
  54169. "ZPL-2.0": [
  54170. "Zope Public License 2.0",
  54171. true,
  54172. false
  54173. ],
  54174. "ZPL-2.1": [
  54175. "Zope Public License 2.1",
  54176. true,
  54177. false
  54178. ]
  54179. }<?php
  54180. namespace Composer\Spdx;
  54181. class SpdxLicenses
  54182. {
  54183. const LICENSES_FILE = 'spdx-licenses.json';
  54184. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  54185. private $licenses;
  54186. private $licensesExpression;
  54187. private $exceptions;
  54188. private $exceptionsExpression;
  54189. public function __construct()
  54190. {
  54191. $this->loadLicenses();
  54192. $this->loadExceptions();
  54193. }
  54194. public function getLicenseByIdentifier($identifier)
  54195. {
  54196. $key = strtolower($identifier);
  54197. if (!isset($this->licenses[$key])) {
  54198. return null;
  54199. }
  54200. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  54201. return array(
  54202. $name,
  54203. $isOsiApproved,
  54204. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  54205. $isDeprecatedLicenseId,
  54206. );
  54207. }
  54208. public function getLicenses()
  54209. {
  54210. return $this->licenses;
  54211. }
  54212. public function getExceptionByIdentifier($identifier)
  54213. {
  54214. $key = strtolower($identifier);
  54215. if (!isset($this->exceptions[$key])) {
  54216. return null;
  54217. }
  54218. list($identifier, $name) = $this->exceptions[$key];
  54219. return array(
  54220. $name,
  54221. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  54222. );
  54223. }
  54224. public function getIdentifierByName($name)
  54225. {
  54226. foreach ($this->licenses as $licenseData) {
  54227. if ($licenseData[1] === $name) {
  54228. return $licenseData[0];
  54229. }
  54230. }
  54231. foreach ($this->exceptions as $licenseData) {
  54232. if ($licenseData[1] === $name) {
  54233. return $licenseData[0];
  54234. }
  54235. }
  54236. return null;
  54237. }
  54238. public function isOsiApprovedByIdentifier($identifier)
  54239. {
  54240. return $this->licenses[strtolower($identifier)][2];
  54241. }
  54242. public function isDeprecatedByIdentifier($identifier)
  54243. {
  54244. return $this->licenses[strtolower($identifier)][3];
  54245. }
  54246. public function validate($license)
  54247. {
  54248. if (is_array($license)) {
  54249. $count = count($license);
  54250. if ($count !== count(array_filter($license, 'is_string'))) {
  54251. throw new \InvalidArgumentException('Array of strings expected.');
  54252. }
  54253. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  54254. }
  54255. if (!is_string($license)) {
  54256. throw new \InvalidArgumentException(sprintf(
  54257. 'Array or String expected, %s given.',
  54258. gettype($license)
  54259. ));
  54260. }
  54261. return $this->isValidLicenseString($license);
  54262. }
  54263. public static function getResourcesDir()
  54264. {
  54265. return dirname(__DIR__) . '/res';
  54266. }
  54267. private function loadLicenses()
  54268. {
  54269. if (null !== $this->licenses) {
  54270. return;
  54271. }
  54272. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  54273. if (false === $json) {
  54274. throw new \RuntimeException('Missing license file in ' . self::getResourcesDir() . '/' . self::LICENSES_FILE);
  54275. }
  54276. $this->licenses = array();
  54277. foreach (json_decode($json, true) as $identifier => $license) {
  54278. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  54279. }
  54280. }
  54281. private function loadExceptions()
  54282. {
  54283. if (null !== $this->exceptions) {
  54284. return;
  54285. }
  54286. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  54287. if (false === $json) {
  54288. throw new \RuntimeException('Missing exceptions file in ' . self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  54289. }
  54290. $this->exceptions = array();
  54291. foreach (json_decode($json, true) as $identifier => $exception) {
  54292. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  54293. }
  54294. }
  54295. private function getLicensesExpression()
  54296. {
  54297. if (null === $this->licensesExpression) {
  54298. $licenses = array_map('preg_quote', array_keys($this->licenses));
  54299. rsort($licenses);
  54300. $licenses = implode('|', $licenses);
  54301. $this->licensesExpression = $licenses;
  54302. }
  54303. return $this->licensesExpression;
  54304. }
  54305. private function getExceptionsExpression()
  54306. {
  54307. if (null === $this->exceptionsExpression) {
  54308. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  54309. rsort($exceptions);
  54310. $exceptions = implode('|', $exceptions);
  54311. $this->exceptionsExpression = $exceptions;
  54312. }
  54313. return $this->exceptionsExpression;
  54314. }
  54315. private function isValidLicenseString($license)
  54316. {
  54317. if (isset($this->licenses[strtolower($license)])) {
  54318. return true;
  54319. }
  54320. $licenses = $this->getLicensesExpression();
  54321. $exceptions = $this->getExceptionsExpression();
  54322. $regex = <<<REGEX
  54323. {
  54324. (?(DEFINE)
  54325. # idstring: 1*( ALPHA / DIGIT / - / . )
  54326. (?<idstring>[\pL\pN.-]{1,})
  54327. # license-id: taken from list
  54328. (?<licenseid>{$licenses})
  54329. # license-exception-id: taken from list
  54330. (?<licenseexceptionid>{$exceptions})
  54331. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  54332. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  54333. # simple-expresssion: license-id / license-id+ / license-ref
  54334. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  54335. # compound-expression: 1*(
  54336. # simple-expression /
  54337. # simple-expression WITH license-exception-id /
  54338. # compound-expression AND compound-expression /
  54339. # compound-expression OR compound-expression
  54340. # ) / ( compound-expression ) )
  54341. (?<compound_head>
  54342. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  54343. | \( \s* (?&compound_expression) \s* \)
  54344. )
  54345. (?<compound_expression>
  54346. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  54347. )
  54348. # license-expression: 1*1(simple-expression / compound-expression)
  54349. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  54350. ) # end of define
  54351. ^(NONE | NOASSERTION | (?&license_expression))$
  54352. }xi
  54353. REGEX;
  54354. $match = preg_match($regex, $license);
  54355. if (0 === $match) {
  54356. return false;
  54357. }
  54358. if (false === $match) {
  54359. throw new \RuntimeException('Regex failed to compile/run.');
  54360. }
  54361. return true;
  54362. }
  54363. }
  54364. MIT License
  54365. Copyright (c) 2017 Composer
  54366. Permission is hereby granted, free of charge, to any person obtaining a copy
  54367. of this software and associated documentation files (the "Software"), to deal
  54368. in the Software without restriction, including without limitation the rights
  54369. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54370. copies of the Software, and to permit persons to whom the Software is
  54371. furnished to do so, subject to the following conditions:
  54372. The above copyright notice and this permission notice shall be included in all
  54373. copies or substantial portions of the Software.
  54374. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  54375. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54376. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  54377. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  54378. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54379. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  54380. SOFTWARE.
  54381. <?php
  54382. declare(strict_types=1);
  54383. namespace Composer\XdebugHandler;
  54384. class PhpConfig
  54385. {
  54386. public function useOriginal(): array
  54387. {
  54388. $this->getDataAndReset();
  54389. return [];
  54390. }
  54391. public function useStandard(): array
  54392. {
  54393. $data = $this->getDataAndReset();
  54394. if ($data !== null) {
  54395. return ['-n', '-c', $data['tmpIni']];
  54396. }
  54397. return [];
  54398. }
  54399. public function usePersistent(): array
  54400. {
  54401. $data = $this->getDataAndReset();
  54402. if ($data !== null) {
  54403. $this->updateEnv('PHPRC', $data['tmpIni']);
  54404. $this->updateEnv('PHP_INI_SCAN_DIR', '');
  54405. }
  54406. return [];
  54407. }
  54408. private function getDataAndReset(): ?array
  54409. {
  54410. $data = XdebugHandler::getRestartSettings();
  54411. if ($data !== null) {
  54412. $this->updateEnv('PHPRC', $data['phprc']);
  54413. $this->updateEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  54414. }
  54415. return $data;
  54416. }
  54417. private function updateEnv(string $name, $value): void
  54418. {
  54419. Process::setEnv($name, false !== $value ? $value : null);
  54420. }
  54421. }
  54422. <?php
  54423. declare(strict_types=1);
  54424. namespace Composer\XdebugHandler;
  54425. use Composer\Pcre\Preg;
  54426. class Process
  54427. {
  54428. public static function escape(string $arg, bool $meta = true, bool $module = false): string
  54429. {
  54430. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  54431. return "'".str_replace("'", "'\\''", $arg)."'";
  54432. }
  54433. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  54434. $arg = Preg::replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  54435. if ($meta) {
  54436. $meta = $dquotes || Preg::isMatch('/%[^%]+%/', $arg);
  54437. if (!$meta) {
  54438. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  54439. } elseif ($module && !$dquotes && $quote) {
  54440. $meta = false;
  54441. }
  54442. }
  54443. if ($quote) {
  54444. $arg = '"'.(Preg::replace('/(\\\\*)$/', '$1$1', $arg)).'"';
  54445. }
  54446. if ($meta) {
  54447. $arg = Preg::replace('/(["^&|<>()%])/', '^$1', $arg);
  54448. }
  54449. return $arg;
  54450. }
  54451. public static function escapeShellCommand(array $args): string
  54452. {
  54453. $command = '';
  54454. $module = array_shift($args);
  54455. if ($module !== null) {
  54456. $command = self::escape($module, true, true);
  54457. foreach ($args as $arg) {
  54458. $command .= ' '.self::escape($arg);
  54459. }
  54460. }
  54461. return $command;
  54462. }
  54463. public static function setEnv(string $name, ?string $value = null): bool
  54464. {
  54465. $unset = null === $value;
  54466. if (!putenv($unset ? $name : $name.'='.$value)) {
  54467. return false;
  54468. }
  54469. if ($unset) {
  54470. unset($_SERVER[$name]);
  54471. } else {
  54472. $_SERVER[$name] = $value;
  54473. }
  54474. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  54475. if ($unset) {
  54476. unset($_ENV[$name]);
  54477. } else {
  54478. $_ENV[$name] = $value;
  54479. }
  54480. }
  54481. return true;
  54482. }
  54483. }
  54484. <?php
  54485. declare(strict_types=1);
  54486. namespace Composer\XdebugHandler;
  54487. use Psr\Log\LoggerInterface;
  54488. use Psr\Log\LogLevel;
  54489. class Status
  54490. {
  54491. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  54492. const CHECK = 'Check';
  54493. const ERROR = 'Error';
  54494. const INFO = 'Info';
  54495. const NORESTART = 'NoRestart';
  54496. const RESTART = 'Restart';
  54497. const RESTARTING = 'Restarting';
  54498. const RESTARTED = 'Restarted';
  54499. private $debug;
  54500. private $envAllowXdebug;
  54501. private $loaded;
  54502. private $logger;
  54503. private $modeOff;
  54504. private $time;
  54505. public function __construct(string $envAllowXdebug, bool $debug)
  54506. {
  54507. $start = getenv(self::ENV_RESTART);
  54508. Process::setEnv(self::ENV_RESTART);
  54509. $this->time = is_numeric($start) ? round((microtime(true) - $start) * 1000) : 0;
  54510. $this->envAllowXdebug = $envAllowXdebug;
  54511. $this->debug = $debug && defined('STDERR');
  54512. $this->modeOff = false;
  54513. }
  54514. public function setLogger(LoggerInterface $logger): void
  54515. {
  54516. $this->logger = $logger;
  54517. }
  54518. public function report(string $op, ?string $data): void
  54519. {
  54520. if ($this->logger !== null || $this->debug) {
  54521. $callable = [$this, 'report'.$op];
  54522. if (!is_callable($callable)) {
  54523. throw new \InvalidArgumentException('Unknown op handler: '.$op);
  54524. }
  54525. $params = $data !== null ? [$data] : [];
  54526. call_user_func_array($callable, $params);
  54527. }
  54528. }
  54529. private function output(string $text, ?string $level = null): void
  54530. {
  54531. if ($this->logger !== null) {
  54532. $this->logger->log($level !== null ? $level: LogLevel::DEBUG, $text);
  54533. }
  54534. if ($this->debug) {
  54535. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  54536. }
  54537. }
  54538. private function reportCheck(string $loaded): void
  54539. {
  54540. list($version, $mode) = explode('|', $loaded);
  54541. if ($version !== '') {
  54542. $this->loaded = '('.$version.')'.($mode !== '' ? ' xdebug.mode='.$mode : '');
  54543. }
  54544. $this->modeOff = $mode === 'off';
  54545. $this->output('Checking '.$this->envAllowXdebug);
  54546. }
  54547. private function reportError(string $error): void
  54548. {
  54549. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  54550. }
  54551. private function reportInfo(string $info): void
  54552. {
  54553. $this->output($info);
  54554. }
  54555. private function reportNoRestart(): void
  54556. {
  54557. $this->output($this->getLoadedMessage());
  54558. if ($this->loaded !== null) {
  54559. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  54560. if (!((bool) getenv($this->envAllowXdebug))) {
  54561. $text .= ' Allowed by '.($this->modeOff ? 'xdebug.mode' : 'application');
  54562. }
  54563. $this->output($text);
  54564. }
  54565. }
  54566. private function reportRestart(): void
  54567. {
  54568. $this->output($this->getLoadedMessage());
  54569. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  54570. }
  54571. private function reportRestarted(): void
  54572. {
  54573. $loaded = $this->getLoadedMessage();
  54574. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  54575. $level = $this->loaded !== null ? LogLevel::WARNING : null;
  54576. $this->output($text, $level);
  54577. }
  54578. private function reportRestarting(string $command): void
  54579. {
  54580. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  54581. $this->output($text);
  54582. $text = 'Running '.$command;
  54583. $this->output($text);
  54584. }
  54585. private function getEnvAllow(): string
  54586. {
  54587. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  54588. }
  54589. private function getLoadedMessage(): string
  54590. {
  54591. $loaded = $this->loaded !== null ? sprintf('loaded %s', $this->loaded) : 'not loaded';
  54592. return 'The Xdebug extension is '.$loaded;
  54593. }
  54594. }
  54595. <?php
  54596. declare(strict_types=1);
  54597. namespace Composer\XdebugHandler;
  54598. use Composer\Pcre\Preg;
  54599. use Psr\Log\LoggerInterface;
  54600. class XdebugHandler
  54601. {
  54602. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  54603. const SUFFIX_INIS = '_ORIGINAL_INIS';
  54604. const RESTART_ID = 'internal';
  54605. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  54606. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  54607. protected $tmpIni;
  54608. private static $inRestart;
  54609. private static $name;
  54610. private static $skipped;
  54611. private static $xdebugActive;
  54612. private static $xdebugMode;
  54613. private static $xdebugVersion;
  54614. private $cli;
  54615. private $debug;
  54616. private $envAllowXdebug;
  54617. private $envOriginalInis;
  54618. private $persistent;
  54619. private $script;
  54620. private $statusWriter;
  54621. public function __construct(string $envPrefix)
  54622. {
  54623. if ($envPrefix === '') {
  54624. throw new \RuntimeException('Invalid constructor parameter');
  54625. }
  54626. self::$name = strtoupper($envPrefix);
  54627. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  54628. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  54629. self::setXdebugDetails();
  54630. self::$inRestart = false;
  54631. if ($this->cli = PHP_SAPI === 'cli') {
  54632. $this->debug = (string) getenv(self::DEBUG);
  54633. }
  54634. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  54635. }
  54636. public function setLogger(LoggerInterface $logger): self
  54637. {
  54638. $this->statusWriter->setLogger($logger);
  54639. return $this;
  54640. }
  54641. public function setMainScript(string $script): self
  54642. {
  54643. $this->script = $script;
  54644. return $this;
  54645. }
  54646. public function setPersistent(): self
  54647. {
  54648. $this->persistent = true;
  54649. return $this;
  54650. }
  54651. public function check(): void
  54652. {
  54653. $this->notify(Status::CHECK, self::$xdebugVersion.'|'.self::$xdebugMode);
  54654. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  54655. if (!((bool) $envArgs[0]) && $this->requiresRestart(self::$xdebugActive)) {
  54656. $this->notify(Status::RESTART);
  54657. if ($this->prepareRestart()) {
  54658. $command = $this->getCommand();
  54659. $this->restart($command);
  54660. }
  54661. return;
  54662. }
  54663. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  54664. $this->notify(Status::RESTARTED);
  54665. Process::setEnv($this->envAllowXdebug);
  54666. self::$inRestart = true;
  54667. if (self::$xdebugVersion === null) {
  54668. self::$skipped = $envArgs[1];
  54669. }
  54670. $this->tryEnableSignals();
  54671. $this->setEnvRestartSettings($envArgs);
  54672. return;
  54673. }
  54674. $this->notify(Status::NORESTART);
  54675. $settings = self::getRestartSettings();
  54676. if ($settings !== null) {
  54677. $this->syncSettings($settings);
  54678. }
  54679. }
  54680. public static function getAllIniFiles(): array
  54681. {
  54682. if (self::$name !== null) {
  54683. $env = getenv(self::$name.self::SUFFIX_INIS);
  54684. if (false !== $env) {
  54685. return explode(PATH_SEPARATOR, $env);
  54686. }
  54687. }
  54688. $paths = [(string) php_ini_loaded_file()];
  54689. $scanned = php_ini_scanned_files();
  54690. if ($scanned !== false) {
  54691. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  54692. }
  54693. return $paths;
  54694. }
  54695. public static function getRestartSettings(): ?array
  54696. {
  54697. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  54698. if (count($envArgs) !== 6
  54699. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  54700. return null;
  54701. }
  54702. return [
  54703. 'tmpIni' => $envArgs[0],
  54704. 'scannedInis' => (bool) $envArgs[1],
  54705. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  54706. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  54707. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  54708. 'skipped' => $envArgs[5],
  54709. ];
  54710. }
  54711. public static function getSkippedVersion(): string
  54712. {
  54713. return (string) self::$skipped;
  54714. }
  54715. public static function isXdebugActive(): bool
  54716. {
  54717. self::setXdebugDetails();
  54718. return self::$xdebugActive;
  54719. }
  54720. protected function requiresRestart(bool $default): bool
  54721. {
  54722. return $default;
  54723. }
  54724. protected function restart(array $command): void
  54725. {
  54726. $this->doRestart($command);
  54727. }
  54728. private function doRestart(array $command): void
  54729. {
  54730. $this->tryEnableSignals();
  54731. $this->notify(Status::RESTARTING, implode(' ', $command));
  54732. if (PHP_VERSION_ID >= 70400) {
  54733. $cmd = $command;
  54734. } else {
  54735. $cmd = Process::escapeShellCommand($command);
  54736. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  54737. $cmd = '"'.$cmd.'"';
  54738. }
  54739. }
  54740. $process = proc_open($cmd, [], $pipes);
  54741. if (is_resource($process)) {
  54742. $exitCode = proc_close($process);
  54743. }
  54744. if (!isset($exitCode)) {
  54745. $this->notify(Status::ERROR, 'Unable to restart process');
  54746. $exitCode = -1;
  54747. } else {
  54748. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  54749. }
  54750. if ($this->debug === '2') {
  54751. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  54752. } else {
  54753. @unlink((string) $this->tmpIni);
  54754. }
  54755. exit($exitCode);
  54756. }
  54757. private function prepareRestart(): bool
  54758. {
  54759. $error = null;
  54760. $iniFiles = self::getAllIniFiles();
  54761. $scannedInis = count($iniFiles) > 1;
  54762. $tmpDir = sys_get_temp_dir();
  54763. if (!$this->cli) {
  54764. $error = 'Unsupported SAPI: '.PHP_SAPI;
  54765. } elseif (!$this->checkConfiguration($info)) {
  54766. $error = $info;
  54767. } elseif (!$this->checkMainScript()) {
  54768. $error = 'Unable to access main script: '.$this->script;
  54769. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  54770. $error = $error !== null ? $error : 'Unable to create temp ini file at: '.$tmpDir;
  54771. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  54772. $error = 'Unable to set environment variables';
  54773. }
  54774. if ($error !== null) {
  54775. $this->notify(Status::ERROR, $error);
  54776. }
  54777. return $error === null;
  54778. }
  54779. private function writeTmpIni(array $iniFiles, string $tmpDir, ?string &$error): bool
  54780. {
  54781. if (($tmpfile = @tempnam($tmpDir, '')) === false) {
  54782. return false;
  54783. }
  54784. $this->tmpIni = $tmpfile;
  54785. if ($iniFiles[0] === '') {
  54786. array_shift($iniFiles);
  54787. }
  54788. $content = '';
  54789. $sectionRegex = '/^\s*\[(?:PATH|HOST)\s*=/mi';
  54790. $xdebugRegex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  54791. foreach ($iniFiles as $file) {
  54792. if (($data = @file_get_contents($file)) === false) {
  54793. $error = 'Unable to read ini: '.$file;
  54794. return false;
  54795. }
  54796. if (Preg::isMatchWithOffsets($sectionRegex, $data, $matches, PREG_OFFSET_CAPTURE)) {
  54797. $data = substr($data, 0, $matches[0][1]);
  54798. }
  54799. $content .= Preg::replace($xdebugRegex, ';$1', $data).PHP_EOL;
  54800. }
  54801. $config = parse_ini_string($content);
  54802. $loaded = ini_get_all(null, false);
  54803. if (false === $config || false === $loaded) {
  54804. $error = 'Unable to parse ini data';
  54805. return false;
  54806. }
  54807. $content .= $this->mergeLoadedConfig($loaded, $config);
  54808. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  54809. return (bool) @file_put_contents($this->tmpIni, $content);
  54810. }
  54811. private function getCommand(): array
  54812. {
  54813. $php = [PHP_BINARY];
  54814. $args = array_slice($_SERVER['argv'], 1);
  54815. if (!$this->persistent) {
  54816. array_push($php, '-n', '-c', $this->tmpIni);
  54817. }
  54818. return array_merge($php, [$this->script], $args);
  54819. }
  54820. private function setEnvironment(bool $scannedInis, array $iniFiles): bool
  54821. {
  54822. $scanDir = getenv('PHP_INI_SCAN_DIR');
  54823. $phprc = getenv('PHPRC');
  54824. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  54825. return false;
  54826. }
  54827. if ($this->persistent) {
  54828. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  54829. return false;
  54830. }
  54831. }
  54832. $envArgs = [
  54833. self::RESTART_ID,
  54834. self::$xdebugVersion,
  54835. (int) $scannedInis,
  54836. false === $scanDir ? '*' : $scanDir,
  54837. false === $phprc ? '*' : $phprc,
  54838. ];
  54839. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  54840. }
  54841. private function notify(string $op, ?string $data = null): void
  54842. {
  54843. $this->statusWriter->report($op, $data);
  54844. }
  54845. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig): string
  54846. {
  54847. $content = '';
  54848. foreach ($loadedConfig as $name => $value) {
  54849. if (!is_string($value)
  54850. || strpos($name, 'xdebug') === 0
  54851. || $name === 'apc.mmap_file_mask') {
  54852. continue;
  54853. }
  54854. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  54855. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  54856. }
  54857. }
  54858. return $content;
  54859. }
  54860. private function checkMainScript(): bool
  54861. {
  54862. if ($this->script !== null) {
  54863. return file_exists($this->script) || '--' === $this->script;
  54864. }
  54865. if (file_exists($this->script = $_SERVER['argv'][0])) {
  54866. return true;
  54867. }
  54868. $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  54869. $main = end($trace);
  54870. if ($main !== false && isset($main['file'])) {
  54871. return file_exists($this->script = $main['file']);
  54872. }
  54873. return false;
  54874. }
  54875. private function setEnvRestartSettings(array $envArgs): void
  54876. {
  54877. $settings = [
  54878. php_ini_loaded_file(),
  54879. $envArgs[2],
  54880. $envArgs[3],
  54881. $envArgs[4],
  54882. getenv($this->envOriginalInis),
  54883. self::$skipped,
  54884. ];
  54885. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  54886. }
  54887. private function syncSettings(array $settings): void
  54888. {
  54889. if (false === getenv($this->envOriginalInis)) {
  54890. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  54891. }
  54892. self::$skipped = $settings['skipped'];
  54893. $this->notify(Status::INFO, 'Process called with existing restart settings');
  54894. }
  54895. private function checkConfiguration(?string &$info): bool
  54896. {
  54897. if (!function_exists('proc_open')) {
  54898. $info = 'proc_open function is disabled';
  54899. return false;
  54900. }
  54901. if (extension_loaded('uopz') && !((bool) ini_get('uopz.disable'))) {
  54902. if (function_exists('uopz_allow_exit')) {
  54903. @uopz_allow_exit(true);
  54904. } else {
  54905. $info = 'uopz extension is not compatible';
  54906. return false;
  54907. }
  54908. }
  54909. if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 70400) {
  54910. $workingDir = getcwd();
  54911. if ($workingDir === false) {
  54912. $info = 'unable to determine working directory';
  54913. return false;
  54914. }
  54915. if (0 === strpos($workingDir, '\\\\')) {
  54916. $info = 'cmd.exe does not support UNC paths: '.$workingDir;
  54917. return false;
  54918. }
  54919. }
  54920. return true;
  54921. }
  54922. private function tryEnableSignals(): void
  54923. {
  54924. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  54925. pcntl_async_signals(true);
  54926. $message = 'Async signals enabled';
  54927. if (!self::$inRestart) {
  54928. pcntl_signal(SIGINT, SIG_IGN);
  54929. } elseif (is_int(pcntl_signal_get_handler(SIGINT))) {
  54930. pcntl_signal(SIGINT, SIG_DFL);
  54931. }
  54932. }
  54933. if (!self::$inRestart && function_exists('sapi_windows_set_ctrl_handler')) {
  54934. sapi_windows_set_ctrl_handler(function ($evt) {});
  54935. }
  54936. }
  54937. private static function setXdebugDetails(): void
  54938. {
  54939. if (self::$xdebugActive !== null) {
  54940. return;
  54941. }
  54942. self::$xdebugActive = false;
  54943. if (!extension_loaded('xdebug')) {
  54944. return;
  54945. }
  54946. $version = phpversion('xdebug');
  54947. self::$xdebugVersion = $version !== false ? $version : 'unknown';
  54948. if (version_compare(self::$xdebugVersion, '3.1', '>=')) {
  54949. $modes = xdebug_info('mode');
  54950. self::$xdebugMode = count($modes) === 0 ? 'off' : implode(',', $modes);
  54951. self::$xdebugActive = self::$xdebugMode !== 'off';
  54952. return;
  54953. }
  54954. $iniMode = ini_get('xdebug.mode');
  54955. if ($iniMode === false) {
  54956. self::$xdebugActive = true;
  54957. return;
  54958. }
  54959. $envMode = (string) getenv('XDEBUG_MODE');
  54960. if ($envMode !== '') {
  54961. self::$xdebugMode = $envMode;
  54962. } else {
  54963. self::$xdebugMode = $iniMode !== '' ? $iniMode : 'off';
  54964. }
  54965. if (Preg::isMatch('/^,+$/', str_replace(' ', '', self::$xdebugMode))) {
  54966. self::$xdebugMode = 'off';
  54967. }
  54968. self::$xdebugActive = self::$xdebugMode !== 'off';
  54969. }
  54970. }
  54971. MIT License
  54972. Copyright (c) 2016
  54973. Permission is hereby granted, free of charge, to any person obtaining a copy
  54974. of this software and associated documentation files (the "Software"), to deal
  54975. in the Software without restriction, including without limitation the rights
  54976. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54977. copies of the Software, and to permit persons to whom the Software is
  54978. furnished to do so, subject to the following conditions:
  54979. The above copyright notice and this permission notice shall be included in all
  54980. copies or substantial portions of the Software.
  54981. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  54982. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54983. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  54984. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  54985. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54986. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  54987. SOFTWARE.
  54988. <?php
  54989. namespace JsonSchema\Constraints;
  54990. use JsonSchema\Entity\JsonPointer;
  54991. use JsonSchema\Exception\InvalidArgumentException;
  54992. use JsonSchema\Exception\ValidationException;
  54993. use JsonSchema\Validator;
  54994. class BaseConstraint
  54995. {
  54996. protected $errors = array();
  54997. protected $errorMask = Validator::ERROR_NONE;
  54998. protected $factory;
  54999. public function __construct(Factory $factory = null)
  55000. {
  55001. $this->factory = $factory ?: new Factory();
  55002. }
  55003. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  55004. {
  55005. $error = array(
  55006. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  55007. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  55008. 'message' => $message,
  55009. 'constraint' => $constraint,
  55010. 'context' => $this->factory->getErrorContext(),
  55011. );
  55012. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  55013. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  55014. }
  55015. if (is_array($more) && count($more) > 0) {
  55016. $error += $more;
  55017. }
  55018. $this->errors[] = $error;
  55019. $this->errorMask |= $error['context'];
  55020. }
  55021. public function addErrors(array $errors)
  55022. {
  55023. if ($errors) {
  55024. $this->errors = array_merge($this->errors, $errors);
  55025. $errorMask = &$this->errorMask;
  55026. array_walk($errors, function ($error) use (&$errorMask) {
  55027. if (isset($error['context'])) {
  55028. $errorMask |= $error['context'];
  55029. }
  55030. });
  55031. }
  55032. }
  55033. public function getErrors($errorContext = Validator::ERROR_ALL)
  55034. {
  55035. if ($errorContext === Validator::ERROR_ALL) {
  55036. return $this->errors;
  55037. }
  55038. return array_filter($this->errors, function ($error) use ($errorContext) {
  55039. if ($errorContext & $error['context']) {
  55040. return true;
  55041. }
  55042. });
  55043. }
  55044. public function numErrors($errorContext = Validator::ERROR_ALL)
  55045. {
  55046. if ($errorContext === Validator::ERROR_ALL) {
  55047. return count($this->errors);
  55048. }
  55049. return count($this->getErrors($errorContext));
  55050. }
  55051. public function isValid()
  55052. {
  55053. return !$this->getErrors();
  55054. }
  55055. public function reset()
  55056. {
  55057. $this->errors = array();
  55058. $this->errorMask = Validator::ERROR_NONE;
  55059. }
  55060. public function getErrorMask()
  55061. {
  55062. return $this->errorMask;
  55063. }
  55064. public static function arrayToObjectRecursive($array)
  55065. {
  55066. $json = json_encode($array);
  55067. if (json_last_error() !== \JSON_ERROR_NONE) {
  55068. $message = 'Unable to encode schema array as JSON';
  55069. if (function_exists('json_last_error_msg')) {
  55070. $message .= ': ' . json_last_error_msg();
  55071. }
  55072. throw new InvalidArgumentException($message);
  55073. }
  55074. return (object) json_decode($json);
  55075. }
  55076. }
  55077. <?php
  55078. namespace JsonSchema\Constraints;
  55079. use JsonSchema\Entity\JsonPointer;
  55080. class CollectionConstraint extends Constraint
  55081. {
  55082. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  55083. {
  55084. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  55085. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  55086. }
  55087. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  55088. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  55089. }
  55090. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  55091. $unique = $value;
  55092. if (is_array($value) && count($value)) {
  55093. $unique = array_map(function ($e) {
  55094. return var_export($e, true);
  55095. }, $value);
  55096. }
  55097. if (count(array_unique($unique)) != count($value)) {
  55098. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  55099. }
  55100. }
  55101. if (isset($schema->items)) {
  55102. $this->validateItems($value, $schema, $path, $i);
  55103. }
  55104. }
  55105. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  55106. {
  55107. if (is_object($schema->items)) {
  55108. foreach ($value as $k => &$v) {
  55109. $initErrors = $this->getErrors();
  55110. $this->checkUndefined($v, $schema->items, $path, $k);
  55111. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  55112. $secondErrors = $this->getErrors();
  55113. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  55114. }
  55115. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  55116. $this->errors = $secondErrors;
  55117. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  55118. $this->errors = $initErrors;
  55119. }
  55120. }
  55121. unset($v);
  55122. } else {
  55123. foreach ($value as $k => &$v) {
  55124. if (array_key_exists($k, $schema->items)) {
  55125. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  55126. } else {
  55127. if (property_exists($schema, 'additionalItems')) {
  55128. if ($schema->additionalItems !== false) {
  55129. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  55130. } else {
  55131. $this->addError(
  55132. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  55133. }
  55134. } else {
  55135. $this->checkUndefined($v, new \stdClass(), $path, $k);
  55136. }
  55137. }
  55138. }
  55139. unset($v);
  55140. if (count($value) > 0) {
  55141. for ($k = count($value); $k < count($schema->items); $k++) {
  55142. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  55143. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  55144. }
  55145. }
  55146. }
  55147. }
  55148. }
  55149. <?php
  55150. namespace JsonSchema\Constraints;
  55151. use JsonSchema\Entity\JsonPointer;
  55152. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  55153. {
  55154. protected $inlineSchemaProperty = '$schema';
  55155. const CHECK_MODE_NONE = 0x00000000;
  55156. const CHECK_MODE_NORMAL = 0x00000001;
  55157. const CHECK_MODE_TYPE_CAST = 0x00000002;
  55158. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  55159. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  55160. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  55161. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  55162. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  55163. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  55164. protected function incrementPath(JsonPointer $path = null, $i)
  55165. {
  55166. $path = $path ?: new JsonPointer('');
  55167. if ($i === null || $i === '') {
  55168. return $path;
  55169. }
  55170. $path = $path->withPropertyPaths(
  55171. array_merge(
  55172. $path->getPropertyPaths(),
  55173. array($i)
  55174. )
  55175. );
  55176. return $path;
  55177. }
  55178. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  55179. {
  55180. $validator = $this->factory->createInstanceFor('collection');
  55181. $validator->check($value, $schema, $path, $i);
  55182. $this->addErrors($validator->getErrors());
  55183. }
  55184. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  55185. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  55186. {
  55187. $validator = $this->factory->createInstanceFor('object');
  55188. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  55189. $this->addErrors($validator->getErrors());
  55190. }
  55191. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  55192. {
  55193. $validator = $this->factory->createInstanceFor('type');
  55194. $validator->check($value, $schema, $path, $i);
  55195. $this->addErrors($validator->getErrors());
  55196. }
  55197. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  55198. {
  55199. $validator = $this->factory->createInstanceFor('undefined');
  55200. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  55201. $this->addErrors($validator->getErrors());
  55202. }
  55203. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  55204. {
  55205. $validator = $this->factory->createInstanceFor('string');
  55206. $validator->check($value, $schema, $path, $i);
  55207. $this->addErrors($validator->getErrors());
  55208. }
  55209. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  55210. {
  55211. $validator = $this->factory->createInstanceFor('number');
  55212. $validator->check($value, $schema, $path, $i);
  55213. $this->addErrors($validator->getErrors());
  55214. }
  55215. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  55216. {
  55217. $validator = $this->factory->createInstanceFor('enum');
  55218. $validator->check($value, $schema, $path, $i);
  55219. $this->addErrors($validator->getErrors());
  55220. }
  55221. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  55222. {
  55223. $validator = $this->factory->createInstanceFor('format');
  55224. $validator->check($value, $schema, $path, $i);
  55225. $this->addErrors($validator->getErrors());
  55226. }
  55227. protected function getTypeCheck()
  55228. {
  55229. return $this->factory->getTypeCheck();
  55230. }
  55231. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  55232. {
  55233. $result = array_map(
  55234. function ($path) {
  55235. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  55236. },
  55237. $pointer->getPropertyPaths()
  55238. );
  55239. return trim(implode('', $result), '.');
  55240. }
  55241. }
  55242. <?php
  55243. namespace JsonSchema\Constraints;
  55244. use JsonSchema\Entity\JsonPointer;
  55245. interface ConstraintInterface
  55246. {
  55247. public function getErrors();
  55248. public function addErrors(array $errors);
  55249. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  55250. public function isValid();
  55251. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  55252. }
  55253. <?php
  55254. namespace JsonSchema\Constraints;
  55255. use JsonSchema\Entity\JsonPointer;
  55256. class EnumConstraint extends Constraint
  55257. {
  55258. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  55259. {
  55260. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  55261. return;
  55262. }
  55263. $type = gettype($element);
  55264. foreach ($schema->enum as $enum) {
  55265. $enumType = gettype($enum);
  55266. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  55267. if ((object) $element == $enum) {
  55268. return;
  55269. }
  55270. }
  55271. if ($type === gettype($enum)) {
  55272. if ($type == 'object') {
  55273. if ($element == $enum) {
  55274. return;
  55275. }
  55276. } elseif ($element === $enum) {
  55277. return;
  55278. }
  55279. }
  55280. }
  55281. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  55282. }
  55283. }
  55284. <?php
  55285. namespace JsonSchema\Constraints;
  55286. use JsonSchema\Exception\InvalidArgumentException;
  55287. use JsonSchema\SchemaStorage;
  55288. use JsonSchema\SchemaStorageInterface;
  55289. use JsonSchema\Uri\UriRetriever;
  55290. use JsonSchema\UriRetrieverInterface;
  55291. use JsonSchema\Validator;
  55292. class Factory
  55293. {
  55294. protected $schemaStorage;
  55295. protected $uriRetriever;
  55296. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  55297. private $typeCheck = array();
  55298. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  55299. protected $constraintMap = array(
  55300. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  55301. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  55302. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  55303. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  55304. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  55305. 'string' => 'JsonSchema\Constraints\StringConstraint',
  55306. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  55307. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  55308. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  55309. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  55310. 'validator' => 'JsonSchema\Validator'
  55311. );
  55312. private $instanceCache = array();
  55313. public function __construct(
  55314. SchemaStorageInterface $schemaStorage = null,
  55315. UriRetrieverInterface $uriRetriever = null,
  55316. $checkMode = Constraint::CHECK_MODE_NORMAL
  55317. ) {
  55318. $this->setConfig($checkMode);
  55319. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  55320. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  55321. }
  55322. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  55323. {
  55324. $this->checkMode = $checkMode;
  55325. }
  55326. public function addConfig($options)
  55327. {
  55328. $this->checkMode |= $options;
  55329. }
  55330. public function removeConfig($options)
  55331. {
  55332. $this->checkMode &= ~$options;
  55333. }
  55334. public function getConfig($options = null)
  55335. {
  55336. if ($options === null) {
  55337. return $this->checkMode;
  55338. }
  55339. return $this->checkMode & $options;
  55340. }
  55341. public function getUriRetriever()
  55342. {
  55343. return $this->uriRetriever;
  55344. }
  55345. public function getSchemaStorage()
  55346. {
  55347. return $this->schemaStorage;
  55348. }
  55349. public function getTypeCheck()
  55350. {
  55351. if (!isset($this->typeCheck[$this->checkMode])) {
  55352. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  55353. ? new TypeCheck\LooseTypeCheck()
  55354. : new TypeCheck\StrictTypeCheck();
  55355. }
  55356. return $this->typeCheck[$this->checkMode];
  55357. }
  55358. public function setConstraintClass($name, $class)
  55359. {
  55360. if (!class_exists($class)) {
  55361. throw new InvalidArgumentException('Unknown constraint ' . $name);
  55362. }
  55363. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  55364. throw new InvalidArgumentException('Invalid class ' . $name);
  55365. }
  55366. $this->constraintMap[$name] = $class;
  55367. return $this;
  55368. }
  55369. public function createInstanceFor($constraintName)
  55370. {
  55371. if (!isset($this->constraintMap[$constraintName])) {
  55372. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  55373. }
  55374. if (!isset($this->instanceCache[$constraintName])) {
  55375. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  55376. }
  55377. return clone $this->instanceCache[$constraintName];
  55378. }
  55379. public function getErrorContext()
  55380. {
  55381. return $this->errorContext;
  55382. }
  55383. public function setErrorContext($errorContext)
  55384. {
  55385. $this->errorContext = $errorContext;
  55386. }
  55387. }
  55388. <?php
  55389. namespace JsonSchema\Constraints;
  55390. use JsonSchema\Entity\JsonPointer;
  55391. use JsonSchema\Rfc3339;
  55392. class FormatConstraint extends Constraint
  55393. {
  55394. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  55395. {
  55396. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  55397. return;
  55398. }
  55399. switch ($schema->format) {
  55400. case 'date':
  55401. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  55402. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  55403. }
  55404. break;
  55405. case 'time':
  55406. if (!$this->validateDateTime($element, 'H:i:s')) {
  55407. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  55408. }
  55409. break;
  55410. case 'date-time':
  55411. if (null === Rfc3339::createFromString($element)) {
  55412. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  55413. }
  55414. break;
  55415. case 'utc-millisec':
  55416. if (!$this->validateDateTime($element, 'U')) {
  55417. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  55418. }
  55419. break;
  55420. case 'regex':
  55421. if (!$this->validateRegex($element)) {
  55422. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  55423. }
  55424. break;
  55425. case 'color':
  55426. if (!$this->validateColor($element)) {
  55427. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  55428. }
  55429. break;
  55430. case 'style':
  55431. if (!$this->validateStyle($element)) {
  55432. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  55433. }
  55434. break;
  55435. case 'phone':
  55436. if (!$this->validatePhone($element)) {
  55437. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  55438. }
  55439. break;
  55440. case 'uri':
  55441. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  55442. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  55443. }
  55444. break;
  55445. case 'uriref':
  55446. case 'uri-reference':
  55447. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  55448. if (substr($element, 0, 2) === '//') {
  55449. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  55450. } elseif (substr($element, 0, 1) === '/') {
  55451. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  55452. } elseif (strlen($element)) {
  55453. $pathParts = explode('/', $element, 2);
  55454. if (strpos($pathParts[0], ':') !== false) {
  55455. $validURL = null;
  55456. } else {
  55457. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  55458. }
  55459. } else {
  55460. $validURL = null;
  55461. }
  55462. if ($validURL === null) {
  55463. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  55464. }
  55465. }
  55466. break;
  55467. case 'email':
  55468. $filterFlags = FILTER_NULL_ON_FAILURE;
  55469. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  55470. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  55471. }
  55472. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  55473. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  55474. }
  55475. break;
  55476. case 'ip-address':
  55477. case 'ipv4':
  55478. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  55479. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  55480. }
  55481. break;
  55482. case 'ipv6':
  55483. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  55484. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  55485. }
  55486. break;
  55487. case 'host-name':
  55488. case 'hostname':
  55489. if (!$this->validateHostname($element)) {
  55490. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  55491. }
  55492. break;
  55493. default:
  55494. break;
  55495. }
  55496. }
  55497. protected function validateDateTime($datetime, $format)
  55498. {
  55499. $dt = \DateTime::createFromFormat($format, $datetime);
  55500. if (!$dt) {
  55501. return false;
  55502. }
  55503. if ($datetime === $dt->format($format)) {
  55504. return true;
  55505. }
  55506. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  55507. return true;
  55508. }
  55509. return false;
  55510. }
  55511. protected function validateRegex($regex)
  55512. {
  55513. return false !== @preg_match('/' . $regex . '/u', '');
  55514. }
  55515. protected function validateColor($color)
  55516. {
  55517. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  55518. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  55519. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  55520. return true;
  55521. }
  55522. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  55523. }
  55524. protected function validateStyle($style)
  55525. {
  55526. $properties = explode(';', rtrim($style, ';'));
  55527. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  55528. return empty($invalidEntries);
  55529. }
  55530. protected function validatePhone($phone)
  55531. {
  55532. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  55533. }
  55534. protected function validateHostname($host)
  55535. {
  55536. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  55537. return preg_match($hostnameRegex, $host);
  55538. }
  55539. }
  55540. <?php
  55541. namespace JsonSchema\Constraints;
  55542. use JsonSchema\Entity\JsonPointer;
  55543. class NumberConstraint extends Constraint
  55544. {
  55545. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  55546. {
  55547. if (isset($schema->exclusiveMinimum)) {
  55548. if (isset($schema->minimum)) {
  55549. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  55550. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  55551. } elseif ($element < $schema->minimum) {
  55552. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  55553. }
  55554. } else {
  55555. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  55556. }
  55557. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  55558. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  55559. }
  55560. if (isset($schema->exclusiveMaximum)) {
  55561. if (isset($schema->maximum)) {
  55562. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  55563. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  55564. } elseif ($element > $schema->maximum) {
  55565. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  55566. }
  55567. } else {
  55568. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  55569. }
  55570. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  55571. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  55572. }
  55573. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  55574. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  55575. }
  55576. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  55577. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  55578. }
  55579. $this->checkFormat($element, $schema, $path, $i);
  55580. }
  55581. private function fmod($number1, $number2)
  55582. {
  55583. $modulus = ($number1 - round($number1 / $number2) * $number2);
  55584. $precision = 0.0000000001;
  55585. if (-$precision < $modulus && $modulus < $precision) {
  55586. return 0.0;
  55587. }
  55588. return $modulus;
  55589. }
  55590. }
  55591. <?php
  55592. namespace JsonSchema\Constraints;
  55593. use JsonSchema\Entity\JsonPointer;
  55594. class ObjectConstraint extends Constraint
  55595. {
  55596. protected $appliedDefaults = array();
  55597. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  55598. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  55599. {
  55600. if ($element instanceof UndefinedConstraint) {
  55601. return;
  55602. }
  55603. $this->appliedDefaults = $appliedDefaults;
  55604. $matches = array();
  55605. if ($patternProperties) {
  55606. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  55607. }
  55608. if ($properties) {
  55609. $this->validateProperties($element, $properties, $path);
  55610. }
  55611. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  55612. }
  55613. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  55614. {
  55615. $try = array('/', '#', '+', '~', '%');
  55616. $matches = array();
  55617. foreach ($patternProperties as $pregex => $schema) {
  55618. $delimiter = '/';
  55619. foreach ($try as $delimiter) {
  55620. if (strpos($pregex, $delimiter) === false) {
  55621. break;
  55622. }
  55623. }
  55624. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  55625. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  55626. continue;
  55627. }
  55628. foreach ($element as $i => $value) {
  55629. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  55630. $matches[] = $i;
  55631. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  55632. }
  55633. }
  55634. }
  55635. return $matches;
  55636. }
  55637. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  55638. $properties = null, $additionalProp = null)
  55639. {
  55640. $this->validateMinMaxConstraint($element, $schema, $path);
  55641. foreach ($element as $i => $value) {
  55642. $definition = $this->getProperty($properties, $i);
  55643. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  55644. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  55645. }
  55646. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  55647. if ($additionalProp === true) {
  55648. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  55649. } else {
  55650. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  55651. }
  55652. }
  55653. $require = $this->getProperty($definition, 'requires');
  55654. if ($require && !$this->getProperty($element, $require)) {
  55655. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  55656. }
  55657. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  55658. if (is_object($property)) {
  55659. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  55660. }
  55661. }
  55662. }
  55663. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  55664. {
  55665. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  55666. foreach ($properties as $i => $value) {
  55667. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  55668. $definition = $this->getProperty($properties, $i);
  55669. if (is_object($definition)) {
  55670. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  55671. }
  55672. }
  55673. }
  55674. protected function &getProperty(&$element, $property, $fallback = null)
  55675. {
  55676. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  55677. return $element[$property];
  55678. } elseif (is_object($element) && property_exists($element, $property)) {
  55679. return $element->$property;
  55680. }
  55681. return $fallback;
  55682. }
  55683. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  55684. {
  55685. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  55686. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  55687. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  55688. }
  55689. }
  55690. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  55691. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  55692. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  55693. }
  55694. }
  55695. }
  55696. }
  55697. <?php
  55698. namespace JsonSchema\Constraints;
  55699. use JsonSchema\Entity\JsonPointer;
  55700. use JsonSchema\Exception\InvalidArgumentException;
  55701. use JsonSchema\Exception\InvalidSchemaException;
  55702. use JsonSchema\Exception\RuntimeException;
  55703. use JsonSchema\Validator;
  55704. class SchemaConstraint extends Constraint
  55705. {
  55706. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  55707. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  55708. {
  55709. if ($schema !== null) {
  55710. $validationSchema = $schema;
  55711. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  55712. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  55713. } else {
  55714. throw new InvalidArgumentException('no schema found to verify against');
  55715. }
  55716. if (is_array($validationSchema)) {
  55717. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  55718. }
  55719. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  55720. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  55721. throw new RuntimeException('Cannot validate the schema of a non-object');
  55722. }
  55723. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  55724. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  55725. } else {
  55726. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  55727. }
  55728. $schemaStorage = $this->factory->getSchemaStorage();
  55729. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  55730. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  55731. }
  55732. $initialErrorCount = $this->numErrors();
  55733. $initialConfig = $this->factory->getConfig();
  55734. $initialContext = $this->factory->getErrorContext();
  55735. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  55736. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  55737. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  55738. try {
  55739. $this->check($validationSchema, $schemaSpec);
  55740. } catch (\Exception $e) {
  55741. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  55742. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  55743. }
  55744. }
  55745. if ($this->numErrors() > $initialErrorCount) {
  55746. $this->addError($path, 'Schema is not valid', 'schema');
  55747. }
  55748. $this->factory->setConfig($initialConfig);
  55749. $this->factory->setErrorContext($initialContext);
  55750. }
  55751. $this->checkUndefined($element, $validationSchema, $path, $i);
  55752. }
  55753. }
  55754. <?php
  55755. namespace JsonSchema\Constraints;
  55756. use JsonSchema\Entity\JsonPointer;
  55757. class StringConstraint extends Constraint
  55758. {
  55759. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  55760. {
  55761. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  55762. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  55763. 'maxLength' => $schema->maxLength,
  55764. ));
  55765. }
  55766. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  55767. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  55768. 'minLength' => $schema->minLength,
  55769. ));
  55770. }
  55771. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  55772. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  55773. 'pattern' => $schema->pattern,
  55774. ));
  55775. }
  55776. $this->checkFormat($element, $schema, $path, $i);
  55777. }
  55778. private function strlen($string)
  55779. {
  55780. if (extension_loaded('mbstring')) {
  55781. return mb_strlen($string, mb_detect_encoding($string));
  55782. }
  55783. return strlen($string);
  55784. }
  55785. }
  55786. <?php
  55787. namespace JsonSchema\Constraints\TypeCheck;
  55788. class LooseTypeCheck implements TypeCheckInterface
  55789. {
  55790. public static function isObject($value)
  55791. {
  55792. return
  55793. is_object($value) ||
  55794. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  55795. }
  55796. public static function isArray($value)
  55797. {
  55798. return
  55799. is_array($value) &&
  55800. (count($value) == 0 || !self::isAssociativeArray($value));
  55801. }
  55802. public static function propertyGet($value, $property)
  55803. {
  55804. if (is_object($value)) {
  55805. return $value->{$property};
  55806. }
  55807. return $value[$property];
  55808. }
  55809. public static function propertySet(&$value, $property, $data)
  55810. {
  55811. if (is_object($value)) {
  55812. $value->{$property} = $data;
  55813. } else {
  55814. $value[$property] = $data;
  55815. }
  55816. }
  55817. public static function propertyExists($value, $property)
  55818. {
  55819. if (is_object($value)) {
  55820. return property_exists($value, $property);
  55821. }
  55822. return array_key_exists($property, $value);
  55823. }
  55824. public static function propertyCount($value)
  55825. {
  55826. if (is_object($value)) {
  55827. return count(get_object_vars($value));
  55828. }
  55829. return count($value);
  55830. }
  55831. private static function isAssociativeArray($arr)
  55832. {
  55833. return array_keys($arr) !== range(0, count($arr) - 1);
  55834. }
  55835. }
  55836. <?php
  55837. namespace JsonSchema\Constraints\TypeCheck;
  55838. class StrictTypeCheck implements TypeCheckInterface
  55839. {
  55840. public static function isObject($value)
  55841. {
  55842. return is_object($value);
  55843. }
  55844. public static function isArray($value)
  55845. {
  55846. return is_array($value);
  55847. }
  55848. public static function propertyGet($value, $property)
  55849. {
  55850. return $value->{$property};
  55851. }
  55852. public static function propertySet(&$value, $property, $data)
  55853. {
  55854. $value->{$property} = $data;
  55855. }
  55856. public static function propertyExists($value, $property)
  55857. {
  55858. return property_exists($value, $property);
  55859. }
  55860. public static function propertyCount($value)
  55861. {
  55862. if (!is_object($value)) {
  55863. return 0;
  55864. }
  55865. return count(get_object_vars($value));
  55866. }
  55867. }
  55868. <?php
  55869. namespace JsonSchema\Constraints\TypeCheck;
  55870. interface TypeCheckInterface
  55871. {
  55872. public static function isObject($value);
  55873. public static function isArray($value);
  55874. public static function propertyGet($value, $property);
  55875. public static function propertySet(&$value, $property, $data);
  55876. public static function propertyExists($value, $property);
  55877. public static function propertyCount($value);
  55878. }
  55879. <?php
  55880. namespace JsonSchema\Constraints;
  55881. use JsonSchema\Entity\JsonPointer;
  55882. use JsonSchema\Exception\InvalidArgumentException;
  55883. use UnexpectedValueException as StandardUnexpectedValueException;
  55884. class TypeConstraint extends Constraint
  55885. {
  55886. public static $wording = array(
  55887. 'integer' => 'an integer',
  55888. 'number' => 'a number',
  55889. 'boolean' => 'a boolean',
  55890. 'object' => 'an object',
  55891. 'array' => 'an array',
  55892. 'string' => 'a string',
  55893. 'null' => 'a null',
  55894. 'any' => null,
  55895. 0 => null,
  55896. );
  55897. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  55898. {
  55899. $type = isset($schema->type) ? $schema->type : null;
  55900. $isValid = false;
  55901. $wording = array();
  55902. if (is_array($type)) {
  55903. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  55904. } elseif (is_object($type)) {
  55905. $this->checkUndefined($value, $type, $path);
  55906. return;
  55907. } else {
  55908. $isValid = $this->validateType($value, $type);
  55909. }
  55910. if ($isValid === false) {
  55911. if (!is_array($type)) {
  55912. $this->validateTypeNameWording($type);
  55913. $wording[] = self::$wording[$type];
  55914. }
  55915. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  55916. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  55917. }
  55918. }
  55919. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  55920. {
  55921. foreach ($type as $tp) {
  55922. if (is_object($tp)) {
  55923. if (!$isValid) {
  55924. $validator = $this->factory->createInstanceFor('type');
  55925. $subSchema = new \stdClass();
  55926. $subSchema->type = $tp;
  55927. $validator->check($value, $subSchema, $path, null);
  55928. $error = $validator->getErrors();
  55929. $isValid = !(bool) $error;
  55930. $validTypesWording[] = self::$wording['object'];
  55931. }
  55932. } else {
  55933. $this->validateTypeNameWording($tp);
  55934. $validTypesWording[] = self::$wording[$tp];
  55935. if (!$isValid) {
  55936. $isValid = $this->validateType($value, $tp);
  55937. }
  55938. }
  55939. }
  55940. }
  55941. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  55942. {
  55943. if ($listEnd === false || !isset($elements[1])) {
  55944. return implode($delimiter, $elements);
  55945. }
  55946. $lastElement = array_slice($elements, -1);
  55947. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  55948. $implodedElements = array_merge(array($firsElements), $lastElement);
  55949. return join(" $listEnd ", $implodedElements);
  55950. }
  55951. protected function validateTypeNameWording($type)
  55952. {
  55953. if (!array_key_exists($type, self::$wording)) {
  55954. throw new StandardUnexpectedValueException(
  55955. sprintf(
  55956. 'No wording for %s available, expected wordings are: [%s]',
  55957. var_export($type, true),
  55958. implode(', ', array_filter(self::$wording)))
  55959. );
  55960. }
  55961. }
  55962. protected function validateType(&$value, $type)
  55963. {
  55964. if (!$type) {
  55965. return true;
  55966. }
  55967. if ('any' === $type) {
  55968. return true;
  55969. }
  55970. if ('object' === $type) {
  55971. return $this->getTypeCheck()->isObject($value);
  55972. }
  55973. if ('array' === $type) {
  55974. return $this->getTypeCheck()->isArray($value);
  55975. }
  55976. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  55977. if ('integer' === $type) {
  55978. if ($coerce) {
  55979. $value = $this->toInteger($value);
  55980. }
  55981. return is_int($value);
  55982. }
  55983. if ('number' === $type) {
  55984. if ($coerce) {
  55985. $value = $this->toNumber($value);
  55986. }
  55987. return is_numeric($value) && !is_string($value);
  55988. }
  55989. if ('boolean' === $type) {
  55990. if ($coerce) {
  55991. $value = $this->toBoolean($value);
  55992. }
  55993. return is_bool($value);
  55994. }
  55995. if ('string' === $type) {
  55996. return is_string($value);
  55997. }
  55998. if ('email' === $type) {
  55999. return is_string($value);
  56000. }
  56001. if ('null' === $type) {
  56002. return is_null($value);
  56003. }
  56004. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  56005. }
  56006. protected function toBoolean($value)
  56007. {
  56008. if ($value === 'true') {
  56009. return true;
  56010. }
  56011. if ($value === 'false') {
  56012. return false;
  56013. }
  56014. return $value;
  56015. }
  56016. protected function toNumber($value)
  56017. {
  56018. if (is_numeric($value)) {
  56019. return $value + 0;
  56020. }
  56021. return $value;
  56022. }
  56023. protected function toInteger($value)
  56024. {
  56025. if (is_numeric($value) && (int) $value == $value) {
  56026. return (int) $value;
  56027. }
  56028. return $value;
  56029. }
  56030. }
  56031. <?php
  56032. namespace JsonSchema\Constraints;
  56033. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  56034. use JsonSchema\Entity\JsonPointer;
  56035. use JsonSchema\Exception\ValidationException;
  56036. use JsonSchema\Uri\UriResolver;
  56037. #[\AllowDynamicProperties]
  56038. class UndefinedConstraint extends Constraint
  56039. {
  56040. protected $appliedDefaults = array();
  56041. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  56042. {
  56043. if (is_null($schema) || !is_object($schema)) {
  56044. return;
  56045. }
  56046. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  56047. if ($fromDefault) {
  56048. $path->setFromDefault();
  56049. }
  56050. $this->validateCommonProperties($value, $schema, $path, $i);
  56051. $this->validateOfProperties($value, $schema, $path, '');
  56052. $this->validateTypes($value, $schema, $path, $i);
  56053. }
  56054. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  56055. {
  56056. if ($this->getTypeCheck()->isArray($value)) {
  56057. $this->checkArray($value, $schema, $path, $i);
  56058. }
  56059. if (LooseTypeCheck::isObject($value)) {
  56060. $this->checkObject(
  56061. $value,
  56062. $schema,
  56063. $path,
  56064. isset($schema->properties) ? $schema->properties : null,
  56065. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  56066. isset($schema->patternProperties) ? $schema->patternProperties : null,
  56067. $this->appliedDefaults
  56068. );
  56069. }
  56070. if (is_string($value)) {
  56071. $this->checkString($value, $schema, $path, $i);
  56072. }
  56073. if (is_numeric($value)) {
  56074. $this->checkNumber($value, $schema, $path, $i);
  56075. }
  56076. if (isset($schema->enum)) {
  56077. $this->checkEnum($value, $schema, $path, $i);
  56078. }
  56079. }
  56080. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  56081. {
  56082. if (isset($schema->extends)) {
  56083. if (is_string($schema->extends)) {
  56084. $schema->extends = $this->validateUri($schema, $schema->extends);
  56085. }
  56086. if (is_array($schema->extends)) {
  56087. foreach ($schema->extends as $extends) {
  56088. $this->checkUndefined($value, $extends, $path, $i);
  56089. }
  56090. } else {
  56091. $this->checkUndefined($value, $schema->extends, $path, $i);
  56092. }
  56093. }
  56094. if (!$path->fromDefault()) {
  56095. $this->applyDefaultValues($value, $schema, $path);
  56096. }
  56097. if ($this->getTypeCheck()->isObject($value)) {
  56098. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  56099. foreach ($schema->required as $required) {
  56100. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  56101. $this->addError(
  56102. $this->incrementPath($path ?: new JsonPointer(''), $required),
  56103. 'The property ' . $required . ' is required',
  56104. 'required'
  56105. );
  56106. }
  56107. }
  56108. } elseif (isset($schema->required) && !is_array($schema->required)) {
  56109. if ($schema->required && $value instanceof self) {
  56110. $propertyPaths = $path->getPropertyPaths();
  56111. $propertyName = end($propertyPaths);
  56112. $this->addError(
  56113. $path,
  56114. 'The property ' . $propertyName . ' is required',
  56115. 'required'
  56116. );
  56117. }
  56118. } else {
  56119. if ($value instanceof self) {
  56120. return;
  56121. }
  56122. }
  56123. }
  56124. if (!($value instanceof self)) {
  56125. $this->checkType($value, $schema, $path, $i);
  56126. }
  56127. if (isset($schema->disallow)) {
  56128. $initErrors = $this->getErrors();
  56129. $typeSchema = new \stdClass();
  56130. $typeSchema->type = $schema->disallow;
  56131. $this->checkType($value, $typeSchema, $path);
  56132. if (count($this->getErrors()) == count($initErrors)) {
  56133. $this->addError($path, 'Disallowed value was matched', 'disallow');
  56134. } else {
  56135. $this->errors = $initErrors;
  56136. }
  56137. }
  56138. if (isset($schema->not)) {
  56139. $initErrors = $this->getErrors();
  56140. $this->checkUndefined($value, $schema->not, $path, $i);
  56141. if (count($this->getErrors()) == count($initErrors)) {
  56142. $this->addError($path, 'Matched a schema which it should not', 'not');
  56143. } else {
  56144. $this->errors = $initErrors;
  56145. }
  56146. }
  56147. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  56148. $this->validateDependencies($value, $schema->dependencies, $path);
  56149. }
  56150. }
  56151. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  56152. {
  56153. if (!$requiredOnly) {
  56154. return true;
  56155. }
  56156. if (
  56157. $name !== null
  56158. && isset($parentSchema->required)
  56159. && is_array($parentSchema->required)
  56160. && in_array($name, $parentSchema->required)
  56161. ) {
  56162. return true;
  56163. }
  56164. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  56165. return true;
  56166. }
  56167. return false;
  56168. }
  56169. protected function applyDefaultValues(&$value, $schema, $path)
  56170. {
  56171. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  56172. return;
  56173. }
  56174. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  56175. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  56176. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  56177. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  56178. if (
  56179. !LooseTypeCheck::propertyExists($value, $currentProperty)
  56180. && property_exists($propertyDefinition, 'default')
  56181. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  56182. ) {
  56183. if (is_object($propertyDefinition->default)) {
  56184. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  56185. } else {
  56186. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  56187. }
  56188. $this->appliedDefaults[] = $currentProperty;
  56189. }
  56190. }
  56191. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  56192. $items = array();
  56193. if (LooseTypeCheck::isArray($schema->items)) {
  56194. $items = $schema->items;
  56195. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  56196. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  56197. }
  56198. foreach ($items as $currentItem => $itemDefinition) {
  56199. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  56200. if (
  56201. !array_key_exists($currentItem, $value)
  56202. && property_exists($itemDefinition, 'default')
  56203. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  56204. if (is_object($itemDefinition->default)) {
  56205. $value[$currentItem] = clone $itemDefinition->default;
  56206. } else {
  56207. $value[$currentItem] = $itemDefinition->default;
  56208. }
  56209. }
  56210. $path->setFromDefault();
  56211. }
  56212. } elseif (
  56213. $value instanceof self
  56214. && property_exists($schema, 'default')
  56215. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  56216. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  56217. $path->setFromDefault();
  56218. }
  56219. }
  56220. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  56221. {
  56222. if ($value instanceof self) {
  56223. return;
  56224. }
  56225. if (isset($schema->allOf)) {
  56226. $isValid = true;
  56227. foreach ($schema->allOf as $allOf) {
  56228. $initErrors = $this->getErrors();
  56229. $this->checkUndefined($value, $allOf, $path, $i);
  56230. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  56231. }
  56232. if (!$isValid) {
  56233. $this->addError($path, 'Failed to match all schemas', 'allOf');
  56234. }
  56235. }
  56236. if (isset($schema->anyOf)) {
  56237. $isValid = false;
  56238. $startErrors = $this->getErrors();
  56239. $caughtException = null;
  56240. foreach ($schema->anyOf as $anyOf) {
  56241. $initErrors = $this->getErrors();
  56242. try {
  56243. $this->checkUndefined($value, $anyOf, $path, $i);
  56244. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  56245. break;
  56246. }
  56247. } catch (ValidationException $e) {
  56248. $isValid = false;
  56249. }
  56250. }
  56251. if (!$isValid) {
  56252. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  56253. } else {
  56254. $this->errors = $startErrors;
  56255. }
  56256. }
  56257. if (isset($schema->oneOf)) {
  56258. $allErrors = array();
  56259. $matchedSchemas = 0;
  56260. $startErrors = $this->getErrors();
  56261. foreach ($schema->oneOf as $oneOf) {
  56262. try {
  56263. $this->errors = array();
  56264. $this->checkUndefined($value, $oneOf, $path, $i);
  56265. if (count($this->getErrors()) == 0) {
  56266. $matchedSchemas++;
  56267. }
  56268. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  56269. } catch (ValidationException $e) {
  56270. }
  56271. }
  56272. if ($matchedSchemas !== 1) {
  56273. $this->addErrors(array_merge($allErrors, $startErrors));
  56274. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  56275. } else {
  56276. $this->errors = $startErrors;
  56277. }
  56278. }
  56279. }
  56280. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  56281. {
  56282. foreach ($dependencies as $key => $dependency) {
  56283. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  56284. if (is_string($dependency)) {
  56285. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  56286. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  56287. }
  56288. } elseif (is_array($dependency)) {
  56289. foreach ($dependency as $d) {
  56290. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  56291. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  56292. }
  56293. }
  56294. } elseif (is_object($dependency)) {
  56295. $this->checkUndefined($value, $dependency, $path, $i);
  56296. }
  56297. }
  56298. }
  56299. }
  56300. protected function validateUri($schema, $schemaUri = null)
  56301. {
  56302. $resolver = new UriResolver();
  56303. $retriever = $this->factory->getUriRetriever();
  56304. $jsonSchema = null;
  56305. if ($resolver->isValid($schemaUri)) {
  56306. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  56307. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  56308. }
  56309. return $jsonSchema;
  56310. }
  56311. }
  56312. <?php
  56313. namespace JsonSchema\Entity;
  56314. use JsonSchema\Exception\InvalidArgumentException;
  56315. class JsonPointer
  56316. {
  56317. private $filename;
  56318. private $propertyPaths = array();
  56319. private $fromDefault = false;
  56320. public function __construct($value)
  56321. {
  56322. if (!is_string($value)) {
  56323. throw new InvalidArgumentException('Ref value must be a string');
  56324. }
  56325. $splitRef = explode('#', $value, 2);
  56326. $this->filename = $splitRef[0];
  56327. if (array_key_exists(1, $splitRef)) {
  56328. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  56329. }
  56330. }
  56331. private function decodePropertyPaths($propertyPathString)
  56332. {
  56333. $paths = array();
  56334. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  56335. $path = $this->decodePath($path);
  56336. if (is_string($path) && '' !== $path) {
  56337. $paths[] = $path;
  56338. }
  56339. }
  56340. return $paths;
  56341. }
  56342. private function encodePropertyPaths()
  56343. {
  56344. return array_map(
  56345. array($this, 'encodePath'),
  56346. $this->getPropertyPaths()
  56347. );
  56348. }
  56349. private function decodePath($path)
  56350. {
  56351. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  56352. }
  56353. private function encodePath($path)
  56354. {
  56355. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  56356. }
  56357. public function getFilename()
  56358. {
  56359. return $this->filename;
  56360. }
  56361. public function getPropertyPaths()
  56362. {
  56363. return $this->propertyPaths;
  56364. }
  56365. public function withPropertyPaths(array $propertyPaths)
  56366. {
  56367. $new = clone $this;
  56368. $new->propertyPaths = $propertyPaths;
  56369. return $new;
  56370. }
  56371. public function getPropertyPathAsString()
  56372. {
  56373. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  56374. }
  56375. public function __toString()
  56376. {
  56377. return $this->getFilename() . $this->getPropertyPathAsString();
  56378. }
  56379. public function setFromDefault()
  56380. {
  56381. $this->fromDefault = true;
  56382. }
  56383. public function fromDefault()
  56384. {
  56385. return $this->fromDefault;
  56386. }
  56387. }
  56388. <?php
  56389. namespace JsonSchema\Exception;
  56390. interface ExceptionInterface
  56391. {
  56392. }
  56393. <?php
  56394. namespace JsonSchema\Exception;
  56395. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  56396. {
  56397. }
  56398. <?php
  56399. namespace JsonSchema\Exception;
  56400. class InvalidConfigException extends RuntimeException
  56401. {
  56402. }
  56403. <?php
  56404. namespace JsonSchema\Exception;
  56405. class InvalidSchemaException extends RuntimeException
  56406. {
  56407. }
  56408. <?php
  56409. namespace JsonSchema\Exception;
  56410. class InvalidSchemaMediaTypeException extends RuntimeException
  56411. {
  56412. }
  56413. <?php
  56414. namespace JsonSchema\Exception;
  56415. class InvalidSourceUriException extends InvalidArgumentException
  56416. {
  56417. }
  56418. <?php
  56419. namespace JsonSchema\Exception;
  56420. class JsonDecodingException extends RuntimeException
  56421. {
  56422. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  56423. {
  56424. switch ($code) {
  56425. case JSON_ERROR_DEPTH:
  56426. $message = 'The maximum stack depth has been exceeded';
  56427. break;
  56428. case JSON_ERROR_STATE_MISMATCH:
  56429. $message = 'Invalid or malformed JSON';
  56430. break;
  56431. case JSON_ERROR_CTRL_CHAR:
  56432. $message = 'Control character error, possibly incorrectly encoded';
  56433. break;
  56434. case JSON_ERROR_UTF8:
  56435. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  56436. break;
  56437. case JSON_ERROR_SYNTAX:
  56438. $message = 'JSON syntax is malformed';
  56439. break;
  56440. default:
  56441. $message = 'Syntax error';
  56442. }
  56443. parent::__construct($message, $code, $previous);
  56444. }
  56445. }
  56446. <?php
  56447. namespace JsonSchema\Exception;
  56448. class ResourceNotFoundException extends RuntimeException
  56449. {
  56450. }
  56451. <?php
  56452. namespace JsonSchema\Exception;
  56453. class RuntimeException extends \RuntimeException implements ExceptionInterface
  56454. {
  56455. }
  56456. <?php
  56457. namespace JsonSchema\Exception;
  56458. class UnresolvableJsonPointerException extends InvalidArgumentException
  56459. {
  56460. }
  56461. <?php
  56462. namespace JsonSchema\Exception;
  56463. class UriResolverException extends RuntimeException
  56464. {
  56465. }
  56466. <?php
  56467. namespace JsonSchema\Exception;
  56468. class ValidationException extends RuntimeException
  56469. {
  56470. }
  56471. <?php
  56472. namespace JsonSchema\Iterator;
  56473. class ObjectIterator implements \Iterator, \Countable
  56474. {
  56475. private $object;
  56476. private $position = 0;
  56477. private $data = array();
  56478. private $initialized = false;
  56479. public function __construct($object)
  56480. {
  56481. $this->object = $object;
  56482. }
  56483. public function current()
  56484. {
  56485. $this->initialize();
  56486. return $this->data[$this->position];
  56487. }
  56488. public function next()
  56489. {
  56490. $this->initialize();
  56491. $this->position++;
  56492. }
  56493. public function key()
  56494. {
  56495. $this->initialize();
  56496. return $this->position;
  56497. }
  56498. public function valid()
  56499. {
  56500. $this->initialize();
  56501. return isset($this->data[$this->position]);
  56502. }
  56503. public function rewind()
  56504. {
  56505. $this->initialize();
  56506. $this->position = 0;
  56507. }
  56508. public function count()
  56509. {
  56510. $this->initialize();
  56511. return count($this->data);
  56512. }
  56513. private function initialize()
  56514. {
  56515. if (!$this->initialized) {
  56516. $this->data = $this->buildDataFromObject($this->object);
  56517. $this->initialized = true;
  56518. }
  56519. }
  56520. private function buildDataFromObject($object)
  56521. {
  56522. $result = array();
  56523. $stack = new \SplStack();
  56524. $stack->push($object);
  56525. while (!$stack->isEmpty()) {
  56526. $current = $stack->pop();
  56527. if (is_object($current)) {
  56528. array_push($result, $current);
  56529. }
  56530. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  56531. if (is_object($propertyValue) || is_array($propertyValue)) {
  56532. $stack->push($propertyValue);
  56533. }
  56534. }
  56535. }
  56536. return $result;
  56537. }
  56538. private function getDataFromItem($item)
  56539. {
  56540. if (!is_object($item) && !is_array($item)) {
  56541. return array();
  56542. }
  56543. return is_object($item) ? get_object_vars($item) : $item;
  56544. }
  56545. }
  56546. <?php
  56547. namespace JsonSchema;
  56548. class Rfc3339
  56549. {
  56550. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  56551. public static function createFromString($string)
  56552. {
  56553. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  56554. return null;
  56555. }
  56556. $dateAndTime = $matches[1];
  56557. $microseconds = $matches[2] ?: '.000000';
  56558. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  56559. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  56560. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  56561. return $dateTime ?: null;
  56562. }
  56563. }
  56564. <?php
  56565. namespace JsonSchema;
  56566. use JsonSchema\Constraints\BaseConstraint;
  56567. use JsonSchema\Entity\JsonPointer;
  56568. use JsonSchema\Exception\UnresolvableJsonPointerException;
  56569. use JsonSchema\Uri\UriResolver;
  56570. use JsonSchema\Uri\UriRetriever;
  56571. class SchemaStorage implements SchemaStorageInterface
  56572. {
  56573. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  56574. protected $uriRetriever;
  56575. protected $uriResolver;
  56576. protected $schemas = array();
  56577. public function __construct(
  56578. UriRetrieverInterface $uriRetriever = null,
  56579. UriResolverInterface $uriResolver = null
  56580. ) {
  56581. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  56582. $this->uriResolver = $uriResolver ?: new UriResolver();
  56583. }
  56584. public function getUriRetriever()
  56585. {
  56586. return $this->uriRetriever;
  56587. }
  56588. public function getUriResolver()
  56589. {
  56590. return $this->uriResolver;
  56591. }
  56592. public function addSchema($id, $schema = null)
  56593. {
  56594. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  56595. $schema = $this->uriRetriever->retrieve($id);
  56596. }
  56597. if (is_array($schema)) {
  56598. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  56599. }
  56600. if (is_object($schema) && property_exists($schema, 'id')) {
  56601. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  56602. $schema->properties->id->format = 'uri-reference';
  56603. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  56604. $schema->properties->id->format = 'uri-reference';
  56605. $schema->properties->{'$ref'}->format = 'uri-reference';
  56606. }
  56607. }
  56608. $this->expandRefs($schema, $id);
  56609. $this->schemas[$id] = $schema;
  56610. }
  56611. private function expandRefs(&$schema, $base = null)
  56612. {
  56613. if (!is_object($schema)) {
  56614. if (is_array($schema)) {
  56615. foreach ($schema as &$member) {
  56616. $this->expandRefs($member, $base);
  56617. }
  56618. }
  56619. return;
  56620. }
  56621. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  56622. $base = $this->uriResolver->resolve($schema->id, $base);
  56623. }
  56624. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  56625. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  56626. $schema->{'$ref'} = (string) $refPointer;
  56627. }
  56628. foreach ($schema as &$member) {
  56629. $this->expandRefs($member, $base);
  56630. }
  56631. }
  56632. public function getSchema($id)
  56633. {
  56634. if (!array_key_exists($id, $this->schemas)) {
  56635. $this->addSchema($id);
  56636. }
  56637. return $this->schemas[$id];
  56638. }
  56639. public function resolveRef($ref)
  56640. {
  56641. $jsonPointer = new JsonPointer($ref);
  56642. $fileName = $jsonPointer->getFilename();
  56643. if (!strlen($fileName)) {
  56644. throw new UnresolvableJsonPointerException(sprintf(
  56645. "Could not resolve fragment '%s': no file is defined",
  56646. $jsonPointer->getPropertyPathAsString()
  56647. ));
  56648. }
  56649. $refSchema = $this->getSchema($fileName);
  56650. foreach ($jsonPointer->getPropertyPaths() as $path) {
  56651. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  56652. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  56653. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  56654. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  56655. } else {
  56656. throw new UnresolvableJsonPointerException(sprintf(
  56657. 'File: %s is found, but could not resolve fragment: %s',
  56658. $jsonPointer->getFilename(),
  56659. $jsonPointer->getPropertyPathAsString()
  56660. ));
  56661. }
  56662. }
  56663. return $refSchema;
  56664. }
  56665. public function resolveRefSchema($refSchema)
  56666. {
  56667. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  56668. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  56669. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  56670. unset($refSchema->{'$ref'});
  56671. }
  56672. return $refSchema;
  56673. }
  56674. }
  56675. <?php
  56676. namespace JsonSchema;
  56677. interface SchemaStorageInterface
  56678. {
  56679. public function addSchema($id, $schema = null);
  56680. public function getSchema($id);
  56681. public function resolveRef($ref);
  56682. public function resolveRefSchema($refSchema);
  56683. }
  56684. <?php
  56685. namespace JsonSchema\Uri\Retrievers;
  56686. abstract class AbstractRetriever implements UriRetrieverInterface
  56687. {
  56688. protected $contentType;
  56689. public function getContentType()
  56690. {
  56691. return $this->contentType;
  56692. }
  56693. }
  56694. <?php
  56695. namespace JsonSchema\Uri\Retrievers;
  56696. use JsonSchema\Exception\RuntimeException;
  56697. use JsonSchema\Validator;
  56698. class Curl extends AbstractRetriever
  56699. {
  56700. protected $messageBody;
  56701. public function __construct()
  56702. {
  56703. if (!function_exists('curl_init')) {
  56704. throw new RuntimeException('cURL not installed');
  56705. }
  56706. }
  56707. public function retrieve($uri)
  56708. {
  56709. $ch = curl_init();
  56710. curl_setopt($ch, CURLOPT_URL, $uri);
  56711. curl_setopt($ch, CURLOPT_HEADER, true);
  56712. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  56713. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  56714. $response = curl_exec($ch);
  56715. if (false === $response) {
  56716. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  56717. }
  56718. $this->fetchMessageBody($response);
  56719. $this->fetchContentType($response);
  56720. curl_close($ch);
  56721. return $this->messageBody;
  56722. }
  56723. private function fetchMessageBody($response)
  56724. {
  56725. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  56726. $this->messageBody = $match[1];
  56727. }
  56728. protected function fetchContentType($response)
  56729. {
  56730. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  56731. $this->contentType = trim($match[1]);
  56732. return true;
  56733. }
  56734. return false;
  56735. }
  56736. }
  56737. <?php
  56738. namespace JsonSchema\Uri\Retrievers;
  56739. use JsonSchema\Exception\ResourceNotFoundException;
  56740. class FileGetContents extends AbstractRetriever
  56741. {
  56742. protected $messageBody;
  56743. public function retrieve($uri)
  56744. {
  56745. $errorMessage = null;
  56746. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  56747. $errorMessage = $errstr;
  56748. });
  56749. $response = file_get_contents($uri);
  56750. restore_error_handler();
  56751. if ($errorMessage) {
  56752. throw new ResourceNotFoundException($errorMessage);
  56753. }
  56754. if (false === $response) {
  56755. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  56756. }
  56757. if ($response == ''
  56758. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  56759. ) {
  56760. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  56761. }
  56762. $this->messageBody = $response;
  56763. if (!empty($http_response_header)) {
  56764. $this->fetchContentType($http_response_header);
  56765. } else {
  56766. $this->contentType = null;
  56767. }
  56768. return $this->messageBody;
  56769. }
  56770. private function fetchContentType(array $headers)
  56771. {
  56772. foreach ($headers as $header) {
  56773. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  56774. return true;
  56775. }
  56776. }
  56777. return false;
  56778. }
  56779. protected static function getContentTypeMatchInHeader($header)
  56780. {
  56781. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  56782. return trim($match[1]);
  56783. }
  56784. return null;
  56785. }
  56786. }
  56787. <?php
  56788. namespace JsonSchema\Uri\Retrievers;
  56789. use JsonSchema\Validator;
  56790. class PredefinedArray extends AbstractRetriever
  56791. {
  56792. private $schemas;
  56793. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  56794. {
  56795. $this->schemas = $schemas;
  56796. $this->contentType = $contentType;
  56797. }
  56798. public function retrieve($uri)
  56799. {
  56800. if (!array_key_exists($uri, $this->schemas)) {
  56801. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  56802. 'The JSON schema "%s" was not found.',
  56803. $uri
  56804. ));
  56805. }
  56806. return $this->schemas[$uri];
  56807. }
  56808. }
  56809. <?php
  56810. namespace JsonSchema\Uri\Retrievers;
  56811. interface UriRetrieverInterface
  56812. {
  56813. public function retrieve($uri);
  56814. public function getContentType();
  56815. }
  56816. <?php
  56817. namespace JsonSchema\Uri;
  56818. use JsonSchema\Exception\UriResolverException;
  56819. use JsonSchema\UriResolverInterface;
  56820. class UriResolver implements UriResolverInterface
  56821. {
  56822. public function parse($uri)
  56823. {
  56824. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  56825. $components = array();
  56826. if (5 < count($match)) {
  56827. $components = array(
  56828. 'scheme' => $match[2],
  56829. 'authority' => $match[4],
  56830. 'path' => $match[5]
  56831. );
  56832. }
  56833. if (7 < count($match)) {
  56834. $components['query'] = $match[7];
  56835. }
  56836. if (9 < count($match)) {
  56837. $components['fragment'] = $match[9];
  56838. }
  56839. return $components;
  56840. }
  56841. public function generate(array $components)
  56842. {
  56843. $uri = $components['scheme'] . '://'
  56844. . $components['authority']
  56845. . $components['path'];
  56846. if (array_key_exists('query', $components) && strlen($components['query'])) {
  56847. $uri .= '?' . $components['query'];
  56848. }
  56849. if (array_key_exists('fragment', $components)) {
  56850. $uri .= '#' . $components['fragment'];
  56851. }
  56852. return $uri;
  56853. }
  56854. public function resolve($uri, $baseUri = null)
  56855. {
  56856. if (
  56857. !is_null($baseUri) &&
  56858. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  56859. !preg_match('|^[^/]+://|u', $baseUri)
  56860. ) {
  56861. if (is_file($baseUri)) {
  56862. $baseUri = 'file://' . realpath($baseUri);
  56863. } elseif (is_dir($baseUri)) {
  56864. $baseUri = 'file://' . realpath($baseUri) . '/';
  56865. } else {
  56866. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  56867. }
  56868. }
  56869. if ($uri == '') {
  56870. return $baseUri;
  56871. }
  56872. $components = $this->parse($uri);
  56873. $path = $components['path'];
  56874. if (!empty($components['scheme'])) {
  56875. return $uri;
  56876. }
  56877. $baseComponents = $this->parse($baseUri);
  56878. $basePath = $baseComponents['path'];
  56879. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  56880. if (isset($components['fragment'])) {
  56881. $baseComponents['fragment'] = $components['fragment'];
  56882. }
  56883. return $this->generate($baseComponents);
  56884. }
  56885. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  56886. {
  56887. $relativePath = self::normalizePath($relativePath);
  56888. if ($relativePath == '') {
  56889. return $basePath;
  56890. }
  56891. if ($relativePath[0] == '/') {
  56892. return $relativePath;
  56893. }
  56894. $basePathSegments = explode('/', $basePath);
  56895. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  56896. $numLevelUp = strlen($match[0]) /3 + 1;
  56897. if ($numLevelUp >= count($basePathSegments)) {
  56898. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  56899. }
  56900. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  56901. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  56902. return implode('/', $basePathSegments) . '/' . $path;
  56903. }
  56904. private static function normalizePath($path)
  56905. {
  56906. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  56907. $path = preg_replace('|//|', '/', $path);
  56908. return $path;
  56909. }
  56910. public function isValid($uri)
  56911. {
  56912. $components = $this->parse($uri);
  56913. return !empty($components);
  56914. }
  56915. }
  56916. <?php
  56917. namespace JsonSchema\Uri;
  56918. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  56919. use JsonSchema\Exception\JsonDecodingException;
  56920. use JsonSchema\Exception\ResourceNotFoundException;
  56921. use JsonSchema\Uri\Retrievers\FileGetContents;
  56922. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  56923. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  56924. use JsonSchema\Validator;
  56925. class UriRetriever implements BaseUriRetrieverInterface
  56926. {
  56927. protected $translationMap = array(
  56928. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  56929. );
  56930. protected $allowedInvalidContentTypeEndpoints = array(
  56931. 'http://json-schema.org/',
  56932. 'https://json-schema.org/'
  56933. );
  56934. protected $uriRetriever = null;
  56935. private $schemaCache = array();
  56936. public function addInvalidContentTypeEndpoint($endpoint)
  56937. {
  56938. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  56939. }
  56940. public function confirmMediaType($uriRetriever, $uri)
  56941. {
  56942. $contentType = $uriRetriever->getContentType();
  56943. if (is_null($contentType)) {
  56944. return;
  56945. }
  56946. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  56947. return;
  56948. }
  56949. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  56950. if (strpos($uri, $endpoint) === 0) {
  56951. return true;
  56952. }
  56953. }
  56954. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  56955. }
  56956. public function getUriRetriever()
  56957. {
  56958. if (is_null($this->uriRetriever)) {
  56959. $this->setUriRetriever(new FileGetContents());
  56960. }
  56961. return $this->uriRetriever;
  56962. }
  56963. public function resolvePointer($jsonSchema, $uri)
  56964. {
  56965. $resolver = new UriResolver();
  56966. $parsed = $resolver->parse($uri);
  56967. if (empty($parsed['fragment'])) {
  56968. return $jsonSchema;
  56969. }
  56970. $path = explode('/', $parsed['fragment']);
  56971. while ($path) {
  56972. $pathElement = array_shift($path);
  56973. if (!empty($pathElement)) {
  56974. $pathElement = str_replace('~1', '/', $pathElement);
  56975. $pathElement = str_replace('~0', '~', $pathElement);
  56976. if (!empty($jsonSchema->$pathElement)) {
  56977. $jsonSchema = $jsonSchema->$pathElement;
  56978. } else {
  56979. throw new ResourceNotFoundException(
  56980. 'Fragment "' . $parsed['fragment'] . '" not found'
  56981. . ' in ' . $uri
  56982. );
  56983. }
  56984. if (!is_object($jsonSchema)) {
  56985. throw new ResourceNotFoundException(
  56986. 'Fragment part "' . $pathElement . '" is no object '
  56987. . ' in ' . $uri
  56988. );
  56989. }
  56990. }
  56991. }
  56992. return $jsonSchema;
  56993. }
  56994. public function retrieve($uri, $baseUri = null, $translate = true)
  56995. {
  56996. $resolver = new UriResolver();
  56997. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  56998. $arParts = $resolver->parse($resolvedUri);
  56999. if (isset($arParts['fragment'])) {
  57000. unset($arParts['fragment']);
  57001. $fetchUri = $resolver->generate($arParts);
  57002. }
  57003. if ($translate) {
  57004. $fetchUri = $this->translate($fetchUri);
  57005. }
  57006. $jsonSchema = $this->loadSchema($fetchUri);
  57007. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  57008. if ($jsonSchema instanceof \stdClass) {
  57009. $jsonSchema->id = $resolvedUri;
  57010. }
  57011. return $jsonSchema;
  57012. }
  57013. protected function loadSchema($fetchUri)
  57014. {
  57015. if (isset($this->schemaCache[$fetchUri])) {
  57016. return $this->schemaCache[$fetchUri];
  57017. }
  57018. $uriRetriever = $this->getUriRetriever();
  57019. $contents = $this->uriRetriever->retrieve($fetchUri);
  57020. $this->confirmMediaType($uriRetriever, $fetchUri);
  57021. $jsonSchema = json_decode($contents);
  57022. if (JSON_ERROR_NONE < $error = json_last_error()) {
  57023. throw new JsonDecodingException($error);
  57024. }
  57025. $this->schemaCache[$fetchUri] = $jsonSchema;
  57026. return $jsonSchema;
  57027. }
  57028. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  57029. {
  57030. $this->uriRetriever = $uriRetriever;
  57031. return $this;
  57032. }
  57033. public function parse($uri)
  57034. {
  57035. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  57036. $components = array();
  57037. if (5 < count($match)) {
  57038. $components = array(
  57039. 'scheme' => $match[2],
  57040. 'authority' => $match[4],
  57041. 'path' => $match[5]
  57042. );
  57043. }
  57044. if (7 < count($match)) {
  57045. $components['query'] = $match[7];
  57046. }
  57047. if (9 < count($match)) {
  57048. $components['fragment'] = $match[9];
  57049. }
  57050. return $components;
  57051. }
  57052. public function generate(array $components)
  57053. {
  57054. $uri = $components['scheme'] . '://'
  57055. . $components['authority']
  57056. . $components['path'];
  57057. if (array_key_exists('query', $components)) {
  57058. $uri .= $components['query'];
  57059. }
  57060. if (array_key_exists('fragment', $components)) {
  57061. $uri .= $components['fragment'];
  57062. }
  57063. return $uri;
  57064. }
  57065. public function resolve($uri, $baseUri = null)
  57066. {
  57067. $components = $this->parse($uri);
  57068. $path = $components['path'];
  57069. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  57070. return $uri;
  57071. }
  57072. $baseComponents = $this->parse($baseUri);
  57073. $basePath = $baseComponents['path'];
  57074. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  57075. return $this->generate($baseComponents);
  57076. }
  57077. public function isValid($uri)
  57078. {
  57079. $components = $this->parse($uri);
  57080. return !empty($components);
  57081. }
  57082. public function setTranslation($from, $to)
  57083. {
  57084. $this->translationMap[$from] = $to;
  57085. }
  57086. public function translate($uri)
  57087. {
  57088. foreach ($this->translationMap as $from => $to) {
  57089. $uri = preg_replace($from, $to, $uri);
  57090. }
  57091. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  57092. return $uri;
  57093. }
  57094. }
  57095. <?php
  57096. namespace JsonSchema;
  57097. interface UriResolverInterface
  57098. {
  57099. public function resolve($uri, $baseUri = null);
  57100. }
  57101. <?php
  57102. namespace JsonSchema;
  57103. interface UriRetrieverInterface
  57104. {
  57105. public function retrieve($uri, $baseUri = null);
  57106. }
  57107. <?php
  57108. namespace JsonSchema;
  57109. use JsonSchema\Constraints\BaseConstraint;
  57110. use JsonSchema\Constraints\Constraint;
  57111. class Validator extends BaseConstraint
  57112. {
  57113. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  57114. const ERROR_NONE = 0x00000000;
  57115. const ERROR_ALL = 0xFFFFFFFF;
  57116. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  57117. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  57118. public function validate(&$value, $schema = null, $checkMode = null)
  57119. {
  57120. if (is_array($schema)) {
  57121. $schema = self::arrayToObjectRecursive($schema);
  57122. }
  57123. $initialCheckMode = $this->factory->getConfig();
  57124. if ($checkMode !== null) {
  57125. $this->factory->setConfig($checkMode);
  57126. }
  57127. if (is_object($schema) && property_exists($schema, 'id')) {
  57128. $schemaURI = $schema->id;
  57129. } else {
  57130. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  57131. }
  57132. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  57133. $validator = $this->factory->createInstanceFor('schema');
  57134. $validator->check(
  57135. $value,
  57136. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  57137. );
  57138. $this->factory->setConfig($initialCheckMode);
  57139. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  57140. return $validator->getErrorMask();
  57141. }
  57142. public function check($value, $schema)
  57143. {
  57144. return $this->validate($value, $schema);
  57145. }
  57146. public function coerce(&$value, $schema)
  57147. {
  57148. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  57149. }
  57150. }
  57151. The MIT License (MIT)
  57152. Copyright (c) 2013-2016 container-interop
  57153. Copyright (c) 2016 PHP Framework Interoperability Group
  57154. Permission is hereby granted, free of charge, to any person obtaining a copy of
  57155. this software and associated documentation files (the "Software"), to deal in
  57156. the Software without restriction, including without limitation the rights to
  57157. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  57158. the Software, and to permit persons to whom the Software is furnished to do so,
  57159. subject to the following conditions:
  57160. The above copyright notice and this permission notice shall be included in all
  57161. copies or substantial portions of the Software.
  57162. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  57163. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  57164. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  57165. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  57166. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  57167. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  57168. <?php
  57169. namespace Psr\Container;
  57170. interface ContainerExceptionInterface
  57171. {
  57172. }
  57173. <?php
  57174. declare(strict_types=1);
  57175. namespace Psr\Container;
  57176. interface ContainerInterface
  57177. {
  57178. public function get(string $id);
  57179. public function has(string $id);
  57180. }
  57181. <?php
  57182. namespace Psr\Container;
  57183. interface NotFoundExceptionInterface extends ContainerExceptionInterface
  57184. {
  57185. }
  57186. Copyright (c) 2012 PHP Framework Interoperability Group
  57187. Permission is hereby granted, free of charge, to any person obtaining a copy
  57188. of this software and associated documentation files (the "Software"), to deal
  57189. in the Software without restriction, including without limitation the rights
  57190. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  57191. copies of the Software, and to permit persons to whom the Software is
  57192. furnished to do so, subject to the following conditions:
  57193. The above copyright notice and this permission notice shall be included in
  57194. all copies or substantial portions of the Software.
  57195. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  57196. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  57197. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  57198. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  57199. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  57200. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  57201. THE SOFTWARE.
  57202. <?php
  57203. namespace Psr\Log;
  57204. abstract class AbstractLogger implements LoggerInterface
  57205. {
  57206. public function emergency($message, array $context = array())
  57207. {
  57208. $this->log(LogLevel::EMERGENCY, $message, $context);
  57209. }
  57210. public function alert($message, array $context = array())
  57211. {
  57212. $this->log(LogLevel::ALERT, $message, $context);
  57213. }
  57214. public function critical($message, array $context = array())
  57215. {
  57216. $this->log(LogLevel::CRITICAL, $message, $context);
  57217. }
  57218. public function error($message, array $context = array())
  57219. {
  57220. $this->log(LogLevel::ERROR, $message, $context);
  57221. }
  57222. public function warning($message, array $context = array())
  57223. {
  57224. $this->log(LogLevel::WARNING, $message, $context);
  57225. }
  57226. public function notice($message, array $context = array())
  57227. {
  57228. $this->log(LogLevel::NOTICE, $message, $context);
  57229. }
  57230. public function info($message, array $context = array())
  57231. {
  57232. $this->log(LogLevel::INFO, $message, $context);
  57233. }
  57234. public function debug($message, array $context = array())
  57235. {
  57236. $this->log(LogLevel::DEBUG, $message, $context);
  57237. }
  57238. }
  57239. <?php
  57240. namespace Psr\Log;
  57241. class InvalidArgumentException extends \InvalidArgumentException
  57242. {
  57243. }
  57244. <?php
  57245. namespace Psr\Log;
  57246. class LogLevel
  57247. {
  57248. const EMERGENCY = 'emergency';
  57249. const ALERT = 'alert';
  57250. const CRITICAL = 'critical';
  57251. const ERROR = 'error';
  57252. const WARNING = 'warning';
  57253. const NOTICE = 'notice';
  57254. const INFO = 'info';
  57255. const DEBUG = 'debug';
  57256. }
  57257. <?php
  57258. namespace Psr\Log;
  57259. interface LoggerAwareInterface
  57260. {
  57261. public function setLogger(LoggerInterface $logger);
  57262. }
  57263. <?php
  57264. namespace Psr\Log;
  57265. trait LoggerAwareTrait
  57266. {
  57267. protected $logger;
  57268. public function setLogger(LoggerInterface $logger)
  57269. {
  57270. $this->logger = $logger;
  57271. }
  57272. }
  57273. <?php
  57274. namespace Psr\Log;
  57275. interface LoggerInterface
  57276. {
  57277. public function emergency($message, array $context = array());
  57278. public function alert($message, array $context = array());
  57279. public function critical($message, array $context = array());
  57280. public function error($message, array $context = array());
  57281. public function warning($message, array $context = array());
  57282. public function notice($message, array $context = array());
  57283. public function info($message, array $context = array());
  57284. public function debug($message, array $context = array());
  57285. public function log($level, $message, array $context = array());
  57286. }
  57287. <?php
  57288. namespace Psr\Log;
  57289. trait LoggerTrait
  57290. {
  57291. public function emergency($message, array $context = array())
  57292. {
  57293. $this->log(LogLevel::EMERGENCY, $message, $context);
  57294. }
  57295. public function alert($message, array $context = array())
  57296. {
  57297. $this->log(LogLevel::ALERT, $message, $context);
  57298. }
  57299. public function critical($message, array $context = array())
  57300. {
  57301. $this->log(LogLevel::CRITICAL, $message, $context);
  57302. }
  57303. public function error($message, array $context = array())
  57304. {
  57305. $this->log(LogLevel::ERROR, $message, $context);
  57306. }
  57307. public function warning($message, array $context = array())
  57308. {
  57309. $this->log(LogLevel::WARNING, $message, $context);
  57310. }
  57311. public function notice($message, array $context = array())
  57312. {
  57313. $this->log(LogLevel::NOTICE, $message, $context);
  57314. }
  57315. public function info($message, array $context = array())
  57316. {
  57317. $this->log(LogLevel::INFO, $message, $context);
  57318. }
  57319. public function debug($message, array $context = array())
  57320. {
  57321. $this->log(LogLevel::DEBUG, $message, $context);
  57322. }
  57323. abstract public function log($level, $message, array $context = array());
  57324. }
  57325. <?php
  57326. namespace Psr\Log;
  57327. class NullLogger extends AbstractLogger
  57328. {
  57329. public function log($level, $message, array $context = array())
  57330. {
  57331. }
  57332. }
  57333. <?php
  57334. namespace Psr\Log\Test;
  57335. class DummyTest
  57336. {
  57337. public function __toString()
  57338. {
  57339. return 'DummyTest';
  57340. }
  57341. }
  57342. <?php
  57343. namespace Psr\Log\Test;
  57344. use Psr\Log\LoggerInterface;
  57345. use Psr\Log\LogLevel;
  57346. use PHPUnit\Framework\TestCase;
  57347. abstract class LoggerInterfaceTest extends TestCase
  57348. {
  57349. abstract public function getLogger();
  57350. abstract public function getLogs();
  57351. public function testImplements()
  57352. {
  57353. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  57354. }
  57355. public function testLogsAtAllLevels($level, $message)
  57356. {
  57357. $logger = $this->getLogger();
  57358. $logger->{$level}($message, array('user' => 'Bob'));
  57359. $logger->log($level, $message, array('user' => 'Bob'));
  57360. $expected = array(
  57361. $level.' message of level '.$level.' with context: Bob',
  57362. $level.' message of level '.$level.' with context: Bob',
  57363. );
  57364. $this->assertEquals($expected, $this->getLogs());
  57365. }
  57366. public function provideLevelsAndMessages()
  57367. {
  57368. return array(
  57369. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  57370. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  57371. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  57372. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  57373. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  57374. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  57375. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  57376. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  57377. );
  57378. }
  57379. public function testThrowsOnInvalidLevel()
  57380. {
  57381. $logger = $this->getLogger();
  57382. $logger->log('invalid level', 'Foo');
  57383. }
  57384. public function testContextReplacement()
  57385. {
  57386. $logger = $this->getLogger();
  57387. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  57388. $expected = array('info {Message {nothing} Bob Bar a}');
  57389. $this->assertEquals($expected, $this->getLogs());
  57390. }
  57391. public function testObjectCastToString()
  57392. {
  57393. if (method_exists($this, 'createPartialMock')) {
  57394. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  57395. } else {
  57396. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  57397. }
  57398. $dummy->expects($this->once())
  57399. ->method('__toString')
  57400. ->will($this->returnValue('DUMMY'));
  57401. $this->getLogger()->warning($dummy);
  57402. $expected = array('warning DUMMY');
  57403. $this->assertEquals($expected, $this->getLogs());
  57404. }
  57405. public function testContextCanContainAnything()
  57406. {
  57407. $closed = fopen('php://memory', 'r');
  57408. fclose($closed);
  57409. $context = array(
  57410. 'bool' => true,
  57411. 'null' => null,
  57412. 'string' => 'Foo',
  57413. 'int' => 0,
  57414. 'float' => 0.5,
  57415. 'nested' => array('with object' => new DummyTest),
  57416. 'object' => new \DateTime,
  57417. 'resource' => fopen('php://memory', 'r'),
  57418. 'closed' => $closed,
  57419. );
  57420. $this->getLogger()->warning('Crazy context data', $context);
  57421. $expected = array('warning Crazy context data');
  57422. $this->assertEquals($expected, $this->getLogs());
  57423. }
  57424. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  57425. {
  57426. $logger = $this->getLogger();
  57427. $logger->warning('Random message', array('exception' => 'oops'));
  57428. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  57429. $expected = array(
  57430. 'warning Random message',
  57431. 'critical Uncaught Exception!'
  57432. );
  57433. $this->assertEquals($expected, $this->getLogs());
  57434. }
  57435. }
  57436. <?php
  57437. namespace Psr\Log\Test;
  57438. use Psr\Log\AbstractLogger;
  57439. class TestLogger extends AbstractLogger
  57440. {
  57441. public $records = [];
  57442. public $recordsByLevel = [];
  57443. public function log($level, $message, array $context = [])
  57444. {
  57445. $record = [
  57446. 'level' => $level,
  57447. 'message' => $message,
  57448. 'context' => $context,
  57449. ];
  57450. $this->recordsByLevel[$record['level']][] = $record;
  57451. $this->records[] = $record;
  57452. }
  57453. public function hasRecords($level)
  57454. {
  57455. return isset($this->recordsByLevel[$level]);
  57456. }
  57457. public function hasRecord($record, $level)
  57458. {
  57459. if (is_string($record)) {
  57460. $record = ['message' => $record];
  57461. }
  57462. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  57463. if ($rec['message'] !== $record['message']) {
  57464. return false;
  57465. }
  57466. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  57467. return false;
  57468. }
  57469. return true;
  57470. }, $level);
  57471. }
  57472. public function hasRecordThatContains($message, $level)
  57473. {
  57474. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  57475. return strpos($rec['message'], $message) !== false;
  57476. }, $level);
  57477. }
  57478. public function hasRecordThatMatches($regex, $level)
  57479. {
  57480. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  57481. return preg_match($regex, $rec['message']) > 0;
  57482. }, $level);
  57483. }
  57484. public function hasRecordThatPasses(callable $predicate, $level)
  57485. {
  57486. if (!isset($this->recordsByLevel[$level])) {
  57487. return false;
  57488. }
  57489. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  57490. if (call_user_func($predicate, $rec, $i)) {
  57491. return true;
  57492. }
  57493. }
  57494. return false;
  57495. }
  57496. public function __call($method, $args)
  57497. {
  57498. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  57499. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  57500. $level = strtolower($matches[2]);
  57501. if (method_exists($this, $genericMethod)) {
  57502. $args[] = $level;
  57503. return call_user_func_array([$this, $genericMethod], $args);
  57504. }
  57505. }
  57506. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  57507. }
  57508. public function reset()
  57509. {
  57510. $this->records = [];
  57511. $this->recordsByLevel = [];
  57512. }
  57513. }
  57514. The MIT License (MIT)
  57515. Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden
  57516. Permission is hereby granted, free of charge, to any person
  57517. obtaining a copy of this software and associated documentation
  57518. files (the "Software"), to deal in the Software without
  57519. restriction, including without limitation the rights to use,
  57520. copy, modify, merge, publish, distribute, sublicense, and/or sell
  57521. copies of the Software, and to permit persons to whom the
  57522. Software is furnished to do so, subject to the following
  57523. conditions:
  57524. The above copyright notice and this permission notice shall be
  57525. included in all copies or substantial portions of the Software.
  57526. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  57527. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  57528. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  57529. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  57530. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  57531. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  57532. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  57533. OTHER DEALINGS IN THE SOFTWARE.
  57534. <?php
  57535. namespace React\Promise;
  57536. final class Deferred
  57537. {
  57538. private $promise;
  57539. private $resolveCallback;
  57540. private $rejectCallback;
  57541. public function __construct(callable $canceller = null)
  57542. {
  57543. $this->promise = new Promise(function ($resolve, $reject): void {
  57544. $this->resolveCallback = $resolve;
  57545. $this->rejectCallback = $reject;
  57546. }, $canceller);
  57547. }
  57548. public function promise(): PromiseInterface
  57549. {
  57550. return $this->promise;
  57551. }
  57552. public function resolve($value): void
  57553. {
  57554. ($this->resolveCallback)($value);
  57555. }
  57556. public function reject(\Throwable $reason): void
  57557. {
  57558. ($this->rejectCallback)($reason);
  57559. }
  57560. }
  57561. <?php
  57562. namespace React\Promise\Exception;
  57563. class CompositeException extends \Exception
  57564. {
  57565. private $throwables;
  57566. public function __construct(array $throwables, string $message = '', int $code = 0, ?\Throwable $previous = null)
  57567. {
  57568. parent::__construct($message, $code, $previous);
  57569. $this->throwables = $throwables;
  57570. }
  57571. public function getThrowables(): array
  57572. {
  57573. return $this->throwables;
  57574. }
  57575. }
  57576. <?php
  57577. namespace React\Promise\Exception;
  57578. class LengthException extends \LengthException
  57579. {
  57580. }
  57581. <?php
  57582. namespace React\Promise\Internal;
  57583. final class CancellationQueue
  57584. {
  57585. private $started = false;
  57586. private $queue = [];
  57587. public function __invoke(): void
  57588. {
  57589. if ($this->started) {
  57590. return;
  57591. }
  57592. $this->started = true;
  57593. $this->drain();
  57594. }
  57595. public function enqueue($cancellable): void
  57596. {
  57597. if (!\is_object($cancellable) || !\method_exists($cancellable, 'then') || !\method_exists($cancellable, 'cancel')) {
  57598. return;
  57599. }
  57600. $length = \array_push($this->queue, $cancellable);
  57601. if ($this->started && 1 === $length) {
  57602. $this->drain();
  57603. }
  57604. }
  57605. private function drain(): void
  57606. {
  57607. for ($i = \key($this->queue); isset($this->queue[$i]); $i++) {
  57608. $cancellable = $this->queue[$i];
  57609. assert(\method_exists($cancellable, 'cancel'));
  57610. $exception = null;
  57611. try {
  57612. $cancellable->cancel();
  57613. } catch (\Throwable $exception) {
  57614. }
  57615. unset($this->queue[$i]);
  57616. if ($exception) {
  57617. throw $exception;
  57618. }
  57619. }
  57620. $this->queue = [];
  57621. }
  57622. }
  57623. <?php
  57624. namespace React\Promise\Internal;
  57625. use React\Promise\PromiseInterface;
  57626. use function React\Promise\resolve;
  57627. final class FulfilledPromise implements PromiseInterface
  57628. {
  57629. private $value;
  57630. public function __construct($value = null)
  57631. {
  57632. if ($value instanceof PromiseInterface) {
  57633. throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.');
  57634. }
  57635. $this->value = $value;
  57636. }
  57637. public function then(callable $onFulfilled = null, callable $onRejected = null): PromiseInterface
  57638. {
  57639. if (null === $onFulfilled) {
  57640. return $this;
  57641. }
  57642. try {
  57643. $result = $onFulfilled($this->value);
  57644. return resolve($result);
  57645. } catch (\Throwable $exception) {
  57646. return new RejectedPromise($exception);
  57647. }
  57648. }
  57649. public function catch(callable $onRejected): PromiseInterface
  57650. {
  57651. return $this;
  57652. }
  57653. public function finally(callable $onFulfilledOrRejected): PromiseInterface
  57654. {
  57655. return $this->then(function ($value) use ($onFulfilledOrRejected): PromiseInterface {
  57656. return resolve($onFulfilledOrRejected())->then(function () use ($value) {
  57657. return $value;
  57658. });
  57659. });
  57660. }
  57661. public function cancel(): void
  57662. {
  57663. }
  57664. public function otherwise(callable $onRejected): PromiseInterface
  57665. {
  57666. return $this->catch($onRejected);
  57667. }
  57668. public function always(callable $onFulfilledOrRejected): PromiseInterface
  57669. {
  57670. return $this->finally($onFulfilledOrRejected);
  57671. }
  57672. }
  57673. <?php
  57674. namespace React\Promise\Internal;
  57675. use React\Promise\PromiseInterface;
  57676. use function React\Promise\_checkTypehint;
  57677. use function React\Promise\resolve;
  57678. use function React\Promise\set_rejection_handler;
  57679. final class RejectedPromise implements PromiseInterface
  57680. {
  57681. private $reason;
  57682. private $handled = false;
  57683. public function __construct(\Throwable $reason)
  57684. {
  57685. $this->reason = $reason;
  57686. }
  57687. public function __destruct()
  57688. {
  57689. if ($this->handled) {
  57690. return;
  57691. }
  57692. $handler = set_rejection_handler(null);
  57693. if ($handler === null) {
  57694. $message = 'Unhandled promise rejection with ' . \get_class($this->reason) . ': ' . $this->reason->getMessage() . ' in ' . $this->reason->getFile() . ':' . $this->reason->getLine() . PHP_EOL;
  57695. $message .= 'Stack trace:' . PHP_EOL . $this->reason->getTraceAsString();
  57696. \error_log($message);
  57697. return;
  57698. }
  57699. try {
  57700. $handler($this->reason);
  57701. } catch (\Throwable $e) {
  57702. $message = 'Fatal error: Uncaught ' . \get_class($e) . ' from unhandled promise rejection handler: ' . $e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine() . PHP_EOL;
  57703. $message .= 'Stack trace:' . PHP_EOL . $e->getTraceAsString();
  57704. \error_log($message);
  57705. exit(255);
  57706. }
  57707. }
  57708. public function then(callable $onFulfilled = null, callable $onRejected = null): PromiseInterface
  57709. {
  57710. if (null === $onRejected) {
  57711. return $this;
  57712. }
  57713. $this->handled = true;
  57714. try {
  57715. return resolve($onRejected($this->reason));
  57716. } catch (\Throwable $exception) {
  57717. return new RejectedPromise($exception);
  57718. }
  57719. }
  57720. public function catch(callable $onRejected): PromiseInterface
  57721. {
  57722. if (!_checkTypehint($onRejected, $this->reason)) {
  57723. return $this;
  57724. }
  57725. return $this->then(null, $onRejected);
  57726. }
  57727. public function finally(callable $onFulfilledOrRejected): PromiseInterface
  57728. {
  57729. return $this->then(null, function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface {
  57730. return resolve($onFulfilledOrRejected())->then(function () use ($reason): PromiseInterface {
  57731. return new RejectedPromise($reason);
  57732. });
  57733. });
  57734. }
  57735. public function cancel(): void
  57736. {
  57737. $this->handled = true;
  57738. }
  57739. public function otherwise(callable $onRejected): PromiseInterface
  57740. {
  57741. return $this->catch($onRejected);
  57742. }
  57743. public function always(callable $onFulfilledOrRejected): PromiseInterface
  57744. {
  57745. return $this->finally($onFulfilledOrRejected);
  57746. }
  57747. }
  57748. <?php
  57749. namespace React\Promise;
  57750. use React\Promise\Internal\RejectedPromise;
  57751. final class Promise implements PromiseInterface
  57752. {
  57753. private $canceller;
  57754. private $result;
  57755. private $handlers = [];
  57756. private $requiredCancelRequests = 0;
  57757. private $cancelled = false;
  57758. public function __construct(callable $resolver, callable $canceller = null)
  57759. {
  57760. $this->canceller = $canceller;
  57761. $cb = $resolver;
  57762. $resolver = $canceller = null;
  57763. $this->call($cb);
  57764. }
  57765. public function then(callable $onFulfilled = null, callable $onRejected = null): PromiseInterface
  57766. {
  57767. if (null !== $this->result) {
  57768. return $this->result->then($onFulfilled, $onRejected);
  57769. }
  57770. if (null === $this->canceller) {
  57771. return new static($this->resolver($onFulfilled, $onRejected));
  57772. }
  57773. $parent = $this;
  57774. ++$parent->requiredCancelRequests;
  57775. return new static(
  57776. $this->resolver($onFulfilled, $onRejected),
  57777. static function () use (&$parent): void {
  57778. assert($parent instanceof self);
  57779. --$parent->requiredCancelRequests;
  57780. if ($parent->requiredCancelRequests <= 0) {
  57781. $parent->cancel();
  57782. }
  57783. $parent = null;
  57784. }
  57785. );
  57786. }
  57787. public function catch(callable $onRejected): PromiseInterface
  57788. {
  57789. return $this->then(null, static function (\Throwable $reason) use ($onRejected) {
  57790. if (!_checkTypehint($onRejected, $reason)) {
  57791. return new RejectedPromise($reason);
  57792. }
  57793. return $onRejected($reason);
  57794. });
  57795. }
  57796. public function finally(callable $onFulfilledOrRejected): PromiseInterface
  57797. {
  57798. return $this->then(static function ($value) use ($onFulfilledOrRejected): PromiseInterface {
  57799. return resolve($onFulfilledOrRejected())->then(function () use ($value) {
  57800. return $value;
  57801. });
  57802. }, static function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface {
  57803. return resolve($onFulfilledOrRejected())->then(function () use ($reason): RejectedPromise {
  57804. return new RejectedPromise($reason);
  57805. });
  57806. });
  57807. }
  57808. public function cancel(): void
  57809. {
  57810. $this->cancelled = true;
  57811. $canceller = $this->canceller;
  57812. $this->canceller = null;
  57813. $parentCanceller = null;
  57814. if (null !== $this->result) {
  57815. if ($this->result instanceof RejectedPromise) {
  57816. $this->result->cancel();
  57817. }
  57818. $root = $this->unwrap($this->result);
  57819. if (!$root instanceof self || null !== $root->result) {
  57820. return;
  57821. }
  57822. $root->requiredCancelRequests--;
  57823. if ($root->requiredCancelRequests <= 0) {
  57824. $parentCanceller = [$root, 'cancel'];
  57825. }
  57826. }
  57827. if (null !== $canceller) {
  57828. $this->call($canceller);
  57829. }
  57830. if ($parentCanceller) {
  57831. $parentCanceller();
  57832. }
  57833. }
  57834. public function otherwise(callable $onRejected): PromiseInterface
  57835. {
  57836. return $this->catch($onRejected);
  57837. }
  57838. public function always(callable $onFulfilledOrRejected): PromiseInterface
  57839. {
  57840. return $this->finally($onFulfilledOrRejected);
  57841. }
  57842. private function resolver(callable $onFulfilled = null, callable $onRejected = null): callable
  57843. {
  57844. return function (callable $resolve, callable $reject) use ($onFulfilled, $onRejected): void {
  57845. $this->handlers[] = static function (PromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject): void {
  57846. $promise = $promise->then($onFulfilled, $onRejected);
  57847. if ($promise instanceof self && $promise->result === null) {
  57848. $promise->handlers[] = static function (PromiseInterface $promise) use ($resolve, $reject): void {
  57849. $promise->then($resolve, $reject);
  57850. };
  57851. } else {
  57852. $promise->then($resolve, $reject);
  57853. }
  57854. };
  57855. };
  57856. }
  57857. private function reject(\Throwable $reason): void
  57858. {
  57859. if (null !== $this->result) {
  57860. return;
  57861. }
  57862. $this->settle(reject($reason));
  57863. }
  57864. private function settle(PromiseInterface $result): void
  57865. {
  57866. $result = $this->unwrap($result);
  57867. if ($result === $this) {
  57868. $result = new RejectedPromise(
  57869. new \LogicException('Cannot resolve a promise with itself.')
  57870. );
  57871. }
  57872. if ($result instanceof self) {
  57873. $result->requiredCancelRequests++;
  57874. } else {
  57875. $this->canceller = null;
  57876. }
  57877. $handlers = $this->handlers;
  57878. $this->handlers = [];
  57879. $this->result = $result;
  57880. foreach ($handlers as $handler) {
  57881. $handler($result);
  57882. }
  57883. if ($this->cancelled && $result instanceof RejectedPromise) {
  57884. $result->cancel();
  57885. }
  57886. }
  57887. private function unwrap(PromiseInterface $promise): PromiseInterface
  57888. {
  57889. while ($promise instanceof self && null !== $promise->result) {
  57890. $promise = $promise->result;
  57891. }
  57892. return $promise;
  57893. }
  57894. private function call(callable $cb): void
  57895. {
  57896. $callback = $cb;
  57897. $cb = null;
  57898. if (\is_array($callback)) {
  57899. $ref = new \ReflectionMethod($callback[0], $callback[1]);
  57900. } elseif (\is_object($callback) && !$callback instanceof \Closure) {
  57901. $ref = new \ReflectionMethod($callback, '__invoke');
  57902. } else {
  57903. assert($callback instanceof \Closure || \is_string($callback));
  57904. $ref = new \ReflectionFunction($callback);
  57905. }
  57906. $args = $ref->getNumberOfParameters();
  57907. try {
  57908. if ($args === 0) {
  57909. $callback();
  57910. } else {
  57911. $target =& $this;
  57912. $callback(
  57913. static function ($value) use (&$target): void {
  57914. if ($target !== null) {
  57915. $target->settle(resolve($value));
  57916. $target = null;
  57917. }
  57918. },
  57919. static function (\Throwable $reason) use (&$target): void {
  57920. if ($target !== null) {
  57921. $target->reject($reason);
  57922. $target = null;
  57923. }
  57924. }
  57925. );
  57926. }
  57927. } catch (\Throwable $e) {
  57928. $target = null;
  57929. $this->reject($e);
  57930. }
  57931. }
  57932. }
  57933. <?php
  57934. namespace React\Promise;
  57935. interface PromiseInterface
  57936. {
  57937. public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface;
  57938. public function catch(callable $onRejected): PromiseInterface;
  57939. public function finally(callable $onFulfilledOrRejected): PromiseInterface;
  57940. public function cancel(): void;
  57941. public function otherwise(callable $onRejected): PromiseInterface;
  57942. public function always(callable $onFulfilledOrRejected): PromiseInterface;
  57943. }
  57944. <?php
  57945. namespace React\Promise;
  57946. use React\Promise\Exception\CompositeException;
  57947. use React\Promise\Internal\FulfilledPromise;
  57948. use React\Promise\Internal\RejectedPromise;
  57949. function resolve($promiseOrValue): PromiseInterface
  57950. {
  57951. if ($promiseOrValue instanceof PromiseInterface) {
  57952. return $promiseOrValue;
  57953. }
  57954. if (\is_object($promiseOrValue) && \method_exists($promiseOrValue, 'then')) {
  57955. $canceller = null;
  57956. if (\method_exists($promiseOrValue, 'cancel')) {
  57957. $canceller = [$promiseOrValue, 'cancel'];
  57958. assert(\is_callable($canceller));
  57959. }
  57960. return new Promise(function (callable $resolve, callable $reject) use ($promiseOrValue): void {
  57961. $promiseOrValue->then($resolve, $reject);
  57962. }, $canceller);
  57963. }
  57964. return new FulfilledPromise($promiseOrValue);
  57965. }
  57966. function reject(\Throwable $reason): PromiseInterface
  57967. {
  57968. return new RejectedPromise($reason);
  57969. }
  57970. function all(iterable $promisesOrValues): PromiseInterface
  57971. {
  57972. $cancellationQueue = new Internal\CancellationQueue();
  57973. return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void {
  57974. $toResolve = 0;
  57975. $continue = true;
  57976. $values = [];
  57977. foreach ($promisesOrValues as $i => $promiseOrValue) {
  57978. $cancellationQueue->enqueue($promiseOrValue);
  57979. $values[$i] = null;
  57980. ++$toResolve;
  57981. resolve($promiseOrValue)->then(
  57982. function ($value) use ($i, &$values, &$toResolve, &$continue, $resolve): void {
  57983. $values[$i] = $value;
  57984. if (0 === --$toResolve && !$continue) {
  57985. $resolve($values);
  57986. }
  57987. },
  57988. function (\Throwable $reason) use (&$continue, $reject): void {
  57989. $continue = false;
  57990. $reject($reason);
  57991. }
  57992. );
  57993. if (!$continue && !\is_array($promisesOrValues)) {
  57994. break;
  57995. }
  57996. }
  57997. $continue = false;
  57998. if ($toResolve === 0) {
  57999. $resolve($values);
  58000. }
  58001. }, $cancellationQueue);
  58002. }
  58003. function race(iterable $promisesOrValues): PromiseInterface
  58004. {
  58005. $cancellationQueue = new Internal\CancellationQueue();
  58006. return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void {
  58007. $continue = true;
  58008. foreach ($promisesOrValues as $promiseOrValue) {
  58009. $cancellationQueue->enqueue($promiseOrValue);
  58010. resolve($promiseOrValue)->then($resolve, $reject)->finally(function () use (&$continue): void {
  58011. $continue = false;
  58012. });
  58013. if (!$continue && !\is_array($promisesOrValues)) {
  58014. break;
  58015. }
  58016. }
  58017. }, $cancellationQueue);
  58018. }
  58019. function any(iterable $promisesOrValues): PromiseInterface
  58020. {
  58021. $cancellationQueue = new Internal\CancellationQueue();
  58022. return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void {
  58023. $toReject = 0;
  58024. $continue = true;
  58025. $reasons = [];
  58026. foreach ($promisesOrValues as $i => $promiseOrValue) {
  58027. $cancellationQueue->enqueue($promiseOrValue);
  58028. ++$toReject;
  58029. resolve($promiseOrValue)->then(
  58030. function ($value) use ($resolve, &$continue): void {
  58031. $continue = false;
  58032. $resolve($value);
  58033. },
  58034. function (\Throwable $reason) use ($i, &$reasons, &$toReject, $reject, &$continue): void {
  58035. $reasons[$i] = $reason;
  58036. if (0 === --$toReject && !$continue) {
  58037. $reject(new CompositeException(
  58038. $reasons,
  58039. 'All promises rejected.'
  58040. ));
  58041. }
  58042. }
  58043. );
  58044. if (!$continue && !\is_array($promisesOrValues)) {
  58045. break;
  58046. }
  58047. }
  58048. $continue = false;
  58049. if ($toReject === 0 && !$reasons) {
  58050. $reject(new Exception\LengthException(
  58051. 'Must contain at least 1 item but contains only 0 items.'
  58052. ));
  58053. } elseif ($toReject === 0) {
  58054. $reject(new CompositeException(
  58055. $reasons,
  58056. 'All promises rejected.'
  58057. ));
  58058. }
  58059. }, $cancellationQueue);
  58060. }
  58061. function set_rejection_handler(?callable $callback): ?callable
  58062. {
  58063. static $current = null;
  58064. $previous = $current;
  58065. $current = $callback;
  58066. return $previous;
  58067. }
  58068. function _checkTypehint(callable $callback, \Throwable $reason): bool
  58069. {
  58070. if (\is_array($callback)) {
  58071. $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]);
  58072. } elseif (\is_object($callback) && !$callback instanceof \Closure) {
  58073. $callbackReflection = new \ReflectionMethod($callback, '__invoke');
  58074. } else {
  58075. assert($callback instanceof \Closure || \is_string($callback));
  58076. $callbackReflection = new \ReflectionFunction($callback);
  58077. }
  58078. $parameters = $callbackReflection->getParameters();
  58079. if (!isset($parameters[0])) {
  58080. return true;
  58081. }
  58082. $expectedException = $parameters[0];
  58083. $type = $expectedException->getType();
  58084. $isTypeUnion = true;
  58085. $types = [];
  58086. switch (true) {
  58087. case $type === null:
  58088. break;
  58089. case $type instanceof \ReflectionNamedType:
  58090. $types = [$type];
  58091. break;
  58092. case $type instanceof \ReflectionIntersectionType:
  58093. $isTypeUnion = false;
  58094. case $type instanceof \ReflectionUnionType;
  58095. $types = $type->getTypes();
  58096. break;
  58097. default:
  58098. throw new \LogicException('Unexpected return value of ReflectionParameter::getType');
  58099. }
  58100. if (empty($types)) {
  58101. return true;
  58102. }
  58103. foreach ($types as $type) {
  58104. if ($type instanceof \ReflectionIntersectionType) {
  58105. foreach ($type->getTypes() as $typeToMatch) {
  58106. assert($typeToMatch instanceof \ReflectionNamedType);
  58107. $name = $typeToMatch->getName();
  58108. if (!($matches = (!$typeToMatch->isBuiltin() && $reason instanceof $name))) {
  58109. break;
  58110. }
  58111. }
  58112. assert(isset($matches));
  58113. } else {
  58114. assert($type instanceof \ReflectionNamedType);
  58115. $name = $type->getName();
  58116. $matches = !$type->isBuiltin() && $reason instanceof $name;
  58117. }
  58118. if ($matches) {
  58119. if ($isTypeUnion) {
  58120. return true;
  58121. }
  58122. } else {
  58123. if (!$isTypeUnion) {
  58124. return false;
  58125. }
  58126. }
  58127. }
  58128. return $isTypeUnion ? false : true;
  58129. }
  58130. <?php
  58131. if (!\function_exists('React\Promise\resolve')) {
  58132. require __DIR__.'/functions.php';
  58133. }
  58134. Copyright (c) 2011 Jordi Boggiano
  58135. Permission is hereby granted, free of charge, to any person obtaining a copy
  58136. of this software and associated documentation files (the "Software"), to deal
  58137. in the Software without restriction, including without limitation the rights
  58138. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58139. copies of the Software, and to permit persons to whom the Software is furnished
  58140. to do so, subject to the following conditions:
  58141. The above copyright notice and this permission notice shall be included in all
  58142. copies or substantial portions of the Software.
  58143. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  58144. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  58145. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  58146. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  58147. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  58148. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58149. THE SOFTWARE.
  58150. <?php
  58151. namespace Seld\JsonLint;
  58152. class DuplicateKeyException extends ParsingException
  58153. {
  58154. protected $details;
  58155. public function __construct($message, $key, array $details)
  58156. {
  58157. $details['key'] = $key;
  58158. parent::__construct($message, $details);
  58159. }
  58160. public function getKey()
  58161. {
  58162. return $this->details['key'];
  58163. }
  58164. public function getDetails()
  58165. {
  58166. return $this->details;
  58167. }
  58168. }
  58169. <?php
  58170. namespace Seld\JsonLint;
  58171. use stdClass;
  58172. class JsonParser
  58173. {
  58174. const DETECT_KEY_CONFLICTS = 1;
  58175. const ALLOW_DUPLICATE_KEYS = 2;
  58176. const PARSE_TO_ASSOC = 4;
  58177. const ALLOW_COMMENTS = 8;
  58178. private $lexer;
  58179. private $flags;
  58180. private $stack;
  58181. private $vstack;
  58182. private $lstack;
  58183. private $symbols = array(
  58184. 'error' => 2,
  58185. 'JSONString' => 3,
  58186. 'STRING' => 4,
  58187. 'JSONNumber' => 5,
  58188. 'NUMBER' => 6,
  58189. 'JSONNullLiteral' => 7,
  58190. 'NULL' => 8,
  58191. 'JSONBooleanLiteral' => 9,
  58192. 'TRUE' => 10,
  58193. 'FALSE' => 11,
  58194. 'JSONText' => 12,
  58195. 'JSONValue' => 13,
  58196. 'EOF' => 14,
  58197. 'JSONObject' => 15,
  58198. 'JSONArray' => 16,
  58199. '{' => 17,
  58200. '}' => 18,
  58201. 'JSONMemberList' => 19,
  58202. 'JSONMember' => 20,
  58203. ':' => 21,
  58204. ',' => 22,
  58205. '[' => 23,
  58206. ']' => 24,
  58207. 'JSONElementList' => 25,
  58208. '$accept' => 0,
  58209. '$end' => 1,
  58210. );
  58211. private $terminals_ = array(
  58212. 2 => "error",
  58213. 4 => "STRING",
  58214. 6 => "NUMBER",
  58215. 8 => "NULL",
  58216. 10 => "TRUE",
  58217. 11 => "FALSE",
  58218. 14 => "EOF",
  58219. 17 => "{",
  58220. 18 => "}",
  58221. 21 => ":",
  58222. 22 => ",",
  58223. 23 => "[",
  58224. 24 => "]",
  58225. );
  58226. private $productions_ = array(
  58227. 1 => array(3, 1),
  58228. 2 => array(5, 1),
  58229. 3 => array(7, 1),
  58230. 4 => array(9, 1),
  58231. 5 => array(9, 1),
  58232. 6 => array(12, 2),
  58233. 7 => array(13, 1),
  58234. 8 => array(13, 1),
  58235. 9 => array(13, 1),
  58236. 10 => array(13, 1),
  58237. 11 => array(13, 1),
  58238. 12 => array(13, 1),
  58239. 13 => array(15, 2),
  58240. 14 => array(15, 3),
  58241. 15 => array(20, 3),
  58242. 16 => array(19, 1),
  58243. 17 => array(19, 3),
  58244. 18 => array(16, 2),
  58245. 19 => array(16, 3),
  58246. 20 => array(25, 1),
  58247. 21 => array(25, 3)
  58248. );
  58249. private $table = array(
  58250. 0 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  58251. 1 => array( 1 => array(3)),
  58252. 2 => array( 14 => array(1,16)),
  58253. 3 => array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)),
  58254. 4 => array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)),
  58255. 5 => array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)),
  58256. 6 => array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)),
  58257. 7 => array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)),
  58258. 8 => array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)),
  58259. 9 => array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)),
  58260. 10 => array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)),
  58261. 11 => array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)),
  58262. 12 => array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)),
  58263. 13 => array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)),
  58264. 14 => array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ),
  58265. 15 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ),
  58266. 16 => array( 1 => array(2,6)),
  58267. 17 => array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)),
  58268. 18 => array( 18 => array(1,24), 22 => array(1,25)),
  58269. 19 => array( 18 => array(2,16), 22 => array(2,16)),
  58270. 20 => array( 21 => array(1,26)),
  58271. 21 => array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)),
  58272. 22 => array( 22 => array(1,28), 24 => array(1,27)),
  58273. 23 => array( 22 => array(2,20), 24 => array(2,20)),
  58274. 24 => array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)),
  58275. 25 => array( 3 => 20, 4 => array(1,12), 20 => 29 ),
  58276. 26 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  58277. 27 => array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)),
  58278. 28 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  58279. 29 => array( 18 => array(2,17), 22 => array(2,17)),
  58280. 30 => array( 18 => array(2,15), 22 => array(2,15)),
  58281. 31 => array( 22 => array(2,21), 24 => array(2,21)),
  58282. );
  58283. private $defaultActions = array(
  58284. 16 => array(2, 6)
  58285. );
  58286. public function lint($input, $flags = 0)
  58287. {
  58288. try {
  58289. $this->parse($input, $flags);
  58290. } catch (ParsingException $e) {
  58291. return $e;
  58292. }
  58293. return null;
  58294. }
  58295. public function parse($input, $flags = 0)
  58296. {
  58297. $this->failOnBOM($input);
  58298. $this->flags = $flags;
  58299. $this->stack = array(0);
  58300. $this->vstack = array(null);
  58301. $this->lstack = array();
  58302. $yytext = '';
  58303. $yylineno = 0;
  58304. $yyleng = 0;
  58305. $recovering = 0;
  58306. $this->lexer = new Lexer($flags);
  58307. $this->lexer->setInput($input);
  58308. $yyloc = $this->lexer->yylloc;
  58309. $this->lstack[] = $yyloc;
  58310. $symbol = null;
  58311. $preErrorSymbol = null;
  58312. $action = null;
  58313. $a = null;
  58314. $r = null;
  58315. $p = null;
  58316. $len = null;
  58317. $newState = null;
  58318. $expected = null;
  58319. $errStr = null;
  58320. while (true) {
  58321. $state = $this->stack[\count($this->stack)-1];
  58322. if (isset($this->defaultActions[$state])) {
  58323. $action = $this->defaultActions[$state];
  58324. } else {
  58325. if ($symbol === null) {
  58326. $symbol = $this->lexer->lex();
  58327. }
  58328. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  58329. }
  58330. if (!$action || !$action[0]) {
  58331. assert(isset($symbol));
  58332. if (!$recovering) {
  58333. $expected = array();
  58334. foreach ($this->table[$state] as $p => $ignore) {
  58335. if (isset($this->terminals_[$p]) && $p > 2) {
  58336. $expected[] = "'" . $this->terminals_[$p] . "'";
  58337. }
  58338. }
  58339. $message = null;
  58340. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  58341. $message = "Invalid string";
  58342. if ("'" === substr($this->lexer->match, 0, 1)) {
  58343. $message .= ", it appears you used single quotes instead of double quotes";
  58344. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  58345. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  58346. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  58347. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  58348. }
  58349. }
  58350. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  58351. $errStr .= $this->lexer->showPosition() . "\n";
  58352. if ($message) {
  58353. $errStr .= $message;
  58354. } else {
  58355. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  58356. $errStr .= implode(', ', $expected);
  58357. }
  58358. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  58359. $errStr .= " - It appears you have an extra trailing comma";
  58360. }
  58361. $this->parseError($errStr, array(
  58362. 'text' => $this->lexer->match,
  58363. 'token' => isset($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  58364. 'line' => $this->lexer->yylineno,
  58365. 'loc' => $yyloc,
  58366. 'expected' => $expected,
  58367. ));
  58368. }
  58369. if ($recovering == 3) {
  58370. if ($symbol === Lexer::EOF) {
  58371. throw new ParsingException($errStr ?: 'Parsing halted.');
  58372. }
  58373. $yyleng = $this->lexer->yyleng;
  58374. $yytext = $this->lexer->yytext;
  58375. $yylineno = $this->lexer->yylineno;
  58376. $yyloc = $this->lexer->yylloc;
  58377. $symbol = $this->lexer->lex();
  58378. }
  58379. while (true) {
  58380. if (\array_key_exists(Lexer::T_ERROR, $this->table[$state])) {
  58381. break;
  58382. }
  58383. if ($state == 0) {
  58384. throw new ParsingException($errStr ?: 'Parsing halted.');
  58385. }
  58386. $this->popStack(1);
  58387. $state = $this->stack[\count($this->stack)-1];
  58388. }
  58389. $preErrorSymbol = $symbol;
  58390. $symbol = Lexer::T_ERROR;
  58391. $state = $this->stack[\count($this->stack)-1];
  58392. $action = isset($this->table[$state][Lexer::T_ERROR]) ? $this->table[$state][Lexer::T_ERROR] : false;
  58393. if ($action === false) {
  58394. throw new \LogicException('No table value found for '.$state.' => '.Lexer::T_ERROR);
  58395. }
  58396. $recovering = 3;
  58397. }
  58398. if (\is_array($action[0]) && \count($action) > 1) {
  58399. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  58400. }
  58401. switch ($action[0]) {
  58402. case 1:
  58403. assert(isset($symbol));
  58404. $this->stack[] = $symbol;
  58405. $this->vstack[] = $this->lexer->yytext;
  58406. $this->lstack[] = $this->lexer->yylloc;
  58407. $this->stack[] = $action[1];
  58408. $symbol = null;
  58409. if (!$preErrorSymbol) {
  58410. $yyleng = $this->lexer->yyleng;
  58411. $yytext = $this->lexer->yytext;
  58412. $yylineno = $this->lexer->yylineno;
  58413. $yyloc = $this->lexer->yylloc;
  58414. if ($recovering > 0) {
  58415. $recovering--;
  58416. }
  58417. } else {
  58418. $symbol = $preErrorSymbol;
  58419. $preErrorSymbol = null;
  58420. }
  58421. break;
  58422. case 2:
  58423. $len = $this->productions_[$action[1]][1];
  58424. $currentToken = $this->vstack[\count($this->vstack) - $len];
  58425. $position = array(
  58426. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  58427. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  58428. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  58429. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  58430. );
  58431. list($newToken, $actionResult) = $this->performAction($currentToken, $yytext, $yyleng, $yylineno, $action[1]);
  58432. if (!$actionResult instanceof Undefined) {
  58433. return $actionResult;
  58434. }
  58435. if ($len) {
  58436. $this->popStack($len);
  58437. }
  58438. $this->stack[] = $this->productions_[$action[1]][0];
  58439. $this->vstack[] = $newToken;
  58440. $this->lstack[] = $position;
  58441. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  58442. $this->stack[] = $newState;
  58443. break;
  58444. case 3:
  58445. return true;
  58446. }
  58447. }
  58448. }
  58449. protected function parseError($str, $hash = null)
  58450. {
  58451. throw new ParsingException($str, $hash ?: array());
  58452. }
  58453. private function performAction($currentToken, $yytext, $yyleng, $yylineno, $yystate)
  58454. {
  58455. $token = $currentToken;
  58456. $len = \count($this->vstack) - 1;
  58457. switch ($yystate) {
  58458. case 1:
  58459. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  58460. $token = $yytext;
  58461. break;
  58462. case 2:
  58463. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  58464. $token = \floatval($yytext);
  58465. } else {
  58466. $token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  58467. }
  58468. break;
  58469. case 3:
  58470. $token = null;
  58471. break;
  58472. case 4:
  58473. $token = true;
  58474. break;
  58475. case 5:
  58476. $token = false;
  58477. break;
  58478. case 6:
  58479. $token = $this->vstack[$len-1];
  58480. return array($token, $token);
  58481. case 13:
  58482. if ($this->flags & self::PARSE_TO_ASSOC) {
  58483. $token = array();
  58484. } else {
  58485. $token = new stdClass;
  58486. }
  58487. break;
  58488. case 14:
  58489. $token = $this->vstack[$len-1];
  58490. break;
  58491. case 15:
  58492. $token = array($this->vstack[$len-2], $this->vstack[$len]);
  58493. break;
  58494. case 16:
  58495. assert(\is_array($this->vstack[$len]));
  58496. if (PHP_VERSION_ID < 70100) {
  58497. $property = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
  58498. } else {
  58499. $property = $this->vstack[$len][0];
  58500. }
  58501. if ($this->flags & self::PARSE_TO_ASSOC) {
  58502. $token = array();
  58503. $token[$property] = $this->vstack[$len][1];
  58504. } else {
  58505. $token = new stdClass;
  58506. $token->$property = $this->vstack[$len][1];
  58507. }
  58508. break;
  58509. case 17:
  58510. assert(\is_array($this->vstack[$len]));
  58511. if ($this->flags & self::PARSE_TO_ASSOC) {
  58512. assert(\is_array($this->vstack[$len-2]));
  58513. $token =& $this->vstack[$len-2];
  58514. $key = $this->vstack[$len][0];
  58515. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2][$key])) {
  58516. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  58517. $errStr .= $this->lexer->showPosition() . "\n";
  58518. $errStr .= "Duplicate key: ".$this->vstack[$len][0];
  58519. throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
  58520. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2][$key])) {
  58521. $duplicateCount = 1;
  58522. do {
  58523. $duplicateKey = $key . '.' . $duplicateCount++;
  58524. } while (isset($this->vstack[$len-2][$duplicateKey]));
  58525. $key = $duplicateKey;
  58526. }
  58527. $this->vstack[$len-2][$key] = $this->vstack[$len][1];
  58528. } else {
  58529. assert($this->vstack[$len-2] instanceof stdClass);
  58530. $token = $this->vstack[$len-2];
  58531. if (PHP_VERSION_ID < 70100) {
  58532. $key = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
  58533. } else {
  58534. $key = $this->vstack[$len][0];
  58535. }
  58536. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2]->{$key})) {
  58537. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  58538. $errStr .= $this->lexer->showPosition() . "\n";
  58539. $errStr .= "Duplicate key: ".$this->vstack[$len][0];
  58540. throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
  58541. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2]->{$key})) {
  58542. $duplicateCount = 1;
  58543. do {
  58544. $duplicateKey = $key . '.' . $duplicateCount++;
  58545. } while (isset($this->vstack[$len-2]->$duplicateKey));
  58546. $key = $duplicateKey;
  58547. }
  58548. $this->vstack[$len-2]->$key = $this->vstack[$len][1];
  58549. }
  58550. break;
  58551. case 18:
  58552. $token = array();
  58553. break;
  58554. case 19:
  58555. $token = $this->vstack[$len-1];
  58556. break;
  58557. case 20:
  58558. $token = array($this->vstack[$len]);
  58559. break;
  58560. case 21:
  58561. assert(\is_array($this->vstack[$len-2]));
  58562. $this->vstack[$len-2][] = $this->vstack[$len];
  58563. $token = $this->vstack[$len-2];
  58564. break;
  58565. }
  58566. return array($token, new Undefined());
  58567. }
  58568. private function stringInterpolation($match)
  58569. {
  58570. switch ($match[0]) {
  58571. case '\\\\':
  58572. return '\\';
  58573. case '\"':
  58574. return '"';
  58575. case '\b':
  58576. return \chr(8);
  58577. case '\f':
  58578. return \chr(12);
  58579. case '\n':
  58580. return "\n";
  58581. case '\r':
  58582. return "\r";
  58583. case '\t':
  58584. return "\t";
  58585. case '\/':
  58586. return "/";
  58587. default:
  58588. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  58589. }
  58590. }
  58591. private function popStack($n)
  58592. {
  58593. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  58594. $this->vstack = \array_slice($this->vstack, 0, - $n);
  58595. $this->lstack = \array_slice($this->lstack, 0, - $n);
  58596. }
  58597. private function failOnBOM($input)
  58598. {
  58599. $bom = "\xEF\xBB\xBF";
  58600. if (substr($input, 0, 3) === $bom) {
  58601. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark");
  58602. }
  58603. }
  58604. }
  58605. <?php
  58606. namespace Seld\JsonLint;
  58607. class Lexer
  58608. {
  58609. const EOF = 1;
  58610. const T_INVALID = -1;
  58611. const T_SKIP_WHITESPACE = 0;
  58612. const T_ERROR = 2;
  58613. const T_BREAK_LINE = 3;
  58614. const T_COMMENT = 30;
  58615. const T_OPEN_COMMENT = 31;
  58616. const T_CLOSE_COMMENT = 32;
  58617. private $rules = array(
  58618. 0 => '/\G\s*\n\r?/',
  58619. 1 => '/\G\s+/',
  58620. 2 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  58621. 3 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  58622. 4 => '/\G\{/',
  58623. 5 => '/\G\}/',
  58624. 6 => '/\G\[/',
  58625. 7 => '/\G\]/',
  58626. 8 => '/\G,/',
  58627. 9 => '/\G:/',
  58628. 10 => '/\Gtrue\b/',
  58629. 11 => '/\Gfalse\b/',
  58630. 12 => '/\Gnull\b/',
  58631. 13 => '/\G$/',
  58632. 14 => '/\G\/\//',
  58633. 15 => '/\G\/\*/',
  58634. 16 => '/\G\*\//',
  58635. 17 => '/\G./',
  58636. );
  58637. private $input;
  58638. private $more;
  58639. private $done;
  58640. private $offset;
  58641. private $flags;
  58642. public $match;
  58643. public $yylineno;
  58644. public $yyleng;
  58645. public $yytext;
  58646. public $yylloc;
  58647. public function __construct($flags = 0)
  58648. {
  58649. $this->flags = $flags;
  58650. }
  58651. public function lex()
  58652. {
  58653. while (true) {
  58654. $symbol = $this->next();
  58655. switch ($symbol) {
  58656. case self::T_SKIP_WHITESPACE:
  58657. case self::T_BREAK_LINE:
  58658. break;
  58659. case self::T_COMMENT:
  58660. case self::T_OPEN_COMMENT:
  58661. if (!($this->flags & JsonParser::ALLOW_COMMENTS)) {
  58662. $this->parseError('Lexical error on line ' . ($this->yylineno+1) . ". Comments are not allowed.\n" . $this->showPosition());
  58663. }
  58664. $this->skipUntil($symbol === self::T_COMMENT ? self::T_BREAK_LINE : self::T_CLOSE_COMMENT);
  58665. if ($this->done) {
  58666. return 14;
  58667. }
  58668. break;
  58669. case self::T_CLOSE_COMMENT:
  58670. $this->parseError('Lexical error on line ' . ($this->yylineno+1) . ". Unexpected token.\n" . $this->showPosition());
  58671. default:
  58672. return $symbol;
  58673. }
  58674. }
  58675. }
  58676. public function setInput($input)
  58677. {
  58678. $this->input = $input;
  58679. $this->more = false;
  58680. $this->done = false;
  58681. $this->offset = 0;
  58682. $this->yylineno = $this->yyleng = 0;
  58683. $this->yytext = $this->match = '';
  58684. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  58685. return $this;
  58686. }
  58687. public function showPosition()
  58688. {
  58689. if ($this->yylineno === 0 && $this->offset === 1 && $this->match !== '{') {
  58690. return $this->match.'...' . "\n^";
  58691. }
  58692. $pre = str_replace("\n", '', $this->getPastInput());
  58693. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  58694. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  58695. }
  58696. public function getPastInput()
  58697. {
  58698. $pastLength = $this->offset - \strlen($this->match);
  58699. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  58700. }
  58701. public function getUpcomingInput()
  58702. {
  58703. $next = $this->match;
  58704. if (\strlen($next) < 20) {
  58705. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  58706. }
  58707. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  58708. }
  58709. public function getFullUpcomingInput()
  58710. {
  58711. $next = $this->match;
  58712. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  58713. $len = \strlen($this->input);
  58714. if ($len === $this->offset) {
  58715. $strEnd = $len;
  58716. } else {
  58717. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  58718. }
  58719. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  58720. } elseif (\strlen($next) < 20) {
  58721. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  58722. }
  58723. return $next;
  58724. }
  58725. protected function parseError($str)
  58726. {
  58727. throw new ParsingException($str);
  58728. }
  58729. private function skipUntil($token)
  58730. {
  58731. $symbol = $this->next();
  58732. while ($symbol !== $token && false === $this->done) {
  58733. $symbol = $this->next();
  58734. }
  58735. }
  58736. private function next()
  58737. {
  58738. if ($this->done) {
  58739. return self::EOF;
  58740. }
  58741. if ($this->offset === \strlen($this->input)) {
  58742. $this->done = true;
  58743. }
  58744. $token = null;
  58745. $match = null;
  58746. $col = null;
  58747. $lines = null;
  58748. if (!$this->more) {
  58749. $this->yytext = '';
  58750. $this->match = '';
  58751. }
  58752. $rulesLen = count($this->rules);
  58753. for ($i=0; $i < $rulesLen; $i++) {
  58754. if (preg_match($this->rules[$i], $this->input, $match, 0, $this->offset)) {
  58755. $lines = explode("\n", $match[0]);
  58756. array_shift($lines);
  58757. $lineCount = \count($lines);
  58758. $this->yylineno += $lineCount;
  58759. $this->yylloc = array(
  58760. 'first_line' => $this->yylloc['last_line'],
  58761. 'last_line' => $this->yylineno+1,
  58762. 'first_column' => $this->yylloc['last_column'],
  58763. 'last_column' => $lineCount > 0 ? \strlen($lines[$lineCount - 1]) : $this->yylloc['last_column'] + \strlen($match[0]),
  58764. );
  58765. $this->yytext .= $match[0];
  58766. $this->match .= $match[0];
  58767. $this->yyleng = \strlen($this->yytext);
  58768. $this->more = false;
  58769. $this->offset += \strlen($match[0]);
  58770. return $this->performAction($i);
  58771. }
  58772. }
  58773. if ($this->offset === \strlen($this->input)) {
  58774. return self::EOF;
  58775. }
  58776. $this->parseError(
  58777. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition()
  58778. );
  58779. }
  58780. private function performAction($rule)
  58781. {
  58782. switch ($rule) {
  58783. case 0:
  58784. return self::T_BREAK_LINE;
  58785. case 1:
  58786. return self::T_SKIP_WHITESPACE;
  58787. case 2:
  58788. return 6;
  58789. case 3:
  58790. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  58791. return 4;
  58792. case 4:
  58793. return 17;
  58794. case 5:
  58795. return 18;
  58796. case 6:
  58797. return 23;
  58798. case 7:
  58799. return 24;
  58800. case 8:
  58801. return 22;
  58802. case 9:
  58803. return 21;
  58804. case 10:
  58805. return 10;
  58806. case 11:
  58807. return 11;
  58808. case 12:
  58809. return 8;
  58810. case 13:
  58811. return 14;
  58812. case 14:
  58813. return self::T_COMMENT;
  58814. case 15:
  58815. return self::T_OPEN_COMMENT;
  58816. case 16:
  58817. return self::T_CLOSE_COMMENT;
  58818. case 17:
  58819. return self::T_INVALID;
  58820. default:
  58821. throw new \LogicException('Unsupported rule '.$rule);
  58822. }
  58823. }
  58824. }
  58825. <?php
  58826. namespace Seld\JsonLint;
  58827. class ParsingException extends \Exception
  58828. {
  58829. protected $details;
  58830. public function __construct($message, $details = array())
  58831. {
  58832. $this->details = $details;
  58833. parent::__construct($message);
  58834. }
  58835. public function getDetails()
  58836. {
  58837. return $this->details;
  58838. }
  58839. }
  58840. <?php
  58841. namespace Seld\JsonLint;
  58842. class Undefined
  58843. {
  58844. }
  58845. Copyright (c) 2015 Jordi Boggiano
  58846. Permission is hereby granted, free of charge, to any person obtaining a copy
  58847. of this software and associated documentation files (the "Software"), to deal
  58848. in the Software without restriction, including without limitation the rights
  58849. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58850. copies of the Software, and to permit persons to whom the Software is furnished
  58851. to do so, subject to the following conditions:
  58852. The above copyright notice and this permission notice shall be included in all
  58853. copies or substantial portions of the Software.
  58854. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  58855. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  58856. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  58857. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  58858. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  58859. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58860. THE SOFTWARE.
  58861. <?php
  58862. namespace Seld\PharUtils;
  58863. class Linter
  58864. {
  58865. public static function lint($path, array $excludedPaths = array())
  58866. {
  58867. $php = defined('PHP_BINARY') ? PHP_BINARY : 'php';
  58868. if ($isWindows = defined('PHP_WINDOWS_VERSION_BUILD')) {
  58869. $tmpFile = @tempnam(sys_get_temp_dir(), '');
  58870. if (!$tmpFile || !is_writable($tmpFile)) {
  58871. throw new \RuntimeException('Unable to create temp file');
  58872. }
  58873. $php = self::escapeWindowsPath($php);
  58874. $tmpFile = self::escapeWindowsPath($tmpFile);
  58875. if (PHP_VERSION_ID >= 80000) {
  58876. $format = '%s -l %s';
  58877. } else {
  58878. $format = '"%s -l %s"';
  58879. }
  58880. $command = sprintf($format, $php, $tmpFile);
  58881. } else {
  58882. $command = "'".$php."' -l";
  58883. }
  58884. $descriptorspec = array(
  58885. 0 => array('pipe', 'r'),
  58886. 1 => array('pipe', 'w'),
  58887. 2 => array('pipe', 'w')
  58888. );
  58889. $baseLen = strlen(realpath($path)) + 7 + 1;
  58890. foreach (new \RecursiveIteratorIterator(new \Phar($path)) as $file) {
  58891. if ($file->isDir()) {
  58892. continue;
  58893. }
  58894. if (substr($file, -4) === '.php') {
  58895. $filename = (string) $file;
  58896. if (in_array(substr($filename, $baseLen), $excludedPaths, true)) {
  58897. continue;
  58898. }
  58899. if ($isWindows) {
  58900. file_put_contents($tmpFile, file_get_contents($filename));
  58901. }
  58902. $process = proc_open($command, $descriptorspec, $pipes);
  58903. if (is_resource($process)) {
  58904. if (!$isWindows) {
  58905. fwrite($pipes[0], file_get_contents($filename));
  58906. }
  58907. fclose($pipes[0]);
  58908. $stdout = stream_get_contents($pipes[1]);
  58909. fclose($pipes[1]);
  58910. $stderr = stream_get_contents($pipes[2]);
  58911. fclose($pipes[2]);
  58912. $exitCode = proc_close($process);
  58913. if ($exitCode !== 0) {
  58914. if ($isWindows) {
  58915. $stderr = str_replace($tmpFile, $filename, $stderr);
  58916. }
  58917. throw new \UnexpectedValueException('Failed linting '.$file.': '.$stderr);
  58918. }
  58919. } else {
  58920. throw new \RuntimeException('Could not start linter process');
  58921. }
  58922. }
  58923. }
  58924. if ($isWindows) {
  58925. @unlink($tmpFile);
  58926. }
  58927. }
  58928. private static function escapeWindowsPath($path)
  58929. {
  58930. if (strpbrk($path, " ()") !== false) {
  58931. $path = '"'.$path.'"';
  58932. }
  58933. return $path;
  58934. }
  58935. }
  58936. <?php
  58937. namespace Seld\PharUtils;
  58938. class Timestamps
  58939. {
  58940. private $contents;
  58941. public function __construct($file)
  58942. {
  58943. $this->contents = file_get_contents($file);
  58944. }
  58945. public function updateTimestamps($timestamp = null)
  58946. {
  58947. if ($timestamp instanceof \DateTime || $timestamp instanceof \DateTimeInterface) {
  58948. $timestamp = $timestamp->getTimestamp();
  58949. } elseif (is_string($timestamp)) {
  58950. $timestamp = strtotime($timestamp);
  58951. } elseif (!is_int($timestamp)) {
  58952. $timestamp = strtotime('1984-12-24T00:00:00Z');
  58953. }
  58954. if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
  58955. throw new \RuntimeException('Could not detect the stub\'s end in the phar');
  58956. }
  58957. $pos = $match[0][1] + strlen($match[0][0]);
  58958. $stubEnd = $pos + $this->readUint($pos, 4);
  58959. $pos += 4;
  58960. $numFiles = $this->readUint($pos, 4);
  58961. $pos += 4;
  58962. $pos += 2;
  58963. $pos += 4;
  58964. $aliasLength = $this->readUint($pos, 4);
  58965. $pos += 4 + $aliasLength;
  58966. $metadataLength = $this->readUint($pos, 4);
  58967. $pos += 4 + $metadataLength;
  58968. while ($pos < $stubEnd) {
  58969. $filenameLength = $this->readUint($pos, 4);
  58970. $pos += 4 + $filenameLength;
  58971. $pos += 4;
  58972. $timeStampBytes = pack('L', $timestamp);
  58973. $this->contents[$pos + 0] = $timeStampBytes[0];
  58974. $this->contents[$pos + 1] = $timeStampBytes[1];
  58975. $this->contents[$pos + 2] = $timeStampBytes[2];
  58976. $this->contents[$pos + 3] = $timeStampBytes[3];
  58977. $pos += 4*4;
  58978. $metadataLength = $this->readUint($pos, 4);
  58979. $pos += 4 + $metadataLength;
  58980. $numFiles--;
  58981. }
  58982. if ($numFiles !== 0) {
  58983. throw new \LogicException('All files were not processed, something must have gone wrong');
  58984. }
  58985. }
  58986. public function save($path, $signatureAlgo)
  58987. {
  58988. $pos = $this->determineSignatureBegin();
  58989. $algos = array(
  58990. \Phar::MD5 => 'md5',
  58991. \Phar::SHA1 => 'sha1',
  58992. \Phar::SHA256 => 'sha256',
  58993. \Phar::SHA512 => 'sha512',
  58994. );
  58995. if (!isset($algos[$signatureAlgo])) {
  58996. throw new \UnexpectedValueException('Invalid hash algorithm given: '.$signatureAlgo.' expected one of Phar::MD5, Phar::SHA1, Phar::SHA256 or Phar::SHA512');
  58997. }
  58998. $algo = $algos[$signatureAlgo];
  58999. $signature = hash($algo, substr($this->contents, 0, $pos), true)
  59000. . pack('L', $signatureAlgo)
  59001. . 'GBMB';
  59002. $this->contents = substr($this->contents, 0, $pos) . $signature;
  59003. return file_put_contents($path, $this->contents);
  59004. }
  59005. private function readUint($pos, $bytes)
  59006. {
  59007. $res = unpack('V', substr($this->contents, $pos, $bytes));
  59008. return $res[1];
  59009. }
  59010. private function determineSignatureBegin()
  59011. {
  59012. if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
  59013. throw new \RuntimeException('Could not detect the stub\'s end in the phar');
  59014. }
  59015. $pos = $match[0][1] + strlen($match[0][0]);
  59016. $manifestEnd = $pos + 4 + $this->readUint($pos, 4);
  59017. $pos += 4;
  59018. $numFiles = $this->readUint($pos, 4);
  59019. $pos += 4;
  59020. $pos += 2;
  59021. $pos += 4;
  59022. $aliasLength = $this->readUint($pos, 4);
  59023. $pos += 4 + $aliasLength;
  59024. $metadataLength = $this->readUint($pos, 4);
  59025. $pos += 4 + $metadataLength;
  59026. $compressedSizes = 0;
  59027. while (($numFiles > 0) && ($pos < $manifestEnd - 24)) {
  59028. $filenameLength = $this->readUint($pos, 4);
  59029. $pos += 4 + $filenameLength;
  59030. $pos += 2*4;
  59031. $compressedSizes += $this->readUint($pos, 4);
  59032. $pos += 3*4;
  59033. $metadataLength = $this->readUint($pos, 4);
  59034. $pos += 4 + $metadataLength;
  59035. $numFiles--;
  59036. }
  59037. if ($numFiles !== 0) {
  59038. throw new \LogicException('All files were not processed, something must have gone wrong');
  59039. }
  59040. return $manifestEnd + $compressedSizes;
  59041. }
  59042. }
  59043. Copyright (c) 2015 Jordi Boggiano
  59044. Permission is hereby granted, free of charge, to any person obtaining a copy
  59045. of this software and associated documentation files (the "Software"), to deal
  59046. in the Software without restriction, including without limitation the rights
  59047. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  59048. copies of the Software, and to permit persons to whom the Software is furnished
  59049. to do so, subject to the following conditions:
  59050. The above copyright notice and this permission notice shall be included in all
  59051. copies or substantial portions of the Software.
  59052. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  59053. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  59054. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  59055. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  59056. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  59057. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  59058. THE SOFTWARE.
  59059. <?php
  59060. namespace Seld\Signal;
  59061. use Psr\Log\LoggerInterface;
  59062. use Closure;
  59063. use WeakReference;
  59064. final class SignalHandler
  59065. {
  59066. public const SIGHUP = 'SIGHUP';
  59067. public const SIGINT = 'SIGINT';
  59068. public const SIGQUIT = 'SIGQUIT';
  59069. public const SIGILL = 'SIGILL';
  59070. public const SIGTRAP = 'SIGTRAP';
  59071. public const SIGABRT = 'SIGABRT';
  59072. public const SIGIOT = 'SIGIOT';
  59073. public const SIGBUS = 'SIGBUS';
  59074. public const SIGFPE = 'SIGFPE';
  59075. public const SIGKILL = 'SIGKILL';
  59076. public const SIGUSR1 = 'SIGUSR1';
  59077. public const SIGUSR2 = 'SIGUSR2';
  59078. public const SIGSEGV = 'SIGSEGV';
  59079. public const SIGPIPE = 'SIGPIPE';
  59080. public const SIGALRM = 'SIGALRM';
  59081. public const SIGTERM = 'SIGTERM';
  59082. public const SIGSTKFLT = 'SIGSTKFLT';
  59083. public const SIGCLD = 'SIGCLD';
  59084. public const SIGCHLD = 'SIGCHLD';
  59085. public const SIGCONT = 'SIGCONT';
  59086. public const SIGSTOP = 'SIGSTOP';
  59087. public const SIGTSTP = 'SIGTSTP';
  59088. public const SIGTTIN = 'SIGTTIN';
  59089. public const SIGTTOU = 'SIGTTOU';
  59090. public const SIGURG = 'SIGURG';
  59091. public const SIGXCPU = 'SIGXCPU';
  59092. public const SIGXFSZ = 'SIGXFSZ';
  59093. public const SIGVTALRM = 'SIGVTALRM';
  59094. public const SIGPROF = 'SIGPROF';
  59095. public const SIGWINCH = 'SIGWINCH';
  59096. public const SIGPOLL = 'SIGPOLL';
  59097. public const SIGIO = 'SIGIO';
  59098. public const SIGPWR = 'SIGPWR';
  59099. public const SIGSYS = 'SIGSYS';
  59100. public const SIGBABY = 'SIGBABY';
  59101. public const SIGBREAK = 'SIGBREAK';
  59102. private const ALL_SIGNALS = [
  59103. self::SIGHUP, self::SIGINT, self::SIGQUIT, self::SIGILL, self::SIGTRAP, self::SIGABRT, self::SIGIOT, self::SIGBUS,
  59104. self::SIGFPE, self::SIGKILL, self::SIGUSR1, self::SIGUSR2, self::SIGSEGV, self::SIGPIPE, self::SIGALRM, self::SIGTERM,
  59105. self::SIGSTKFLT, self::SIGCLD, self::SIGCHLD, self::SIGCONT, self::SIGSTOP, self::SIGTSTP, self::SIGTTIN, self::SIGTTOU,
  59106. self::SIGURG, self::SIGXCPU, self::SIGXFSZ, self::SIGVTALRM, self::SIGPROF, self::SIGWINCH, self::SIGPOLL, self::SIGIO,
  59107. self::SIGPWR, self::SIGSYS, self::SIGBABY, self::SIGBREAK
  59108. ];
  59109. private $triggered = null;
  59110. private $signals;
  59111. private $loggerOrCallback;
  59112. private static $handlers = [];
  59113. private static $windowsHandler = null;
  59114. private function __construct(array $signals, $loggerOrCallback)
  59115. {
  59116. if (!is_callable($loggerOrCallback) && !$loggerOrCallback instanceof LoggerInterface && $loggerOrCallback !== null) {
  59117. throw new \InvalidArgumentException('$loggerOrCallback must be a '.LoggerInterface::class.' instance, a callable, or null, '.(is_object($loggerOrCallback) ? get_class($loggerOrCallback) : gettype($loggerOrCallback)).' received.');
  59118. }
  59119. $this->signals = $signals;
  59120. $this->loggerOrCallback = $loggerOrCallback;
  59121. }
  59122. private function trigger(string $signalName): void
  59123. {
  59124. $this->triggered = $signalName;
  59125. if ($this->loggerOrCallback instanceof LoggerInterface) {
  59126. $this->loggerOrCallback->info('Received '.$signalName);
  59127. } elseif ($this->loggerOrCallback !== null) {
  59128. ($this->loggerOrCallback)($signalName, $this);
  59129. }
  59130. }
  59131. public function isTriggered(): bool
  59132. {
  59133. return $this->triggered !== null;
  59134. }
  59135. public function exitWithLastSignal(): void
  59136. {
  59137. $signal = $this->triggered ?? 'SIGINT';
  59138. $signal = defined($signal) ? constant($signal) : 2;
  59139. if (function_exists('posix_kill') && function_exists('posix_getpid')) {
  59140. pcntl_signal($signal, SIG_DFL);
  59141. posix_kill(posix_getpid(), $signal);
  59142. }
  59143. exit(128 + $signal);
  59144. }
  59145. public function reset(): void
  59146. {
  59147. $this->triggered = null;
  59148. }
  59149. public function __destruct()
  59150. {
  59151. $this->unregister();
  59152. }
  59153. public static function create(?array $signals = null, $loggerOrCallback = null): self
  59154. {
  59155. if ($signals === null) {
  59156. $signals = [self::SIGINT, self::SIGTERM];
  59157. }
  59158. $signals = array_map(function ($signal) {
  59159. if (is_int($signal)) {
  59160. return self::getSignalName($signal);
  59161. } elseif (!in_array($signal, self::ALL_SIGNALS, true)) {
  59162. throw new \InvalidArgumentException('$signals must be an array of SIG* constants or self::SIG* constants, got '.var_export($signal, true));
  59163. }
  59164. return $signal;
  59165. }, (array) $signals);
  59166. $handler = new self($signals, $loggerOrCallback);
  59167. if (PHP_VERSION_ID >= 80000) {
  59168. array_unshift(self::$handlers, WeakReference::create($handler));
  59169. } else {
  59170. array_unshift(self::$handlers, $handler);
  59171. }
  59172. if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli' && (in_array(self::SIGINT, $signals, true) || in_array(self::SIGBREAK, $signals, true))) {
  59173. if (null === self::$windowsHandler) {
  59174. self::$windowsHandler = Closure::fromCallable([self::class, 'handleWindowsSignal']);
  59175. sapi_windows_set_ctrl_handler(self::$windowsHandler);
  59176. }
  59177. }
  59178. if (function_exists('pcntl_signal') && function_exists('pcntl_async_signals')) {
  59179. pcntl_async_signals(true);
  59180. self::registerPcntlHandler($signals);
  59181. }
  59182. return $handler;
  59183. }
  59184. public function unregister(): void
  59185. {
  59186. $signals = $this->signals;
  59187. $index = false;
  59188. foreach (self::$handlers as $key => $handler) {
  59189. if (($handler instanceof WeakReference && $handler->get() === $this) || $handler === $this) {
  59190. $index = $key;
  59191. break;
  59192. }
  59193. }
  59194. if ($index === false) {
  59195. return;
  59196. }
  59197. unset(self::$handlers[$index]);
  59198. if (self::$windowsHandler !== null && (in_array(self::SIGINT, $signals, true) || in_array(self::SIGBREAK, $signals, true))) {
  59199. if (self::getHandlerFor(self::SIGINT) === null && self::getHandlerFor(self::SIGBREAK) === null) {
  59200. sapi_windows_set_ctrl_handler(self::$windowsHandler, false);
  59201. self::$windowsHandler = null;
  59202. }
  59203. }
  59204. if (function_exists('pcntl_signal')) {
  59205. foreach ($signals as $signal) {
  59206. if (!defined($signal)) {
  59207. continue;
  59208. }
  59209. if (self::getHandlerFor($signal) !== null) {
  59210. continue;
  59211. }
  59212. pcntl_signal(constant($signal), SIG_DFL);
  59213. }
  59214. }
  59215. }
  59216. public static function unregisterAll(): void
  59217. {
  59218. if (self::$windowsHandler !== null) {
  59219. sapi_windows_set_ctrl_handler(self::$windowsHandler, false);
  59220. self::$windowsHandler = null;
  59221. }
  59222. foreach (self::$handlers as $key => $handler) {
  59223. if ($handler instanceof WeakReference) {
  59224. $handler = $handler->get();
  59225. if ($handler === null) {
  59226. unset(self::$handlers[$key]);
  59227. continue;
  59228. }
  59229. }
  59230. $handler->unregister();
  59231. }
  59232. }
  59233. private static function registerPcntlHandler(array $signals): void
  59234. {
  59235. static $callable;
  59236. if ($callable === null) {
  59237. $callable = Closure::fromCallable([self::class, 'handlePcntlSignal']);
  59238. }
  59239. foreach ($signals as $signal) {
  59240. if (!defined($signal)) {
  59241. continue;
  59242. }
  59243. pcntl_signal(constant($signal), $callable);
  59244. }
  59245. }
  59246. private static function handleWindowsSignal(int $event): void
  59247. {
  59248. if (PHP_WINDOWS_EVENT_CTRL_C === $event) {
  59249. self::callHandlerFor(self::SIGINT);
  59250. } elseif (PHP_WINDOWS_EVENT_CTRL_BREAK === $event) {
  59251. self::callHandlerFor(self::SIGBREAK);
  59252. }
  59253. }
  59254. private static function handlePcntlSignal(int $signal): void
  59255. {
  59256. self::callHandlerFor(self::getSignalName($signal));
  59257. }
  59258. private static function callHandlerFor(string $signal): void
  59259. {
  59260. $handler = self::getHandlerFor($signal);
  59261. if ($handler !== null) {
  59262. $handler->trigger($signal);
  59263. }
  59264. }
  59265. private static function getHandlerFor(string $signal): ?self
  59266. {
  59267. foreach (self::$handlers as $key => $handler) {
  59268. if ($handler instanceof WeakReference) {
  59269. $handler = $handler->get();
  59270. if ($handler === null) {
  59271. unset(self::$handlers[$key]);
  59272. continue;
  59273. }
  59274. }
  59275. if (in_array($signal, $handler->signals, true)) {
  59276. return $handler;
  59277. }
  59278. }
  59279. return null;
  59280. }
  59281. private static function getSignalName(int $signo): string
  59282. {
  59283. static $signals = null;
  59284. if ($signals === null) {
  59285. $signals = [];
  59286. foreach (self::ALL_SIGNALS as $value) {
  59287. if (defined($value)) {
  59288. $signals[constant($value)] = $value;
  59289. }
  59290. }
  59291. }
  59292. if (isset($signals[$signo])) {
  59293. return $signals[$signo];
  59294. }
  59295. throw new \InvalidArgumentException('Unknown signal #'.$signo);
  59296. }
  59297. }
  59298. <?php
  59299. namespace Symfony\Component\Console;
  59300. use Symfony\Component\Console\Command\Command;
  59301. use Symfony\Component\Console\Command\CompleteCommand;
  59302. use Symfony\Component\Console\Command\DumpCompletionCommand;
  59303. use Symfony\Component\Console\Command\HelpCommand;
  59304. use Symfony\Component\Console\Command\LazyCommand;
  59305. use Symfony\Component\Console\Command\ListCommand;
  59306. use Symfony\Component\Console\Command\SignalableCommandInterface;
  59307. use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
  59308. use Symfony\Component\Console\Completion\CompletionInput;
  59309. use Symfony\Component\Console\Completion\CompletionSuggestions;
  59310. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  59311. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  59312. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  59313. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  59314. use Symfony\Component\Console\Exception\CommandNotFoundException;
  59315. use Symfony\Component\Console\Exception\ExceptionInterface;
  59316. use Symfony\Component\Console\Exception\LogicException;
  59317. use Symfony\Component\Console\Exception\NamespaceNotFoundException;
  59318. use Symfony\Component\Console\Exception\RuntimeException;
  59319. use Symfony\Component\Console\Formatter\OutputFormatter;
  59320. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  59321. use Symfony\Component\Console\Helper\FormatterHelper;
  59322. use Symfony\Component\Console\Helper\Helper;
  59323. use Symfony\Component\Console\Helper\HelperSet;
  59324. use Symfony\Component\Console\Helper\ProcessHelper;
  59325. use Symfony\Component\Console\Helper\QuestionHelper;
  59326. use Symfony\Component\Console\Input\ArgvInput;
  59327. use Symfony\Component\Console\Input\ArrayInput;
  59328. use Symfony\Component\Console\Input\InputArgument;
  59329. use Symfony\Component\Console\Input\InputAwareInterface;
  59330. use Symfony\Component\Console\Input\InputDefinition;
  59331. use Symfony\Component\Console\Input\InputInterface;
  59332. use Symfony\Component\Console\Input\InputOption;
  59333. use Symfony\Component\Console\Output\ConsoleOutput;
  59334. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  59335. use Symfony\Component\Console\Output\OutputInterface;
  59336. use Symfony\Component\Console\SignalRegistry\SignalRegistry;
  59337. use Symfony\Component\Console\Style\SymfonyStyle;
  59338. use Symfony\Component\ErrorHandler\ErrorHandler;
  59339. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  59340. use Symfony\Contracts\Service\ResetInterface;
  59341. class Application implements ResetInterface
  59342. {
  59343. private $commands = [];
  59344. private $wantHelps = false;
  59345. private $runningCommand;
  59346. private $name;
  59347. private $version;
  59348. private $commandLoader;
  59349. private $catchExceptions = true;
  59350. private $autoExit = true;
  59351. private $definition;
  59352. private $helperSet;
  59353. private $dispatcher;
  59354. private $terminal;
  59355. private $defaultCommand;
  59356. private $singleCommand = false;
  59357. private $initialized;
  59358. private $signalRegistry;
  59359. private $signalsToDispatchEvent = [];
  59360. public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
  59361. {
  59362. $this->name = $name;
  59363. $this->version = $version;
  59364. $this->terminal = new Terminal();
  59365. $this->defaultCommand = 'list';
  59366. if (\defined('SIGINT') && SignalRegistry::isSupported()) {
  59367. $this->signalRegistry = new SignalRegistry();
  59368. $this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
  59369. }
  59370. }
  59371. public function setDispatcher(EventDispatcherInterface $dispatcher)
  59372. {
  59373. $this->dispatcher = $dispatcher;
  59374. }
  59375. public function setCommandLoader(CommandLoaderInterface $commandLoader)
  59376. {
  59377. $this->commandLoader = $commandLoader;
  59378. }
  59379. public function getSignalRegistry(): SignalRegistry
  59380. {
  59381. if (!$this->signalRegistry) {
  59382. throw new RuntimeException('Signals are not supported. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
  59383. }
  59384. return $this->signalRegistry;
  59385. }
  59386. public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
  59387. {
  59388. $this->signalsToDispatchEvent = $signalsToDispatchEvent;
  59389. }
  59390. public function run(?InputInterface $input = null, ?OutputInterface $output = null)
  59391. {
  59392. if (\function_exists('putenv')) {
  59393. @putenv('LINES='.$this->terminal->getHeight());
  59394. @putenv('COLUMNS='.$this->terminal->getWidth());
  59395. }
  59396. if (null === $input) {
  59397. $input = new ArgvInput();
  59398. }
  59399. if (null === $output) {
  59400. $output = new ConsoleOutput();
  59401. }
  59402. $renderException = function (\Throwable $e) use ($output) {
  59403. if ($output instanceof ConsoleOutputInterface) {
  59404. $this->renderThrowable($e, $output->getErrorOutput());
  59405. } else {
  59406. $this->renderThrowable($e, $output);
  59407. }
  59408. };
  59409. if ($phpHandler = set_exception_handler($renderException)) {
  59410. restore_exception_handler();
  59411. if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
  59412. $errorHandler = true;
  59413. } elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
  59414. $phpHandler[0]->setExceptionHandler($errorHandler);
  59415. }
  59416. }
  59417. $this->configureIO($input, $output);
  59418. try {
  59419. $exitCode = $this->doRun($input, $output);
  59420. } catch (\Exception $e) {
  59421. if (!$this->catchExceptions) {
  59422. throw $e;
  59423. }
  59424. $renderException($e);
  59425. $exitCode = $e->getCode();
  59426. if (is_numeric($exitCode)) {
  59427. $exitCode = (int) $exitCode;
  59428. if ($exitCode <= 0) {
  59429. $exitCode = 1;
  59430. }
  59431. } else {
  59432. $exitCode = 1;
  59433. }
  59434. } finally {
  59435. if (!$phpHandler) {
  59436. if (set_exception_handler($renderException) === $renderException) {
  59437. restore_exception_handler();
  59438. }
  59439. restore_exception_handler();
  59440. } elseif (!$errorHandler) {
  59441. $finalHandler = $phpHandler[0]->setExceptionHandler(null);
  59442. if ($finalHandler !== $renderException) {
  59443. $phpHandler[0]->setExceptionHandler($finalHandler);
  59444. }
  59445. }
  59446. }
  59447. if ($this->autoExit) {
  59448. if ($exitCode > 255) {
  59449. $exitCode = 255;
  59450. }
  59451. exit($exitCode);
  59452. }
  59453. return $exitCode;
  59454. }
  59455. public function doRun(InputInterface $input, OutputInterface $output)
  59456. {
  59457. if (true === $input->hasParameterOption(['--version', '-V'], true)) {
  59458. $output->writeln($this->getLongVersion());
  59459. return 0;
  59460. }
  59461. try {
  59462. $input->bind($this->getDefinition());
  59463. } catch (ExceptionInterface $e) {
  59464. }
  59465. $name = $this->getCommandName($input);
  59466. if (true === $input->hasParameterOption(['--help', '-h'], true)) {
  59467. if (!$name) {
  59468. $name = 'help';
  59469. $input = new ArrayInput(['command_name' => $this->defaultCommand]);
  59470. } else {
  59471. $this->wantHelps = true;
  59472. }
  59473. }
  59474. if (!$name) {
  59475. $name = $this->defaultCommand;
  59476. $definition = $this->getDefinition();
  59477. $definition->setArguments(array_merge(
  59478. $definition->getArguments(),
  59479. [
  59480. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  59481. ]
  59482. ));
  59483. }
  59484. try {
  59485. $this->runningCommand = null;
  59486. $command = $this->find($name);
  59487. } catch (\Throwable $e) {
  59488. if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
  59489. if (null !== $this->dispatcher) {
  59490. $event = new ConsoleErrorEvent($input, $output, $e);
  59491. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  59492. if (0 === $event->getExitCode()) {
  59493. return 0;
  59494. }
  59495. $e = $event->getError();
  59496. }
  59497. throw $e;
  59498. }
  59499. $alternative = $alternatives[0];
  59500. $style = new SymfonyStyle($input, $output);
  59501. $output->writeln('');
  59502. $formattedBlock = (new FormatterHelper())->formatBlock(sprintf('Command "%s" is not defined.', $name), 'error', true);
  59503. $output->writeln($formattedBlock);
  59504. if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
  59505. if (null !== $this->dispatcher) {
  59506. $event = new ConsoleErrorEvent($input, $output, $e);
  59507. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  59508. return $event->getExitCode();
  59509. }
  59510. return 1;
  59511. }
  59512. $command = $this->find($alternative);
  59513. }
  59514. if ($command instanceof LazyCommand) {
  59515. $command = $command->getCommand();
  59516. }
  59517. $this->runningCommand = $command;
  59518. $exitCode = $this->doRunCommand($command, $input, $output);
  59519. $this->runningCommand = null;
  59520. return $exitCode;
  59521. }
  59522. public function reset()
  59523. {
  59524. }
  59525. public function setHelperSet(HelperSet $helperSet)
  59526. {
  59527. $this->helperSet = $helperSet;
  59528. }
  59529. public function getHelperSet()
  59530. {
  59531. if (!$this->helperSet) {
  59532. $this->helperSet = $this->getDefaultHelperSet();
  59533. }
  59534. return $this->helperSet;
  59535. }
  59536. public function setDefinition(InputDefinition $definition)
  59537. {
  59538. $this->definition = $definition;
  59539. }
  59540. public function getDefinition()
  59541. {
  59542. if (!$this->definition) {
  59543. $this->definition = $this->getDefaultInputDefinition();
  59544. }
  59545. if ($this->singleCommand) {
  59546. $inputDefinition = $this->definition;
  59547. $inputDefinition->setArguments();
  59548. return $inputDefinition;
  59549. }
  59550. return $this->definition;
  59551. }
  59552. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  59553. {
  59554. if (
  59555. CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
  59556. && 'command' === $input->getCompletionName()
  59557. ) {
  59558. $commandNames = [];
  59559. foreach ($this->all() as $name => $command) {
  59560. if ($command->isHidden() || $command->getName() !== $name) {
  59561. continue;
  59562. }
  59563. $commandNames[] = $command->getName();
  59564. foreach ($command->getAliases() as $name) {
  59565. $commandNames[] = $name;
  59566. }
  59567. }
  59568. $suggestions->suggestValues(array_filter($commandNames));
  59569. return;
  59570. }
  59571. if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) {
  59572. $suggestions->suggestOptions($this->getDefinition()->getOptions());
  59573. return;
  59574. }
  59575. }
  59576. public function getHelp()
  59577. {
  59578. return $this->getLongVersion();
  59579. }
  59580. public function areExceptionsCaught()
  59581. {
  59582. return $this->catchExceptions;
  59583. }
  59584. public function setCatchExceptions(bool $boolean)
  59585. {
  59586. $this->catchExceptions = $boolean;
  59587. }
  59588. public function isAutoExitEnabled()
  59589. {
  59590. return $this->autoExit;
  59591. }
  59592. public function setAutoExit(bool $boolean)
  59593. {
  59594. $this->autoExit = $boolean;
  59595. }
  59596. public function getName()
  59597. {
  59598. return $this->name;
  59599. }
  59600. public function setName(string $name)
  59601. {
  59602. $this->name = $name;
  59603. }
  59604. public function getVersion()
  59605. {
  59606. return $this->version;
  59607. }
  59608. public function setVersion(string $version)
  59609. {
  59610. $this->version = $version;
  59611. }
  59612. public function getLongVersion()
  59613. {
  59614. if ('UNKNOWN' !== $this->getName()) {
  59615. if ('UNKNOWN' !== $this->getVersion()) {
  59616. return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
  59617. }
  59618. return $this->getName();
  59619. }
  59620. return 'Console Tool';
  59621. }
  59622. public function register(string $name)
  59623. {
  59624. return $this->add(new Command($name));
  59625. }
  59626. public function addCommands(array $commands)
  59627. {
  59628. foreach ($commands as $command) {
  59629. $this->add($command);
  59630. }
  59631. }
  59632. public function add(Command $command)
  59633. {
  59634. $this->init();
  59635. $command->setApplication($this);
  59636. if (!$command->isEnabled()) {
  59637. $command->setApplication(null);
  59638. return null;
  59639. }
  59640. if (!$command instanceof LazyCommand) {
  59641. $command->getDefinition();
  59642. }
  59643. if (!$command->getName()) {
  59644. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
  59645. }
  59646. $this->commands[$command->getName()] = $command;
  59647. foreach ($command->getAliases() as $alias) {
  59648. $this->commands[$alias] = $command;
  59649. }
  59650. return $command;
  59651. }
  59652. public function get(string $name)
  59653. {
  59654. $this->init();
  59655. if (!$this->has($name)) {
  59656. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  59657. }
  59658. if (!isset($this->commands[$name])) {
  59659. throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
  59660. }
  59661. $command = $this->commands[$name];
  59662. if ($this->wantHelps) {
  59663. $this->wantHelps = false;
  59664. $helpCommand = $this->get('help');
  59665. $helpCommand->setCommand($command);
  59666. return $helpCommand;
  59667. }
  59668. return $command;
  59669. }
  59670. public function has(string $name)
  59671. {
  59672. $this->init();
  59673. return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
  59674. }
  59675. public function getNamespaces()
  59676. {
  59677. $namespaces = [];
  59678. foreach ($this->all() as $command) {
  59679. if ($command->isHidden()) {
  59680. continue;
  59681. }
  59682. $namespaces[] = $this->extractAllNamespaces($command->getName());
  59683. foreach ($command->getAliases() as $alias) {
  59684. $namespaces[] = $this->extractAllNamespaces($alias);
  59685. }
  59686. }
  59687. return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
  59688. }
  59689. public function findNamespace(string $namespace)
  59690. {
  59691. $allNamespaces = $this->getNamespaces();
  59692. $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*';
  59693. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  59694. if (empty($namespaces)) {
  59695. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  59696. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  59697. if (1 == \count($alternatives)) {
  59698. $message .= "\n\nDid you mean this?\n ";
  59699. } else {
  59700. $message .= "\n\nDid you mean one of these?\n ";
  59701. }
  59702. $message .= implode("\n ", $alternatives);
  59703. }
  59704. throw new NamespaceNotFoundException($message, $alternatives);
  59705. }
  59706. $exact = \in_array($namespace, $namespaces, true);
  59707. if (\count($namespaces) > 1 && !$exact) {
  59708. throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  59709. }
  59710. return $exact ? $namespace : reset($namespaces);
  59711. }
  59712. public function find(string $name)
  59713. {
  59714. $this->init();
  59715. $aliases = [];
  59716. foreach ($this->commands as $command) {
  59717. foreach ($command->getAliases() as $alias) {
  59718. if (!$this->has($alias)) {
  59719. $this->commands[$alias] = $command;
  59720. }
  59721. }
  59722. }
  59723. if ($this->has($name)) {
  59724. return $this->get($name);
  59725. }
  59726. $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
  59727. $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*';
  59728. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  59729. if (empty($commands)) {
  59730. $commands = preg_grep('{^'.$expr.'}i', $allCommands);
  59731. }
  59732. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) {
  59733. if (false !== $pos = strrpos($name, ':')) {
  59734. $this->findNamespace(substr($name, 0, $pos));
  59735. }
  59736. $message = sprintf('Command "%s" is not defined.', $name);
  59737. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  59738. $alternatives = array_filter($alternatives, function ($name) {
  59739. return !$this->get($name)->isHidden();
  59740. });
  59741. if (1 == \count($alternatives)) {
  59742. $message .= "\n\nDid you mean this?\n ";
  59743. } else {
  59744. $message .= "\n\nDid you mean one of these?\n ";
  59745. }
  59746. $message .= implode("\n ", $alternatives);
  59747. }
  59748. throw new CommandNotFoundException($message, array_values($alternatives));
  59749. }
  59750. if (\count($commands) > 1) {
  59751. $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
  59752. $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
  59753. if (!$commandList[$nameOrAlias] instanceof Command) {
  59754. $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
  59755. }
  59756. $commandName = $commandList[$nameOrAlias]->getName();
  59757. $aliases[$nameOrAlias] = $commandName;
  59758. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  59759. }));
  59760. }
  59761. if (\count($commands) > 1) {
  59762. $usableWidth = $this->terminal->getWidth() - 10;
  59763. $abbrevs = array_values($commands);
  59764. $maxLen = 0;
  59765. foreach ($abbrevs as $abbrev) {
  59766. $maxLen = max(Helper::width($abbrev), $maxLen);
  59767. }
  59768. $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
  59769. if ($commandList[$cmd]->isHidden()) {
  59770. unset($commands[array_search($cmd, $commands)]);
  59771. return false;
  59772. }
  59773. $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();
  59774. return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
  59775. }, array_values($commands));
  59776. if (\count($commands) > 1) {
  59777. $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
  59778. throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
  59779. }
  59780. }
  59781. $command = $this->get(reset($commands));
  59782. if ($command->isHidden()) {
  59783. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  59784. }
  59785. return $command;
  59786. }
  59787. public function all(?string $namespace = null)
  59788. {
  59789. $this->init();
  59790. if (null === $namespace) {
  59791. if (!$this->commandLoader) {
  59792. return $this->commands;
  59793. }
  59794. $commands = $this->commands;
  59795. foreach ($this->commandLoader->getNames() as $name) {
  59796. if (!isset($commands[$name]) && $this->has($name)) {
  59797. $commands[$name] = $this->get($name);
  59798. }
  59799. }
  59800. return $commands;
  59801. }
  59802. $commands = [];
  59803. foreach ($this->commands as $name => $command) {
  59804. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  59805. $commands[$name] = $command;
  59806. }
  59807. }
  59808. if ($this->commandLoader) {
  59809. foreach ($this->commandLoader->getNames() as $name) {
  59810. if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
  59811. $commands[$name] = $this->get($name);
  59812. }
  59813. }
  59814. }
  59815. return $commands;
  59816. }
  59817. public static function getAbbreviations(array $names)
  59818. {
  59819. $abbrevs = [];
  59820. foreach ($names as $name) {
  59821. for ($len = \strlen($name); $len > 0; --$len) {
  59822. $abbrev = substr($name, 0, $len);
  59823. $abbrevs[$abbrev][] = $name;
  59824. }
  59825. }
  59826. return $abbrevs;
  59827. }
  59828. public function renderThrowable(\Throwable $e, OutputInterface $output): void
  59829. {
  59830. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  59831. $this->doRenderThrowable($e, $output);
  59832. if (null !== $this->runningCommand) {
  59833. $output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
  59834. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  59835. }
  59836. }
  59837. protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
  59838. {
  59839. do {
  59840. $message = trim($e->getMessage());
  59841. if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  59842. $class = get_debug_type($e);
  59843. $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
  59844. $len = Helper::width($title);
  59845. } else {
  59846. $len = 0;
  59847. }
  59848. if (str_contains($message, "@anonymous\0")) {
  59849. $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
  59850. return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
  59851. }, $message);
  59852. }
  59853. $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
  59854. $lines = [];
  59855. foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
  59856. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  59857. $lineLength = Helper::width($line) + 4;
  59858. $lines[] = [$line, $lineLength];
  59859. $len = max($lineLength, $len);
  59860. }
  59861. }
  59862. $messages = [];
  59863. if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  59864. $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
  59865. }
  59866. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  59867. if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  59868. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::width($title))));
  59869. }
  59870. foreach ($lines as $line) {
  59871. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  59872. }
  59873. $messages[] = $emptyLine;
  59874. $messages[] = '';
  59875. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  59876. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  59877. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  59878. $trace = $e->getTrace();
  59879. array_unshift($trace, [
  59880. 'function' => '',
  59881. 'file' => $e->getFile() ?: 'n/a',
  59882. 'line' => $e->getLine() ?: 'n/a',
  59883. 'args' => [],
  59884. ]);
  59885. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  59886. $class = $trace[$i]['class'] ?? '';
  59887. $type = $trace[$i]['type'] ?? '';
  59888. $function = $trace[$i]['function'] ?? '';
  59889. $file = $trace[$i]['file'] ?? 'n/a';
  59890. $line = $trace[$i]['line'] ?? 'n/a';
  59891. $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
  59892. }
  59893. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  59894. }
  59895. } while ($e = $e->getPrevious());
  59896. }
  59897. protected function configureIO(InputInterface $input, OutputInterface $output)
  59898. {
  59899. if (true === $input->hasParameterOption(['--ansi'], true)) {
  59900. $output->setDecorated(true);
  59901. } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
  59902. $output->setDecorated(false);
  59903. }
  59904. if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
  59905. $input->setInteractive(false);
  59906. }
  59907. switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
  59908. case -1:
  59909. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  59910. break;
  59911. case 1:
  59912. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  59913. break;
  59914. case 2:
  59915. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  59916. break;
  59917. case 3:
  59918. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  59919. break;
  59920. default:
  59921. $shellVerbosity = 0;
  59922. break;
  59923. }
  59924. if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
  59925. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  59926. $shellVerbosity = -1;
  59927. } else {
  59928. if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
  59929. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  59930. $shellVerbosity = 3;
  59931. } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
  59932. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  59933. $shellVerbosity = 2;
  59934. } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
  59935. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  59936. $shellVerbosity = 1;
  59937. }
  59938. }
  59939. if (-1 === $shellVerbosity) {
  59940. $input->setInteractive(false);
  59941. }
  59942. if (\function_exists('putenv')) {
  59943. @putenv('SHELL_VERBOSITY='.$shellVerbosity);
  59944. }
  59945. $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
  59946. $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
  59947. }
  59948. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  59949. {
  59950. foreach ($command->getHelperSet() as $helper) {
  59951. if ($helper instanceof InputAwareInterface) {
  59952. $helper->setInput($input);
  59953. }
  59954. }
  59955. if ($this->signalsToDispatchEvent) {
  59956. $commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : [];
  59957. if ($commandSignals || null !== $this->dispatcher) {
  59958. if (!$this->signalRegistry) {
  59959. throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
  59960. }
  59961. if (Terminal::hasSttyAvailable()) {
  59962. $sttyMode = shell_exec('stty -g');
  59963. foreach ([\SIGINT, \SIGTERM] as $signal) {
  59964. $this->signalRegistry->register($signal, static function () use ($sttyMode) {
  59965. shell_exec('stty '.$sttyMode);
  59966. });
  59967. }
  59968. }
  59969. }
  59970. if (null !== $this->dispatcher) {
  59971. foreach ($this->signalsToDispatchEvent as $signal) {
  59972. $event = new ConsoleSignalEvent($command, $input, $output, $signal);
  59973. $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) {
  59974. $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
  59975. if (!$hasNext) {
  59976. if (!\in_array($signal, [\SIGUSR1, \SIGUSR2], true)) {
  59977. exit(0);
  59978. }
  59979. }
  59980. });
  59981. }
  59982. }
  59983. foreach ($commandSignals as $signal) {
  59984. $this->signalRegistry->register($signal, [$command, 'handleSignal']);
  59985. }
  59986. }
  59987. if (null === $this->dispatcher) {
  59988. return $command->run($input, $output);
  59989. }
  59990. try {
  59991. $command->mergeApplicationDefinition();
  59992. $input->bind($command->getDefinition());
  59993. } catch (ExceptionInterface $e) {
  59994. }
  59995. $event = new ConsoleCommandEvent($command, $input, $output);
  59996. $e = null;
  59997. try {
  59998. $this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);
  59999. if ($event->commandShouldRun()) {
  60000. $exitCode = $command->run($input, $output);
  60001. } else {
  60002. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  60003. }
  60004. } catch (\Throwable $e) {
  60005. $event = new ConsoleErrorEvent($input, $output, $e, $command);
  60006. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  60007. $e = $event->getError();
  60008. if (0 === $exitCode = $event->getExitCode()) {
  60009. $e = null;
  60010. }
  60011. }
  60012. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  60013. $this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
  60014. if (null !== $e) {
  60015. throw $e;
  60016. }
  60017. return $event->getExitCode();
  60018. }
  60019. protected function getCommandName(InputInterface $input)
  60020. {
  60021. return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument();
  60022. }
  60023. protected function getDefaultInputDefinition()
  60024. {
  60025. return new InputDefinition([
  60026. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  60027. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>'.$this->defaultCommand.'</info> command'),
  60028. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  60029. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  60030. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  60031. new InputOption('--ansi', '', InputOption::VALUE_NEGATABLE, 'Force (or disable --no-ansi) ANSI output', null),
  60032. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  60033. ]);
  60034. }
  60035. protected function getDefaultCommands()
  60036. {
  60037. return [new HelpCommand(), new ListCommand(), new CompleteCommand(), new DumpCompletionCommand()];
  60038. }
  60039. protected function getDefaultHelperSet()
  60040. {
  60041. return new HelperSet([
  60042. new FormatterHelper(),
  60043. new DebugFormatterHelper(),
  60044. new ProcessHelper(),
  60045. new QuestionHelper(),
  60046. ]);
  60047. }
  60048. private function getAbbreviationSuggestions(array $abbrevs): string
  60049. {
  60050. return ' '.implode("\n ", $abbrevs);
  60051. }
  60052. public function extractNamespace(string $name, ?int $limit = null)
  60053. {
  60054. $parts = explode(':', $name, -1);
  60055. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  60056. }
  60057. private function findAlternatives(string $name, iterable $collection): array
  60058. {
  60059. $threshold = 1e3;
  60060. $alternatives = [];
  60061. $collectionParts = [];
  60062. foreach ($collection as $item) {
  60063. $collectionParts[$item] = explode(':', $item);
  60064. }
  60065. foreach (explode(':', $name) as $i => $subname) {
  60066. foreach ($collectionParts as $collectionName => $parts) {
  60067. $exists = isset($alternatives[$collectionName]);
  60068. if (!isset($parts[$i]) && $exists) {
  60069. $alternatives[$collectionName] += $threshold;
  60070. continue;
  60071. } elseif (!isset($parts[$i])) {
  60072. continue;
  60073. }
  60074. $lev = levenshtein($subname, $parts[$i]);
  60075. if ($lev <= \strlen($subname) / 3 || '' !== $subname && str_contains($parts[$i], $subname)) {
  60076. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  60077. } elseif ($exists) {
  60078. $alternatives[$collectionName] += $threshold;
  60079. }
  60080. }
  60081. }
  60082. foreach ($collection as $item) {
  60083. $lev = levenshtein($name, $item);
  60084. if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
  60085. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  60086. }
  60087. }
  60088. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  60089. ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
  60090. return array_keys($alternatives);
  60091. }
  60092. public function setDefaultCommand(string $commandName, bool $isSingleCommand = false)
  60093. {
  60094. $this->defaultCommand = explode('|', ltrim($commandName, '|'))[0];
  60095. if ($isSingleCommand) {
  60096. $this->find($commandName);
  60097. $this->singleCommand = true;
  60098. }
  60099. return $this;
  60100. }
  60101. public function isSingleCommand(): bool
  60102. {
  60103. return $this->singleCommand;
  60104. }
  60105. private function splitStringByWidth(string $string, int $width): array
  60106. {
  60107. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  60108. return str_split($string, $width);
  60109. }
  60110. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  60111. $lines = [];
  60112. $line = '';
  60113. $offset = 0;
  60114. while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
  60115. $offset += \strlen($m[0]);
  60116. foreach (preg_split('//u', $m[0]) as $char) {
  60117. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  60118. $line .= $char;
  60119. continue;
  60120. }
  60121. $lines[] = str_pad($line, $width);
  60122. $line = $char;
  60123. }
  60124. }
  60125. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  60126. mb_convert_variables($encoding, 'utf8', $lines);
  60127. return $lines;
  60128. }
  60129. private function extractAllNamespaces(string $name): array
  60130. {
  60131. $parts = explode(':', $name, -1);
  60132. $namespaces = [];
  60133. foreach ($parts as $part) {
  60134. if (\count($namespaces)) {
  60135. $namespaces[] = end($namespaces).':'.$part;
  60136. } else {
  60137. $namespaces[] = $part;
  60138. }
  60139. }
  60140. return $namespaces;
  60141. }
  60142. private function init()
  60143. {
  60144. if ($this->initialized) {
  60145. return;
  60146. }
  60147. $this->initialized = true;
  60148. foreach ($this->getDefaultCommands() as $command) {
  60149. $this->add($command);
  60150. }
  60151. }
  60152. }
  60153. <?php
  60154. namespace Symfony\Component\Console\Attribute;
  60155. #[\Attribute(\Attribute::TARGET_CLASS)]
  60156. class AsCommand
  60157. {
  60158. public function __construct(
  60159. public string $name,
  60160. public ?string $description = null,
  60161. array $aliases = [],
  60162. bool $hidden = false,
  60163. ) {
  60164. if (!$hidden && !$aliases) {
  60165. return;
  60166. }
  60167. $name = explode('|', $name);
  60168. $name = array_merge($name, $aliases);
  60169. if ($hidden && '' !== $name[0]) {
  60170. array_unshift($name, '');
  60171. }
  60172. $this->name = implode('|', $name);
  60173. }
  60174. }
  60175. <?php
  60176. namespace Symfony\Component\Console\CI;
  60177. use Symfony\Component\Console\Output\OutputInterface;
  60178. class GithubActionReporter
  60179. {
  60180. private $output;
  60181. private const ESCAPED_DATA = [
  60182. '%' => '%25',
  60183. "\r" => '%0D',
  60184. "\n" => '%0A',
  60185. ];
  60186. private const ESCAPED_PROPERTIES = [
  60187. '%' => '%25',
  60188. "\r" => '%0D',
  60189. "\n" => '%0A',
  60190. ':' => '%3A',
  60191. ',' => '%2C',
  60192. ];
  60193. public function __construct(OutputInterface $output)
  60194. {
  60195. $this->output = $output;
  60196. }
  60197. public static function isGithubActionEnvironment(): bool
  60198. {
  60199. return false !== getenv('GITHUB_ACTIONS');
  60200. }
  60201. public function error(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  60202. {
  60203. $this->log('error', $message, $file, $line, $col);
  60204. }
  60205. public function warning(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  60206. {
  60207. $this->log('warning', $message, $file, $line, $col);
  60208. }
  60209. public function debug(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  60210. {
  60211. $this->log('debug', $message, $file, $line, $col);
  60212. }
  60213. private function log(string $type, string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  60214. {
  60215. $message = strtr($message, self::ESCAPED_DATA);
  60216. if (!$file) {
  60217. $this->output->writeln(sprintf('::%s::%s', $type, $message));
  60218. return;
  60219. }
  60220. $this->output->writeln(sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message));
  60221. }
  60222. }
  60223. <?php
  60224. namespace Symfony\Component\Console;
  60225. use Symfony\Component\Console\Exception\InvalidArgumentException;
  60226. final class Color
  60227. {
  60228. private const COLORS = [
  60229. 'black' => 0,
  60230. 'red' => 1,
  60231. 'green' => 2,
  60232. 'yellow' => 3,
  60233. 'blue' => 4,
  60234. 'magenta' => 5,
  60235. 'cyan' => 6,
  60236. 'white' => 7,
  60237. 'default' => 9,
  60238. ];
  60239. private const BRIGHT_COLORS = [
  60240. 'gray' => 0,
  60241. 'bright-red' => 1,
  60242. 'bright-green' => 2,
  60243. 'bright-yellow' => 3,
  60244. 'bright-blue' => 4,
  60245. 'bright-magenta' => 5,
  60246. 'bright-cyan' => 6,
  60247. 'bright-white' => 7,
  60248. ];
  60249. private const AVAILABLE_OPTIONS = [
  60250. 'bold' => ['set' => 1, 'unset' => 22],
  60251. 'underscore' => ['set' => 4, 'unset' => 24],
  60252. 'blink' => ['set' => 5, 'unset' => 25],
  60253. 'reverse' => ['set' => 7, 'unset' => 27],
  60254. 'conceal' => ['set' => 8, 'unset' => 28],
  60255. ];
  60256. private $foreground;
  60257. private $background;
  60258. private $options = [];
  60259. public function __construct(string $foreground = '', string $background = '', array $options = [])
  60260. {
  60261. $this->foreground = $this->parseColor($foreground);
  60262. $this->background = $this->parseColor($background, true);
  60263. foreach ($options as $option) {
  60264. if (!isset(self::AVAILABLE_OPTIONS[$option])) {
  60265. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(self::AVAILABLE_OPTIONS))));
  60266. }
  60267. $this->options[$option] = self::AVAILABLE_OPTIONS[$option];
  60268. }
  60269. }
  60270. public function apply(string $text): string
  60271. {
  60272. return $this->set().$text.$this->unset();
  60273. }
  60274. public function set(): string
  60275. {
  60276. $setCodes = [];
  60277. if ('' !== $this->foreground) {
  60278. $setCodes[] = $this->foreground;
  60279. }
  60280. if ('' !== $this->background) {
  60281. $setCodes[] = $this->background;
  60282. }
  60283. foreach ($this->options as $option) {
  60284. $setCodes[] = $option['set'];
  60285. }
  60286. if (0 === \count($setCodes)) {
  60287. return '';
  60288. }
  60289. return sprintf("\033[%sm", implode(';', $setCodes));
  60290. }
  60291. public function unset(): string
  60292. {
  60293. $unsetCodes = [];
  60294. if ('' !== $this->foreground) {
  60295. $unsetCodes[] = 39;
  60296. }
  60297. if ('' !== $this->background) {
  60298. $unsetCodes[] = 49;
  60299. }
  60300. foreach ($this->options as $option) {
  60301. $unsetCodes[] = $option['unset'];
  60302. }
  60303. if (0 === \count($unsetCodes)) {
  60304. return '';
  60305. }
  60306. return sprintf("\033[%sm", implode(';', $unsetCodes));
  60307. }
  60308. private function parseColor(string $color, bool $background = false): string
  60309. {
  60310. if ('' === $color) {
  60311. return '';
  60312. }
  60313. if ('#' === $color[0]) {
  60314. $color = substr($color, 1);
  60315. if (3 === \strlen($color)) {
  60316. $color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
  60317. }
  60318. if (6 !== \strlen($color)) {
  60319. throw new InvalidArgumentException(sprintf('Invalid "%s" color.', $color));
  60320. }
  60321. return ($background ? '4' : '3').$this->convertHexColorToAnsi(hexdec($color));
  60322. }
  60323. if (isset(self::COLORS[$color])) {
  60324. return ($background ? '4' : '3').self::COLORS[$color];
  60325. }
  60326. if (isset(self::BRIGHT_COLORS[$color])) {
  60327. return ($background ? '10' : '9').self::BRIGHT_COLORS[$color];
  60328. }
  60329. throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));
  60330. }
  60331. private function convertHexColorToAnsi(int $color): string
  60332. {
  60333. $r = ($color >> 16) & 255;
  60334. $g = ($color >> 8) & 255;
  60335. $b = $color & 255;
  60336. if ('truecolor' !== getenv('COLORTERM')) {
  60337. return (string) $this->degradeHexColorToAnsi($r, $g, $b);
  60338. }
  60339. return sprintf('8;2;%d;%d;%d', $r, $g, $b);
  60340. }
  60341. private function degradeHexColorToAnsi(int $r, int $g, int $b): int
  60342. {
  60343. if (0 === round($this->getSaturation($r, $g, $b) / 50)) {
  60344. return 0;
  60345. }
  60346. return (round($b / 255) << 2) | (round($g / 255) << 1) | round($r / 255);
  60347. }
  60348. private function getSaturation(int $r, int $g, int $b): int
  60349. {
  60350. $r = $r / 255;
  60351. $g = $g / 255;
  60352. $b = $b / 255;
  60353. $v = max($r, $g, $b);
  60354. if (0 === $diff = $v - min($r, $g, $b)) {
  60355. return 0;
  60356. }
  60357. return (int) $diff * 100 / $v;
  60358. }
  60359. }
  60360. <?php
  60361. namespace Symfony\Component\Console\Command;
  60362. use Symfony\Component\Console\Application;
  60363. use Symfony\Component\Console\Attribute\AsCommand;
  60364. use Symfony\Component\Console\Completion\CompletionInput;
  60365. use Symfony\Component\Console\Completion\CompletionSuggestions;
  60366. use Symfony\Component\Console\Exception\ExceptionInterface;
  60367. use Symfony\Component\Console\Exception\InvalidArgumentException;
  60368. use Symfony\Component\Console\Exception\LogicException;
  60369. use Symfony\Component\Console\Helper\HelperSet;
  60370. use Symfony\Component\Console\Input\InputArgument;
  60371. use Symfony\Component\Console\Input\InputDefinition;
  60372. use Symfony\Component\Console\Input\InputInterface;
  60373. use Symfony\Component\Console\Input\InputOption;
  60374. use Symfony\Component\Console\Output\OutputInterface;
  60375. class Command
  60376. {
  60377. public const SUCCESS = 0;
  60378. public const FAILURE = 1;
  60379. public const INVALID = 2;
  60380. protected static $defaultName;
  60381. protected static $defaultDescription;
  60382. private $application;
  60383. private $name;
  60384. private $processTitle;
  60385. private $aliases = [];
  60386. private $definition;
  60387. private $hidden = false;
  60388. private $help = '';
  60389. private $description = '';
  60390. private $fullDefinition;
  60391. private $ignoreValidationErrors = false;
  60392. private $code;
  60393. private $synopsis = [];
  60394. private $usages = [];
  60395. private $helperSet;
  60396. public static function getDefaultName()
  60397. {
  60398. $class = static::class;
  60399. if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
  60400. return $attribute[0]->newInstance()->name;
  60401. }
  60402. $r = new \ReflectionProperty($class, 'defaultName');
  60403. return $class === $r->class ? static::$defaultName : null;
  60404. }
  60405. public static function getDefaultDescription(): ?string
  60406. {
  60407. $class = static::class;
  60408. if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
  60409. return $attribute[0]->newInstance()->description;
  60410. }
  60411. $r = new \ReflectionProperty($class, 'defaultDescription');
  60412. return $class === $r->class ? static::$defaultDescription : null;
  60413. }
  60414. public function __construct(?string $name = null)
  60415. {
  60416. $this->definition = new InputDefinition();
  60417. if (null === $name && null !== $name = static::getDefaultName()) {
  60418. $aliases = explode('|', $name);
  60419. if ('' === $name = array_shift($aliases)) {
  60420. $this->setHidden(true);
  60421. $name = array_shift($aliases);
  60422. }
  60423. $this->setAliases($aliases);
  60424. }
  60425. if (null !== $name) {
  60426. $this->setName($name);
  60427. }
  60428. if ('' === $this->description) {
  60429. $this->setDescription(static::getDefaultDescription() ?? '');
  60430. }
  60431. $this->configure();
  60432. }
  60433. public function ignoreValidationErrors()
  60434. {
  60435. $this->ignoreValidationErrors = true;
  60436. }
  60437. public function setApplication(?Application $application = null)
  60438. {
  60439. $this->application = $application;
  60440. if ($application) {
  60441. $this->setHelperSet($application->getHelperSet());
  60442. } else {
  60443. $this->helperSet = null;
  60444. }
  60445. $this->fullDefinition = null;
  60446. }
  60447. public function setHelperSet(HelperSet $helperSet)
  60448. {
  60449. $this->helperSet = $helperSet;
  60450. }
  60451. public function getHelperSet()
  60452. {
  60453. return $this->helperSet;
  60454. }
  60455. public function getApplication()
  60456. {
  60457. return $this->application;
  60458. }
  60459. public function isEnabled()
  60460. {
  60461. return true;
  60462. }
  60463. protected function configure()
  60464. {
  60465. }
  60466. protected function execute(InputInterface $input, OutputInterface $output)
  60467. {
  60468. throw new LogicException('You must override the execute() method in the concrete command class.');
  60469. }
  60470. protected function interact(InputInterface $input, OutputInterface $output)
  60471. {
  60472. }
  60473. protected function initialize(InputInterface $input, OutputInterface $output)
  60474. {
  60475. }
  60476. public function run(InputInterface $input, OutputInterface $output)
  60477. {
  60478. $this->mergeApplicationDefinition();
  60479. try {
  60480. $input->bind($this->getDefinition());
  60481. } catch (ExceptionInterface $e) {
  60482. if (!$this->ignoreValidationErrors) {
  60483. throw $e;
  60484. }
  60485. }
  60486. $this->initialize($input, $output);
  60487. if (null !== $this->processTitle) {
  60488. if (\function_exists('cli_set_process_title')) {
  60489. if (!@cli_set_process_title($this->processTitle)) {
  60490. if ('Darwin' === \PHP_OS) {
  60491. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  60492. } else {
  60493. cli_set_process_title($this->processTitle);
  60494. }
  60495. }
  60496. } elseif (\function_exists('setproctitle')) {
  60497. setproctitle($this->processTitle);
  60498. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  60499. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  60500. }
  60501. }
  60502. if ($input->isInteractive()) {
  60503. $this->interact($input, $output);
  60504. }
  60505. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  60506. $input->setArgument('command', $this->getName());
  60507. }
  60508. $input->validate();
  60509. if ($this->code) {
  60510. $statusCode = ($this->code)($input, $output);
  60511. } else {
  60512. $statusCode = $this->execute($input, $output);
  60513. if (!\is_int($statusCode)) {
  60514. throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
  60515. }
  60516. }
  60517. return is_numeric($statusCode) ? (int) $statusCode : 0;
  60518. }
  60519. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  60520. {
  60521. }
  60522. public function setCode(callable $code)
  60523. {
  60524. if ($code instanceof \Closure) {
  60525. $r = new \ReflectionFunction($code);
  60526. if (null === $r->getClosureThis()) {
  60527. set_error_handler(static function () {});
  60528. try {
  60529. if ($c = \Closure::bind($code, $this)) {
  60530. $code = $c;
  60531. }
  60532. } finally {
  60533. restore_error_handler();
  60534. }
  60535. }
  60536. }
  60537. $this->code = $code;
  60538. return $this;
  60539. }
  60540. public function mergeApplicationDefinition(bool $mergeArgs = true)
  60541. {
  60542. if (null === $this->application) {
  60543. return;
  60544. }
  60545. $this->fullDefinition = new InputDefinition();
  60546. $this->fullDefinition->setOptions($this->definition->getOptions());
  60547. $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
  60548. if ($mergeArgs) {
  60549. $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
  60550. $this->fullDefinition->addArguments($this->definition->getArguments());
  60551. } else {
  60552. $this->fullDefinition->setArguments($this->definition->getArguments());
  60553. }
  60554. }
  60555. public function setDefinition($definition)
  60556. {
  60557. if ($definition instanceof InputDefinition) {
  60558. $this->definition = $definition;
  60559. } else {
  60560. $this->definition->setDefinition($definition);
  60561. }
  60562. $this->fullDefinition = null;
  60563. return $this;
  60564. }
  60565. public function getDefinition()
  60566. {
  60567. return $this->fullDefinition ?? $this->getNativeDefinition();
  60568. }
  60569. public function getNativeDefinition()
  60570. {
  60571. if (null === $this->definition) {
  60572. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
  60573. }
  60574. return $this->definition;
  60575. }
  60576. public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null)
  60577. {
  60578. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  60579. if (null !== $this->fullDefinition) {
  60580. $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
  60581. }
  60582. return $this;
  60583. }
  60584. public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null)
  60585. {
  60586. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  60587. if (null !== $this->fullDefinition) {
  60588. $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  60589. }
  60590. return $this;
  60591. }
  60592. public function setName(string $name)
  60593. {
  60594. $this->validateName($name);
  60595. $this->name = $name;
  60596. return $this;
  60597. }
  60598. public function setProcessTitle(string $title)
  60599. {
  60600. $this->processTitle = $title;
  60601. return $this;
  60602. }
  60603. public function getName()
  60604. {
  60605. return $this->name;
  60606. }
  60607. public function setHidden(bool $hidden )
  60608. {
  60609. $this->hidden = $hidden;
  60610. return $this;
  60611. }
  60612. public function isHidden()
  60613. {
  60614. return $this->hidden;
  60615. }
  60616. public function setDescription(string $description)
  60617. {
  60618. $this->description = $description;
  60619. return $this;
  60620. }
  60621. public function getDescription()
  60622. {
  60623. return $this->description;
  60624. }
  60625. public function setHelp(string $help)
  60626. {
  60627. $this->help = $help;
  60628. return $this;
  60629. }
  60630. public function getHelp()
  60631. {
  60632. return $this->help;
  60633. }
  60634. public function getProcessedHelp()
  60635. {
  60636. $name = $this->name;
  60637. $isSingleCommand = $this->application && $this->application->isSingleCommand();
  60638. $placeholders = [
  60639. '%command.name%',
  60640. '%command.full_name%',
  60641. ];
  60642. $replacements = [
  60643. $name,
  60644. $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
  60645. ];
  60646. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  60647. }
  60648. public function setAliases(iterable $aliases)
  60649. {
  60650. $list = [];
  60651. foreach ($aliases as $alias) {
  60652. $this->validateName($alias);
  60653. $list[] = $alias;
  60654. }
  60655. $this->aliases = \is_array($aliases) ? $aliases : $list;
  60656. return $this;
  60657. }
  60658. public function getAliases()
  60659. {
  60660. return $this->aliases;
  60661. }
  60662. public function getSynopsis(bool $short = false)
  60663. {
  60664. $key = $short ? 'short' : 'long';
  60665. if (!isset($this->synopsis[$key])) {
  60666. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  60667. }
  60668. return $this->synopsis[$key];
  60669. }
  60670. public function addUsage(string $usage)
  60671. {
  60672. if (!str_starts_with($usage, $this->name)) {
  60673. $usage = sprintf('%s %s', $this->name, $usage);
  60674. }
  60675. $this->usages[] = $usage;
  60676. return $this;
  60677. }
  60678. public function getUsages()
  60679. {
  60680. return $this->usages;
  60681. }
  60682. public function getHelper(string $name)
  60683. {
  60684. if (null === $this->helperSet) {
  60685. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  60686. }
  60687. return $this->helperSet->get($name);
  60688. }
  60689. private function validateName(string $name)
  60690. {
  60691. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  60692. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  60693. }
  60694. }
  60695. }
  60696. <?php
  60697. namespace Symfony\Component\Console\Command;
  60698. use Symfony\Component\Console\Completion\CompletionInput;
  60699. use Symfony\Component\Console\Completion\CompletionSuggestions;
  60700. use Symfony\Component\Console\Completion\Output\BashCompletionOutput;
  60701. use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
  60702. use Symfony\Component\Console\Exception\CommandNotFoundException;
  60703. use Symfony\Component\Console\Exception\ExceptionInterface;
  60704. use Symfony\Component\Console\Input\InputInterface;
  60705. use Symfony\Component\Console\Input\InputOption;
  60706. use Symfony\Component\Console\Output\OutputInterface;
  60707. final class CompleteCommand extends Command
  60708. {
  60709. protected static $defaultName = '|_complete';
  60710. protected static $defaultDescription = 'Internal command to provide shell completion suggestions';
  60711. private $completionOutputs;
  60712. private $isDebug = false;
  60713. public function __construct(array $completionOutputs = [])
  60714. {
  60715. $this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class];
  60716. parent::__construct();
  60717. }
  60718. protected function configure(): void
  60719. {
  60720. $this
  60721. ->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("'.implode('", "', array_keys($this->completionOutputs)).'")')
  60722. ->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)')
  60723. ->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)')
  60724. ->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script')
  60725. ;
  60726. }
  60727. protected function initialize(InputInterface $input, OutputInterface $output)
  60728. {
  60729. $this->isDebug = filter_var(getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOLEAN);
  60730. }
  60731. protected function execute(InputInterface $input, OutputInterface $output): int
  60732. {
  60733. try {
  60734. $shell = $input->getOption('shell');
  60735. if (!$shell) {
  60736. throw new \RuntimeException('The "--shell" option must be set.');
  60737. }
  60738. if (!$completionOutput = $this->completionOutputs[$shell] ?? false) {
  60739. throw new \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
  60740. }
  60741. $completionInput = $this->createCompletionInput($input);
  60742. $suggestions = new CompletionSuggestions();
  60743. $this->log([
  60744. '',
  60745. '<comment>'.date('Y-m-d H:i:s').'</>',
  60746. '<info>Input:</> <comment>("|" indicates the cursor position)</>',
  60747. ' '.(string) $completionInput,
  60748. '<info>Command:</>',
  60749. ' '.(string) implode(' ', $_SERVER['argv']),
  60750. '<info>Messages:</>',
  60751. ]);
  60752. $command = $this->findCommand($completionInput, $output);
  60753. if (null === $command) {
  60754. $this->log(' No command found, completing using the Application class.');
  60755. $this->getApplication()->complete($completionInput, $suggestions);
  60756. } elseif (
  60757. $completionInput->mustSuggestArgumentValuesFor('command')
  60758. && $command->getName() !== $completionInput->getCompletionValue()
  60759. && !\in_array($completionInput->getCompletionValue(), $command->getAliases(), true)
  60760. ) {
  60761. $this->log(' No command found, completing using the Application class.');
  60762. $suggestions->suggestValues(array_filter(array_merge([$command->getName()], $command->getAliases())));
  60763. } else {
  60764. $command->mergeApplicationDefinition();
  60765. $completionInput->bind($command->getDefinition());
  60766. if (CompletionInput::TYPE_OPTION_NAME === $completionInput->getCompletionType()) {
  60767. $this->log(' Completing option names for the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> command.');
  60768. $suggestions->suggestOptions($command->getDefinition()->getOptions());
  60769. } else {
  60770. $this->log([
  60771. ' Completing using the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> class.',
  60772. ' Completing <comment>'.$completionInput->getCompletionType().'</> for <comment>'.$completionInput->getCompletionName().'</>',
  60773. ]);
  60774. if (null !== $compval = $completionInput->getCompletionValue()) {
  60775. $this->log(' Current value: <comment>'.$compval.'</>');
  60776. }
  60777. $command->complete($completionInput, $suggestions);
  60778. }
  60779. }
  60780. $completionOutput = new $completionOutput();
  60781. $this->log('<info>Suggestions:</>');
  60782. if ($options = $suggestions->getOptionSuggestions()) {
  60783. $this->log(' --'.implode(' --', array_map(function ($o) { return $o->getName(); }, $options)));
  60784. } elseif ($values = $suggestions->getValueSuggestions()) {
  60785. $this->log(' '.implode(' ', $values));
  60786. } else {
  60787. $this->log(' <comment>No suggestions were provided</>');
  60788. }
  60789. $completionOutput->write($suggestions, $output);
  60790. } catch (\Throwable $e) {
  60791. $this->log([
  60792. '<error>Error!</error>',
  60793. (string) $e,
  60794. ]);
  60795. if ($output->isDebug()) {
  60796. throw $e;
  60797. }
  60798. return 2;
  60799. }
  60800. return 0;
  60801. }
  60802. private function createCompletionInput(InputInterface $input): CompletionInput
  60803. {
  60804. $currentIndex = $input->getOption('current');
  60805. if (!$currentIndex || !ctype_digit($currentIndex)) {
  60806. throw new \RuntimeException('The "--current" option must be set and it must be an integer.');
  60807. }
  60808. $completionInput = CompletionInput::fromTokens($input->getOption('input'), (int) $currentIndex);
  60809. try {
  60810. $completionInput->bind($this->getApplication()->getDefinition());
  60811. } catch (ExceptionInterface $e) {
  60812. }
  60813. return $completionInput;
  60814. }
  60815. private function findCommand(CompletionInput $completionInput, OutputInterface $output): ?Command
  60816. {
  60817. try {
  60818. $inputName = $completionInput->getFirstArgument();
  60819. if (null === $inputName) {
  60820. return null;
  60821. }
  60822. return $this->getApplication()->find($inputName);
  60823. } catch (CommandNotFoundException $e) {
  60824. }
  60825. return null;
  60826. }
  60827. private function log($messages): void
  60828. {
  60829. if (!$this->isDebug) {
  60830. return;
  60831. }
  60832. $commandName = basename($_SERVER['argv'][0]);
  60833. file_put_contents(sys_get_temp_dir().'/sf_'.$commandName.'.log', implode(\PHP_EOL, (array) $messages).\PHP_EOL, \FILE_APPEND);
  60834. }
  60835. }
  60836. <?php
  60837. namespace Symfony\Component\Console\Command;
  60838. use Symfony\Component\Console\Completion\CompletionInput;
  60839. use Symfony\Component\Console\Completion\CompletionSuggestions;
  60840. use Symfony\Component\Console\Input\InputArgument;
  60841. use Symfony\Component\Console\Input\InputInterface;
  60842. use Symfony\Component\Console\Input\InputOption;
  60843. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  60844. use Symfony\Component\Console\Output\OutputInterface;
  60845. use Symfony\Component\Process\Process;
  60846. final class DumpCompletionCommand extends Command
  60847. {
  60848. protected static $defaultName = 'completion';
  60849. protected static $defaultDescription = 'Dump the shell completion script';
  60850. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  60851. {
  60852. if ($input->mustSuggestArgumentValuesFor('shell')) {
  60853. $suggestions->suggestValues($this->getSupportedShells());
  60854. }
  60855. }
  60856. protected function configure()
  60857. {
  60858. $fullCommand = $_SERVER['PHP_SELF'];
  60859. $commandName = basename($fullCommand);
  60860. $fullCommand = @realpath($fullCommand) ?: $fullCommand;
  60861. $this
  60862. ->setHelp(<<<EOH
  60863. The <info>%command.name%</> command dumps the shell completion script required
  60864. to use shell autocompletion (currently only bash completion is supported).
  60865. <comment>Static installation
  60866. -------------------</>
  60867. Dump the script to a global completion file and restart your shell:
  60868. <info>%command.full_name% bash | sudo tee /etc/bash_completion.d/{$commandName}</>
  60869. Or dump the script to a local file and source it:
  60870. <info>%command.full_name% bash > completion.sh</>
  60871. <comment># source the file whenever you use the project</>
  60872. <info>source completion.sh</>
  60873. <comment># or add this line at the end of your "~/.bashrc" file:</>
  60874. <info>source /path/to/completion.sh</>
  60875. <comment>Dynamic installation
  60876. --------------------</>
  60877. Add this to the end of your shell configuration file (e.g. <info>"~/.bashrc"</>):
  60878. <info>eval "$({$fullCommand} completion bash)"</>
  60879. EOH
  60880. )
  60881. ->addArgument('shell', InputArgument::OPTIONAL, 'The shell type (e.g. "bash"), the value of the "$SHELL" env var will be used if this is not given')
  60882. ->addOption('debug', null, InputOption::VALUE_NONE, 'Tail the completion debug log')
  60883. ;
  60884. }
  60885. protected function execute(InputInterface $input, OutputInterface $output): int
  60886. {
  60887. $commandName = basename($_SERVER['argv'][0]);
  60888. if ($input->getOption('debug')) {
  60889. $this->tailDebugLog($commandName, $output);
  60890. return 0;
  60891. }
  60892. $shell = $input->getArgument('shell') ?? self::guessShell();
  60893. $completionFile = __DIR__.'/../Resources/completion.'.$shell;
  60894. if (!file_exists($completionFile)) {
  60895. $supportedShells = $this->getSupportedShells();
  60896. if ($output instanceof ConsoleOutputInterface) {
  60897. $output = $output->getErrorOutput();
  60898. }
  60899. if ($shell) {
  60900. $output->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
  60901. } else {
  60902. $output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
  60903. }
  60904. return 2;
  60905. }
  60906. $output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], file_get_contents($completionFile)));
  60907. return 0;
  60908. }
  60909. private static function guessShell(): string
  60910. {
  60911. return basename($_SERVER['SHELL'] ?? '');
  60912. }
  60913. private function tailDebugLog(string $commandName, OutputInterface $output): void
  60914. {
  60915. $debugFile = sys_get_temp_dir().'/sf_'.$commandName.'.log';
  60916. if (!file_exists($debugFile)) {
  60917. touch($debugFile);
  60918. }
  60919. $process = new Process(['tail', '-f', $debugFile], null, null, null, 0);
  60920. $process->run(function (string $type, string $line) use ($output): void {
  60921. $output->write($line);
  60922. });
  60923. }
  60924. private function getSupportedShells(): array
  60925. {
  60926. $shells = [];
  60927. foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
  60928. if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
  60929. $shells[] = $file->getExtension();
  60930. }
  60931. }
  60932. return $shells;
  60933. }
  60934. }
  60935. <?php
  60936. namespace Symfony\Component\Console\Command;
  60937. use Symfony\Component\Console\Completion\CompletionInput;
  60938. use Symfony\Component\Console\Completion\CompletionSuggestions;
  60939. use Symfony\Component\Console\Descriptor\ApplicationDescription;
  60940. use Symfony\Component\Console\Helper\DescriptorHelper;
  60941. use Symfony\Component\Console\Input\InputArgument;
  60942. use Symfony\Component\Console\Input\InputInterface;
  60943. use Symfony\Component\Console\Input\InputOption;
  60944. use Symfony\Component\Console\Output\OutputInterface;
  60945. class HelpCommand extends Command
  60946. {
  60947. private $command;
  60948. protected function configure()
  60949. {
  60950. $this->ignoreValidationErrors();
  60951. $this
  60952. ->setName('help')
  60953. ->setDefinition([
  60954. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  60955. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  60956. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  60957. ])
  60958. ->setDescription('Display help for a command')
  60959. ->setHelp(<<<'EOF'
  60960. The <info>%command.name%</info> command displays help for a given command:
  60961. <info>%command.full_name% list</info>
  60962. You can also output the help in other formats by using the <comment>--format</comment> option:
  60963. <info>%command.full_name% --format=xml list</info>
  60964. To display the list of available commands, please use the <info>list</info> command.
  60965. EOF
  60966. )
  60967. ;
  60968. }
  60969. public function setCommand(Command $command)
  60970. {
  60971. $this->command = $command;
  60972. }
  60973. protected function execute(InputInterface $input, OutputInterface $output)
  60974. {
  60975. if (null === $this->command) {
  60976. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  60977. }
  60978. $helper = new DescriptorHelper();
  60979. $helper->describe($output, $this->command, [
  60980. 'format' => $input->getOption('format'),
  60981. 'raw_text' => $input->getOption('raw'),
  60982. ]);
  60983. $this->command = null;
  60984. return 0;
  60985. }
  60986. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  60987. {
  60988. if ($input->mustSuggestArgumentValuesFor('command_name')) {
  60989. $descriptor = new ApplicationDescription($this->getApplication());
  60990. $suggestions->suggestValues(array_keys($descriptor->getCommands()));
  60991. return;
  60992. }
  60993. if ($input->mustSuggestOptionValuesFor('format')) {
  60994. $helper = new DescriptorHelper();
  60995. $suggestions->suggestValues($helper->getFormats());
  60996. }
  60997. }
  60998. }
  60999. <?php
  61000. namespace Symfony\Component\Console\Command;
  61001. use Symfony\Component\Console\Application;
  61002. use Symfony\Component\Console\Completion\CompletionInput;
  61003. use Symfony\Component\Console\Completion\CompletionSuggestions;
  61004. use Symfony\Component\Console\Helper\HelperSet;
  61005. use Symfony\Component\Console\Input\InputDefinition;
  61006. use Symfony\Component\Console\Input\InputInterface;
  61007. use Symfony\Component\Console\Output\OutputInterface;
  61008. final class LazyCommand extends Command
  61009. {
  61010. private $command;
  61011. private $isEnabled;
  61012. public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
  61013. {
  61014. $this->setName($name)
  61015. ->setAliases($aliases)
  61016. ->setHidden($isHidden)
  61017. ->setDescription($description);
  61018. $this->command = $commandFactory;
  61019. $this->isEnabled = $isEnabled;
  61020. }
  61021. public function ignoreValidationErrors(): void
  61022. {
  61023. $this->getCommand()->ignoreValidationErrors();
  61024. }
  61025. public function setApplication(?Application $application = null): void
  61026. {
  61027. if ($this->command instanceof parent) {
  61028. $this->command->setApplication($application);
  61029. }
  61030. parent::setApplication($application);
  61031. }
  61032. public function setHelperSet(HelperSet $helperSet): void
  61033. {
  61034. if ($this->command instanceof parent) {
  61035. $this->command->setHelperSet($helperSet);
  61036. }
  61037. parent::setHelperSet($helperSet);
  61038. }
  61039. public function isEnabled(): bool
  61040. {
  61041. return $this->isEnabled ?? $this->getCommand()->isEnabled();
  61042. }
  61043. public function run(InputInterface $input, OutputInterface $output): int
  61044. {
  61045. return $this->getCommand()->run($input, $output);
  61046. }
  61047. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  61048. {
  61049. $this->getCommand()->complete($input, $suggestions);
  61050. }
  61051. public function setCode(callable $code): self
  61052. {
  61053. $this->getCommand()->setCode($code);
  61054. return $this;
  61055. }
  61056. public function mergeApplicationDefinition(bool $mergeArgs = true): void
  61057. {
  61058. $this->getCommand()->mergeApplicationDefinition($mergeArgs);
  61059. }
  61060. public function setDefinition($definition): self
  61061. {
  61062. $this->getCommand()->setDefinition($definition);
  61063. return $this;
  61064. }
  61065. public function getDefinition(): InputDefinition
  61066. {
  61067. return $this->getCommand()->getDefinition();
  61068. }
  61069. public function getNativeDefinition(): InputDefinition
  61070. {
  61071. return $this->getCommand()->getNativeDefinition();
  61072. }
  61073. public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null): self
  61074. {
  61075. $this->getCommand()->addArgument($name, $mode, $description, $default);
  61076. return $this;
  61077. }
  61078. public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): self
  61079. {
  61080. $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
  61081. return $this;
  61082. }
  61083. public function setProcessTitle(string $title): self
  61084. {
  61085. $this->getCommand()->setProcessTitle($title);
  61086. return $this;
  61087. }
  61088. public function setHelp(string $help): self
  61089. {
  61090. $this->getCommand()->setHelp($help);
  61091. return $this;
  61092. }
  61093. public function getHelp(): string
  61094. {
  61095. return $this->getCommand()->getHelp();
  61096. }
  61097. public function getProcessedHelp(): string
  61098. {
  61099. return $this->getCommand()->getProcessedHelp();
  61100. }
  61101. public function getSynopsis(bool $short = false): string
  61102. {
  61103. return $this->getCommand()->getSynopsis($short);
  61104. }
  61105. public function addUsage(string $usage): self
  61106. {
  61107. $this->getCommand()->addUsage($usage);
  61108. return $this;
  61109. }
  61110. public function getUsages(): array
  61111. {
  61112. return $this->getCommand()->getUsages();
  61113. }
  61114. public function getHelper(string $name)
  61115. {
  61116. return $this->getCommand()->getHelper($name);
  61117. }
  61118. public function getCommand(): parent
  61119. {
  61120. if (!$this->command instanceof \Closure) {
  61121. return $this->command;
  61122. }
  61123. $command = $this->command = ($this->command)();
  61124. $command->setApplication($this->getApplication());
  61125. if (null !== $this->getHelperSet()) {
  61126. $command->setHelperSet($this->getHelperSet());
  61127. }
  61128. $command->setName($this->getName())
  61129. ->setAliases($this->getAliases())
  61130. ->setHidden($this->isHidden())
  61131. ->setDescription($this->getDescription());
  61132. $command->getDefinition();
  61133. return $command;
  61134. }
  61135. }
  61136. <?php
  61137. namespace Symfony\Component\Console\Command;
  61138. use Symfony\Component\Console\Completion\CompletionInput;
  61139. use Symfony\Component\Console\Completion\CompletionSuggestions;
  61140. use Symfony\Component\Console\Descriptor\ApplicationDescription;
  61141. use Symfony\Component\Console\Helper\DescriptorHelper;
  61142. use Symfony\Component\Console\Input\InputArgument;
  61143. use Symfony\Component\Console\Input\InputInterface;
  61144. use Symfony\Component\Console\Input\InputOption;
  61145. use Symfony\Component\Console\Output\OutputInterface;
  61146. class ListCommand extends Command
  61147. {
  61148. protected function configure()
  61149. {
  61150. $this
  61151. ->setName('list')
  61152. ->setDefinition([
  61153. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  61154. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  61155. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  61156. new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
  61157. ])
  61158. ->setDescription('List commands')
  61159. ->setHelp(<<<'EOF'
  61160. The <info>%command.name%</info> command lists all commands:
  61161. <info>%command.full_name%</info>
  61162. You can also display the commands for a specific namespace:
  61163. <info>%command.full_name% test</info>
  61164. You can also output the information in other formats by using the <comment>--format</comment> option:
  61165. <info>%command.full_name% --format=xml</info>
  61166. It's also possible to get raw list of commands (useful for embedding command runner):
  61167. <info>%command.full_name% --raw</info>
  61168. EOF
  61169. )
  61170. ;
  61171. }
  61172. protected function execute(InputInterface $input, OutputInterface $output)
  61173. {
  61174. $helper = new DescriptorHelper();
  61175. $helper->describe($output, $this->getApplication(), [
  61176. 'format' => $input->getOption('format'),
  61177. 'raw_text' => $input->getOption('raw'),
  61178. 'namespace' => $input->getArgument('namespace'),
  61179. 'short' => $input->getOption('short'),
  61180. ]);
  61181. return 0;
  61182. }
  61183. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  61184. {
  61185. if ($input->mustSuggestArgumentValuesFor('namespace')) {
  61186. $descriptor = new ApplicationDescription($this->getApplication());
  61187. $suggestions->suggestValues(array_keys($descriptor->getNamespaces()));
  61188. return;
  61189. }
  61190. if ($input->mustSuggestOptionValuesFor('format')) {
  61191. $helper = new DescriptorHelper();
  61192. $suggestions->suggestValues($helper->getFormats());
  61193. }
  61194. }
  61195. }
  61196. <?php
  61197. namespace Symfony\Component\Console\Command;
  61198. use Symfony\Component\Console\Exception\LogicException;
  61199. use Symfony\Component\Lock\LockFactory;
  61200. use Symfony\Component\Lock\LockInterface;
  61201. use Symfony\Component\Lock\Store\FlockStore;
  61202. use Symfony\Component\Lock\Store\SemaphoreStore;
  61203. trait LockableTrait
  61204. {
  61205. private $lock;
  61206. private function lock(?string $name = null, bool $blocking = false): bool
  61207. {
  61208. if (!class_exists(SemaphoreStore::class)) {
  61209. throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
  61210. }
  61211. if (null !== $this->lock) {
  61212. throw new LogicException('A lock is already in place.');
  61213. }
  61214. if (SemaphoreStore::isSupported()) {
  61215. $store = new SemaphoreStore();
  61216. } else {
  61217. $store = new FlockStore();
  61218. }
  61219. $this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
  61220. if (!$this->lock->acquire($blocking)) {
  61221. $this->lock = null;
  61222. return false;
  61223. }
  61224. return true;
  61225. }
  61226. private function release()
  61227. {
  61228. if ($this->lock) {
  61229. $this->lock->release();
  61230. $this->lock = null;
  61231. }
  61232. }
  61233. }
  61234. <?php
  61235. namespace Symfony\Component\Console\Command;
  61236. interface SignalableCommandInterface
  61237. {
  61238. public function getSubscribedSignals(): array;
  61239. public function handleSignal(int $signal): void;
  61240. }
  61241. <?php
  61242. namespace Symfony\Component\Console\CommandLoader;
  61243. use Symfony\Component\Console\Command\Command;
  61244. use Symfony\Component\Console\Exception\CommandNotFoundException;
  61245. interface CommandLoaderInterface
  61246. {
  61247. public function get(string $name);
  61248. public function has(string $name);
  61249. public function getNames();
  61250. }
  61251. <?php
  61252. namespace Symfony\Component\Console\CommandLoader;
  61253. use Psr\Container\ContainerInterface;
  61254. use Symfony\Component\Console\Exception\CommandNotFoundException;
  61255. class ContainerCommandLoader implements CommandLoaderInterface
  61256. {
  61257. private $container;
  61258. private $commandMap;
  61259. public function __construct(ContainerInterface $container, array $commandMap)
  61260. {
  61261. $this->container = $container;
  61262. $this->commandMap = $commandMap;
  61263. }
  61264. public function get(string $name)
  61265. {
  61266. if (!$this->has($name)) {
  61267. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  61268. }
  61269. return $this->container->get($this->commandMap[$name]);
  61270. }
  61271. public function has(string $name)
  61272. {
  61273. return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
  61274. }
  61275. public function getNames()
  61276. {
  61277. return array_keys($this->commandMap);
  61278. }
  61279. }
  61280. <?php
  61281. namespace Symfony\Component\Console\CommandLoader;
  61282. use Symfony\Component\Console\Exception\CommandNotFoundException;
  61283. class FactoryCommandLoader implements CommandLoaderInterface
  61284. {
  61285. private $factories;
  61286. public function __construct(array $factories)
  61287. {
  61288. $this->factories = $factories;
  61289. }
  61290. public function has(string $name)
  61291. {
  61292. return isset($this->factories[$name]);
  61293. }
  61294. public function get(string $name)
  61295. {
  61296. if (!isset($this->factories[$name])) {
  61297. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  61298. }
  61299. $factory = $this->factories[$name];
  61300. return $factory();
  61301. }
  61302. public function getNames()
  61303. {
  61304. return array_keys($this->factories);
  61305. }
  61306. }
  61307. <?php
  61308. namespace Symfony\Component\Console\Completion;
  61309. use Symfony\Component\Console\Exception\RuntimeException;
  61310. use Symfony\Component\Console\Input\ArgvInput;
  61311. use Symfony\Component\Console\Input\InputDefinition;
  61312. use Symfony\Component\Console\Input\InputOption;
  61313. final class CompletionInput extends ArgvInput
  61314. {
  61315. public const TYPE_ARGUMENT_VALUE = 'argument_value';
  61316. public const TYPE_OPTION_VALUE = 'option_value';
  61317. public const TYPE_OPTION_NAME = 'option_name';
  61318. public const TYPE_NONE = 'none';
  61319. private $tokens;
  61320. private $currentIndex;
  61321. private $completionType;
  61322. private $completionName = null;
  61323. private $completionValue = '';
  61324. public static function fromString(string $inputStr, int $currentIndex): self
  61325. {
  61326. preg_match_all('/(?<=^|\s)([\'"]?)(.+?)(?<!\\\\)\1(?=$|\s)/', $inputStr, $tokens);
  61327. return self::fromTokens($tokens[0], $currentIndex);
  61328. }
  61329. public static function fromTokens(array $tokens, int $currentIndex): self
  61330. {
  61331. $input = new self($tokens);
  61332. $input->tokens = $tokens;
  61333. $input->currentIndex = $currentIndex;
  61334. return $input;
  61335. }
  61336. public function bind(InputDefinition $definition): void
  61337. {
  61338. parent::bind($definition);
  61339. $relevantToken = $this->getRelevantToken();
  61340. if ('-' === $relevantToken[0]) {
  61341. [$optionToken, $optionValue] = explode('=', $relevantToken, 2) + ['', ''];
  61342. $option = $this->getOptionFromToken($optionToken);
  61343. if (null === $option && !$this->isCursorFree()) {
  61344. $this->completionType = self::TYPE_OPTION_NAME;
  61345. $this->completionValue = $relevantToken;
  61346. return;
  61347. }
  61348. if (null !== $option && $option->acceptValue()) {
  61349. $this->completionType = self::TYPE_OPTION_VALUE;
  61350. $this->completionName = $option->getName();
  61351. $this->completionValue = $optionValue ?: (!str_starts_with($optionToken, '--') ? substr($optionToken, 2) : '');
  61352. return;
  61353. }
  61354. }
  61355. $previousToken = $this->tokens[$this->currentIndex - 1];
  61356. if ('-' === $previousToken[0] && '' !== trim($previousToken, '-')) {
  61357. $previousOption = $this->getOptionFromToken($previousToken);
  61358. if (null !== $previousOption && $previousOption->acceptValue()) {
  61359. $this->completionType = self::TYPE_OPTION_VALUE;
  61360. $this->completionName = $previousOption->getName();
  61361. $this->completionValue = $relevantToken;
  61362. return;
  61363. }
  61364. }
  61365. $this->completionType = self::TYPE_ARGUMENT_VALUE;
  61366. foreach ($this->definition->getArguments() as $argumentName => $argument) {
  61367. if (!isset($this->arguments[$argumentName])) {
  61368. break;
  61369. }
  61370. $argumentValue = $this->arguments[$argumentName];
  61371. $this->completionName = $argumentName;
  61372. if (\is_array($argumentValue)) {
  61373. $this->completionValue = $argumentValue ? $argumentValue[array_key_last($argumentValue)] : null;
  61374. } else {
  61375. $this->completionValue = $argumentValue;
  61376. }
  61377. }
  61378. if ($this->currentIndex >= \count($this->tokens)) {
  61379. if (!isset($this->arguments[$argumentName]) || $this->definition->getArgument($argumentName)->isArray()) {
  61380. $this->completionName = $argumentName;
  61381. $this->completionValue = '';
  61382. } else {
  61383. $this->completionType = self::TYPE_NONE;
  61384. $this->completionName = null;
  61385. $this->completionValue = '';
  61386. }
  61387. }
  61388. }
  61389. public function getCompletionType(): string
  61390. {
  61391. return $this->completionType;
  61392. }
  61393. public function getCompletionName(): ?string
  61394. {
  61395. return $this->completionName;
  61396. }
  61397. public function getCompletionValue(): string
  61398. {
  61399. return $this->completionValue;
  61400. }
  61401. public function mustSuggestOptionValuesFor(string $optionName): bool
  61402. {
  61403. return self::TYPE_OPTION_VALUE === $this->getCompletionType() && $optionName === $this->getCompletionName();
  61404. }
  61405. public function mustSuggestArgumentValuesFor(string $argumentName): bool
  61406. {
  61407. return self::TYPE_ARGUMENT_VALUE === $this->getCompletionType() && $argumentName === $this->getCompletionName();
  61408. }
  61409. protected function parseToken(string $token, bool $parseOptions): bool
  61410. {
  61411. try {
  61412. return parent::parseToken($token, $parseOptions);
  61413. } catch (RuntimeException $e) {
  61414. }
  61415. return $parseOptions;
  61416. }
  61417. private function getOptionFromToken(string $optionToken): ?InputOption
  61418. {
  61419. $optionName = ltrim($optionToken, '-');
  61420. if (!$optionName) {
  61421. return null;
  61422. }
  61423. if ('-' === ($optionToken[1] ?? ' ')) {
  61424. return $this->definition->hasOption($optionName) ? $this->definition->getOption($optionName) : null;
  61425. }
  61426. return $this->definition->hasShortcut($optionName[0]) ? $this->definition->getOptionForShortcut($optionName[0]) : null;
  61427. }
  61428. private function getRelevantToken(): string
  61429. {
  61430. return $this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex];
  61431. }
  61432. private function isCursorFree(): bool
  61433. {
  61434. $nrOfTokens = \count($this->tokens);
  61435. if ($this->currentIndex > $nrOfTokens) {
  61436. throw new \LogicException('Current index is invalid, it must be the number of input tokens or one more.');
  61437. }
  61438. return $this->currentIndex >= $nrOfTokens;
  61439. }
  61440. public function __toString()
  61441. {
  61442. $str = '';
  61443. foreach ($this->tokens as $i => $token) {
  61444. $str .= $token;
  61445. if ($this->currentIndex === $i) {
  61446. $str .= '|';
  61447. }
  61448. $str .= ' ';
  61449. }
  61450. if ($this->currentIndex > $i) {
  61451. $str .= '|';
  61452. }
  61453. return rtrim($str);
  61454. }
  61455. }
  61456. <?php
  61457. namespace Symfony\Component\Console\Completion;
  61458. use Symfony\Component\Console\Input\InputOption;
  61459. final class CompletionSuggestions
  61460. {
  61461. private $valueSuggestions = [];
  61462. private $optionSuggestions = [];
  61463. public function suggestValue($value): self
  61464. {
  61465. $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value;
  61466. return $this;
  61467. }
  61468. public function suggestValues(array $values): self
  61469. {
  61470. foreach ($values as $value) {
  61471. $this->suggestValue($value);
  61472. }
  61473. return $this;
  61474. }
  61475. public function suggestOption(InputOption $option): self
  61476. {
  61477. $this->optionSuggestions[] = $option;
  61478. return $this;
  61479. }
  61480. public function suggestOptions(array $options): self
  61481. {
  61482. foreach ($options as $option) {
  61483. $this->suggestOption($option);
  61484. }
  61485. return $this;
  61486. }
  61487. public function getOptionSuggestions(): array
  61488. {
  61489. return $this->optionSuggestions;
  61490. }
  61491. public function getValueSuggestions(): array
  61492. {
  61493. return $this->valueSuggestions;
  61494. }
  61495. }
  61496. <?php
  61497. namespace Symfony\Component\Console\Completion\Output;
  61498. use Symfony\Component\Console\Completion\CompletionSuggestions;
  61499. use Symfony\Component\Console\Output\OutputInterface;
  61500. class BashCompletionOutput implements CompletionOutputInterface
  61501. {
  61502. public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
  61503. {
  61504. $values = $suggestions->getValueSuggestions();
  61505. foreach ($suggestions->getOptionSuggestions() as $option) {
  61506. $values[] = '--'.$option->getName();
  61507. if ($option->isNegatable()) {
  61508. $values[] = '--no-'.$option->getName();
  61509. }
  61510. }
  61511. $output->writeln(implode("\n", $values));
  61512. }
  61513. }
  61514. <?php
  61515. namespace Symfony\Component\Console\Completion\Output;
  61516. use Symfony\Component\Console\Completion\CompletionSuggestions;
  61517. use Symfony\Component\Console\Output\OutputInterface;
  61518. interface CompletionOutputInterface
  61519. {
  61520. public function write(CompletionSuggestions $suggestions, OutputInterface $output): void;
  61521. }
  61522. <?php
  61523. namespace Symfony\Component\Console\Completion;
  61524. class Suggestion
  61525. {
  61526. private $value;
  61527. public function __construct(string $value)
  61528. {
  61529. $this->value = $value;
  61530. }
  61531. public function getValue(): string
  61532. {
  61533. return $this->value;
  61534. }
  61535. public function __toString(): string
  61536. {
  61537. return $this->getValue();
  61538. }
  61539. }
  61540. <?php
  61541. namespace Symfony\Component\Console;
  61542. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  61543. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  61544. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  61545. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  61546. final class ConsoleEvents
  61547. {
  61548. public const COMMAND = 'console.command';
  61549. public const SIGNAL = 'console.signal';
  61550. public const TERMINATE = 'console.terminate';
  61551. public const ERROR = 'console.error';
  61552. public const ALIASES = [
  61553. ConsoleCommandEvent::class => self::COMMAND,
  61554. ConsoleErrorEvent::class => self::ERROR,
  61555. ConsoleSignalEvent::class => self::SIGNAL,
  61556. ConsoleTerminateEvent::class => self::TERMINATE,
  61557. ];
  61558. }
  61559. <?php
  61560. namespace Symfony\Component\Console;
  61561. use Symfony\Component\Console\Output\OutputInterface;
  61562. final class Cursor
  61563. {
  61564. private $output;
  61565. private $input;
  61566. public function __construct(OutputInterface $output, $input = null)
  61567. {
  61568. $this->output = $output;
  61569. $this->input = $input ?? (\defined('STDIN') ? \STDIN : fopen('php://input', 'r+'));
  61570. }
  61571. public function moveUp(int $lines = 1): self
  61572. {
  61573. $this->output->write(sprintf("\x1b[%dA", $lines));
  61574. return $this;
  61575. }
  61576. public function moveDown(int $lines = 1): self
  61577. {
  61578. $this->output->write(sprintf("\x1b[%dB", $lines));
  61579. return $this;
  61580. }
  61581. public function moveRight(int $columns = 1): self
  61582. {
  61583. $this->output->write(sprintf("\x1b[%dC", $columns));
  61584. return $this;
  61585. }
  61586. public function moveLeft(int $columns = 1): self
  61587. {
  61588. $this->output->write(sprintf("\x1b[%dD", $columns));
  61589. return $this;
  61590. }
  61591. public function moveToColumn(int $column): self
  61592. {
  61593. $this->output->write(sprintf("\x1b[%dG", $column));
  61594. return $this;
  61595. }
  61596. public function moveToPosition(int $column, int $row): self
  61597. {
  61598. $this->output->write(sprintf("\x1b[%d;%dH", $row + 1, $column));
  61599. return $this;
  61600. }
  61601. public function savePosition(): self
  61602. {
  61603. $this->output->write("\x1b7");
  61604. return $this;
  61605. }
  61606. public function restorePosition(): self
  61607. {
  61608. $this->output->write("\x1b8");
  61609. return $this;
  61610. }
  61611. public function hide(): self
  61612. {
  61613. $this->output->write("\x1b[?25l");
  61614. return $this;
  61615. }
  61616. public function show(): self
  61617. {
  61618. $this->output->write("\x1b[?25h\x1b[?0c");
  61619. return $this;
  61620. }
  61621. public function clearLine(): self
  61622. {
  61623. $this->output->write("\x1b[2K");
  61624. return $this;
  61625. }
  61626. public function clearLineAfter(): self
  61627. {
  61628. $this->output->write("\x1b[K");
  61629. return $this;
  61630. }
  61631. public function clearOutput(): self
  61632. {
  61633. $this->output->write("\x1b[0J");
  61634. return $this;
  61635. }
  61636. public function clearScreen(): self
  61637. {
  61638. $this->output->write("\x1b[2J");
  61639. return $this;
  61640. }
  61641. public function getCurrentPosition(): array
  61642. {
  61643. static $isTtySupported;
  61644. if (null === $isTtySupported && \function_exists('proc_open')) {
  61645. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
  61646. }
  61647. if (!$isTtySupported) {
  61648. return [1, 1];
  61649. }
  61650. $sttyMode = shell_exec('stty -g');
  61651. shell_exec('stty -icanon -echo');
  61652. @fwrite($this->input, "\033[6n");
  61653. $code = trim(fread($this->input, 1024));
  61654. shell_exec(sprintf('stty %s', $sttyMode));
  61655. sscanf($code, "\033[%d;%dR", $row, $col);
  61656. return [$col, $row];
  61657. }
  61658. }
  61659. <?php
  61660. namespace Symfony\Component\Console\DependencyInjection;
  61661. use Symfony\Component\Console\Command\Command;
  61662. use Symfony\Component\Console\Command\LazyCommand;
  61663. use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
  61664. use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
  61665. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  61666. use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
  61667. use Symfony\Component\DependencyInjection\ContainerBuilder;
  61668. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  61669. use Symfony\Component\DependencyInjection\Reference;
  61670. use Symfony\Component\DependencyInjection\TypedReference;
  61671. class AddConsoleCommandPass implements CompilerPassInterface
  61672. {
  61673. private $commandLoaderServiceId;
  61674. private $commandTag;
  61675. private $noPreloadTag;
  61676. private $privateTagName;
  61677. public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload', string $privateTagName = 'container.private')
  61678. {
  61679. if (0 < \func_num_args()) {
  61680. trigger_deprecation('symfony/console', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
  61681. }
  61682. $this->commandLoaderServiceId = $commandLoaderServiceId;
  61683. $this->commandTag = $commandTag;
  61684. $this->noPreloadTag = $noPreloadTag;
  61685. $this->privateTagName = $privateTagName;
  61686. }
  61687. public function process(ContainerBuilder $container)
  61688. {
  61689. $commandServices = $container->findTaggedServiceIds($this->commandTag, true);
  61690. $lazyCommandMap = [];
  61691. $lazyCommandRefs = [];
  61692. $serviceIds = [];
  61693. foreach ($commandServices as $id => $tags) {
  61694. $definition = $container->getDefinition($id);
  61695. $definition->addTag($this->noPreloadTag);
  61696. $class = $container->getParameterBag()->resolveValue($definition->getClass());
  61697. if (isset($tags[0]['command'])) {
  61698. $aliases = $tags[0]['command'];
  61699. } else {
  61700. if (!$r = $container->getReflectionClass($class)) {
  61701. throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
  61702. }
  61703. if (!$r->isSubclassOf(Command::class)) {
  61704. throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
  61705. }
  61706. $aliases = str_replace('%', '%%', $class::getDefaultName() ?? '');
  61707. }
  61708. $aliases = explode('|', $aliases ?? '');
  61709. $commandName = array_shift($aliases);
  61710. if ($isHidden = '' === $commandName) {
  61711. $commandName = array_shift($aliases);
  61712. }
  61713. if (null === $commandName) {
  61714. if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) {
  61715. $commandId = 'console.command.public_alias.'.$id;
  61716. $container->setAlias($commandId, $id)->setPublic(true);
  61717. $id = $commandId;
  61718. }
  61719. $serviceIds[] = $id;
  61720. continue;
  61721. }
  61722. $description = $tags[0]['description'] ?? null;
  61723. unset($tags[0]);
  61724. $lazyCommandMap[$commandName] = $id;
  61725. $lazyCommandRefs[$id] = new TypedReference($id, $class);
  61726. foreach ($aliases as $alias) {
  61727. $lazyCommandMap[$alias] = $id;
  61728. }
  61729. foreach ($tags as $tag) {
  61730. if (isset($tag['command'])) {
  61731. $aliases[] = $tag['command'];
  61732. $lazyCommandMap[$tag['command']] = $id;
  61733. }
  61734. $description = $description ?? $tag['description'] ?? null;
  61735. }
  61736. $definition->addMethodCall('setName', [$commandName]);
  61737. if ($aliases) {
  61738. $definition->addMethodCall('setAliases', [$aliases]);
  61739. }
  61740. if ($isHidden) {
  61741. $definition->addMethodCall('setHidden', [true]);
  61742. }
  61743. if (!$description) {
  61744. if (!$r = $container->getReflectionClass($class)) {
  61745. throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
  61746. }
  61747. if (!$r->isSubclassOf(Command::class)) {
  61748. throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
  61749. }
  61750. $description = str_replace('%', '%%', $class::getDefaultDescription() ?? '');
  61751. }
  61752. if ($description) {
  61753. $definition->addMethodCall('setDescription', [$description]);
  61754. $container->register('.'.$id.'.lazy', LazyCommand::class)
  61755. ->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]);
  61756. $lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy');
  61757. }
  61758. }
  61759. $container
  61760. ->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
  61761. ->setPublic(true)
  61762. ->addTag($this->noPreloadTag)
  61763. ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
  61764. $container->setParameter('console.command.ids', $serviceIds);
  61765. }
  61766. }
  61767. <?php
  61768. namespace Symfony\Component\Console\Descriptor;
  61769. use Symfony\Component\Console\Application;
  61770. use Symfony\Component\Console\Command\Command;
  61771. use Symfony\Component\Console\Exception\CommandNotFoundException;
  61772. class ApplicationDescription
  61773. {
  61774. public const GLOBAL_NAMESPACE = '_global';
  61775. private $application;
  61776. private $namespace;
  61777. private $showHidden;
  61778. private $namespaces;
  61779. private $commands;
  61780. private $aliases;
  61781. public function __construct(Application $application, ?string $namespace = null, bool $showHidden = false)
  61782. {
  61783. $this->application = $application;
  61784. $this->namespace = $namespace;
  61785. $this->showHidden = $showHidden;
  61786. }
  61787. public function getNamespaces(): array
  61788. {
  61789. if (null === $this->namespaces) {
  61790. $this->inspectApplication();
  61791. }
  61792. return $this->namespaces;
  61793. }
  61794. public function getCommands(): array
  61795. {
  61796. if (null === $this->commands) {
  61797. $this->inspectApplication();
  61798. }
  61799. return $this->commands;
  61800. }
  61801. public function getCommand(string $name): Command
  61802. {
  61803. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  61804. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  61805. }
  61806. return $this->commands[$name] ?? $this->aliases[$name];
  61807. }
  61808. private function inspectApplication()
  61809. {
  61810. $this->commands = [];
  61811. $this->namespaces = [];
  61812. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  61813. foreach ($this->sortCommands($all) as $namespace => $commands) {
  61814. $names = [];
  61815. foreach ($commands as $name => $command) {
  61816. if (!$command->getName() || (!$this->showHidden && $command->isHidden())) {
  61817. continue;
  61818. }
  61819. if ($command->getName() === $name) {
  61820. $this->commands[$name] = $command;
  61821. } else {
  61822. $this->aliases[$name] = $command;
  61823. }
  61824. $names[] = $name;
  61825. }
  61826. $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
  61827. }
  61828. }
  61829. private function sortCommands(array $commands): array
  61830. {
  61831. $namespacedCommands = [];
  61832. $globalCommands = [];
  61833. $sortedCommands = [];
  61834. foreach ($commands as $name => $command) {
  61835. $key = $this->application->extractNamespace($name, 1);
  61836. if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
  61837. $globalCommands[$name] = $command;
  61838. } else {
  61839. $namespacedCommands[$key][$name] = $command;
  61840. }
  61841. }
  61842. if ($globalCommands) {
  61843. ksort($globalCommands);
  61844. $sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
  61845. }
  61846. if ($namespacedCommands) {
  61847. ksort($namespacedCommands, \SORT_STRING);
  61848. foreach ($namespacedCommands as $key => $commandsSet) {
  61849. ksort($commandsSet);
  61850. $sortedCommands[$key] = $commandsSet;
  61851. }
  61852. }
  61853. return $sortedCommands;
  61854. }
  61855. }
  61856. <?php
  61857. namespace Symfony\Component\Console\Descriptor;
  61858. use Symfony\Component\Console\Application;
  61859. use Symfony\Component\Console\Command\Command;
  61860. use Symfony\Component\Console\Exception\InvalidArgumentException;
  61861. use Symfony\Component\Console\Input\InputArgument;
  61862. use Symfony\Component\Console\Input\InputDefinition;
  61863. use Symfony\Component\Console\Input\InputOption;
  61864. use Symfony\Component\Console\Output\OutputInterface;
  61865. abstract class Descriptor implements DescriptorInterface
  61866. {
  61867. protected $output;
  61868. public function describe(OutputInterface $output, object $object, array $options = [])
  61869. {
  61870. $this->output = $output;
  61871. switch (true) {
  61872. case $object instanceof InputArgument:
  61873. $this->describeInputArgument($object, $options);
  61874. break;
  61875. case $object instanceof InputOption:
  61876. $this->describeInputOption($object, $options);
  61877. break;
  61878. case $object instanceof InputDefinition:
  61879. $this->describeInputDefinition($object, $options);
  61880. break;
  61881. case $object instanceof Command:
  61882. $this->describeCommand($object, $options);
  61883. break;
  61884. case $object instanceof Application:
  61885. $this->describeApplication($object, $options);
  61886. break;
  61887. default:
  61888. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
  61889. }
  61890. }
  61891. protected function write(string $content, bool $decorated = false)
  61892. {
  61893. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  61894. }
  61895. abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
  61896. abstract protected function describeInputOption(InputOption $option, array $options = []);
  61897. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
  61898. abstract protected function describeCommand(Command $command, array $options = []);
  61899. abstract protected function describeApplication(Application $application, array $options = []);
  61900. }
  61901. <?php
  61902. namespace Symfony\Component\Console\Descriptor;
  61903. use Symfony\Component\Console\Output\OutputInterface;
  61904. interface DescriptorInterface
  61905. {
  61906. public function describe(OutputInterface $output, object $object, array $options = []);
  61907. }
  61908. <?php
  61909. namespace Symfony\Component\Console\Descriptor;
  61910. use Symfony\Component\Console\Application;
  61911. use Symfony\Component\Console\Command\Command;
  61912. use Symfony\Component\Console\Input\InputArgument;
  61913. use Symfony\Component\Console\Input\InputDefinition;
  61914. use Symfony\Component\Console\Input\InputOption;
  61915. class JsonDescriptor extends Descriptor
  61916. {
  61917. protected function describeInputArgument(InputArgument $argument, array $options = [])
  61918. {
  61919. $this->writeData($this->getInputArgumentData($argument), $options);
  61920. }
  61921. protected function describeInputOption(InputOption $option, array $options = [])
  61922. {
  61923. $this->writeData($this->getInputOptionData($option), $options);
  61924. if ($option->isNegatable()) {
  61925. $this->writeData($this->getInputOptionData($option, true), $options);
  61926. }
  61927. }
  61928. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  61929. {
  61930. $this->writeData($this->getInputDefinitionData($definition), $options);
  61931. }
  61932. protected function describeCommand(Command $command, array $options = [])
  61933. {
  61934. $this->writeData($this->getCommandData($command, $options['short'] ?? false), $options);
  61935. }
  61936. protected function describeApplication(Application $application, array $options = [])
  61937. {
  61938. $describedNamespace = $options['namespace'] ?? null;
  61939. $description = new ApplicationDescription($application, $describedNamespace, true);
  61940. $commands = [];
  61941. foreach ($description->getCommands() as $command) {
  61942. $commands[] = $this->getCommandData($command, $options['short'] ?? false);
  61943. }
  61944. $data = [];
  61945. if ('UNKNOWN' !== $application->getName()) {
  61946. $data['application']['name'] = $application->getName();
  61947. if ('UNKNOWN' !== $application->getVersion()) {
  61948. $data['application']['version'] = $application->getVersion();
  61949. }
  61950. }
  61951. $data['commands'] = $commands;
  61952. if ($describedNamespace) {
  61953. $data['namespace'] = $describedNamespace;
  61954. } else {
  61955. $data['namespaces'] = array_values($description->getNamespaces());
  61956. }
  61957. $this->writeData($data, $options);
  61958. }
  61959. private function writeData(array $data, array $options)
  61960. {
  61961. $flags = $options['json_encoding'] ?? 0;
  61962. $this->write(json_encode($data, $flags));
  61963. }
  61964. private function getInputArgumentData(InputArgument $argument): array
  61965. {
  61966. return [
  61967. 'name' => $argument->getName(),
  61968. 'is_required' => $argument->isRequired(),
  61969. 'is_array' => $argument->isArray(),
  61970. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  61971. 'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  61972. ];
  61973. }
  61974. private function getInputOptionData(InputOption $option, bool $negated = false): array
  61975. {
  61976. return $negated ? [
  61977. 'name' => '--no-'.$option->getName(),
  61978. 'shortcut' => '',
  61979. 'accept_value' => false,
  61980. 'is_value_required' => false,
  61981. 'is_multiple' => false,
  61982. 'description' => 'Negate the "--'.$option->getName().'" option',
  61983. 'default' => false,
  61984. ] : [
  61985. 'name' => '--'.$option->getName(),
  61986. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  61987. 'accept_value' => $option->acceptValue(),
  61988. 'is_value_required' => $option->isValueRequired(),
  61989. 'is_multiple' => $option->isArray(),
  61990. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  61991. 'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  61992. ];
  61993. }
  61994. private function getInputDefinitionData(InputDefinition $definition): array
  61995. {
  61996. $inputArguments = [];
  61997. foreach ($definition->getArguments() as $name => $argument) {
  61998. $inputArguments[$name] = $this->getInputArgumentData($argument);
  61999. }
  62000. $inputOptions = [];
  62001. foreach ($definition->getOptions() as $name => $option) {
  62002. $inputOptions[$name] = $this->getInputOptionData($option);
  62003. if ($option->isNegatable()) {
  62004. $inputOptions['no-'.$name] = $this->getInputOptionData($option, true);
  62005. }
  62006. }
  62007. return ['arguments' => $inputArguments, 'options' => $inputOptions];
  62008. }
  62009. private function getCommandData(Command $command, bool $short = false): array
  62010. {
  62011. $data = [
  62012. 'name' => $command->getName(),
  62013. 'description' => $command->getDescription(),
  62014. ];
  62015. if ($short) {
  62016. $data += [
  62017. 'usage' => $command->getAliases(),
  62018. ];
  62019. } else {
  62020. $command->mergeApplicationDefinition(false);
  62021. $data += [
  62022. 'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()),
  62023. 'help' => $command->getProcessedHelp(),
  62024. 'definition' => $this->getInputDefinitionData($command->getDefinition()),
  62025. ];
  62026. }
  62027. $data['hidden'] = $command->isHidden();
  62028. return $data;
  62029. }
  62030. }
  62031. <?php
  62032. namespace Symfony\Component\Console\Descriptor;
  62033. use Symfony\Component\Console\Application;
  62034. use Symfony\Component\Console\Command\Command;
  62035. use Symfony\Component\Console\Helper\Helper;
  62036. use Symfony\Component\Console\Input\InputArgument;
  62037. use Symfony\Component\Console\Input\InputDefinition;
  62038. use Symfony\Component\Console\Input\InputOption;
  62039. use Symfony\Component\Console\Output\OutputInterface;
  62040. class MarkdownDescriptor extends Descriptor
  62041. {
  62042. public function describe(OutputInterface $output, object $object, array $options = [])
  62043. {
  62044. $decorated = $output->isDecorated();
  62045. $output->setDecorated(false);
  62046. parent::describe($output, $object, $options);
  62047. $output->setDecorated($decorated);
  62048. }
  62049. protected function write(string $content, bool $decorated = true)
  62050. {
  62051. parent::write($content, $decorated);
  62052. }
  62053. protected function describeInputArgument(InputArgument $argument, array $options = [])
  62054. {
  62055. $this->write(
  62056. '#### `'.($argument->getName() ?: '<none>')."`\n\n"
  62057. .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
  62058. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  62059. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  62060. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  62061. );
  62062. }
  62063. protected function describeInputOption(InputOption $option, array $options = [])
  62064. {
  62065. $name = '--'.$option->getName();
  62066. if ($option->isNegatable()) {
  62067. $name .= '|--no-'.$option->getName();
  62068. }
  62069. if ($option->getShortcut()) {
  62070. $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
  62071. }
  62072. $this->write(
  62073. '#### `'.$name.'`'."\n\n"
  62074. .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
  62075. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  62076. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  62077. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  62078. .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
  62079. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  62080. );
  62081. }
  62082. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  62083. {
  62084. if ($showArguments = \count($definition->getArguments()) > 0) {
  62085. $this->write('### Arguments');
  62086. foreach ($definition->getArguments() as $argument) {
  62087. $this->write("\n\n");
  62088. if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
  62089. $this->write($describeInputArgument);
  62090. }
  62091. }
  62092. }
  62093. if (\count($definition->getOptions()) > 0) {
  62094. if ($showArguments) {
  62095. $this->write("\n\n");
  62096. }
  62097. $this->write('### Options');
  62098. foreach ($definition->getOptions() as $option) {
  62099. $this->write("\n\n");
  62100. if (null !== $describeInputOption = $this->describeInputOption($option)) {
  62101. $this->write($describeInputOption);
  62102. }
  62103. }
  62104. }
  62105. }
  62106. protected function describeCommand(Command $command, array $options = [])
  62107. {
  62108. if ($options['short'] ?? false) {
  62109. $this->write(
  62110. '`'.$command->getName()."`\n"
  62111. .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
  62112. .($command->getDescription() ? $command->getDescription()."\n\n" : '')
  62113. .'### Usage'."\n\n"
  62114. .array_reduce($command->getAliases(), function ($carry, $usage) {
  62115. return $carry.'* `'.$usage.'`'."\n";
  62116. })
  62117. );
  62118. return;
  62119. }
  62120. $command->mergeApplicationDefinition(false);
  62121. $this->write(
  62122. '`'.$command->getName()."`\n"
  62123. .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
  62124. .($command->getDescription() ? $command->getDescription()."\n\n" : '')
  62125. .'### Usage'."\n\n"
  62126. .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  62127. return $carry.'* `'.$usage.'`'."\n";
  62128. })
  62129. );
  62130. if ($help = $command->getProcessedHelp()) {
  62131. $this->write("\n");
  62132. $this->write($help);
  62133. }
  62134. $definition = $command->getDefinition();
  62135. if ($definition->getOptions() || $definition->getArguments()) {
  62136. $this->write("\n\n");
  62137. $this->describeInputDefinition($definition);
  62138. }
  62139. }
  62140. protected function describeApplication(Application $application, array $options = [])
  62141. {
  62142. $describedNamespace = $options['namespace'] ?? null;
  62143. $description = new ApplicationDescription($application, $describedNamespace);
  62144. $title = $this->getApplicationTitle($application);
  62145. $this->write($title."\n".str_repeat('=', Helper::width($title)));
  62146. foreach ($description->getNamespaces() as $namespace) {
  62147. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  62148. $this->write("\n\n");
  62149. $this->write('**'.$namespace['id'].':**');
  62150. }
  62151. $this->write("\n\n");
  62152. $this->write(implode("\n", array_map(function ($commandName) use ($description) {
  62153. return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
  62154. }, $namespace['commands'])));
  62155. }
  62156. foreach ($description->getCommands() as $command) {
  62157. $this->write("\n\n");
  62158. if (null !== $describeCommand = $this->describeCommand($command, $options)) {
  62159. $this->write($describeCommand);
  62160. }
  62161. }
  62162. }
  62163. private function getApplicationTitle(Application $application): string
  62164. {
  62165. if ('UNKNOWN' !== $application->getName()) {
  62166. if ('UNKNOWN' !== $application->getVersion()) {
  62167. return sprintf('%s %s', $application->getName(), $application->getVersion());
  62168. }
  62169. return $application->getName();
  62170. }
  62171. return 'Console Tool';
  62172. }
  62173. }
  62174. <?php
  62175. namespace Symfony\Component\Console\Descriptor;
  62176. use Symfony\Component\Console\Application;
  62177. use Symfony\Component\Console\Command\Command;
  62178. use Symfony\Component\Console\Formatter\OutputFormatter;
  62179. use Symfony\Component\Console\Helper\Helper;
  62180. use Symfony\Component\Console\Input\InputArgument;
  62181. use Symfony\Component\Console\Input\InputDefinition;
  62182. use Symfony\Component\Console\Input\InputOption;
  62183. class TextDescriptor extends Descriptor
  62184. {
  62185. protected function describeInputArgument(InputArgument $argument, array $options = [])
  62186. {
  62187. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  62188. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  62189. } else {
  62190. $default = '';
  62191. }
  62192. $totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
  62193. $spacingWidth = $totalWidth - \strlen($argument->getName());
  62194. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  62195. $argument->getName(),
  62196. str_repeat(' ', $spacingWidth),
  62197. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  62198. $default
  62199. ), $options);
  62200. }
  62201. protected function describeInputOption(InputOption $option, array $options = [])
  62202. {
  62203. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  62204. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  62205. } else {
  62206. $default = '';
  62207. }
  62208. $value = '';
  62209. if ($option->acceptValue()) {
  62210. $value = '='.strtoupper($option->getName());
  62211. if ($option->isValueOptional()) {
  62212. $value = '['.$value.']';
  62213. }
  62214. }
  62215. $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
  62216. $synopsis = sprintf('%s%s',
  62217. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  62218. sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
  62219. );
  62220. $spacingWidth = $totalWidth - Helper::width($synopsis);
  62221. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  62222. $synopsis,
  62223. str_repeat(' ', $spacingWidth),
  62224. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  62225. $default,
  62226. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  62227. ), $options);
  62228. }
  62229. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  62230. {
  62231. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  62232. foreach ($definition->getArguments() as $argument) {
  62233. $totalWidth = max($totalWidth, Helper::width($argument->getName()));
  62234. }
  62235. if ($definition->getArguments()) {
  62236. $this->writeText('<comment>Arguments:</comment>', $options);
  62237. $this->writeText("\n");
  62238. foreach ($definition->getArguments() as $argument) {
  62239. $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
  62240. $this->writeText("\n");
  62241. }
  62242. }
  62243. if ($definition->getArguments() && $definition->getOptions()) {
  62244. $this->writeText("\n");
  62245. }
  62246. if ($definition->getOptions()) {
  62247. $laterOptions = [];
  62248. $this->writeText('<comment>Options:</comment>', $options);
  62249. foreach ($definition->getOptions() as $option) {
  62250. if (\strlen($option->getShortcut() ?? '') > 1) {
  62251. $laterOptions[] = $option;
  62252. continue;
  62253. }
  62254. $this->writeText("\n");
  62255. $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
  62256. }
  62257. foreach ($laterOptions as $option) {
  62258. $this->writeText("\n");
  62259. $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
  62260. }
  62261. }
  62262. }
  62263. protected function describeCommand(Command $command, array $options = [])
  62264. {
  62265. $command->mergeApplicationDefinition(false);
  62266. if ($description = $command->getDescription()) {
  62267. $this->writeText('<comment>Description:</comment>', $options);
  62268. $this->writeText("\n");
  62269. $this->writeText(' '.$description);
  62270. $this->writeText("\n\n");
  62271. }
  62272. $this->writeText('<comment>Usage:</comment>', $options);
  62273. foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
  62274. $this->writeText("\n");
  62275. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  62276. }
  62277. $this->writeText("\n");
  62278. $definition = $command->getDefinition();
  62279. if ($definition->getOptions() || $definition->getArguments()) {
  62280. $this->writeText("\n");
  62281. $this->describeInputDefinition($definition, $options);
  62282. $this->writeText("\n");
  62283. }
  62284. $help = $command->getProcessedHelp();
  62285. if ($help && $help !== $description) {
  62286. $this->writeText("\n");
  62287. $this->writeText('<comment>Help:</comment>', $options);
  62288. $this->writeText("\n");
  62289. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  62290. $this->writeText("\n");
  62291. }
  62292. }
  62293. protected function describeApplication(Application $application, array $options = [])
  62294. {
  62295. $describedNamespace = $options['namespace'] ?? null;
  62296. $description = new ApplicationDescription($application, $describedNamespace);
  62297. if (isset($options['raw_text']) && $options['raw_text']) {
  62298. $width = $this->getColumnWidth($description->getCommands());
  62299. foreach ($description->getCommands() as $command) {
  62300. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  62301. $this->writeText("\n");
  62302. }
  62303. } else {
  62304. if ('' != $help = $application->getHelp()) {
  62305. $this->writeText("$help\n\n", $options);
  62306. }
  62307. $this->writeText("<comment>Usage:</comment>\n", $options);
  62308. $this->writeText(" command [options] [arguments]\n\n", $options);
  62309. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  62310. $this->writeText("\n");
  62311. $this->writeText("\n");
  62312. $commands = $description->getCommands();
  62313. $namespaces = $description->getNamespaces();
  62314. if ($describedNamespace && $namespaces) {
  62315. $describedNamespaceInfo = reset($namespaces);
  62316. foreach ($describedNamespaceInfo['commands'] as $name) {
  62317. $commands[$name] = $description->getCommand($name);
  62318. }
  62319. }
  62320. $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
  62321. return array_intersect($namespace['commands'], array_keys($commands));
  62322. }, array_values($namespaces)))));
  62323. if ($describedNamespace) {
  62324. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  62325. } else {
  62326. $this->writeText('<comment>Available commands:</comment>', $options);
  62327. }
  62328. foreach ($namespaces as $namespace) {
  62329. $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
  62330. return isset($commands[$name]);
  62331. });
  62332. if (!$namespace['commands']) {
  62333. continue;
  62334. }
  62335. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  62336. $this->writeText("\n");
  62337. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  62338. }
  62339. foreach ($namespace['commands'] as $name) {
  62340. $this->writeText("\n");
  62341. $spacingWidth = $width - Helper::width($name);
  62342. $command = $commands[$name];
  62343. $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
  62344. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
  62345. }
  62346. }
  62347. $this->writeText("\n");
  62348. }
  62349. }
  62350. private function writeText(string $content, array $options = [])
  62351. {
  62352. $this->write(
  62353. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  62354. isset($options['raw_output']) ? !$options['raw_output'] : true
  62355. );
  62356. }
  62357. private function getCommandAliasesText(Command $command): string
  62358. {
  62359. $text = '';
  62360. $aliases = $command->getAliases();
  62361. if ($aliases) {
  62362. $text = '['.implode('|', $aliases).'] ';
  62363. }
  62364. return $text;
  62365. }
  62366. private function formatDefaultValue($default): string
  62367. {
  62368. if (\INF === $default) {
  62369. return 'INF';
  62370. }
  62371. if (\is_string($default)) {
  62372. $default = OutputFormatter::escape($default);
  62373. } elseif (\is_array($default)) {
  62374. foreach ($default as $key => $value) {
  62375. if (\is_string($value)) {
  62376. $default[$key] = OutputFormatter::escape($value);
  62377. }
  62378. }
  62379. }
  62380. return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
  62381. }
  62382. private function getColumnWidth(array $commands): int
  62383. {
  62384. $widths = [];
  62385. foreach ($commands as $command) {
  62386. if ($command instanceof Command) {
  62387. $widths[] = Helper::width($command->getName());
  62388. foreach ($command->getAliases() as $alias) {
  62389. $widths[] = Helper::width($alias);
  62390. }
  62391. } else {
  62392. $widths[] = Helper::width($command);
  62393. }
  62394. }
  62395. return $widths ? max($widths) + 2 : 0;
  62396. }
  62397. private function calculateTotalWidthForOptions(array $options): int
  62398. {
  62399. $totalWidth = 0;
  62400. foreach ($options as $option) {
  62401. $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
  62402. if ($option->isNegatable()) {
  62403. $nameLength += 6 + Helper::width($option->getName());
  62404. } elseif ($option->acceptValue()) {
  62405. $valueLength = 1 + Helper::width($option->getName());
  62406. $valueLength += $option->isValueOptional() ? 2 : 0;
  62407. $nameLength += $valueLength;
  62408. }
  62409. $totalWidth = max($totalWidth, $nameLength);
  62410. }
  62411. return $totalWidth;
  62412. }
  62413. }
  62414. <?php
  62415. namespace Symfony\Component\Console\Descriptor;
  62416. use Symfony\Component\Console\Application;
  62417. use Symfony\Component\Console\Command\Command;
  62418. use Symfony\Component\Console\Input\InputArgument;
  62419. use Symfony\Component\Console\Input\InputDefinition;
  62420. use Symfony\Component\Console\Input\InputOption;
  62421. class XmlDescriptor extends Descriptor
  62422. {
  62423. public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
  62424. {
  62425. $dom = new \DOMDocument('1.0', 'UTF-8');
  62426. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  62427. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  62428. foreach ($definition->getArguments() as $argument) {
  62429. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  62430. }
  62431. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  62432. foreach ($definition->getOptions() as $option) {
  62433. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  62434. }
  62435. return $dom;
  62436. }
  62437. public function getCommandDocument(Command $command, bool $short = false): \DOMDocument
  62438. {
  62439. $dom = new \DOMDocument('1.0', 'UTF-8');
  62440. $dom->appendChild($commandXML = $dom->createElement('command'));
  62441. $commandXML->setAttribute('id', $command->getName());
  62442. $commandXML->setAttribute('name', $command->getName());
  62443. $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);
  62444. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  62445. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  62446. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  62447. if ($short) {
  62448. foreach ($command->getAliases() as $usage) {
  62449. $usagesXML->appendChild($dom->createElement('usage', $usage));
  62450. }
  62451. } else {
  62452. $command->mergeApplicationDefinition(false);
  62453. foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
  62454. $usagesXML->appendChild($dom->createElement('usage', $usage));
  62455. }
  62456. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  62457. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  62458. $definitionXML = $this->getInputDefinitionDocument($command->getDefinition());
  62459. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  62460. }
  62461. return $dom;
  62462. }
  62463. public function getApplicationDocument(Application $application, ?string $namespace = null, bool $short = false): \DOMDocument
  62464. {
  62465. $dom = new \DOMDocument('1.0', 'UTF-8');
  62466. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  62467. if ('UNKNOWN' !== $application->getName()) {
  62468. $rootXml->setAttribute('name', $application->getName());
  62469. if ('UNKNOWN' !== $application->getVersion()) {
  62470. $rootXml->setAttribute('version', $application->getVersion());
  62471. }
  62472. }
  62473. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  62474. $description = new ApplicationDescription($application, $namespace, true);
  62475. if ($namespace) {
  62476. $commandsXML->setAttribute('namespace', $namespace);
  62477. }
  62478. foreach ($description->getCommands() as $command) {
  62479. $this->appendDocument($commandsXML, $this->getCommandDocument($command, $short));
  62480. }
  62481. if (!$namespace) {
  62482. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  62483. foreach ($description->getNamespaces() as $namespaceDescription) {
  62484. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  62485. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  62486. foreach ($namespaceDescription['commands'] as $name) {
  62487. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  62488. $commandXML->appendChild($dom->createTextNode($name));
  62489. }
  62490. }
  62491. }
  62492. return $dom;
  62493. }
  62494. protected function describeInputArgument(InputArgument $argument, array $options = [])
  62495. {
  62496. $this->writeDocument($this->getInputArgumentDocument($argument));
  62497. }
  62498. protected function describeInputOption(InputOption $option, array $options = [])
  62499. {
  62500. $this->writeDocument($this->getInputOptionDocument($option));
  62501. }
  62502. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  62503. {
  62504. $this->writeDocument($this->getInputDefinitionDocument($definition));
  62505. }
  62506. protected function describeCommand(Command $command, array $options = [])
  62507. {
  62508. $this->writeDocument($this->getCommandDocument($command, $options['short'] ?? false));
  62509. }
  62510. protected function describeApplication(Application $application, array $options = [])
  62511. {
  62512. $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? false));
  62513. }
  62514. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  62515. {
  62516. foreach ($importedParent->childNodes as $childNode) {
  62517. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  62518. }
  62519. }
  62520. private function writeDocument(\DOMDocument $dom)
  62521. {
  62522. $dom->formatOutput = true;
  62523. $this->write($dom->saveXML());
  62524. }
  62525. private function getInputArgumentDocument(InputArgument $argument): \DOMDocument
  62526. {
  62527. $dom = new \DOMDocument('1.0', 'UTF-8');
  62528. $dom->appendChild($objectXML = $dom->createElement('argument'));
  62529. $objectXML->setAttribute('name', $argument->getName());
  62530. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  62531. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  62532. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  62533. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  62534. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  62535. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
  62536. foreach ($defaults as $default) {
  62537. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  62538. $defaultXML->appendChild($dom->createTextNode($default));
  62539. }
  62540. return $dom;
  62541. }
  62542. private function getInputOptionDocument(InputOption $option): \DOMDocument
  62543. {
  62544. $dom = new \DOMDocument('1.0', 'UTF-8');
  62545. $dom->appendChild($objectXML = $dom->createElement('option'));
  62546. $objectXML->setAttribute('name', '--'.$option->getName());
  62547. $pos = strpos($option->getShortcut() ?? '', '|');
  62548. if (false !== $pos) {
  62549. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  62550. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  62551. } else {
  62552. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  62553. }
  62554. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  62555. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  62556. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  62557. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  62558. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  62559. if ($option->acceptValue()) {
  62560. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
  62561. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  62562. if (!empty($defaults)) {
  62563. foreach ($defaults as $default) {
  62564. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  62565. $defaultXML->appendChild($dom->createTextNode($default));
  62566. }
  62567. }
  62568. }
  62569. if ($option->isNegatable()) {
  62570. $dom->appendChild($objectXML = $dom->createElement('option'));
  62571. $objectXML->setAttribute('name', '--no-'.$option->getName());
  62572. $objectXML->setAttribute('shortcut', '');
  62573. $objectXML->setAttribute('accept_value', 0);
  62574. $objectXML->setAttribute('is_value_required', 0);
  62575. $objectXML->setAttribute('is_multiple', 0);
  62576. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  62577. $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option'));
  62578. }
  62579. return $dom;
  62580. }
  62581. }
  62582. <?php
  62583. namespace Symfony\Component\Console\Event;
  62584. final class ConsoleCommandEvent extends ConsoleEvent
  62585. {
  62586. public const RETURN_CODE_DISABLED = 113;
  62587. private $commandShouldRun = true;
  62588. public function disableCommand(): bool
  62589. {
  62590. return $this->commandShouldRun = false;
  62591. }
  62592. public function enableCommand(): bool
  62593. {
  62594. return $this->commandShouldRun = true;
  62595. }
  62596. public function commandShouldRun(): bool
  62597. {
  62598. return $this->commandShouldRun;
  62599. }
  62600. }
  62601. <?php
  62602. namespace Symfony\Component\Console\Event;
  62603. use Symfony\Component\Console\Command\Command;
  62604. use Symfony\Component\Console\Input\InputInterface;
  62605. use Symfony\Component\Console\Output\OutputInterface;
  62606. final class ConsoleErrorEvent extends ConsoleEvent
  62607. {
  62608. private $error;
  62609. private $exitCode;
  62610. public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, ?Command $command = null)
  62611. {
  62612. parent::__construct($command, $input, $output);
  62613. $this->error = $error;
  62614. }
  62615. public function getError(): \Throwable
  62616. {
  62617. return $this->error;
  62618. }
  62619. public function setError(\Throwable $error): void
  62620. {
  62621. $this->error = $error;
  62622. }
  62623. public function setExitCode(int $exitCode): void
  62624. {
  62625. $this->exitCode = $exitCode;
  62626. $r = new \ReflectionProperty($this->error, 'code');
  62627. $r->setAccessible(true);
  62628. $r->setValue($this->error, $this->exitCode);
  62629. }
  62630. public function getExitCode(): int
  62631. {
  62632. return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
  62633. }
  62634. }
  62635. <?php
  62636. namespace Symfony\Component\Console\Event;
  62637. use Symfony\Component\Console\Command\Command;
  62638. use Symfony\Component\Console\Input\InputInterface;
  62639. use Symfony\Component\Console\Output\OutputInterface;
  62640. use Symfony\Contracts\EventDispatcher\Event;
  62641. class ConsoleEvent extends Event
  62642. {
  62643. protected $command;
  62644. private $input;
  62645. private $output;
  62646. public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
  62647. {
  62648. $this->command = $command;
  62649. $this->input = $input;
  62650. $this->output = $output;
  62651. }
  62652. public function getCommand()
  62653. {
  62654. return $this->command;
  62655. }
  62656. public function getInput()
  62657. {
  62658. return $this->input;
  62659. }
  62660. public function getOutput()
  62661. {
  62662. return $this->output;
  62663. }
  62664. }
  62665. <?php
  62666. namespace Symfony\Component\Console\Event;
  62667. use Symfony\Component\Console\Command\Command;
  62668. use Symfony\Component\Console\Input\InputInterface;
  62669. use Symfony\Component\Console\Output\OutputInterface;
  62670. final class ConsoleSignalEvent extends ConsoleEvent
  62671. {
  62672. private $handlingSignal;
  62673. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
  62674. {
  62675. parent::__construct($command, $input, $output);
  62676. $this->handlingSignal = $handlingSignal;
  62677. }
  62678. public function getHandlingSignal(): int
  62679. {
  62680. return $this->handlingSignal;
  62681. }
  62682. }
  62683. <?php
  62684. namespace Symfony\Component\Console\Event;
  62685. use Symfony\Component\Console\Command\Command;
  62686. use Symfony\Component\Console\Input\InputInterface;
  62687. use Symfony\Component\Console\Output\OutputInterface;
  62688. final class ConsoleTerminateEvent extends ConsoleEvent
  62689. {
  62690. private $exitCode;
  62691. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
  62692. {
  62693. parent::__construct($command, $input, $output);
  62694. $this->setExitCode($exitCode);
  62695. }
  62696. public function setExitCode(int $exitCode): void
  62697. {
  62698. $this->exitCode = $exitCode;
  62699. }
  62700. public function getExitCode(): int
  62701. {
  62702. return $this->exitCode;
  62703. }
  62704. }
  62705. <?php
  62706. namespace Symfony\Component\Console\EventListener;
  62707. use Psr\Log\LoggerInterface;
  62708. use Symfony\Component\Console\ConsoleEvents;
  62709. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  62710. use Symfony\Component\Console\Event\ConsoleEvent;
  62711. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  62712. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  62713. class ErrorListener implements EventSubscriberInterface
  62714. {
  62715. private $logger;
  62716. public function __construct(?LoggerInterface $logger = null)
  62717. {
  62718. $this->logger = $logger;
  62719. }
  62720. public function onConsoleError(ConsoleErrorEvent $event)
  62721. {
  62722. if (null === $this->logger) {
  62723. return;
  62724. }
  62725. $error = $event->getError();
  62726. if (!$inputString = $this->getInputString($event)) {
  62727. $this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
  62728. return;
  62729. }
  62730. $this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
  62731. }
  62732. public function onConsoleTerminate(ConsoleTerminateEvent $event)
  62733. {
  62734. if (null === $this->logger) {
  62735. return;
  62736. }
  62737. $exitCode = $event->getExitCode();
  62738. if (0 === $exitCode) {
  62739. return;
  62740. }
  62741. if (!$inputString = $this->getInputString($event)) {
  62742. $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
  62743. return;
  62744. }
  62745. $this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
  62746. }
  62747. public static function getSubscribedEvents()
  62748. {
  62749. return [
  62750. ConsoleEvents::ERROR => ['onConsoleError', -128],
  62751. ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128],
  62752. ];
  62753. }
  62754. private static function getInputString(ConsoleEvent $event): ?string
  62755. {
  62756. $commandName = $event->getCommand() ? $event->getCommand()->getName() : null;
  62757. $input = $event->getInput();
  62758. if (method_exists($input, '__toString')) {
  62759. if ($commandName) {
  62760. return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input);
  62761. }
  62762. return (string) $input;
  62763. }
  62764. return $commandName;
  62765. }
  62766. }
  62767. <?php
  62768. namespace Symfony\Component\Console\Exception;
  62769. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  62770. {
  62771. private $alternatives;
  62772. public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
  62773. {
  62774. parent::__construct($message, $code, $previous);
  62775. $this->alternatives = $alternatives;
  62776. }
  62777. public function getAlternatives()
  62778. {
  62779. return $this->alternatives;
  62780. }
  62781. }
  62782. <?php
  62783. namespace Symfony\Component\Console\Exception;
  62784. interface ExceptionInterface extends \Throwable
  62785. {
  62786. }
  62787. <?php
  62788. namespace Symfony\Component\Console\Exception;
  62789. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  62790. {
  62791. }
  62792. <?php
  62793. namespace Symfony\Component\Console\Exception;
  62794. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  62795. {
  62796. }
  62797. <?php
  62798. namespace Symfony\Component\Console\Exception;
  62799. class LogicException extends \LogicException implements ExceptionInterface
  62800. {
  62801. }
  62802. <?php
  62803. namespace Symfony\Component\Console\Exception;
  62804. class MissingInputException extends RuntimeException implements ExceptionInterface
  62805. {
  62806. }
  62807. <?php
  62808. namespace Symfony\Component\Console\Exception;
  62809. class NamespaceNotFoundException extends CommandNotFoundException
  62810. {
  62811. }
  62812. <?php
  62813. namespace Symfony\Component\Console\Exception;
  62814. class RuntimeException extends \RuntimeException implements ExceptionInterface
  62815. {
  62816. }
  62817. <?php
  62818. namespace Symfony\Component\Console\Formatter;
  62819. final class NullOutputFormatter implements OutputFormatterInterface
  62820. {
  62821. private $style;
  62822. public function format(?string $message): ?string
  62823. {
  62824. return null;
  62825. }
  62826. public function getStyle(string $name): OutputFormatterStyleInterface
  62827. {
  62828. return $this->style ?? $this->style = new NullOutputFormatterStyle();
  62829. }
  62830. public function hasStyle(string $name): bool
  62831. {
  62832. return false;
  62833. }
  62834. public function isDecorated(): bool
  62835. {
  62836. return false;
  62837. }
  62838. public function setDecorated(bool $decorated): void
  62839. {
  62840. }
  62841. public function setStyle(string $name, OutputFormatterStyleInterface $style): void
  62842. {
  62843. }
  62844. }
  62845. <?php
  62846. namespace Symfony\Component\Console\Formatter;
  62847. final class NullOutputFormatterStyle implements OutputFormatterStyleInterface
  62848. {
  62849. public function apply(string $text): string
  62850. {
  62851. return $text;
  62852. }
  62853. public function setBackground(?string $color = null): void
  62854. {
  62855. }
  62856. public function setForeground(?string $color = null): void
  62857. {
  62858. }
  62859. public function setOption(string $option): void
  62860. {
  62861. }
  62862. public function setOptions(array $options): void
  62863. {
  62864. }
  62865. public function unsetOption(string $option): void
  62866. {
  62867. }
  62868. }
  62869. <?php
  62870. namespace Symfony\Component\Console\Formatter;
  62871. use Symfony\Component\Console\Exception\InvalidArgumentException;
  62872. use function Symfony\Component\String\b;
  62873. class OutputFormatter implements WrappableOutputFormatterInterface
  62874. {
  62875. private $decorated;
  62876. private $styles = [];
  62877. private $styleStack;
  62878. public function __clone()
  62879. {
  62880. $this->styleStack = clone $this->styleStack;
  62881. foreach ($this->styles as $key => $value) {
  62882. $this->styles[$key] = clone $value;
  62883. }
  62884. }
  62885. public static function escape(string $text)
  62886. {
  62887. $text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text);
  62888. return self::escapeTrailingBackslash($text);
  62889. }
  62890. public static function escapeTrailingBackslash(string $text): string
  62891. {
  62892. if (str_ends_with($text, '\\')) {
  62893. $len = \strlen($text);
  62894. $text = rtrim($text, '\\');
  62895. $text = str_replace("\0", '', $text);
  62896. $text .= str_repeat("\0", $len - \strlen($text));
  62897. }
  62898. return $text;
  62899. }
  62900. public function __construct(bool $decorated = false, array $styles = [])
  62901. {
  62902. $this->decorated = $decorated;
  62903. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  62904. $this->setStyle('info', new OutputFormatterStyle('green'));
  62905. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  62906. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  62907. foreach ($styles as $name => $style) {
  62908. $this->setStyle($name, $style);
  62909. }
  62910. $this->styleStack = new OutputFormatterStyleStack();
  62911. }
  62912. public function setDecorated(bool $decorated)
  62913. {
  62914. $this->decorated = $decorated;
  62915. }
  62916. public function isDecorated()
  62917. {
  62918. return $this->decorated;
  62919. }
  62920. public function setStyle(string $name, OutputFormatterStyleInterface $style)
  62921. {
  62922. $this->styles[strtolower($name)] = $style;
  62923. }
  62924. public function hasStyle(string $name)
  62925. {
  62926. return isset($this->styles[strtolower($name)]);
  62927. }
  62928. public function getStyle(string $name)
  62929. {
  62930. if (!$this->hasStyle($name)) {
  62931. throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
  62932. }
  62933. return $this->styles[strtolower($name)];
  62934. }
  62935. public function format(?string $message)
  62936. {
  62937. return $this->formatAndWrap($message, 0);
  62938. }
  62939. public function formatAndWrap(?string $message, int $width)
  62940. {
  62941. if (null === $message) {
  62942. return '';
  62943. }
  62944. $offset = 0;
  62945. $output = '';
  62946. $openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
  62947. $closeTagRegex = '[a-z][^<>]*+';
  62948. $currentLineLength = 0;
  62949. preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
  62950. foreach ($matches[0] as $i => $match) {
  62951. $pos = $match[1];
  62952. $text = $match[0];
  62953. if (0 != $pos && '\\' == $message[$pos - 1]) {
  62954. continue;
  62955. }
  62956. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength);
  62957. $offset = $pos + \strlen($text);
  62958. if ($open = '/' != $text[1]) {
  62959. $tag = $matches[1][$i][0];
  62960. } else {
  62961. $tag = $matches[3][$i][0] ?? '';
  62962. }
  62963. if (!$open && !$tag) {
  62964. $this->styleStack->pop();
  62965. } elseif (null === $style = $this->createStyleFromString($tag)) {
  62966. $output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
  62967. } elseif ($open) {
  62968. $this->styleStack->push($style);
  62969. } else {
  62970. $this->styleStack->pop($style);
  62971. }
  62972. }
  62973. $output .= $this->applyCurrentStyle(substr($message, $offset), $output, $width, $currentLineLength);
  62974. return strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']);
  62975. }
  62976. public function getStyleStack()
  62977. {
  62978. return $this->styleStack;
  62979. }
  62980. private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
  62981. {
  62982. if (isset($this->styles[$string])) {
  62983. return $this->styles[$string];
  62984. }
  62985. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
  62986. return null;
  62987. }
  62988. $style = new OutputFormatterStyle();
  62989. foreach ($matches as $match) {
  62990. array_shift($match);
  62991. $match[0] = strtolower($match[0]);
  62992. if ('fg' == $match[0]) {
  62993. $style->setForeground(strtolower($match[1]));
  62994. } elseif ('bg' == $match[0]) {
  62995. $style->setBackground(strtolower($match[1]));
  62996. } elseif ('href' === $match[0]) {
  62997. $url = preg_replace('{\\\\([<>])}', '$1', $match[1]);
  62998. $style->setHref($url);
  62999. } elseif ('options' === $match[0]) {
  63000. preg_match_all('([^,;]+)', strtolower($match[1]), $options);
  63001. $options = array_shift($options);
  63002. foreach ($options as $option) {
  63003. $style->setOption($option);
  63004. }
  63005. } else {
  63006. return null;
  63007. }
  63008. }
  63009. return $style;
  63010. }
  63011. private function applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength): string
  63012. {
  63013. if ('' === $text) {
  63014. return '';
  63015. }
  63016. if (!$width) {
  63017. return $this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text;
  63018. }
  63019. if (!$currentLineLength && '' !== $current) {
  63020. $text = ltrim($text);
  63021. }
  63022. if ($currentLineLength) {
  63023. $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n";
  63024. $text = substr($text, $i);
  63025. } else {
  63026. $prefix = '';
  63027. }
  63028. preg_match('~(\\n)$~', $text, $matches);
  63029. $text = $prefix.$this->addLineBreaks($text, $width);
  63030. $text = rtrim($text, "\n").($matches[1] ?? '');
  63031. if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) {
  63032. $text = "\n".$text;
  63033. }
  63034. $lines = explode("\n", $text);
  63035. foreach ($lines as $line) {
  63036. $currentLineLength += \strlen($line);
  63037. if ($width <= $currentLineLength) {
  63038. $currentLineLength = 0;
  63039. }
  63040. }
  63041. if ($this->isDecorated()) {
  63042. foreach ($lines as $i => $line) {
  63043. $lines[$i] = $this->styleStack->getCurrent()->apply($line);
  63044. }
  63045. }
  63046. return implode("\n", $lines);
  63047. }
  63048. private function addLineBreaks(string $text, int $width): string
  63049. {
  63050. $encoding = mb_detect_encoding($text, null, true) ?: 'UTF-8';
  63051. return b($text)->toCodePointString($encoding)->wordwrap($width, "\n", true)->toByteString($encoding);
  63052. }
  63053. }
  63054. <?php
  63055. namespace Symfony\Component\Console\Formatter;
  63056. interface OutputFormatterInterface
  63057. {
  63058. public function setDecorated(bool $decorated);
  63059. public function isDecorated();
  63060. public function setStyle(string $name, OutputFormatterStyleInterface $style);
  63061. public function hasStyle(string $name);
  63062. public function getStyle(string $name);
  63063. public function format(?string $message);
  63064. }
  63065. <?php
  63066. namespace Symfony\Component\Console\Formatter;
  63067. use Symfony\Component\Console\Color;
  63068. class OutputFormatterStyle implements OutputFormatterStyleInterface
  63069. {
  63070. private $color;
  63071. private $foreground;
  63072. private $background;
  63073. private $options;
  63074. private $href;
  63075. private $handlesHrefGracefully;
  63076. public function __construct(?string $foreground = null, ?string $background = null, array $options = [])
  63077. {
  63078. $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
  63079. }
  63080. public function setForeground(?string $color = null)
  63081. {
  63082. $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
  63083. }
  63084. public function setBackground(?string $color = null)
  63085. {
  63086. $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
  63087. }
  63088. public function setHref(string $url): void
  63089. {
  63090. $this->href = $url;
  63091. }
  63092. public function setOption(string $option)
  63093. {
  63094. $this->options[] = $option;
  63095. $this->color = new Color($this->foreground, $this->background, $this->options);
  63096. }
  63097. public function unsetOption(string $option)
  63098. {
  63099. $pos = array_search($option, $this->options);
  63100. if (false !== $pos) {
  63101. unset($this->options[$pos]);
  63102. }
  63103. $this->color = new Color($this->foreground, $this->background, $this->options);
  63104. }
  63105. public function setOptions(array $options)
  63106. {
  63107. $this->color = new Color($this->foreground, $this->background, $this->options = $options);
  63108. }
  63109. public function apply(string $text)
  63110. {
  63111. if (null === $this->handlesHrefGracefully) {
  63112. $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
  63113. && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100)
  63114. && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']);
  63115. }
  63116. if (null !== $this->href && $this->handlesHrefGracefully) {
  63117. $text = "\033]8;;$this->href\033\\$text\033]8;;\033\\";
  63118. }
  63119. return $this->color->apply($text);
  63120. }
  63121. }
  63122. <?php
  63123. namespace Symfony\Component\Console\Formatter;
  63124. interface OutputFormatterStyleInterface
  63125. {
  63126. public function setForeground(?string $color = null);
  63127. public function setBackground(?string $color = null);
  63128. public function setOption(string $option);
  63129. public function unsetOption(string $option);
  63130. public function setOptions(array $options);
  63131. public function apply(string $text);
  63132. }
  63133. <?php
  63134. namespace Symfony\Component\Console\Formatter;
  63135. use Symfony\Component\Console\Exception\InvalidArgumentException;
  63136. use Symfony\Contracts\Service\ResetInterface;
  63137. class OutputFormatterStyleStack implements ResetInterface
  63138. {
  63139. private $styles;
  63140. private $emptyStyle;
  63141. public function __construct(?OutputFormatterStyleInterface $emptyStyle = null)
  63142. {
  63143. $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
  63144. $this->reset();
  63145. }
  63146. public function reset()
  63147. {
  63148. $this->styles = [];
  63149. }
  63150. public function push(OutputFormatterStyleInterface $style)
  63151. {
  63152. $this->styles[] = $style;
  63153. }
  63154. public function pop(?OutputFormatterStyleInterface $style = null)
  63155. {
  63156. if (empty($this->styles)) {
  63157. return $this->emptyStyle;
  63158. }
  63159. if (null === $style) {
  63160. return array_pop($this->styles);
  63161. }
  63162. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  63163. if ($style->apply('') === $stackedStyle->apply('')) {
  63164. $this->styles = \array_slice($this->styles, 0, $index);
  63165. return $stackedStyle;
  63166. }
  63167. }
  63168. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  63169. }
  63170. public function getCurrent()
  63171. {
  63172. if (empty($this->styles)) {
  63173. return $this->emptyStyle;
  63174. }
  63175. return $this->styles[\count($this->styles) - 1];
  63176. }
  63177. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  63178. {
  63179. $this->emptyStyle = $emptyStyle;
  63180. return $this;
  63181. }
  63182. public function getEmptyStyle()
  63183. {
  63184. return $this->emptyStyle;
  63185. }
  63186. }
  63187. <?php
  63188. namespace Symfony\Component\Console\Formatter;
  63189. interface WrappableOutputFormatterInterface extends OutputFormatterInterface
  63190. {
  63191. public function formatAndWrap(?string $message, int $width);
  63192. }
  63193. <?php
  63194. namespace Symfony\Component\Console\Helper;
  63195. class DebugFormatterHelper extends Helper
  63196. {
  63197. private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
  63198. private $started = [];
  63199. private $count = -1;
  63200. public function start(string $id, string $message, string $prefix = 'RUN')
  63201. {
  63202. $this->started[$id] = ['border' => ++$this->count % \count(self::COLORS)];
  63203. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  63204. }
  63205. public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR')
  63206. {
  63207. $message = '';
  63208. if ($error) {
  63209. if (isset($this->started[$id]['out'])) {
  63210. $message .= "\n";
  63211. unset($this->started[$id]['out']);
  63212. }
  63213. if (!isset($this->started[$id]['err'])) {
  63214. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  63215. $this->started[$id]['err'] = true;
  63216. }
  63217. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  63218. } else {
  63219. if (isset($this->started[$id]['err'])) {
  63220. $message .= "\n";
  63221. unset($this->started[$id]['err']);
  63222. }
  63223. if (!isset($this->started[$id]['out'])) {
  63224. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  63225. $this->started[$id]['out'] = true;
  63226. }
  63227. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  63228. }
  63229. return $message;
  63230. }
  63231. public function stop(string $id, string $message, bool $successful, string $prefix = 'RES')
  63232. {
  63233. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  63234. if ($successful) {
  63235. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  63236. }
  63237. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  63238. unset($this->started[$id]['out'], $this->started[$id]['err']);
  63239. return $message;
  63240. }
  63241. private function getBorder(string $id): string
  63242. {
  63243. return sprintf('<bg=%s> </>', self::COLORS[$this->started[$id]['border']]);
  63244. }
  63245. public function getName()
  63246. {
  63247. return 'debug_formatter';
  63248. }
  63249. }
  63250. <?php
  63251. namespace Symfony\Component\Console\Helper;
  63252. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  63253. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  63254. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  63255. use Symfony\Component\Console\Descriptor\TextDescriptor;
  63256. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  63257. use Symfony\Component\Console\Exception\InvalidArgumentException;
  63258. use Symfony\Component\Console\Output\OutputInterface;
  63259. class DescriptorHelper extends Helper
  63260. {
  63261. private $descriptors = [];
  63262. public function __construct()
  63263. {
  63264. $this
  63265. ->register('txt', new TextDescriptor())
  63266. ->register('xml', new XmlDescriptor())
  63267. ->register('json', new JsonDescriptor())
  63268. ->register('md', new MarkdownDescriptor())
  63269. ;
  63270. }
  63271. public function describe(OutputInterface $output, ?object $object, array $options = [])
  63272. {
  63273. $options = array_merge([
  63274. 'raw_text' => false,
  63275. 'format' => 'txt',
  63276. ], $options);
  63277. if (!isset($this->descriptors[$options['format']])) {
  63278. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  63279. }
  63280. $descriptor = $this->descriptors[$options['format']];
  63281. $descriptor->describe($output, $object, $options);
  63282. }
  63283. public function register(string $format, DescriptorInterface $descriptor)
  63284. {
  63285. $this->descriptors[$format] = $descriptor;
  63286. return $this;
  63287. }
  63288. public function getName()
  63289. {
  63290. return 'descriptor';
  63291. }
  63292. public function getFormats(): array
  63293. {
  63294. return array_keys($this->descriptors);
  63295. }
  63296. }
  63297. <?php
  63298. namespace Symfony\Component\Console\Helper;
  63299. use Symfony\Component\Console\Output\OutputInterface;
  63300. use Symfony\Component\VarDumper\Cloner\ClonerInterface;
  63301. use Symfony\Component\VarDumper\Cloner\VarCloner;
  63302. use Symfony\Component\VarDumper\Dumper\CliDumper;
  63303. final class Dumper
  63304. {
  63305. private $output;
  63306. private $dumper;
  63307. private $cloner;
  63308. private $handler;
  63309. public function __construct(OutputInterface $output, ?CliDumper $dumper = null, ?ClonerInterface $cloner = null)
  63310. {
  63311. $this->output = $output;
  63312. $this->dumper = $dumper;
  63313. $this->cloner = $cloner;
  63314. if (class_exists(CliDumper::class)) {
  63315. $this->handler = function ($var): string {
  63316. $dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
  63317. $dumper->setColors($this->output->isDecorated());
  63318. return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
  63319. };
  63320. } else {
  63321. $this->handler = function ($var): string {
  63322. switch (true) {
  63323. case null === $var:
  63324. return 'null';
  63325. case true === $var:
  63326. return 'true';
  63327. case false === $var:
  63328. return 'false';
  63329. case \is_string($var):
  63330. return '"'.$var.'"';
  63331. default:
  63332. return rtrim(print_r($var, true));
  63333. }
  63334. };
  63335. }
  63336. }
  63337. public function __invoke($var): string
  63338. {
  63339. return ($this->handler)($var);
  63340. }
  63341. }
  63342. <?php
  63343. namespace Symfony\Component\Console\Helper;
  63344. use Symfony\Component\Console\Formatter\OutputFormatter;
  63345. class FormatterHelper extends Helper
  63346. {
  63347. public function formatSection(string $section, string $message, string $style = 'info')
  63348. {
  63349. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  63350. }
  63351. public function formatBlock($messages, string $style, bool $large = false)
  63352. {
  63353. if (!\is_array($messages)) {
  63354. $messages = [$messages];
  63355. }
  63356. $len = 0;
  63357. $lines = [];
  63358. foreach ($messages as $message) {
  63359. $message = OutputFormatter::escape($message);
  63360. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  63361. $len = max(self::width($message) + ($large ? 4 : 2), $len);
  63362. }
  63363. $messages = $large ? [str_repeat(' ', $len)] : [];
  63364. for ($i = 0; isset($lines[$i]); ++$i) {
  63365. $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i]));
  63366. }
  63367. if ($large) {
  63368. $messages[] = str_repeat(' ', $len);
  63369. }
  63370. for ($i = 0; isset($messages[$i]); ++$i) {
  63371. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  63372. }
  63373. return implode("\n", $messages);
  63374. }
  63375. public function truncate(string $message, int $length, string $suffix = '...')
  63376. {
  63377. $computedLength = $length - self::width($suffix);
  63378. if ($computedLength > self::width($message)) {
  63379. return $message;
  63380. }
  63381. return self::substr($message, 0, $length).$suffix;
  63382. }
  63383. public function getName()
  63384. {
  63385. return 'formatter';
  63386. }
  63387. }
  63388. <?php
  63389. namespace Symfony\Component\Console\Helper;
  63390. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  63391. use Symfony\Component\String\UnicodeString;
  63392. abstract class Helper implements HelperInterface
  63393. {
  63394. protected $helperSet = null;
  63395. public function setHelperSet(?HelperSet $helperSet = null)
  63396. {
  63397. $this->helperSet = $helperSet;
  63398. }
  63399. public function getHelperSet()
  63400. {
  63401. return $this->helperSet;
  63402. }
  63403. public static function strlen(?string $string)
  63404. {
  63405. trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::width() or Helper::length() instead.', __METHOD__);
  63406. return self::width($string);
  63407. }
  63408. public static function width(?string $string): int
  63409. {
  63410. $string ?? $string = '';
  63411. if (preg_match('//u', $string)) {
  63412. return (new UnicodeString($string))->width(false);
  63413. }
  63414. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  63415. return \strlen($string);
  63416. }
  63417. return mb_strwidth($string, $encoding);
  63418. }
  63419. public static function length(?string $string): int
  63420. {
  63421. $string ?? $string = '';
  63422. if (preg_match('//u', $string)) {
  63423. return (new UnicodeString($string))->length();
  63424. }
  63425. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  63426. return \strlen($string);
  63427. }
  63428. return mb_strlen($string, $encoding);
  63429. }
  63430. public static function substr(?string $string, int $from, ?int $length = null)
  63431. {
  63432. $string ?? $string = '';
  63433. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  63434. return substr($string, $from, $length);
  63435. }
  63436. return mb_substr($string, $from, $length, $encoding);
  63437. }
  63438. public static function formatTime($secs)
  63439. {
  63440. static $timeFormats = [
  63441. [0, '< 1 sec'],
  63442. [1, '1 sec'],
  63443. [2, 'secs', 1],
  63444. [60, '1 min'],
  63445. [120, 'mins', 60],
  63446. [3600, '1 hr'],
  63447. [7200, 'hrs', 3600],
  63448. [86400, '1 day'],
  63449. [172800, 'days', 86400],
  63450. ];
  63451. foreach ($timeFormats as $index => $format) {
  63452. if ($secs >= $format[0]) {
  63453. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  63454. || $index == \count($timeFormats) - 1
  63455. ) {
  63456. if (2 == \count($format)) {
  63457. return $format[1];
  63458. }
  63459. return floor($secs / $format[2]).' '.$format[1];
  63460. }
  63461. }
  63462. }
  63463. }
  63464. public static function formatMemory(int $memory)
  63465. {
  63466. if ($memory >= 1024 * 1024 * 1024) {
  63467. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  63468. }
  63469. if ($memory >= 1024 * 1024) {
  63470. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  63471. }
  63472. if ($memory >= 1024) {
  63473. return sprintf('%d KiB', $memory / 1024);
  63474. }
  63475. return sprintf('%d B', $memory);
  63476. }
  63477. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string)
  63478. {
  63479. trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::removeDecoration() instead.', __METHOD__);
  63480. return self::width(self::removeDecoration($formatter, $string));
  63481. }
  63482. public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
  63483. {
  63484. $isDecorated = $formatter->isDecorated();
  63485. $formatter->setDecorated(false);
  63486. $string = $formatter->format($string ?? '');
  63487. $string = preg_replace("/\033\[[^m]*m/", '', $string ?? '');
  63488. $string = preg_replace('/\\033]8;[^;]*;[^\\033]*\\033\\\\/', '', $string ?? '');
  63489. $formatter->setDecorated($isDecorated);
  63490. return $string;
  63491. }
  63492. }
  63493. <?php
  63494. namespace Symfony\Component\Console\Helper;
  63495. interface HelperInterface
  63496. {
  63497. public function setHelperSet(?HelperSet $helperSet = null);
  63498. public function getHelperSet();
  63499. public function getName();
  63500. }
  63501. <?php
  63502. namespace Symfony\Component\Console\Helper;
  63503. use Symfony\Component\Console\Command\Command;
  63504. use Symfony\Component\Console\Exception\InvalidArgumentException;
  63505. class HelperSet implements \IteratorAggregate
  63506. {
  63507. private $helpers = [];
  63508. private $command;
  63509. public function __construct(array $helpers = [])
  63510. {
  63511. foreach ($helpers as $alias => $helper) {
  63512. $this->set($helper, \is_int($alias) ? null : $alias);
  63513. }
  63514. }
  63515. public function set(HelperInterface $helper, ?string $alias = null)
  63516. {
  63517. $this->helpers[$helper->getName()] = $helper;
  63518. if (null !== $alias) {
  63519. $this->helpers[$alias] = $helper;
  63520. }
  63521. $helper->setHelperSet($this);
  63522. }
  63523. public function has(string $name)
  63524. {
  63525. return isset($this->helpers[$name]);
  63526. }
  63527. public function get(string $name)
  63528. {
  63529. if (!$this->has($name)) {
  63530. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  63531. }
  63532. return $this->helpers[$name];
  63533. }
  63534. public function setCommand(?Command $command = null)
  63535. {
  63536. trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
  63537. $this->command = $command;
  63538. }
  63539. public function getCommand()
  63540. {
  63541. trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
  63542. return $this->command;
  63543. }
  63544. #[\ReturnTypeWillChange]
  63545. public function getIterator()
  63546. {
  63547. return new \ArrayIterator($this->helpers);
  63548. }
  63549. }
  63550. <?php
  63551. namespace Symfony\Component\Console\Helper;
  63552. use Symfony\Component\Console\Input\InputAwareInterface;
  63553. use Symfony\Component\Console\Input\InputInterface;
  63554. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  63555. {
  63556. protected $input;
  63557. public function setInput(InputInterface $input)
  63558. {
  63559. $this->input = $input;
  63560. }
  63561. }
  63562. <?php
  63563. namespace Symfony\Component\Console\Helper;
  63564. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  63565. use Symfony\Component\Console\Output\OutputInterface;
  63566. use Symfony\Component\Process\Exception\ProcessFailedException;
  63567. use Symfony\Component\Process\Process;
  63568. class ProcessHelper extends Helper
  63569. {
  63570. public function run(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
  63571. {
  63572. if (!class_exists(Process::class)) {
  63573. throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
  63574. }
  63575. if ($output instanceof ConsoleOutputInterface) {
  63576. $output = $output->getErrorOutput();
  63577. }
  63578. $formatter = $this->getHelperSet()->get('debug_formatter');
  63579. if ($cmd instanceof Process) {
  63580. $cmd = [$cmd];
  63581. }
  63582. if (!\is_array($cmd)) {
  63583. throw new \TypeError(sprintf('The "command" argument of "%s()" must be an array or a "%s" instance, "%s" given.', __METHOD__, Process::class, get_debug_type($cmd)));
  63584. }
  63585. if (\is_string($cmd[0] ?? null)) {
  63586. $process = new Process($cmd);
  63587. $cmd = [];
  63588. } elseif (($cmd[0] ?? null) instanceof Process) {
  63589. $process = $cmd[0];
  63590. unset($cmd[0]);
  63591. } else {
  63592. throw new \InvalidArgumentException(sprintf('Invalid command provided to "%s()": the command should be an array whose first element is either the path to the binary to run or a "Process" object.', __METHOD__));
  63593. }
  63594. if ($verbosity <= $output->getVerbosity()) {
  63595. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  63596. }
  63597. if ($output->isDebug()) {
  63598. $callback = $this->wrapCallback($output, $process, $callback);
  63599. }
  63600. $process->run($callback, $cmd);
  63601. if ($verbosity <= $output->getVerbosity()) {
  63602. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  63603. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  63604. }
  63605. if (!$process->isSuccessful() && null !== $error) {
  63606. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  63607. }
  63608. return $process;
  63609. }
  63610. public function mustRun(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null): Process
  63611. {
  63612. $process = $this->run($output, $cmd, $error, $callback);
  63613. if (!$process->isSuccessful()) {
  63614. throw new ProcessFailedException($process);
  63615. }
  63616. return $process;
  63617. }
  63618. public function wrapCallback(OutputInterface $output, Process $process, ?callable $callback = null): callable
  63619. {
  63620. if ($output instanceof ConsoleOutputInterface) {
  63621. $output = $output->getErrorOutput();
  63622. }
  63623. $formatter = $this->getHelperSet()->get('debug_formatter');
  63624. return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
  63625. $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
  63626. if (null !== $callback) {
  63627. $callback($type, $buffer);
  63628. }
  63629. };
  63630. }
  63631. private function escapeString(string $str): string
  63632. {
  63633. return str_replace('<', '\\<', $str);
  63634. }
  63635. public function getName(): string
  63636. {
  63637. return 'process';
  63638. }
  63639. }
  63640. <?php
  63641. namespace Symfony\Component\Console\Helper;
  63642. use Symfony\Component\Console\Cursor;
  63643. use Symfony\Component\Console\Exception\LogicException;
  63644. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  63645. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  63646. use Symfony\Component\Console\Output\OutputInterface;
  63647. use Symfony\Component\Console\Terminal;
  63648. final class ProgressBar
  63649. {
  63650. public const FORMAT_VERBOSE = 'verbose';
  63651. public const FORMAT_VERY_VERBOSE = 'very_verbose';
  63652. public const FORMAT_DEBUG = 'debug';
  63653. public const FORMAT_NORMAL = 'normal';
  63654. private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax';
  63655. private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
  63656. private const FORMAT_DEBUG_NOMAX = 'debug_nomax';
  63657. private const FORMAT_NORMAL_NOMAX = 'normal_nomax';
  63658. private $barWidth = 28;
  63659. private $barChar;
  63660. private $emptyBarChar = '-';
  63661. private $progressChar = '>';
  63662. private $format;
  63663. private $internalFormat;
  63664. private $redrawFreq = 1;
  63665. private $writeCount;
  63666. private $lastWriteTime;
  63667. private $minSecondsBetweenRedraws = 0;
  63668. private $maxSecondsBetweenRedraws = 1;
  63669. private $output;
  63670. private $step = 0;
  63671. private $max;
  63672. private $startTime;
  63673. private $stepWidth;
  63674. private $percent = 0.0;
  63675. private $messages = [];
  63676. private $overwrite = true;
  63677. private $terminal;
  63678. private $previousMessage;
  63679. private $cursor;
  63680. private static $formatters;
  63681. private static $formats;
  63682. public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25)
  63683. {
  63684. if ($output instanceof ConsoleOutputInterface) {
  63685. $output = $output->getErrorOutput();
  63686. }
  63687. $this->output = $output;
  63688. $this->setMaxSteps($max);
  63689. $this->terminal = new Terminal();
  63690. if (0 < $minSecondsBetweenRedraws) {
  63691. $this->redrawFreq = null;
  63692. $this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws;
  63693. }
  63694. if (!$this->output->isDecorated()) {
  63695. $this->overwrite = false;
  63696. $this->redrawFreq = null;
  63697. }
  63698. $this->startTime = time();
  63699. $this->cursor = new Cursor($output);
  63700. }
  63701. public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
  63702. {
  63703. if (!self::$formatters) {
  63704. self::$formatters = self::initPlaceholderFormatters();
  63705. }
  63706. self::$formatters[$name] = $callable;
  63707. }
  63708. public static function getPlaceholderFormatterDefinition(string $name): ?callable
  63709. {
  63710. if (!self::$formatters) {
  63711. self::$formatters = self::initPlaceholderFormatters();
  63712. }
  63713. return self::$formatters[$name] ?? null;
  63714. }
  63715. public static function setFormatDefinition(string $name, string $format): void
  63716. {
  63717. if (!self::$formats) {
  63718. self::$formats = self::initFormats();
  63719. }
  63720. self::$formats[$name] = $format;
  63721. }
  63722. public static function getFormatDefinition(string $name): ?string
  63723. {
  63724. if (!self::$formats) {
  63725. self::$formats = self::initFormats();
  63726. }
  63727. return self::$formats[$name] ?? null;
  63728. }
  63729. public function setMessage(string $message, string $name = 'message')
  63730. {
  63731. $this->messages[$name] = $message;
  63732. }
  63733. public function getMessage(string $name = 'message')
  63734. {
  63735. return $this->messages[$name];
  63736. }
  63737. public function getStartTime(): int
  63738. {
  63739. return $this->startTime;
  63740. }
  63741. public function getMaxSteps(): int
  63742. {
  63743. return $this->max;
  63744. }
  63745. public function getProgress(): int
  63746. {
  63747. return $this->step;
  63748. }
  63749. private function getStepWidth(): int
  63750. {
  63751. return $this->stepWidth;
  63752. }
  63753. public function getProgressPercent(): float
  63754. {
  63755. return $this->percent;
  63756. }
  63757. public function getBarOffset(): float
  63758. {
  63759. return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
  63760. }
  63761. public function getEstimated(): float
  63762. {
  63763. if (!$this->step) {
  63764. return 0;
  63765. }
  63766. return round((time() - $this->startTime) / $this->step * $this->max);
  63767. }
  63768. public function getRemaining(): float
  63769. {
  63770. if (!$this->step) {
  63771. return 0;
  63772. }
  63773. return round((time() - $this->startTime) / $this->step * ($this->max - $this->step));
  63774. }
  63775. public function setBarWidth(int $size)
  63776. {
  63777. $this->barWidth = max(1, $size);
  63778. }
  63779. public function getBarWidth(): int
  63780. {
  63781. return $this->barWidth;
  63782. }
  63783. public function setBarCharacter(string $char)
  63784. {
  63785. $this->barChar = $char;
  63786. }
  63787. public function getBarCharacter(): string
  63788. {
  63789. return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar);
  63790. }
  63791. public function setEmptyBarCharacter(string $char)
  63792. {
  63793. $this->emptyBarChar = $char;
  63794. }
  63795. public function getEmptyBarCharacter(): string
  63796. {
  63797. return $this->emptyBarChar;
  63798. }
  63799. public function setProgressCharacter(string $char)
  63800. {
  63801. $this->progressChar = $char;
  63802. }
  63803. public function getProgressCharacter(): string
  63804. {
  63805. return $this->progressChar;
  63806. }
  63807. public function setFormat(string $format)
  63808. {
  63809. $this->format = null;
  63810. $this->internalFormat = $format;
  63811. }
  63812. public function setRedrawFrequency(?int $freq)
  63813. {
  63814. $this->redrawFreq = null !== $freq ? max(1, $freq) : null;
  63815. }
  63816. public function minSecondsBetweenRedraws(float $seconds): void
  63817. {
  63818. $this->minSecondsBetweenRedraws = $seconds;
  63819. }
  63820. public function maxSecondsBetweenRedraws(float $seconds): void
  63821. {
  63822. $this->maxSecondsBetweenRedraws = $seconds;
  63823. }
  63824. public function iterate(iterable $iterable, ?int $max = null): iterable
  63825. {
  63826. $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
  63827. foreach ($iterable as $key => $value) {
  63828. yield $key => $value;
  63829. $this->advance();
  63830. }
  63831. $this->finish();
  63832. }
  63833. public function start(?int $max = null)
  63834. {
  63835. $this->startTime = time();
  63836. $this->step = 0;
  63837. $this->percent = 0.0;
  63838. if (null !== $max) {
  63839. $this->setMaxSteps($max);
  63840. }
  63841. $this->display();
  63842. }
  63843. public function advance(int $step = 1)
  63844. {
  63845. $this->setProgress($this->step + $step);
  63846. }
  63847. public function setOverwrite(bool $overwrite)
  63848. {
  63849. $this->overwrite = $overwrite;
  63850. }
  63851. public function setProgress(int $step)
  63852. {
  63853. if ($this->max && $step > $this->max) {
  63854. $this->max = $step;
  63855. } elseif ($step < 0) {
  63856. $step = 0;
  63857. }
  63858. $redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10);
  63859. $prevPeriod = (int) ($this->step / $redrawFreq);
  63860. $currPeriod = (int) ($step / $redrawFreq);
  63861. $this->step = $step;
  63862. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  63863. $timeInterval = microtime(true) - $this->lastWriteTime;
  63864. if ($this->max === $step) {
  63865. $this->display();
  63866. return;
  63867. }
  63868. if ($timeInterval < $this->minSecondsBetweenRedraws) {
  63869. return;
  63870. }
  63871. if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) {
  63872. $this->display();
  63873. }
  63874. }
  63875. public function setMaxSteps(int $max)
  63876. {
  63877. $this->format = null;
  63878. $this->max = max(0, $max);
  63879. $this->stepWidth = $this->max ? Helper::width((string) $this->max) : 4;
  63880. }
  63881. public function finish(): void
  63882. {
  63883. if (!$this->max) {
  63884. $this->max = $this->step;
  63885. }
  63886. if ($this->step === $this->max && !$this->overwrite) {
  63887. return;
  63888. }
  63889. $this->setProgress($this->max);
  63890. }
  63891. public function display(): void
  63892. {
  63893. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  63894. return;
  63895. }
  63896. if (null === $this->format) {
  63897. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  63898. }
  63899. $this->overwrite($this->buildLine());
  63900. }
  63901. public function clear(): void
  63902. {
  63903. if (!$this->overwrite) {
  63904. return;
  63905. }
  63906. if (null === $this->format) {
  63907. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  63908. }
  63909. $this->overwrite('');
  63910. }
  63911. private function setRealFormat(string $format)
  63912. {
  63913. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  63914. $this->format = self::getFormatDefinition($format.'_nomax');
  63915. } elseif (null !== self::getFormatDefinition($format)) {
  63916. $this->format = self::getFormatDefinition($format);
  63917. } else {
  63918. $this->format = $format;
  63919. }
  63920. }
  63921. private function overwrite(string $message): void
  63922. {
  63923. if ($this->previousMessage === $message) {
  63924. return;
  63925. }
  63926. $originalMessage = $message;
  63927. if ($this->overwrite) {
  63928. if (null !== $this->previousMessage) {
  63929. if ($this->output instanceof ConsoleSectionOutput) {
  63930. $messageLines = explode("\n", $this->previousMessage);
  63931. $lineCount = \count($messageLines);
  63932. foreach ($messageLines as $messageLine) {
  63933. $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine));
  63934. if ($messageLineLength > $this->terminal->getWidth()) {
  63935. $lineCount += floor($messageLineLength / $this->terminal->getWidth());
  63936. }
  63937. }
  63938. $this->output->clear($lineCount);
  63939. } else {
  63940. $lineCount = substr_count($this->previousMessage, "\n");
  63941. for ($i = 0; $i < $lineCount; ++$i) {
  63942. $this->cursor->moveToColumn(1);
  63943. $this->cursor->clearLine();
  63944. $this->cursor->moveUp();
  63945. }
  63946. $this->cursor->moveToColumn(1);
  63947. $this->cursor->clearLine();
  63948. }
  63949. }
  63950. } elseif ($this->step > 0) {
  63951. $message = \PHP_EOL.$message;
  63952. }
  63953. $this->previousMessage = $originalMessage;
  63954. $this->lastWriteTime = microtime(true);
  63955. $this->output->write($message);
  63956. ++$this->writeCount;
  63957. }
  63958. private function determineBestFormat(): string
  63959. {
  63960. switch ($this->output->getVerbosity()) {
  63961. case OutputInterface::VERBOSITY_VERBOSE:
  63962. return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX;
  63963. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  63964. return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX;
  63965. case OutputInterface::VERBOSITY_DEBUG:
  63966. return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX;
  63967. default:
  63968. return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX;
  63969. }
  63970. }
  63971. private static function initPlaceholderFormatters(): array
  63972. {
  63973. return [
  63974. 'bar' => function (self $bar, OutputInterface $output) {
  63975. $completeBars = $bar->getBarOffset();
  63976. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  63977. if ($completeBars < $bar->getBarWidth()) {
  63978. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter()));
  63979. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  63980. }
  63981. return $display;
  63982. },
  63983. 'elapsed' => function (self $bar) {
  63984. return Helper::formatTime(time() - $bar->getStartTime());
  63985. },
  63986. 'remaining' => function (self $bar) {
  63987. if (!$bar->getMaxSteps()) {
  63988. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  63989. }
  63990. return Helper::formatTime($bar->getRemaining());
  63991. },
  63992. 'estimated' => function (self $bar) {
  63993. if (!$bar->getMaxSteps()) {
  63994. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  63995. }
  63996. return Helper::formatTime($bar->getEstimated());
  63997. },
  63998. 'memory' => function (self $bar) {
  63999. return Helper::formatMemory(memory_get_usage(true));
  64000. },
  64001. 'current' => function (self $bar) {
  64002. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
  64003. },
  64004. 'max' => function (self $bar) {
  64005. return $bar->getMaxSteps();
  64006. },
  64007. 'percent' => function (self $bar) {
  64008. return floor($bar->getProgressPercent() * 100);
  64009. },
  64010. ];
  64011. }
  64012. private static function initFormats(): array
  64013. {
  64014. return [
  64015. self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%',
  64016. self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]',
  64017. self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  64018. self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
  64019. self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  64020. self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
  64021. self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  64022. self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  64023. ];
  64024. }
  64025. private function buildLine(): string
  64026. {
  64027. $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
  64028. $callback = function ($matches) {
  64029. if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
  64030. $text = $formatter($this, $this->output);
  64031. } elseif (isset($this->messages[$matches[1]])) {
  64032. $text = $this->messages[$matches[1]];
  64033. } else {
  64034. return $matches[0];
  64035. }
  64036. if (isset($matches[2])) {
  64037. $text = sprintf('%'.$matches[2], $text);
  64038. }
  64039. return $text;
  64040. };
  64041. $line = preg_replace_callback($regex, $callback, $this->format);
  64042. $linesLength = array_map(function ($subLine) {
  64043. return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r")));
  64044. }, explode("\n", $line));
  64045. $linesWidth = max($linesLength);
  64046. $terminalWidth = $this->terminal->getWidth();
  64047. if ($linesWidth <= $terminalWidth) {
  64048. return $line;
  64049. }
  64050. $this->setBarWidth($this->barWidth - $linesWidth + $terminalWidth);
  64051. return preg_replace_callback($regex, $callback, $this->format);
  64052. }
  64053. }
  64054. <?php
  64055. namespace Symfony\Component\Console\Helper;
  64056. use Symfony\Component\Console\Exception\InvalidArgumentException;
  64057. use Symfony\Component\Console\Exception\LogicException;
  64058. use Symfony\Component\Console\Output\OutputInterface;
  64059. class ProgressIndicator
  64060. {
  64061. private const FORMATS = [
  64062. 'normal' => ' %indicator% %message%',
  64063. 'normal_no_ansi' => ' %message%',
  64064. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  64065. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  64066. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  64067. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  64068. ];
  64069. private $output;
  64070. private $startTime;
  64071. private $format;
  64072. private $message;
  64073. private $indicatorValues;
  64074. private $indicatorCurrent;
  64075. private $indicatorChangeInterval;
  64076. private $indicatorUpdateTime;
  64077. private $started = false;
  64078. private static $formatters;
  64079. public function __construct(OutputInterface $output, ?string $format = null, int $indicatorChangeInterval = 100, ?array $indicatorValues = null)
  64080. {
  64081. $this->output = $output;
  64082. if (null === $format) {
  64083. $format = $this->determineBestFormat();
  64084. }
  64085. if (null === $indicatorValues) {
  64086. $indicatorValues = ['-', '\\', '|', '/'];
  64087. }
  64088. $indicatorValues = array_values($indicatorValues);
  64089. if (2 > \count($indicatorValues)) {
  64090. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  64091. }
  64092. $this->format = self::getFormatDefinition($format);
  64093. $this->indicatorChangeInterval = $indicatorChangeInterval;
  64094. $this->indicatorValues = $indicatorValues;
  64095. $this->startTime = time();
  64096. }
  64097. public function setMessage(?string $message)
  64098. {
  64099. $this->message = $message;
  64100. $this->display();
  64101. }
  64102. public function start(string $message)
  64103. {
  64104. if ($this->started) {
  64105. throw new LogicException('Progress indicator already started.');
  64106. }
  64107. $this->message = $message;
  64108. $this->started = true;
  64109. $this->startTime = time();
  64110. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  64111. $this->indicatorCurrent = 0;
  64112. $this->display();
  64113. }
  64114. public function advance()
  64115. {
  64116. if (!$this->started) {
  64117. throw new LogicException('Progress indicator has not yet been started.');
  64118. }
  64119. if (!$this->output->isDecorated()) {
  64120. return;
  64121. }
  64122. $currentTime = $this->getCurrentTimeInMilliseconds();
  64123. if ($currentTime < $this->indicatorUpdateTime) {
  64124. return;
  64125. }
  64126. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  64127. ++$this->indicatorCurrent;
  64128. $this->display();
  64129. }
  64130. public function finish(string $message)
  64131. {
  64132. if (!$this->started) {
  64133. throw new LogicException('Progress indicator has not yet been started.');
  64134. }
  64135. $this->message = $message;
  64136. $this->display();
  64137. $this->output->writeln('');
  64138. $this->started = false;
  64139. }
  64140. public static function getFormatDefinition(string $name)
  64141. {
  64142. return self::FORMATS[$name] ?? null;
  64143. }
  64144. public static function setPlaceholderFormatterDefinition(string $name, callable $callable)
  64145. {
  64146. if (!self::$formatters) {
  64147. self::$formatters = self::initPlaceholderFormatters();
  64148. }
  64149. self::$formatters[$name] = $callable;
  64150. }
  64151. public static function getPlaceholderFormatterDefinition(string $name)
  64152. {
  64153. if (!self::$formatters) {
  64154. self::$formatters = self::initPlaceholderFormatters();
  64155. }
  64156. return self::$formatters[$name] ?? null;
  64157. }
  64158. private function display()
  64159. {
  64160. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  64161. return;
  64162. }
  64163. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
  64164. if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) {
  64165. return $formatter($this);
  64166. }
  64167. return $matches[0];
  64168. }, $this->format ?? ''));
  64169. }
  64170. private function determineBestFormat(): string
  64171. {
  64172. switch ($this->output->getVerbosity()) {
  64173. case OutputInterface::VERBOSITY_VERBOSE:
  64174. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  64175. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  64176. case OutputInterface::VERBOSITY_DEBUG:
  64177. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  64178. default:
  64179. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  64180. }
  64181. }
  64182. private function overwrite(string $message)
  64183. {
  64184. if ($this->output->isDecorated()) {
  64185. $this->output->write("\x0D\x1B[2K");
  64186. $this->output->write($message);
  64187. } else {
  64188. $this->output->writeln($message);
  64189. }
  64190. }
  64191. private function getCurrentTimeInMilliseconds(): float
  64192. {
  64193. return round(microtime(true) * 1000);
  64194. }
  64195. private static function initPlaceholderFormatters(): array
  64196. {
  64197. return [
  64198. 'indicator' => function (self $indicator) {
  64199. return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)];
  64200. },
  64201. 'message' => function (self $indicator) {
  64202. return $indicator->message;
  64203. },
  64204. 'elapsed' => function (self $indicator) {
  64205. return Helper::formatTime(time() - $indicator->startTime);
  64206. },
  64207. 'memory' => function () {
  64208. return Helper::formatMemory(memory_get_usage(true));
  64209. },
  64210. ];
  64211. }
  64212. }
  64213. <?php
  64214. namespace Symfony\Component\Console\Helper;
  64215. use Symfony\Component\Console\Cursor;
  64216. use Symfony\Component\Console\Exception\MissingInputException;
  64217. use Symfony\Component\Console\Exception\RuntimeException;
  64218. use Symfony\Component\Console\Formatter\OutputFormatter;
  64219. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  64220. use Symfony\Component\Console\Input\InputInterface;
  64221. use Symfony\Component\Console\Input\StreamableInputInterface;
  64222. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  64223. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  64224. use Symfony\Component\Console\Output\OutputInterface;
  64225. use Symfony\Component\Console\Question\ChoiceQuestion;
  64226. use Symfony\Component\Console\Question\Question;
  64227. use Symfony\Component\Console\Terminal;
  64228. use function Symfony\Component\String\s;
  64229. class QuestionHelper extends Helper
  64230. {
  64231. private $inputStream;
  64232. private static $stty = true;
  64233. private static $stdinIsInteractive;
  64234. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  64235. {
  64236. if ($output instanceof ConsoleOutputInterface) {
  64237. $output = $output->getErrorOutput();
  64238. }
  64239. if (!$input->isInteractive()) {
  64240. return $this->getDefaultAnswer($question);
  64241. }
  64242. if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
  64243. $this->inputStream = $stream;
  64244. }
  64245. try {
  64246. if (!$question->getValidator()) {
  64247. return $this->doAsk($output, $question);
  64248. }
  64249. $interviewer = function () use ($output, $question) {
  64250. return $this->doAsk($output, $question);
  64251. };
  64252. return $this->validateAttempts($interviewer, $output, $question);
  64253. } catch (MissingInputException $exception) {
  64254. $input->setInteractive(false);
  64255. if (null === $fallbackOutput = $this->getDefaultAnswer($question)) {
  64256. throw $exception;
  64257. }
  64258. return $fallbackOutput;
  64259. }
  64260. }
  64261. public function getName()
  64262. {
  64263. return 'question';
  64264. }
  64265. public static function disableStty()
  64266. {
  64267. self::$stty = false;
  64268. }
  64269. private function doAsk(OutputInterface $output, Question $question)
  64270. {
  64271. $this->writePrompt($output, $question);
  64272. $inputStream = $this->inputStream ?: \STDIN;
  64273. $autocomplete = $question->getAutocompleterCallback();
  64274. if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
  64275. $ret = false;
  64276. if ($question->isHidden()) {
  64277. try {
  64278. $hiddenResponse = $this->getHiddenResponse($output, $inputStream, $question->isTrimmable());
  64279. $ret = $question->isTrimmable() ? trim($hiddenResponse) : $hiddenResponse;
  64280. } catch (RuntimeException $e) {
  64281. if (!$question->isHiddenFallback()) {
  64282. throw $e;
  64283. }
  64284. }
  64285. }
  64286. if (false === $ret) {
  64287. $isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true;
  64288. if (!$isBlocked) {
  64289. stream_set_blocking($inputStream, true);
  64290. }
  64291. $ret = $this->readInput($inputStream, $question);
  64292. if (!$isBlocked) {
  64293. stream_set_blocking($inputStream, false);
  64294. }
  64295. if (false === $ret) {
  64296. throw new MissingInputException('Aborted.');
  64297. }
  64298. if ($question->isTrimmable()) {
  64299. $ret = trim($ret);
  64300. }
  64301. }
  64302. } else {
  64303. $autocomplete = $this->autocomplete($output, $question, $inputStream, $autocomplete);
  64304. $ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
  64305. }
  64306. if ($output instanceof ConsoleSectionOutput) {
  64307. $output->addContent($ret);
  64308. }
  64309. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  64310. if ($normalizer = $question->getNormalizer()) {
  64311. return $normalizer($ret);
  64312. }
  64313. return $ret;
  64314. }
  64315. private function getDefaultAnswer(Question $question)
  64316. {
  64317. $default = $question->getDefault();
  64318. if (null === $default) {
  64319. return $default;
  64320. }
  64321. if ($validator = $question->getValidator()) {
  64322. return \call_user_func($question->getValidator(), $default);
  64323. } elseif ($question instanceof ChoiceQuestion) {
  64324. $choices = $question->getChoices();
  64325. if (!$question->isMultiselect()) {
  64326. return $choices[$default] ?? $default;
  64327. }
  64328. $default = explode(',', $default);
  64329. foreach ($default as $k => $v) {
  64330. $v = $question->isTrimmable() ? trim($v) : $v;
  64331. $default[$k] = $choices[$v] ?? $v;
  64332. }
  64333. }
  64334. return $default;
  64335. }
  64336. protected function writePrompt(OutputInterface $output, Question $question)
  64337. {
  64338. $message = $question->getQuestion();
  64339. if ($question instanceof ChoiceQuestion) {
  64340. $output->writeln(array_merge([
  64341. $question->getQuestion(),
  64342. ], $this->formatChoiceQuestionChoices($question, 'info')));
  64343. $message = $question->getPrompt();
  64344. }
  64345. $output->write($message);
  64346. }
  64347. protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag)
  64348. {
  64349. $messages = [];
  64350. $maxWidth = max(array_map([__CLASS__, 'width'], array_keys($choices = $question->getChoices())));
  64351. foreach ($choices as $key => $value) {
  64352. $padding = str_repeat(' ', $maxWidth - self::width($key));
  64353. $messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
  64354. }
  64355. return $messages;
  64356. }
  64357. protected function writeError(OutputInterface $output, \Exception $error)
  64358. {
  64359. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  64360. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  64361. } else {
  64362. $message = '<error>'.$error->getMessage().'</error>';
  64363. }
  64364. $output->writeln($message);
  64365. }
  64366. private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string
  64367. {
  64368. $cursor = new Cursor($output, $inputStream);
  64369. $fullChoice = '';
  64370. $ret = '';
  64371. $i = 0;
  64372. $ofs = -1;
  64373. $matches = $autocomplete($ret);
  64374. $numMatches = \count($matches);
  64375. $sttyMode = shell_exec('stty -g');
  64376. $isStdin = 'php://stdin' === (stream_get_meta_data($inputStream)['uri'] ?? null);
  64377. $r = [$inputStream];
  64378. $w = [];
  64379. shell_exec('stty -icanon -echo');
  64380. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  64381. while (!feof($inputStream)) {
  64382. while ($isStdin && 0 === @stream_select($r, $w, $w, 0, 100)) {
  64383. $r = [$inputStream];
  64384. }
  64385. $c = fread($inputStream, 1);
  64386. if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
  64387. shell_exec('stty '.$sttyMode);
  64388. throw new MissingInputException('Aborted.');
  64389. } elseif ("\177" === $c) {
  64390. if (0 === $numMatches && 0 !== $i) {
  64391. --$i;
  64392. $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false));
  64393. $fullChoice = self::substr($fullChoice, 0, $i);
  64394. }
  64395. if (0 === $i) {
  64396. $ofs = -1;
  64397. $matches = $autocomplete($ret);
  64398. $numMatches = \count($matches);
  64399. } else {
  64400. $numMatches = 0;
  64401. }
  64402. $ret = self::substr($ret, 0, $i);
  64403. } elseif ("\033" === $c) {
  64404. $c .= fread($inputStream, 2);
  64405. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  64406. if ('A' === $c[2] && -1 === $ofs) {
  64407. $ofs = 0;
  64408. }
  64409. if (0 === $numMatches) {
  64410. continue;
  64411. }
  64412. $ofs += ('A' === $c[2]) ? -1 : 1;
  64413. $ofs = ($numMatches + $ofs) % $numMatches;
  64414. }
  64415. } elseif (\ord($c) < 32) {
  64416. if ("\t" === $c || "\n" === $c) {
  64417. if ($numMatches > 0 && -1 !== $ofs) {
  64418. $ret = (string) $matches[$ofs];
  64419. $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
  64420. $output->write($remainingCharacters);
  64421. $fullChoice .= $remainingCharacters;
  64422. $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
  64423. $matches = array_filter(
  64424. $autocomplete($ret),
  64425. function ($match) use ($ret) {
  64426. return '' === $ret || str_starts_with($match, $ret);
  64427. }
  64428. );
  64429. $numMatches = \count($matches);
  64430. $ofs = -1;
  64431. }
  64432. if ("\n" === $c) {
  64433. $output->write($c);
  64434. break;
  64435. }
  64436. $numMatches = 0;
  64437. }
  64438. continue;
  64439. } else {
  64440. if ("\x80" <= $c) {
  64441. $c .= fread($inputStream, ["\xC0" => 1, "\xD0" => 1, "\xE0" => 2, "\xF0" => 3][$c & "\xF0"]);
  64442. }
  64443. $output->write($c);
  64444. $ret .= $c;
  64445. $fullChoice .= $c;
  64446. ++$i;
  64447. $tempRet = $ret;
  64448. if ($question instanceof ChoiceQuestion && $question->isMultiselect()) {
  64449. $tempRet = $this->mostRecentlyEnteredValue($fullChoice);
  64450. }
  64451. $numMatches = 0;
  64452. $ofs = 0;
  64453. foreach ($autocomplete($ret) as $value) {
  64454. if (str_starts_with($value, $tempRet)) {
  64455. $matches[$numMatches++] = $value;
  64456. }
  64457. }
  64458. }
  64459. $cursor->clearLineAfter();
  64460. if ($numMatches > 0 && -1 !== $ofs) {
  64461. $cursor->savePosition();
  64462. $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)));
  64463. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>');
  64464. $cursor->restorePosition();
  64465. }
  64466. }
  64467. shell_exec('stty '.$sttyMode);
  64468. return $fullChoice;
  64469. }
  64470. private function mostRecentlyEnteredValue(string $entered): string
  64471. {
  64472. if (!str_contains($entered, ',')) {
  64473. return $entered;
  64474. }
  64475. $choices = explode(',', $entered);
  64476. if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) {
  64477. return $lastChoice;
  64478. }
  64479. return $entered;
  64480. }
  64481. private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string
  64482. {
  64483. if ('\\' === \DIRECTORY_SEPARATOR) {
  64484. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  64485. if ('phar:' === substr(__FILE__, 0, 5)) {
  64486. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  64487. copy($exe, $tmpExe);
  64488. $exe = $tmpExe;
  64489. }
  64490. $sExec = shell_exec('"'.$exe.'"');
  64491. $value = $trimmable ? rtrim($sExec) : $sExec;
  64492. $output->writeln('');
  64493. if (isset($tmpExe)) {
  64494. unlink($tmpExe);
  64495. }
  64496. return $value;
  64497. }
  64498. if (self::$stty && Terminal::hasSttyAvailable()) {
  64499. $sttyMode = shell_exec('stty -g');
  64500. shell_exec('stty -echo');
  64501. } elseif ($this->isInteractiveInput($inputStream)) {
  64502. throw new RuntimeException('Unable to hide the response.');
  64503. }
  64504. $value = fgets($inputStream, 4096);
  64505. if (self::$stty && Terminal::hasSttyAvailable()) {
  64506. shell_exec('stty '.$sttyMode);
  64507. }
  64508. if (false === $value) {
  64509. throw new MissingInputException('Aborted.');
  64510. }
  64511. if ($trimmable) {
  64512. $value = trim($value);
  64513. }
  64514. $output->writeln('');
  64515. return $value;
  64516. }
  64517. private function validateAttempts(callable $interviewer, OutputInterface $output, Question $question)
  64518. {
  64519. $error = null;
  64520. $attempts = $question->getMaxAttempts();
  64521. while (null === $attempts || $attempts--) {
  64522. if (null !== $error) {
  64523. $this->writeError($output, $error);
  64524. }
  64525. try {
  64526. return $question->getValidator()($interviewer());
  64527. } catch (RuntimeException $e) {
  64528. throw $e;
  64529. } catch (\Exception $error) {
  64530. }
  64531. }
  64532. throw $error;
  64533. }
  64534. private function isInteractiveInput($inputStream): bool
  64535. {
  64536. if ('php://stdin' !== (stream_get_meta_data($inputStream)['uri'] ?? null)) {
  64537. return false;
  64538. }
  64539. if (null !== self::$stdinIsInteractive) {
  64540. return self::$stdinIsInteractive;
  64541. }
  64542. if (\function_exists('stream_isatty')) {
  64543. return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
  64544. }
  64545. if (\function_exists('posix_isatty')) {
  64546. return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
  64547. }
  64548. if (!\function_exists('shell_exec')) {
  64549. return self::$stdinIsInteractive = true;
  64550. }
  64551. return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
  64552. }
  64553. private function readInput($inputStream, Question $question)
  64554. {
  64555. if (!$question->isMultiline()) {
  64556. $cp = $this->setIOCodepage();
  64557. $ret = fgets($inputStream, 4096);
  64558. return $this->resetIOCodepage($cp, $ret);
  64559. }
  64560. $multiLineStreamReader = $this->cloneInputStream($inputStream);
  64561. if (null === $multiLineStreamReader) {
  64562. return false;
  64563. }
  64564. $ret = '';
  64565. $cp = $this->setIOCodepage();
  64566. while (false !== ($char = fgetc($multiLineStreamReader))) {
  64567. if (\PHP_EOL === "{$ret}{$char}") {
  64568. break;
  64569. }
  64570. $ret .= $char;
  64571. }
  64572. return $this->resetIOCodepage($cp, $ret);
  64573. }
  64574. private function setIOCodepage(): int
  64575. {
  64576. if (\function_exists('sapi_windows_cp_set')) {
  64577. $cp = sapi_windows_cp_get();
  64578. sapi_windows_cp_set(sapi_windows_cp_get('oem'));
  64579. return $cp;
  64580. }
  64581. return 0;
  64582. }
  64583. private function resetIOCodepage(int $cp, $input)
  64584. {
  64585. if (0 !== $cp) {
  64586. sapi_windows_cp_set($cp);
  64587. if (false !== $input && '' !== $input) {
  64588. $input = sapi_windows_cp_conv(sapi_windows_cp_get('oem'), $cp, $input);
  64589. }
  64590. }
  64591. return $input;
  64592. }
  64593. private function cloneInputStream($inputStream)
  64594. {
  64595. $streamMetaData = stream_get_meta_data($inputStream);
  64596. $seekable = $streamMetaData['seekable'] ?? false;
  64597. $mode = $streamMetaData['mode'] ?? 'rb';
  64598. $uri = $streamMetaData['uri'] ?? null;
  64599. if (null === $uri) {
  64600. return null;
  64601. }
  64602. $cloneStream = fopen($uri, $mode);
  64603. if (true === $seekable && !\in_array($mode, ['r', 'rb', 'rt'])) {
  64604. $offset = ftell($inputStream);
  64605. rewind($inputStream);
  64606. stream_copy_to_stream($inputStream, $cloneStream);
  64607. fseek($inputStream, $offset);
  64608. fseek($cloneStream, $offset);
  64609. }
  64610. return $cloneStream;
  64611. }
  64612. }
  64613. <?php
  64614. namespace Symfony\Component\Console\Helper;
  64615. use Symfony\Component\Console\Formatter\OutputFormatter;
  64616. use Symfony\Component\Console\Output\OutputInterface;
  64617. use Symfony\Component\Console\Question\ChoiceQuestion;
  64618. use Symfony\Component\Console\Question\ConfirmationQuestion;
  64619. use Symfony\Component\Console\Question\Question;
  64620. use Symfony\Component\Console\Style\SymfonyStyle;
  64621. class SymfonyQuestionHelper extends QuestionHelper
  64622. {
  64623. protected function writePrompt(OutputInterface $output, Question $question)
  64624. {
  64625. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  64626. $default = $question->getDefault();
  64627. if ($question->isMultiline()) {
  64628. $text .= sprintf(' (press %s to continue)', $this->getEofShortcut());
  64629. }
  64630. switch (true) {
  64631. case null === $default:
  64632. $text = sprintf(' <info>%s</info>:', $text);
  64633. break;
  64634. case $question instanceof ConfirmationQuestion:
  64635. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  64636. break;
  64637. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  64638. $choices = $question->getChoices();
  64639. $default = explode(',', $default);
  64640. foreach ($default as $key => $value) {
  64641. $default[$key] = $choices[trim($value)];
  64642. }
  64643. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  64644. break;
  64645. case $question instanceof ChoiceQuestion:
  64646. $choices = $question->getChoices();
  64647. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
  64648. break;
  64649. default:
  64650. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  64651. }
  64652. $output->writeln($text);
  64653. $prompt = ' > ';
  64654. if ($question instanceof ChoiceQuestion) {
  64655. $output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
  64656. $prompt = $question->getPrompt();
  64657. }
  64658. $output->write($prompt);
  64659. }
  64660. protected function writeError(OutputInterface $output, \Exception $error)
  64661. {
  64662. if ($output instanceof SymfonyStyle) {
  64663. $output->newLine();
  64664. $output->error($error->getMessage());
  64665. return;
  64666. }
  64667. parent::writeError($output, $error);
  64668. }
  64669. private function getEofShortcut(): string
  64670. {
  64671. if ('Windows' === \PHP_OS_FAMILY) {
  64672. return '<comment>Ctrl+Z</comment> then <comment>Enter</comment>';
  64673. }
  64674. return '<comment>Ctrl+D</comment>';
  64675. }
  64676. }
  64677. <?php
  64678. namespace Symfony\Component\Console\Helper;
  64679. use Symfony\Component\Console\Exception\InvalidArgumentException;
  64680. use Symfony\Component\Console\Exception\RuntimeException;
  64681. use Symfony\Component\Console\Formatter\OutputFormatter;
  64682. use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface;
  64683. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  64684. use Symfony\Component\Console\Output\OutputInterface;
  64685. class Table
  64686. {
  64687. private const SEPARATOR_TOP = 0;
  64688. private const SEPARATOR_TOP_BOTTOM = 1;
  64689. private const SEPARATOR_MID = 2;
  64690. private const SEPARATOR_BOTTOM = 3;
  64691. private const BORDER_OUTSIDE = 0;
  64692. private const BORDER_INSIDE = 1;
  64693. private $headerTitle;
  64694. private $footerTitle;
  64695. private $headers = [];
  64696. private $rows = [];
  64697. private $horizontal = false;
  64698. private $effectiveColumnWidths = [];
  64699. private $numberOfColumns;
  64700. private $output;
  64701. private $style;
  64702. private $columnStyles = [];
  64703. private $columnWidths = [];
  64704. private $columnMaxWidths = [];
  64705. private static $styles;
  64706. private $rendered = false;
  64707. public function __construct(OutputInterface $output)
  64708. {
  64709. $this->output = $output;
  64710. if (!self::$styles) {
  64711. self::$styles = self::initStyles();
  64712. }
  64713. $this->setStyle('default');
  64714. }
  64715. public static function setStyleDefinition(string $name, TableStyle $style)
  64716. {
  64717. if (!self::$styles) {
  64718. self::$styles = self::initStyles();
  64719. }
  64720. self::$styles[$name] = $style;
  64721. }
  64722. public static function getStyleDefinition(string $name)
  64723. {
  64724. if (!self::$styles) {
  64725. self::$styles = self::initStyles();
  64726. }
  64727. if (isset(self::$styles[$name])) {
  64728. return self::$styles[$name];
  64729. }
  64730. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  64731. }
  64732. public function setStyle($name)
  64733. {
  64734. $this->style = $this->resolveStyle($name);
  64735. return $this;
  64736. }
  64737. public function getStyle()
  64738. {
  64739. return $this->style;
  64740. }
  64741. public function setColumnStyle(int $columnIndex, $name)
  64742. {
  64743. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  64744. return $this;
  64745. }
  64746. public function getColumnStyle(int $columnIndex)
  64747. {
  64748. return $this->columnStyles[$columnIndex] ?? $this->getStyle();
  64749. }
  64750. public function setColumnWidth(int $columnIndex, int $width)
  64751. {
  64752. $this->columnWidths[$columnIndex] = $width;
  64753. return $this;
  64754. }
  64755. public function setColumnWidths(array $widths)
  64756. {
  64757. $this->columnWidths = [];
  64758. foreach ($widths as $index => $width) {
  64759. $this->setColumnWidth($index, $width);
  64760. }
  64761. return $this;
  64762. }
  64763. public function setColumnMaxWidth(int $columnIndex, int $width): self
  64764. {
  64765. if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) {
  64766. throw new \LogicException(sprintf('Setting a maximum column width is only supported when using a "%s" formatter, got "%s".', WrappableOutputFormatterInterface::class, get_debug_type($this->output->getFormatter())));
  64767. }
  64768. $this->columnMaxWidths[$columnIndex] = $width;
  64769. return $this;
  64770. }
  64771. public function setHeaders(array $headers)
  64772. {
  64773. $headers = array_values($headers);
  64774. if (!empty($headers) && !\is_array($headers[0])) {
  64775. $headers = [$headers];
  64776. }
  64777. $this->headers = $headers;
  64778. return $this;
  64779. }
  64780. public function setRows(array $rows)
  64781. {
  64782. $this->rows = [];
  64783. return $this->addRows($rows);
  64784. }
  64785. public function addRows(array $rows)
  64786. {
  64787. foreach ($rows as $row) {
  64788. $this->addRow($row);
  64789. }
  64790. return $this;
  64791. }
  64792. public function addRow($row)
  64793. {
  64794. if ($row instanceof TableSeparator) {
  64795. $this->rows[] = $row;
  64796. return $this;
  64797. }
  64798. if (!\is_array($row)) {
  64799. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  64800. }
  64801. $this->rows[] = array_values($row);
  64802. return $this;
  64803. }
  64804. public function appendRow($row): self
  64805. {
  64806. if (!$this->output instanceof ConsoleSectionOutput) {
  64807. throw new RuntimeException(sprintf('Output should be an instance of "%s" when calling "%s".', ConsoleSectionOutput::class, __METHOD__));
  64808. }
  64809. if ($this->rendered) {
  64810. $this->output->clear($this->calculateRowCount());
  64811. }
  64812. $this->addRow($row);
  64813. $this->render();
  64814. return $this;
  64815. }
  64816. public function setRow($column, array $row)
  64817. {
  64818. $this->rows[$column] = $row;
  64819. return $this;
  64820. }
  64821. public function setHeaderTitle(?string $title): self
  64822. {
  64823. $this->headerTitle = $title;
  64824. return $this;
  64825. }
  64826. public function setFooterTitle(?string $title): self
  64827. {
  64828. $this->footerTitle = $title;
  64829. return $this;
  64830. }
  64831. public function setHorizontal(bool $horizontal = true): self
  64832. {
  64833. $this->horizontal = $horizontal;
  64834. return $this;
  64835. }
  64836. public function render()
  64837. {
  64838. $divider = new TableSeparator();
  64839. if ($this->horizontal) {
  64840. $rows = [];
  64841. foreach ($this->headers[0] ?? [] as $i => $header) {
  64842. $rows[$i] = [$header];
  64843. foreach ($this->rows as $row) {
  64844. if ($row instanceof TableSeparator) {
  64845. continue;
  64846. }
  64847. if (isset($row[$i])) {
  64848. $rows[$i][] = $row[$i];
  64849. } elseif ($rows[$i][0] instanceof TableCell && $rows[$i][0]->getColspan() >= 2) {
  64850. } else {
  64851. $rows[$i][] = null;
  64852. }
  64853. }
  64854. }
  64855. } else {
  64856. $rows = array_merge($this->headers, [$divider], $this->rows);
  64857. }
  64858. $this->calculateNumberOfColumns($rows);
  64859. $rowGroups = $this->buildTableRows($rows);
  64860. $this->calculateColumnsWidth($rowGroups);
  64861. $isHeader = !$this->horizontal;
  64862. $isFirstRow = $this->horizontal;
  64863. $hasTitle = (bool) $this->headerTitle;
  64864. foreach ($rowGroups as $rowGroup) {
  64865. $isHeaderSeparatorRendered = false;
  64866. foreach ($rowGroup as $row) {
  64867. if ($divider === $row) {
  64868. $isHeader = false;
  64869. $isFirstRow = true;
  64870. continue;
  64871. }
  64872. if ($row instanceof TableSeparator) {
  64873. $this->renderRowSeparator();
  64874. continue;
  64875. }
  64876. if (!$row) {
  64877. continue;
  64878. }
  64879. if ($isHeader && !$isHeaderSeparatorRendered) {
  64880. $this->renderRowSeparator(
  64881. $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
  64882. $hasTitle ? $this->headerTitle : null,
  64883. $hasTitle ? $this->style->getHeaderTitleFormat() : null
  64884. );
  64885. $hasTitle = false;
  64886. $isHeaderSeparatorRendered = true;
  64887. }
  64888. if ($isFirstRow) {
  64889. $this->renderRowSeparator(
  64890. $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
  64891. $hasTitle ? $this->headerTitle : null,
  64892. $hasTitle ? $this->style->getHeaderTitleFormat() : null
  64893. );
  64894. $isFirstRow = false;
  64895. $hasTitle = false;
  64896. }
  64897. if ($this->horizontal) {
  64898. $this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
  64899. } else {
  64900. $this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
  64901. }
  64902. }
  64903. }
  64904. $this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());
  64905. $this->cleanup();
  64906. $this->rendered = true;
  64907. }
  64908. private function renderRowSeparator(int $type = self::SEPARATOR_MID, ?string $title = null, ?string $titleFormat = null)
  64909. {
  64910. if (0 === $count = $this->numberOfColumns) {
  64911. return;
  64912. }
  64913. $borders = $this->style->getBorderChars();
  64914. if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) {
  64915. return;
  64916. }
  64917. $crossings = $this->style->getCrossingChars();
  64918. if (self::SEPARATOR_MID === $type) {
  64919. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
  64920. } elseif (self::SEPARATOR_TOP === $type) {
  64921. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
  64922. } elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
  64923. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
  64924. } else {
  64925. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
  64926. }
  64927. $markup = $leftChar;
  64928. for ($column = 0; $column < $count; ++$column) {
  64929. $markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]);
  64930. $markup .= $column === $count - 1 ? $rightChar : $midChar;
  64931. }
  64932. if (null !== $title) {
  64933. $titleLength = Helper::width(Helper::removeDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title)));
  64934. $markupLength = Helper::width($markup);
  64935. if ($titleLength > $limit = $markupLength - 4) {
  64936. $titleLength = $limit;
  64937. $formatLength = Helper::width(Helper::removeDecoration($formatter, sprintf($titleFormat, '')));
  64938. $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
  64939. }
  64940. $titleStart = intdiv($markupLength - $titleLength, 2);
  64941. if (false === mb_detect_encoding($markup, null, true)) {
  64942. $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
  64943. } else {
  64944. $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength);
  64945. }
  64946. }
  64947. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  64948. }
  64949. private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
  64950. {
  64951. $borders = $this->style->getBorderChars();
  64952. return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]);
  64953. }
  64954. private function renderRow(array $row, string $cellFormat, ?string $firstCellFormat = null)
  64955. {
  64956. $rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
  64957. $columns = $this->getRowColumns($row);
  64958. $last = \count($columns) - 1;
  64959. foreach ($columns as $i => $column) {
  64960. if ($firstCellFormat && 0 === $i) {
  64961. $rowContent .= $this->renderCell($row, $column, $firstCellFormat);
  64962. } else {
  64963. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  64964. }
  64965. $rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
  64966. }
  64967. $this->output->writeln($rowContent);
  64968. }
  64969. private function renderCell(array $row, int $column, string $cellFormat): string
  64970. {
  64971. $cell = $row[$column] ?? '';
  64972. $width = $this->effectiveColumnWidths[$column];
  64973. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  64974. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  64975. $width += $this->getColumnSeparatorWidth() + $this->effectiveColumnWidths[$nextColumn];
  64976. }
  64977. }
  64978. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  64979. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  64980. }
  64981. $style = $this->getColumnStyle($column);
  64982. if ($cell instanceof TableSeparator) {
  64983. return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
  64984. }
  64985. $width += Helper::length($cell) - Helper::length(Helper::removeDecoration($this->output->getFormatter(), $cell));
  64986. $content = sprintf($style->getCellRowContentFormat(), $cell);
  64987. $padType = $style->getPadType();
  64988. if ($cell instanceof TableCell && $cell->getStyle() instanceof TableCellStyle) {
  64989. $isNotStyledByTag = !preg_match('/^<(\w+|(\w+=[\w,]+;?)*)>.+<\/(\w+|(\w+=\w+;?)*)?>$/', $cell);
  64990. if ($isNotStyledByTag) {
  64991. $cellFormat = $cell->getStyle()->getCellFormat();
  64992. if (!\is_string($cellFormat)) {
  64993. $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';');
  64994. $cellFormat = '<'.$tag.'>%s</>';
  64995. }
  64996. if (strstr($content, '</>')) {
  64997. $content = str_replace('</>', '', $content);
  64998. $width -= 3;
  64999. }
  65000. if (strstr($content, '<fg=default;bg=default>')) {
  65001. $content = str_replace('<fg=default;bg=default>', '', $content);
  65002. $width -= \strlen('<fg=default;bg=default>');
  65003. }
  65004. }
  65005. $padType = $cell->getStyle()->getPadByAlign();
  65006. }
  65007. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $padType));
  65008. }
  65009. private function calculateNumberOfColumns(array $rows)
  65010. {
  65011. $columns = [0];
  65012. foreach ($rows as $row) {
  65013. if ($row instanceof TableSeparator) {
  65014. continue;
  65015. }
  65016. $columns[] = $this->getNumberOfColumns($row);
  65017. }
  65018. $this->numberOfColumns = max($columns);
  65019. }
  65020. private function buildTableRows(array $rows): TableRows
  65021. {
  65022. $formatter = $this->output->getFormatter();
  65023. $unmergedRows = [];
  65024. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  65025. $rows = $this->fillNextRows($rows, $rowKey);
  65026. foreach ($rows[$rowKey] as $column => $cell) {
  65027. $colspan = $cell instanceof TableCell ? $cell->getColspan() : 1;
  65028. if (isset($this->columnMaxWidths[$column]) && Helper::width(Helper::removeDecoration($formatter, $cell)) > $this->columnMaxWidths[$column]) {
  65029. $cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
  65030. }
  65031. if (!strstr($cell ?? '', "\n")) {
  65032. continue;
  65033. }
  65034. $escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
  65035. $cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
  65036. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default></>\n", $cell));
  65037. foreach ($lines as $lineKey => $line) {
  65038. if ($colspan > 1) {
  65039. $line = new TableCell($line, ['colspan' => $colspan]);
  65040. }
  65041. if (0 === $lineKey) {
  65042. $rows[$rowKey][$column] = $line;
  65043. } else {
  65044. if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) {
  65045. $unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey);
  65046. }
  65047. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  65048. }
  65049. }
  65050. }
  65051. }
  65052. return new TableRows(function () use ($rows, $unmergedRows): \Traversable {
  65053. foreach ($rows as $rowKey => $row) {
  65054. $rowGroup = [$row instanceof TableSeparator ? $row : $this->fillCells($row)];
  65055. if (isset($unmergedRows[$rowKey])) {
  65056. foreach ($unmergedRows[$rowKey] as $row) {
  65057. $rowGroup[] = $row instanceof TableSeparator ? $row : $this->fillCells($row);
  65058. }
  65059. }
  65060. yield $rowGroup;
  65061. }
  65062. });
  65063. }
  65064. private function calculateRowCount(): int
  65065. {
  65066. $numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, [new TableSeparator()], $this->rows))));
  65067. if ($this->headers) {
  65068. ++$numberOfRows;
  65069. }
  65070. if (\count($this->rows) > 0) {
  65071. ++$numberOfRows;
  65072. }
  65073. return $numberOfRows;
  65074. }
  65075. private function fillNextRows(array $rows, int $line): array
  65076. {
  65077. $unmergedRows = [];
  65078. foreach ($rows[$line] as $column => $cell) {
  65079. if (null !== $cell && !$cell instanceof TableCell && !\is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
  65080. throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', get_debug_type($cell)));
  65081. }
  65082. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  65083. $nbLines = $cell->getRowspan() - 1;
  65084. $lines = [$cell];
  65085. if (strstr($cell, "\n")) {
  65086. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  65087. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  65088. $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
  65089. unset($lines[0]);
  65090. }
  65091. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
  65092. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  65093. $value = $lines[$unmergedRowKey - $line] ?? '';
  65094. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
  65095. if ($nbLines === $unmergedRowKey - $line) {
  65096. break;
  65097. }
  65098. }
  65099. }
  65100. }
  65101. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  65102. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  65103. foreach ($unmergedRow as $cellKey => $cell) {
  65104. array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]);
  65105. }
  65106. } else {
  65107. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  65108. foreach ($unmergedRow as $column => $cell) {
  65109. if (!empty($cell)) {
  65110. $row[$column] = $unmergedRow[$column];
  65111. }
  65112. }
  65113. array_splice($rows, $unmergedRowKey, 0, [$row]);
  65114. }
  65115. }
  65116. return $rows;
  65117. }
  65118. private function fillCells(iterable $row)
  65119. {
  65120. $newRow = [];
  65121. foreach ($row as $column => $cell) {
  65122. $newRow[] = $cell;
  65123. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  65124. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  65125. $newRow[] = '';
  65126. }
  65127. }
  65128. }
  65129. return $newRow ?: $row;
  65130. }
  65131. private function copyRow(array $rows, int $line): array
  65132. {
  65133. $row = $rows[$line];
  65134. foreach ($row as $cellKey => $cellValue) {
  65135. $row[$cellKey] = '';
  65136. if ($cellValue instanceof TableCell) {
  65137. $row[$cellKey] = new TableCell('', ['colspan' => $cellValue->getColspan()]);
  65138. }
  65139. }
  65140. return $row;
  65141. }
  65142. private function getNumberOfColumns(array $row): int
  65143. {
  65144. $columns = \count($row);
  65145. foreach ($row as $column) {
  65146. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  65147. }
  65148. return $columns;
  65149. }
  65150. private function getRowColumns(array $row): array
  65151. {
  65152. $columns = range(0, $this->numberOfColumns - 1);
  65153. foreach ($row as $cellKey => $cell) {
  65154. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  65155. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  65156. }
  65157. }
  65158. return $columns;
  65159. }
  65160. private function calculateColumnsWidth(iterable $groups)
  65161. {
  65162. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  65163. $lengths = [];
  65164. foreach ($groups as $group) {
  65165. foreach ($group as $row) {
  65166. if ($row instanceof TableSeparator) {
  65167. continue;
  65168. }
  65169. foreach ($row as $i => $cell) {
  65170. if ($cell instanceof TableCell) {
  65171. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  65172. $textLength = Helper::width($textContent);
  65173. if ($textLength > 0) {
  65174. $contentColumns = mb_str_split($textContent, ceil($textLength / $cell->getColspan()));
  65175. foreach ($contentColumns as $position => $content) {
  65176. $row[$i + $position] = $content;
  65177. }
  65178. }
  65179. }
  65180. }
  65181. $lengths[] = $this->getCellWidth($row, $column);
  65182. }
  65183. }
  65184. $this->effectiveColumnWidths[$column] = max($lengths) + Helper::width($this->style->getCellRowContentFormat()) - 2;
  65185. }
  65186. }
  65187. private function getColumnSeparatorWidth(): int
  65188. {
  65189. return Helper::width(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
  65190. }
  65191. private function getCellWidth(array $row, int $column): int
  65192. {
  65193. $cellWidth = 0;
  65194. if (isset($row[$column])) {
  65195. $cell = $row[$column];
  65196. $cellWidth = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $cell));
  65197. }
  65198. $columnWidth = $this->columnWidths[$column] ?? 0;
  65199. $cellWidth = max($cellWidth, $columnWidth);
  65200. return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
  65201. }
  65202. private function cleanup()
  65203. {
  65204. $this->effectiveColumnWidths = [];
  65205. $this->numberOfColumns = null;
  65206. }
  65207. private static function initStyles(): array
  65208. {
  65209. $borderless = new TableStyle();
  65210. $borderless
  65211. ->setHorizontalBorderChars('=')
  65212. ->setVerticalBorderChars(' ')
  65213. ->setDefaultCrossingChar(' ')
  65214. ;
  65215. $compact = new TableStyle();
  65216. $compact
  65217. ->setHorizontalBorderChars('')
  65218. ->setVerticalBorderChars('')
  65219. ->setDefaultCrossingChar('')
  65220. ->setCellRowContentFormat('%s ')
  65221. ;
  65222. $styleGuide = new TableStyle();
  65223. $styleGuide
  65224. ->setHorizontalBorderChars('-')
  65225. ->setVerticalBorderChars(' ')
  65226. ->setDefaultCrossingChar(' ')
  65227. ->setCellHeaderFormat('%s')
  65228. ;
  65229. $box = (new TableStyle())
  65230. ->setHorizontalBorderChars('─')
  65231. ->setVerticalBorderChars('│')
  65232. ->setCrossingChars('┼', '┌', '┬', '�', '┤', '┘', '┴', '└', '├')
  65233. ;
  65234. $boxDouble = (new TableStyle())
  65235. ->setHorizontalBorderChars('�', '─')
  65236. ->setVerticalBorderChars('║', '│')
  65237. ->setCrossingChars('┼', '╔', '╤', '╗', '╢', '�', '╧', '╚', '╟', '╠', '╪', '╣')
  65238. ;
  65239. return [
  65240. 'default' => new TableStyle(),
  65241. 'borderless' => $borderless,
  65242. 'compact' => $compact,
  65243. 'symfony-style-guide' => $styleGuide,
  65244. 'box' => $box,
  65245. 'box-double' => $boxDouble,
  65246. ];
  65247. }
  65248. private function resolveStyle($name): TableStyle
  65249. {
  65250. if ($name instanceof TableStyle) {
  65251. return $name;
  65252. }
  65253. if (isset(self::$styles[$name])) {
  65254. return self::$styles[$name];
  65255. }
  65256. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  65257. }
  65258. }
  65259. <?php
  65260. namespace Symfony\Component\Console\Helper;
  65261. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65262. class TableCell
  65263. {
  65264. private $value;
  65265. private $options = [
  65266. 'rowspan' => 1,
  65267. 'colspan' => 1,
  65268. 'style' => null,
  65269. ];
  65270. public function __construct(string $value = '', array $options = [])
  65271. {
  65272. $this->value = $value;
  65273. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  65274. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  65275. }
  65276. if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) {
  65277. throw new InvalidArgumentException('The style option must be an instance of "TableCellStyle".');
  65278. }
  65279. $this->options = array_merge($this->options, $options);
  65280. }
  65281. public function __toString()
  65282. {
  65283. return $this->value;
  65284. }
  65285. public function getColspan()
  65286. {
  65287. return (int) $this->options['colspan'];
  65288. }
  65289. public function getRowspan()
  65290. {
  65291. return (int) $this->options['rowspan'];
  65292. }
  65293. public function getStyle(): ?TableCellStyle
  65294. {
  65295. return $this->options['style'];
  65296. }
  65297. }
  65298. <?php
  65299. namespace Symfony\Component\Console\Helper;
  65300. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65301. class TableCellStyle
  65302. {
  65303. public const DEFAULT_ALIGN = 'left';
  65304. private const TAG_OPTIONS = [
  65305. 'fg',
  65306. 'bg',
  65307. 'options',
  65308. ];
  65309. private const ALIGN_MAP = [
  65310. 'left' => \STR_PAD_RIGHT,
  65311. 'center' => \STR_PAD_BOTH,
  65312. 'right' => \STR_PAD_LEFT,
  65313. ];
  65314. private $options = [
  65315. 'fg' => 'default',
  65316. 'bg' => 'default',
  65317. 'options' => null,
  65318. 'align' => self::DEFAULT_ALIGN,
  65319. 'cellFormat' => null,
  65320. ];
  65321. public function __construct(array $options = [])
  65322. {
  65323. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  65324. throw new InvalidArgumentException(sprintf('The TableCellStyle does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  65325. }
  65326. if (isset($options['align']) && !\array_key_exists($options['align'], self::ALIGN_MAP)) {
  65327. throw new InvalidArgumentException(sprintf('Wrong align value. Value must be following: \'%s\'.', implode('\', \'', array_keys(self::ALIGN_MAP))));
  65328. }
  65329. $this->options = array_merge($this->options, $options);
  65330. }
  65331. public function getOptions(): array
  65332. {
  65333. return $this->options;
  65334. }
  65335. public function getTagOptions()
  65336. {
  65337. return array_filter(
  65338. $this->getOptions(),
  65339. function ($key) {
  65340. return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]);
  65341. },
  65342. \ARRAY_FILTER_USE_KEY
  65343. );
  65344. }
  65345. public function getPadByAlign()
  65346. {
  65347. return self::ALIGN_MAP[$this->getOptions()['align']];
  65348. }
  65349. public function getCellFormat(): ?string
  65350. {
  65351. return $this->getOptions()['cellFormat'];
  65352. }
  65353. }
  65354. <?php
  65355. namespace Symfony\Component\Console\Helper;
  65356. class TableRows implements \IteratorAggregate
  65357. {
  65358. private $generator;
  65359. public function __construct(\Closure $generator)
  65360. {
  65361. $this->generator = $generator;
  65362. }
  65363. public function getIterator(): \Traversable
  65364. {
  65365. return ($this->generator)();
  65366. }
  65367. }
  65368. <?php
  65369. namespace Symfony\Component\Console\Helper;
  65370. class TableSeparator extends TableCell
  65371. {
  65372. public function __construct(array $options = [])
  65373. {
  65374. parent::__construct('', $options);
  65375. }
  65376. }
  65377. <?php
  65378. namespace Symfony\Component\Console\Helper;
  65379. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65380. use Symfony\Component\Console\Exception\LogicException;
  65381. class TableStyle
  65382. {
  65383. private $paddingChar = ' ';
  65384. private $horizontalOutsideBorderChar = '-';
  65385. private $horizontalInsideBorderChar = '-';
  65386. private $verticalOutsideBorderChar = '|';
  65387. private $verticalInsideBorderChar = '|';
  65388. private $crossingChar = '+';
  65389. private $crossingTopRightChar = '+';
  65390. private $crossingTopMidChar = '+';
  65391. private $crossingTopLeftChar = '+';
  65392. private $crossingMidRightChar = '+';
  65393. private $crossingBottomRightChar = '+';
  65394. private $crossingBottomMidChar = '+';
  65395. private $crossingBottomLeftChar = '+';
  65396. private $crossingMidLeftChar = '+';
  65397. private $crossingTopLeftBottomChar = '+';
  65398. private $crossingTopMidBottomChar = '+';
  65399. private $crossingTopRightBottomChar = '+';
  65400. private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
  65401. private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
  65402. private $cellHeaderFormat = '<info>%s</info>';
  65403. private $cellRowFormat = '%s';
  65404. private $cellRowContentFormat = ' %s ';
  65405. private $borderFormat = '%s';
  65406. private $padType = \STR_PAD_RIGHT;
  65407. public function setPaddingChar(string $paddingChar)
  65408. {
  65409. if (!$paddingChar) {
  65410. throw new LogicException('The padding char must not be empty.');
  65411. }
  65412. $this->paddingChar = $paddingChar;
  65413. return $this;
  65414. }
  65415. public function getPaddingChar()
  65416. {
  65417. return $this->paddingChar;
  65418. }
  65419. public function setHorizontalBorderChars(string $outside, ?string $inside = null): self
  65420. {
  65421. $this->horizontalOutsideBorderChar = $outside;
  65422. $this->horizontalInsideBorderChar = $inside ?? $outside;
  65423. return $this;
  65424. }
  65425. public function setVerticalBorderChars(string $outside, ?string $inside = null): self
  65426. {
  65427. $this->verticalOutsideBorderChar = $outside;
  65428. $this->verticalInsideBorderChar = $inside ?? $outside;
  65429. return $this;
  65430. }
  65431. public function getBorderChars(): array
  65432. {
  65433. return [
  65434. $this->horizontalOutsideBorderChar,
  65435. $this->verticalOutsideBorderChar,
  65436. $this->horizontalInsideBorderChar,
  65437. $this->verticalInsideBorderChar,
  65438. ];
  65439. }
  65440. public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, ?string $topLeftBottom = null, ?string $topMidBottom = null, ?string $topRightBottom = null): self
  65441. {
  65442. $this->crossingChar = $cross;
  65443. $this->crossingTopLeftChar = $topLeft;
  65444. $this->crossingTopMidChar = $topMid;
  65445. $this->crossingTopRightChar = $topRight;
  65446. $this->crossingMidRightChar = $midRight;
  65447. $this->crossingBottomRightChar = $bottomRight;
  65448. $this->crossingBottomMidChar = $bottomMid;
  65449. $this->crossingBottomLeftChar = $bottomLeft;
  65450. $this->crossingMidLeftChar = $midLeft;
  65451. $this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
  65452. $this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
  65453. $this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
  65454. return $this;
  65455. }
  65456. public function setDefaultCrossingChar(string $char): self
  65457. {
  65458. return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
  65459. }
  65460. public function getCrossingChar()
  65461. {
  65462. return $this->crossingChar;
  65463. }
  65464. public function getCrossingChars(): array
  65465. {
  65466. return [
  65467. $this->crossingChar,
  65468. $this->crossingTopLeftChar,
  65469. $this->crossingTopMidChar,
  65470. $this->crossingTopRightChar,
  65471. $this->crossingMidRightChar,
  65472. $this->crossingBottomRightChar,
  65473. $this->crossingBottomMidChar,
  65474. $this->crossingBottomLeftChar,
  65475. $this->crossingMidLeftChar,
  65476. $this->crossingTopLeftBottomChar,
  65477. $this->crossingTopMidBottomChar,
  65478. $this->crossingTopRightBottomChar,
  65479. ];
  65480. }
  65481. public function setCellHeaderFormat(string $cellHeaderFormat)
  65482. {
  65483. $this->cellHeaderFormat = $cellHeaderFormat;
  65484. return $this;
  65485. }
  65486. public function getCellHeaderFormat()
  65487. {
  65488. return $this->cellHeaderFormat;
  65489. }
  65490. public function setCellRowFormat(string $cellRowFormat)
  65491. {
  65492. $this->cellRowFormat = $cellRowFormat;
  65493. return $this;
  65494. }
  65495. public function getCellRowFormat()
  65496. {
  65497. return $this->cellRowFormat;
  65498. }
  65499. public function setCellRowContentFormat(string $cellRowContentFormat)
  65500. {
  65501. $this->cellRowContentFormat = $cellRowContentFormat;
  65502. return $this;
  65503. }
  65504. public function getCellRowContentFormat()
  65505. {
  65506. return $this->cellRowContentFormat;
  65507. }
  65508. public function setBorderFormat(string $borderFormat)
  65509. {
  65510. $this->borderFormat = $borderFormat;
  65511. return $this;
  65512. }
  65513. public function getBorderFormat()
  65514. {
  65515. return $this->borderFormat;
  65516. }
  65517. public function setPadType(int $padType)
  65518. {
  65519. if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
  65520. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  65521. }
  65522. $this->padType = $padType;
  65523. return $this;
  65524. }
  65525. public function getPadType()
  65526. {
  65527. return $this->padType;
  65528. }
  65529. public function getHeaderTitleFormat(): string
  65530. {
  65531. return $this->headerTitleFormat;
  65532. }
  65533. public function setHeaderTitleFormat(string $format): self
  65534. {
  65535. $this->headerTitleFormat = $format;
  65536. return $this;
  65537. }
  65538. public function getFooterTitleFormat(): string
  65539. {
  65540. return $this->footerTitleFormat;
  65541. }
  65542. public function setFooterTitleFormat(string $format): self
  65543. {
  65544. $this->footerTitleFormat = $format;
  65545. return $this;
  65546. }
  65547. }
  65548. <?php
  65549. namespace Symfony\Component\Console\Input;
  65550. use Symfony\Component\Console\Exception\RuntimeException;
  65551. class ArgvInput extends Input
  65552. {
  65553. private $tokens;
  65554. private $parsed;
  65555. public function __construct(?array $argv = null, ?InputDefinition $definition = null)
  65556. {
  65557. $argv = $argv ?? $_SERVER['argv'] ?? [];
  65558. array_shift($argv);
  65559. $this->tokens = $argv;
  65560. parent::__construct($definition);
  65561. }
  65562. protected function setTokens(array $tokens)
  65563. {
  65564. $this->tokens = $tokens;
  65565. }
  65566. protected function parse()
  65567. {
  65568. $parseOptions = true;
  65569. $this->parsed = $this->tokens;
  65570. while (null !== $token = array_shift($this->parsed)) {
  65571. $parseOptions = $this->parseToken($token, $parseOptions);
  65572. }
  65573. }
  65574. protected function parseToken(string $token, bool $parseOptions): bool
  65575. {
  65576. if ($parseOptions && '' == $token) {
  65577. $this->parseArgument($token);
  65578. } elseif ($parseOptions && '--' == $token) {
  65579. return false;
  65580. } elseif ($parseOptions && str_starts_with($token, '--')) {
  65581. $this->parseLongOption($token);
  65582. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  65583. $this->parseShortOption($token);
  65584. } else {
  65585. $this->parseArgument($token);
  65586. }
  65587. return $parseOptions;
  65588. }
  65589. private function parseShortOption(string $token)
  65590. {
  65591. $name = substr($token, 1);
  65592. if (\strlen($name) > 1) {
  65593. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  65594. $this->addShortOption($name[0], substr($name, 1));
  65595. } else {
  65596. $this->parseShortOptionSet($name);
  65597. }
  65598. } else {
  65599. $this->addShortOption($name, null);
  65600. }
  65601. }
  65602. private function parseShortOptionSet(string $name)
  65603. {
  65604. $len = \strlen($name);
  65605. for ($i = 0; $i < $len; ++$i) {
  65606. if (!$this->definition->hasShortcut($name[$i])) {
  65607. $encoding = mb_detect_encoding($name, null, true);
  65608. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  65609. }
  65610. $option = $this->definition->getOptionForShortcut($name[$i]);
  65611. if ($option->acceptValue()) {
  65612. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  65613. break;
  65614. } else {
  65615. $this->addLongOption($option->getName(), null);
  65616. }
  65617. }
  65618. }
  65619. private function parseLongOption(string $token)
  65620. {
  65621. $name = substr($token, 2);
  65622. if (false !== $pos = strpos($name, '=')) {
  65623. if ('' === $value = substr($name, $pos + 1)) {
  65624. array_unshift($this->parsed, $value);
  65625. }
  65626. $this->addLongOption(substr($name, 0, $pos), $value);
  65627. } else {
  65628. $this->addLongOption($name, null);
  65629. }
  65630. }
  65631. private function parseArgument(string $token)
  65632. {
  65633. $c = \count($this->arguments);
  65634. if ($this->definition->hasArgument($c)) {
  65635. $arg = $this->definition->getArgument($c);
  65636. $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
  65637. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  65638. $arg = $this->definition->getArgument($c - 1);
  65639. $this->arguments[$arg->getName()][] = $token;
  65640. } else {
  65641. $all = $this->definition->getArguments();
  65642. $symfonyCommandName = null;
  65643. if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) {
  65644. $symfonyCommandName = $this->arguments['command'] ?? null;
  65645. unset($all[$key]);
  65646. }
  65647. if (\count($all)) {
  65648. if ($symfonyCommandName) {
  65649. $message = sprintf('Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode('" "', array_keys($all)));
  65650. } else {
  65651. $message = sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)));
  65652. }
  65653. } elseif ($symfonyCommandName) {
  65654. $message = sprintf('No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token);
  65655. } else {
  65656. $message = sprintf('No arguments expected, got "%s".', $token);
  65657. }
  65658. throw new RuntimeException($message);
  65659. }
  65660. }
  65661. private function addShortOption(string $shortcut, $value)
  65662. {
  65663. if (!$this->definition->hasShortcut($shortcut)) {
  65664. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  65665. }
  65666. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  65667. }
  65668. private function addLongOption(string $name, $value)
  65669. {
  65670. if (!$this->definition->hasOption($name)) {
  65671. if (!$this->definition->hasNegation($name)) {
  65672. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  65673. }
  65674. $optionName = $this->definition->negationToName($name);
  65675. if (null !== $value) {
  65676. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  65677. }
  65678. $this->options[$optionName] = false;
  65679. return;
  65680. }
  65681. $option = $this->definition->getOption($name);
  65682. if (null !== $value && !$option->acceptValue()) {
  65683. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  65684. }
  65685. if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {
  65686. $next = array_shift($this->parsed);
  65687. if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) {
  65688. $value = $next;
  65689. } else {
  65690. array_unshift($this->parsed, $next);
  65691. }
  65692. }
  65693. if (null === $value) {
  65694. if ($option->isValueRequired()) {
  65695. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  65696. }
  65697. if (!$option->isArray() && !$option->isValueOptional()) {
  65698. $value = true;
  65699. }
  65700. }
  65701. if ($option->isArray()) {
  65702. $this->options[$name][] = $value;
  65703. } else {
  65704. $this->options[$name] = $value;
  65705. }
  65706. }
  65707. public function getFirstArgument()
  65708. {
  65709. $isOption = false;
  65710. foreach ($this->tokens as $i => $token) {
  65711. if ($token && '-' === $token[0]) {
  65712. if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
  65713. continue;
  65714. }
  65715. $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
  65716. if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {
  65717. } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
  65718. $isOption = true;
  65719. }
  65720. continue;
  65721. }
  65722. if ($isOption) {
  65723. $isOption = false;
  65724. continue;
  65725. }
  65726. return $token;
  65727. }
  65728. return null;
  65729. }
  65730. public function hasParameterOption($values, bool $onlyParams = false)
  65731. {
  65732. $values = (array) $values;
  65733. foreach ($this->tokens as $token) {
  65734. if ($onlyParams && '--' === $token) {
  65735. return false;
  65736. }
  65737. foreach ($values as $value) {
  65738. $leading = str_starts_with($value, '--') ? $value.'=' : $value;
  65739. if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
  65740. return true;
  65741. }
  65742. }
  65743. }
  65744. return false;
  65745. }
  65746. public function getParameterOption($values, $default = false, bool $onlyParams = false)
  65747. {
  65748. $values = (array) $values;
  65749. $tokens = $this->tokens;
  65750. while (0 < \count($tokens)) {
  65751. $token = array_shift($tokens);
  65752. if ($onlyParams && '--' === $token) {
  65753. return $default;
  65754. }
  65755. foreach ($values as $value) {
  65756. if ($token === $value) {
  65757. return array_shift($tokens);
  65758. }
  65759. $leading = str_starts_with($value, '--') ? $value.'=' : $value;
  65760. if ('' !== $leading && str_starts_with($token, $leading)) {
  65761. return substr($token, \strlen($leading));
  65762. }
  65763. }
  65764. }
  65765. return $default;
  65766. }
  65767. public function __toString()
  65768. {
  65769. $tokens = array_map(function ($token) {
  65770. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  65771. return $match[1].$this->escapeToken($match[2]);
  65772. }
  65773. if ($token && '-' !== $token[0]) {
  65774. return $this->escapeToken($token);
  65775. }
  65776. return $token;
  65777. }, $this->tokens);
  65778. return implode(' ', $tokens);
  65779. }
  65780. }
  65781. <?php
  65782. namespace Symfony\Component\Console\Input;
  65783. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65784. use Symfony\Component\Console\Exception\InvalidOptionException;
  65785. class ArrayInput extends Input
  65786. {
  65787. private $parameters;
  65788. public function __construct(array $parameters, ?InputDefinition $definition = null)
  65789. {
  65790. $this->parameters = $parameters;
  65791. parent::__construct($definition);
  65792. }
  65793. public function getFirstArgument()
  65794. {
  65795. foreach ($this->parameters as $param => $value) {
  65796. if ($param && \is_string($param) && '-' === $param[0]) {
  65797. continue;
  65798. }
  65799. return $value;
  65800. }
  65801. return null;
  65802. }
  65803. public function hasParameterOption($values, bool $onlyParams = false)
  65804. {
  65805. $values = (array) $values;
  65806. foreach ($this->parameters as $k => $v) {
  65807. if (!\is_int($k)) {
  65808. $v = $k;
  65809. }
  65810. if ($onlyParams && '--' === $v) {
  65811. return false;
  65812. }
  65813. if (\in_array($v, $values)) {
  65814. return true;
  65815. }
  65816. }
  65817. return false;
  65818. }
  65819. public function getParameterOption($values, $default = false, bool $onlyParams = false)
  65820. {
  65821. $values = (array) $values;
  65822. foreach ($this->parameters as $k => $v) {
  65823. if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) {
  65824. return $default;
  65825. }
  65826. if (\is_int($k)) {
  65827. if (\in_array($v, $values)) {
  65828. return true;
  65829. }
  65830. } elseif (\in_array($k, $values)) {
  65831. return $v;
  65832. }
  65833. }
  65834. return $default;
  65835. }
  65836. public function __toString()
  65837. {
  65838. $params = [];
  65839. foreach ($this->parameters as $param => $val) {
  65840. if ($param && \is_string($param) && '-' === $param[0]) {
  65841. $glue = ('-' === $param[1]) ? '=' : ' ';
  65842. if (\is_array($val)) {
  65843. foreach ($val as $v) {
  65844. $params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : '');
  65845. }
  65846. } else {
  65847. $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : '');
  65848. }
  65849. } else {
  65850. $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
  65851. }
  65852. }
  65853. return implode(' ', $params);
  65854. }
  65855. protected function parse()
  65856. {
  65857. foreach ($this->parameters as $key => $value) {
  65858. if ('--' === $key) {
  65859. return;
  65860. }
  65861. if (str_starts_with($key, '--')) {
  65862. $this->addLongOption(substr($key, 2), $value);
  65863. } elseif (str_starts_with($key, '-')) {
  65864. $this->addShortOption(substr($key, 1), $value);
  65865. } else {
  65866. $this->addArgument($key, $value);
  65867. }
  65868. }
  65869. }
  65870. private function addShortOption(string $shortcut, $value)
  65871. {
  65872. if (!$this->definition->hasShortcut($shortcut)) {
  65873. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  65874. }
  65875. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  65876. }
  65877. private function addLongOption(string $name, $value)
  65878. {
  65879. if (!$this->definition->hasOption($name)) {
  65880. if (!$this->definition->hasNegation($name)) {
  65881. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  65882. }
  65883. $optionName = $this->definition->negationToName($name);
  65884. $this->options[$optionName] = false;
  65885. return;
  65886. }
  65887. $option = $this->definition->getOption($name);
  65888. if (null === $value) {
  65889. if ($option->isValueRequired()) {
  65890. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  65891. }
  65892. if (!$option->isValueOptional()) {
  65893. $value = true;
  65894. }
  65895. }
  65896. $this->options[$name] = $value;
  65897. }
  65898. private function addArgument($name, $value)
  65899. {
  65900. if (!$this->definition->hasArgument($name)) {
  65901. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  65902. }
  65903. $this->arguments[$name] = $value;
  65904. }
  65905. }
  65906. <?php
  65907. namespace Symfony\Component\Console\Input;
  65908. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65909. use Symfony\Component\Console\Exception\RuntimeException;
  65910. abstract class Input implements InputInterface, StreamableInputInterface
  65911. {
  65912. protected $definition;
  65913. protected $stream;
  65914. protected $options = [];
  65915. protected $arguments = [];
  65916. protected $interactive = true;
  65917. public function __construct(?InputDefinition $definition = null)
  65918. {
  65919. if (null === $definition) {
  65920. $this->definition = new InputDefinition();
  65921. } else {
  65922. $this->bind($definition);
  65923. $this->validate();
  65924. }
  65925. }
  65926. public function bind(InputDefinition $definition)
  65927. {
  65928. $this->arguments = [];
  65929. $this->options = [];
  65930. $this->definition = $definition;
  65931. $this->parse();
  65932. }
  65933. abstract protected function parse();
  65934. public function validate()
  65935. {
  65936. $definition = $this->definition;
  65937. $givenArguments = $this->arguments;
  65938. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  65939. return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  65940. });
  65941. if (\count($missingArguments) > 0) {
  65942. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  65943. }
  65944. }
  65945. public function isInteractive()
  65946. {
  65947. return $this->interactive;
  65948. }
  65949. public function setInteractive(bool $interactive)
  65950. {
  65951. $this->interactive = $interactive;
  65952. }
  65953. public function getArguments()
  65954. {
  65955. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  65956. }
  65957. public function getArgument(string $name)
  65958. {
  65959. if (!$this->definition->hasArgument($name)) {
  65960. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  65961. }
  65962. return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
  65963. }
  65964. public function setArgument(string $name, $value)
  65965. {
  65966. if (!$this->definition->hasArgument($name)) {
  65967. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  65968. }
  65969. $this->arguments[$name] = $value;
  65970. }
  65971. public function hasArgument(string $name)
  65972. {
  65973. return $this->definition->hasArgument($name);
  65974. }
  65975. public function getOptions()
  65976. {
  65977. return array_merge($this->definition->getOptionDefaults(), $this->options);
  65978. }
  65979. public function getOption(string $name)
  65980. {
  65981. if ($this->definition->hasNegation($name)) {
  65982. if (null === $value = $this->getOption($this->definition->negationToName($name))) {
  65983. return $value;
  65984. }
  65985. return !$value;
  65986. }
  65987. if (!$this->definition->hasOption($name)) {
  65988. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  65989. }
  65990. return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  65991. }
  65992. public function setOption(string $name, $value)
  65993. {
  65994. if ($this->definition->hasNegation($name)) {
  65995. $this->options[$this->definition->negationToName($name)] = !$value;
  65996. return;
  65997. } elseif (!$this->definition->hasOption($name)) {
  65998. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  65999. }
  66000. $this->options[$name] = $value;
  66001. }
  66002. public function hasOption(string $name)
  66003. {
  66004. return $this->definition->hasOption($name) || $this->definition->hasNegation($name);
  66005. }
  66006. public function escapeToken(string $token)
  66007. {
  66008. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  66009. }
  66010. public function setStream($stream)
  66011. {
  66012. $this->stream = $stream;
  66013. }
  66014. public function getStream()
  66015. {
  66016. return $this->stream;
  66017. }
  66018. }
  66019. <?php
  66020. namespace Symfony\Component\Console\Input;
  66021. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66022. use Symfony\Component\Console\Exception\LogicException;
  66023. class InputArgument
  66024. {
  66025. public const REQUIRED = 1;
  66026. public const OPTIONAL = 2;
  66027. public const IS_ARRAY = 4;
  66028. private $name;
  66029. private $mode;
  66030. private $default;
  66031. private $description;
  66032. public function __construct(string $name, ?int $mode = null, string $description = '', $default = null)
  66033. {
  66034. if (null === $mode) {
  66035. $mode = self::OPTIONAL;
  66036. } elseif ($mode > 7 || $mode < 1) {
  66037. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  66038. }
  66039. $this->name = $name;
  66040. $this->mode = $mode;
  66041. $this->description = $description;
  66042. $this->setDefault($default);
  66043. }
  66044. public function getName()
  66045. {
  66046. return $this->name;
  66047. }
  66048. public function isRequired()
  66049. {
  66050. return self::REQUIRED === (self::REQUIRED & $this->mode);
  66051. }
  66052. public function isArray()
  66053. {
  66054. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  66055. }
  66056. public function setDefault($default = null)
  66057. {
  66058. if ($this->isRequired() && null !== $default) {
  66059. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  66060. }
  66061. if ($this->isArray()) {
  66062. if (null === $default) {
  66063. $default = [];
  66064. } elseif (!\is_array($default)) {
  66065. throw new LogicException('A default value for an array argument must be an array.');
  66066. }
  66067. }
  66068. $this->default = $default;
  66069. }
  66070. public function getDefault()
  66071. {
  66072. return $this->default;
  66073. }
  66074. public function getDescription()
  66075. {
  66076. return $this->description;
  66077. }
  66078. }
  66079. <?php
  66080. namespace Symfony\Component\Console\Input;
  66081. interface InputAwareInterface
  66082. {
  66083. public function setInput(InputInterface $input);
  66084. }
  66085. <?php
  66086. namespace Symfony\Component\Console\Input;
  66087. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66088. use Symfony\Component\Console\Exception\LogicException;
  66089. class InputDefinition
  66090. {
  66091. private $arguments;
  66092. private $requiredCount;
  66093. private $lastArrayArgument;
  66094. private $lastOptionalArgument;
  66095. private $options;
  66096. private $negations;
  66097. private $shortcuts;
  66098. public function __construct(array $definition = [])
  66099. {
  66100. $this->setDefinition($definition);
  66101. }
  66102. public function setDefinition(array $definition)
  66103. {
  66104. $arguments = [];
  66105. $options = [];
  66106. foreach ($definition as $item) {
  66107. if ($item instanceof InputOption) {
  66108. $options[] = $item;
  66109. } else {
  66110. $arguments[] = $item;
  66111. }
  66112. }
  66113. $this->setArguments($arguments);
  66114. $this->setOptions($options);
  66115. }
  66116. public function setArguments(array $arguments = [])
  66117. {
  66118. $this->arguments = [];
  66119. $this->requiredCount = 0;
  66120. $this->lastOptionalArgument = null;
  66121. $this->lastArrayArgument = null;
  66122. $this->addArguments($arguments);
  66123. }
  66124. public function addArguments(?array $arguments = [])
  66125. {
  66126. if (null !== $arguments) {
  66127. foreach ($arguments as $argument) {
  66128. $this->addArgument($argument);
  66129. }
  66130. }
  66131. }
  66132. public function addArgument(InputArgument $argument)
  66133. {
  66134. if (isset($this->arguments[$argument->getName()])) {
  66135. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  66136. }
  66137. if (null !== $this->lastArrayArgument) {
  66138. throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
  66139. }
  66140. if ($argument->isRequired() && null !== $this->lastOptionalArgument) {
  66141. throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
  66142. }
  66143. if ($argument->isArray()) {
  66144. $this->lastArrayArgument = $argument;
  66145. }
  66146. if ($argument->isRequired()) {
  66147. ++$this->requiredCount;
  66148. } else {
  66149. $this->lastOptionalArgument = $argument;
  66150. }
  66151. $this->arguments[$argument->getName()] = $argument;
  66152. }
  66153. public function getArgument($name)
  66154. {
  66155. if (!$this->hasArgument($name)) {
  66156. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  66157. }
  66158. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  66159. return $arguments[$name];
  66160. }
  66161. public function hasArgument($name)
  66162. {
  66163. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  66164. return isset($arguments[$name]);
  66165. }
  66166. public function getArguments()
  66167. {
  66168. return $this->arguments;
  66169. }
  66170. public function getArgumentCount()
  66171. {
  66172. return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
  66173. }
  66174. public function getArgumentRequiredCount()
  66175. {
  66176. return $this->requiredCount;
  66177. }
  66178. public function getArgumentDefaults()
  66179. {
  66180. $values = [];
  66181. foreach ($this->arguments as $argument) {
  66182. $values[$argument->getName()] = $argument->getDefault();
  66183. }
  66184. return $values;
  66185. }
  66186. public function setOptions(array $options = [])
  66187. {
  66188. $this->options = [];
  66189. $this->shortcuts = [];
  66190. $this->negations = [];
  66191. $this->addOptions($options);
  66192. }
  66193. public function addOptions(array $options = [])
  66194. {
  66195. foreach ($options as $option) {
  66196. $this->addOption($option);
  66197. }
  66198. }
  66199. public function addOption(InputOption $option)
  66200. {
  66201. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  66202. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  66203. }
  66204. if (isset($this->negations[$option->getName()])) {
  66205. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  66206. }
  66207. if ($option->getShortcut()) {
  66208. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  66209. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  66210. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  66211. }
  66212. }
  66213. }
  66214. $this->options[$option->getName()] = $option;
  66215. if ($option->getShortcut()) {
  66216. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  66217. $this->shortcuts[$shortcut] = $option->getName();
  66218. }
  66219. }
  66220. if ($option->isNegatable()) {
  66221. $negatedName = 'no-'.$option->getName();
  66222. if (isset($this->options[$negatedName])) {
  66223. throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
  66224. }
  66225. $this->negations[$negatedName] = $option->getName();
  66226. }
  66227. }
  66228. public function getOption(string $name)
  66229. {
  66230. if (!$this->hasOption($name)) {
  66231. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  66232. }
  66233. return $this->options[$name];
  66234. }
  66235. public function hasOption(string $name)
  66236. {
  66237. return isset($this->options[$name]);
  66238. }
  66239. public function getOptions()
  66240. {
  66241. return $this->options;
  66242. }
  66243. public function hasShortcut(string $name)
  66244. {
  66245. return isset($this->shortcuts[$name]);
  66246. }
  66247. public function hasNegation(string $name): bool
  66248. {
  66249. return isset($this->negations[$name]);
  66250. }
  66251. public function getOptionForShortcut(string $shortcut)
  66252. {
  66253. return $this->getOption($this->shortcutToName($shortcut));
  66254. }
  66255. public function getOptionDefaults()
  66256. {
  66257. $values = [];
  66258. foreach ($this->options as $option) {
  66259. $values[$option->getName()] = $option->getDefault();
  66260. }
  66261. return $values;
  66262. }
  66263. public function shortcutToName(string $shortcut): string
  66264. {
  66265. if (!isset($this->shortcuts[$shortcut])) {
  66266. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  66267. }
  66268. return $this->shortcuts[$shortcut];
  66269. }
  66270. public function negationToName(string $negation): string
  66271. {
  66272. if (!isset($this->negations[$negation])) {
  66273. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
  66274. }
  66275. return $this->negations[$negation];
  66276. }
  66277. public function getSynopsis(bool $short = false)
  66278. {
  66279. $elements = [];
  66280. if ($short && $this->getOptions()) {
  66281. $elements[] = '[options]';
  66282. } elseif (!$short) {
  66283. foreach ($this->getOptions() as $option) {
  66284. $value = '';
  66285. if ($option->acceptValue()) {
  66286. $value = sprintf(
  66287. ' %s%s%s',
  66288. $option->isValueOptional() ? '[' : '',
  66289. strtoupper($option->getName()),
  66290. $option->isValueOptional() ? ']' : ''
  66291. );
  66292. }
  66293. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  66294. $negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
  66295. $elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
  66296. }
  66297. }
  66298. if (\count($elements) && $this->getArguments()) {
  66299. $elements[] = '[--]';
  66300. }
  66301. $tail = '';
  66302. foreach ($this->getArguments() as $argument) {
  66303. $element = '<'.$argument->getName().'>';
  66304. if ($argument->isArray()) {
  66305. $element .= '...';
  66306. }
  66307. if (!$argument->isRequired()) {
  66308. $element = '['.$element;
  66309. $tail .= ']';
  66310. }
  66311. $elements[] = $element;
  66312. }
  66313. return implode(' ', $elements).$tail;
  66314. }
  66315. }
  66316. <?php
  66317. namespace Symfony\Component\Console\Input;
  66318. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66319. use Symfony\Component\Console\Exception\RuntimeException;
  66320. interface InputInterface
  66321. {
  66322. public function getFirstArgument();
  66323. public function hasParameterOption($values, bool $onlyParams = false);
  66324. public function getParameterOption($values, $default = false, bool $onlyParams = false);
  66325. public function bind(InputDefinition $definition);
  66326. public function validate();
  66327. public function getArguments();
  66328. public function getArgument(string $name);
  66329. public function setArgument(string $name, $value);
  66330. public function hasArgument(string $name);
  66331. public function getOptions();
  66332. public function getOption(string $name);
  66333. public function setOption(string $name, $value);
  66334. public function hasOption(string $name);
  66335. public function isInteractive();
  66336. public function setInteractive(bool $interactive);
  66337. }
  66338. <?php
  66339. namespace Symfony\Component\Console\Input;
  66340. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66341. use Symfony\Component\Console\Exception\LogicException;
  66342. class InputOption
  66343. {
  66344. public const VALUE_NONE = 1;
  66345. public const VALUE_REQUIRED = 2;
  66346. public const VALUE_OPTIONAL = 4;
  66347. public const VALUE_IS_ARRAY = 8;
  66348. public const VALUE_NEGATABLE = 16;
  66349. private $name;
  66350. private $shortcut;
  66351. private $mode;
  66352. private $default;
  66353. private $description;
  66354. public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null)
  66355. {
  66356. if (str_starts_with($name, '--')) {
  66357. $name = substr($name, 2);
  66358. }
  66359. if (empty($name)) {
  66360. throw new InvalidArgumentException('An option name cannot be empty.');
  66361. }
  66362. if ('' === $shortcut || [] === $shortcut) {
  66363. $shortcut = null;
  66364. }
  66365. if (null !== $shortcut) {
  66366. if (\is_array($shortcut)) {
  66367. $shortcut = implode('|', $shortcut);
  66368. }
  66369. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  66370. $shortcuts = array_filter($shortcuts, 'strlen');
  66371. $shortcut = implode('|', $shortcuts);
  66372. if ('' === $shortcut) {
  66373. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  66374. }
  66375. }
  66376. if (null === $mode) {
  66377. $mode = self::VALUE_NONE;
  66378. } elseif ($mode >= (self::VALUE_NEGATABLE << 1) || $mode < 1) {
  66379. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  66380. }
  66381. $this->name = $name;
  66382. $this->shortcut = $shortcut;
  66383. $this->mode = $mode;
  66384. $this->description = $description;
  66385. if ($this->isArray() && !$this->acceptValue()) {
  66386. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  66387. }
  66388. if ($this->isNegatable() && $this->acceptValue()) {
  66389. throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
  66390. }
  66391. $this->setDefault($default);
  66392. }
  66393. public function getShortcut()
  66394. {
  66395. return $this->shortcut;
  66396. }
  66397. public function getName()
  66398. {
  66399. return $this->name;
  66400. }
  66401. public function acceptValue()
  66402. {
  66403. return $this->isValueRequired() || $this->isValueOptional();
  66404. }
  66405. public function isValueRequired()
  66406. {
  66407. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  66408. }
  66409. public function isValueOptional()
  66410. {
  66411. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  66412. }
  66413. public function isArray()
  66414. {
  66415. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  66416. }
  66417. public function isNegatable(): bool
  66418. {
  66419. return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
  66420. }
  66421. public function setDefault($default = null)
  66422. {
  66423. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  66424. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  66425. }
  66426. if ($this->isArray()) {
  66427. if (null === $default) {
  66428. $default = [];
  66429. } elseif (!\is_array($default)) {
  66430. throw new LogicException('A default value for an array option must be an array.');
  66431. }
  66432. }
  66433. $this->default = $this->acceptValue() || $this->isNegatable() ? $default : false;
  66434. }
  66435. public function getDefault()
  66436. {
  66437. return $this->default;
  66438. }
  66439. public function getDescription()
  66440. {
  66441. return $this->description;
  66442. }
  66443. public function equals(self $option)
  66444. {
  66445. return $option->getName() === $this->getName()
  66446. && $option->getShortcut() === $this->getShortcut()
  66447. && $option->getDefault() === $this->getDefault()
  66448. && $option->isNegatable() === $this->isNegatable()
  66449. && $option->isArray() === $this->isArray()
  66450. && $option->isValueRequired() === $this->isValueRequired()
  66451. && $option->isValueOptional() === $this->isValueOptional()
  66452. ;
  66453. }
  66454. }
  66455. <?php
  66456. namespace Symfony\Component\Console\Input;
  66457. interface StreamableInputInterface extends InputInterface
  66458. {
  66459. public function setStream($stream);
  66460. public function getStream();
  66461. }
  66462. <?php
  66463. namespace Symfony\Component\Console\Input;
  66464. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66465. class StringInput extends ArgvInput
  66466. {
  66467. public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  66468. public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
  66469. public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  66470. public function __construct(string $input)
  66471. {
  66472. parent::__construct([]);
  66473. $this->setTokens($this->tokenize($input));
  66474. }
  66475. private function tokenize(string $input): array
  66476. {
  66477. $tokens = [];
  66478. $length = \strlen($input);
  66479. $cursor = 0;
  66480. $token = null;
  66481. while ($cursor < $length) {
  66482. if ('\\' === $input[$cursor]) {
  66483. $token .= $input[++$cursor] ?? '';
  66484. ++$cursor;
  66485. continue;
  66486. }
  66487. if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
  66488. if (null !== $token) {
  66489. $tokens[] = $token;
  66490. $token = null;
  66491. }
  66492. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
  66493. $token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
  66494. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
  66495. $token .= stripcslashes(substr($match[0], 1, -1));
  66496. } elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
  66497. $token .= $match[1];
  66498. } else {
  66499. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
  66500. }
  66501. $cursor += \strlen($match[0]);
  66502. }
  66503. if (null !== $token) {
  66504. $tokens[] = $token;
  66505. }
  66506. return $tokens;
  66507. }
  66508. }
  66509. Copyright (c) 2004-present Fabien Potencier
  66510. Permission is hereby granted, free of charge, to any person obtaining a copy
  66511. of this software and associated documentation files (the "Software"), to deal
  66512. in the Software without restriction, including without limitation the rights
  66513. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  66514. copies of the Software, and to permit persons to whom the Software is furnished
  66515. to do so, subject to the following conditions:
  66516. The above copyright notice and this permission notice shall be included in all
  66517. copies or substantial portions of the Software.
  66518. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  66519. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  66520. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  66521. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  66522. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  66523. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  66524. THE SOFTWARE.
  66525. <?php
  66526. namespace Symfony\Component\Console\Logger;
  66527. use Psr\Log\AbstractLogger;
  66528. use Psr\Log\InvalidArgumentException;
  66529. use Psr\Log\LogLevel;
  66530. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  66531. use Symfony\Component\Console\Output\OutputInterface;
  66532. class ConsoleLogger extends AbstractLogger
  66533. {
  66534. public const INFO = 'info';
  66535. public const ERROR = 'error';
  66536. private $output;
  66537. private $verbosityLevelMap = [
  66538. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  66539. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  66540. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  66541. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  66542. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  66543. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  66544. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  66545. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  66546. ];
  66547. private $formatLevelMap = [
  66548. LogLevel::EMERGENCY => self::ERROR,
  66549. LogLevel::ALERT => self::ERROR,
  66550. LogLevel::CRITICAL => self::ERROR,
  66551. LogLevel::ERROR => self::ERROR,
  66552. LogLevel::WARNING => self::INFO,
  66553. LogLevel::NOTICE => self::INFO,
  66554. LogLevel::INFO => self::INFO,
  66555. LogLevel::DEBUG => self::INFO,
  66556. ];
  66557. private $errored = false;
  66558. public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
  66559. {
  66560. $this->output = $output;
  66561. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  66562. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  66563. }
  66564. public function log($level, $message, array $context = [])
  66565. {
  66566. if (!isset($this->verbosityLevelMap[$level])) {
  66567. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  66568. }
  66569. $output = $this->output;
  66570. if (self::ERROR === $this->formatLevelMap[$level]) {
  66571. if ($this->output instanceof ConsoleOutputInterface) {
  66572. $output = $output->getErrorOutput();
  66573. }
  66574. $this->errored = true;
  66575. }
  66576. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  66577. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]);
  66578. }
  66579. }
  66580. public function hasErrored()
  66581. {
  66582. return $this->errored;
  66583. }
  66584. private function interpolate(string $message, array $context): string
  66585. {
  66586. if (!str_contains($message, '{')) {
  66587. return $message;
  66588. }
  66589. $replacements = [];
  66590. foreach ($context as $key => $val) {
  66591. if (null === $val || \is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) {
  66592. $replacements["{{$key}}"] = $val;
  66593. } elseif ($val instanceof \DateTimeInterface) {
  66594. $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
  66595. } elseif (\is_object($val)) {
  66596. $replacements["{{$key}}"] = '[object '.\get_class($val).']';
  66597. } else {
  66598. $replacements["{{$key}}"] = '['.\gettype($val).']';
  66599. }
  66600. }
  66601. return strtr($message, $replacements);
  66602. }
  66603. }
  66604. <?php
  66605. namespace Symfony\Component\Console\Output;
  66606. class BufferedOutput extends Output
  66607. {
  66608. private $buffer = '';
  66609. public function fetch()
  66610. {
  66611. $content = $this->buffer;
  66612. $this->buffer = '';
  66613. return $content;
  66614. }
  66615. protected function doWrite(string $message, bool $newline)
  66616. {
  66617. $this->buffer .= $message;
  66618. if ($newline) {
  66619. $this->buffer .= \PHP_EOL;
  66620. }
  66621. }
  66622. }
  66623. <?php
  66624. namespace Symfony\Component\Console\Output;
  66625. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  66626. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  66627. {
  66628. private $stderr;
  66629. private $consoleSectionOutputs = [];
  66630. public function __construct(int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null)
  66631. {
  66632. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  66633. if (null === $formatter) {
  66634. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
  66635. return;
  66636. }
  66637. $actualDecorated = $this->isDecorated();
  66638. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  66639. if (null === $decorated) {
  66640. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  66641. }
  66642. }
  66643. public function section(): ConsoleSectionOutput
  66644. {
  66645. return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
  66646. }
  66647. public function setDecorated(bool $decorated)
  66648. {
  66649. parent::setDecorated($decorated);
  66650. $this->stderr->setDecorated($decorated);
  66651. }
  66652. public function setFormatter(OutputFormatterInterface $formatter)
  66653. {
  66654. parent::setFormatter($formatter);
  66655. $this->stderr->setFormatter($formatter);
  66656. }
  66657. public function setVerbosity(int $level)
  66658. {
  66659. parent::setVerbosity($level);
  66660. $this->stderr->setVerbosity($level);
  66661. }
  66662. public function getErrorOutput()
  66663. {
  66664. return $this->stderr;
  66665. }
  66666. public function setErrorOutput(OutputInterface $error)
  66667. {
  66668. $this->stderr = $error;
  66669. }
  66670. protected function hasStdoutSupport()
  66671. {
  66672. return false === $this->isRunningOS400();
  66673. }
  66674. protected function hasStderrSupport()
  66675. {
  66676. return false === $this->isRunningOS400();
  66677. }
  66678. private function isRunningOS400(): bool
  66679. {
  66680. $checks = [
  66681. \function_exists('php_uname') ? php_uname('s') : '',
  66682. getenv('OSTYPE'),
  66683. \PHP_OS,
  66684. ];
  66685. return false !== stripos(implode(';', $checks), 'OS400');
  66686. }
  66687. private function openOutputStream()
  66688. {
  66689. if (!$this->hasStdoutSupport()) {
  66690. return fopen('php://output', 'w');
  66691. }
  66692. return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w'));
  66693. }
  66694. private function openErrorStream()
  66695. {
  66696. if (!$this->hasStderrSupport()) {
  66697. return fopen('php://output', 'w');
  66698. }
  66699. return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w'));
  66700. }
  66701. }
  66702. <?php
  66703. namespace Symfony\Component\Console\Output;
  66704. interface ConsoleOutputInterface extends OutputInterface
  66705. {
  66706. public function getErrorOutput();
  66707. public function setErrorOutput(OutputInterface $error);
  66708. public function section(): ConsoleSectionOutput;
  66709. }
  66710. <?php
  66711. namespace Symfony\Component\Console\Output;
  66712. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  66713. use Symfony\Component\Console\Helper\Helper;
  66714. use Symfony\Component\Console\Terminal;
  66715. class ConsoleSectionOutput extends StreamOutput
  66716. {
  66717. private $content = [];
  66718. private $lines = 0;
  66719. private $sections;
  66720. private $terminal;
  66721. public function __construct($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
  66722. {
  66723. parent::__construct($stream, $verbosity, $decorated, $formatter);
  66724. array_unshift($sections, $this);
  66725. $this->sections = &$sections;
  66726. $this->terminal = new Terminal();
  66727. }
  66728. public function clear(?int $lines = null)
  66729. {
  66730. if (empty($this->content) || !$this->isDecorated()) {
  66731. return;
  66732. }
  66733. if ($lines) {
  66734. array_splice($this->content, -($lines * 2));
  66735. } else {
  66736. $lines = $this->lines;
  66737. $this->content = [];
  66738. }
  66739. $this->lines -= $lines;
  66740. parent::doWrite($this->popStreamContentUntilCurrentSection($lines), false);
  66741. }
  66742. public function overwrite($message)
  66743. {
  66744. $this->clear();
  66745. $this->writeln($message);
  66746. }
  66747. public function getContent(): string
  66748. {
  66749. return implode('', $this->content);
  66750. }
  66751. public function addContent(string $input)
  66752. {
  66753. foreach (explode(\PHP_EOL, $input) as $lineContent) {
  66754. $this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
  66755. $this->content[] = $lineContent;
  66756. $this->content[] = \PHP_EOL;
  66757. }
  66758. }
  66759. protected function doWrite(string $message, bool $newline)
  66760. {
  66761. if (!$this->isDecorated()) {
  66762. parent::doWrite($message, $newline);
  66763. return;
  66764. }
  66765. $erasedContent = $this->popStreamContentUntilCurrentSection();
  66766. $this->addContent($message);
  66767. parent::doWrite($message, true);
  66768. parent::doWrite($erasedContent, false);
  66769. }
  66770. private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
  66771. {
  66772. $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
  66773. $erasedContent = [];
  66774. foreach ($this->sections as $section) {
  66775. if ($section === $this) {
  66776. break;
  66777. }
  66778. $numberOfLinesToClear += $section->lines;
  66779. $erasedContent[] = $section->getContent();
  66780. }
  66781. if ($numberOfLinesToClear > 0) {
  66782. parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
  66783. parent::doWrite("\x1b[0J", false);
  66784. }
  66785. return implode('', array_reverse($erasedContent));
  66786. }
  66787. private function getDisplayLength(string $text): int
  66788. {
  66789. return Helper::width(Helper::removeDecoration($this->getFormatter(), str_replace("\t", ' ', $text)));
  66790. }
  66791. }
  66792. <?php
  66793. namespace Symfony\Component\Console\Output;
  66794. use Symfony\Component\Console\Formatter\NullOutputFormatter;
  66795. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  66796. class NullOutput implements OutputInterface
  66797. {
  66798. private $formatter;
  66799. public function setFormatter(OutputFormatterInterface $formatter)
  66800. {
  66801. }
  66802. public function getFormatter()
  66803. {
  66804. if ($this->formatter) {
  66805. return $this->formatter;
  66806. }
  66807. return $this->formatter = new NullOutputFormatter();
  66808. }
  66809. public function setDecorated(bool $decorated)
  66810. {
  66811. }
  66812. public function isDecorated()
  66813. {
  66814. return false;
  66815. }
  66816. public function setVerbosity(int $level)
  66817. {
  66818. }
  66819. public function getVerbosity()
  66820. {
  66821. return self::VERBOSITY_QUIET;
  66822. }
  66823. public function isQuiet()
  66824. {
  66825. return true;
  66826. }
  66827. public function isVerbose()
  66828. {
  66829. return false;
  66830. }
  66831. public function isVeryVerbose()
  66832. {
  66833. return false;
  66834. }
  66835. public function isDebug()
  66836. {
  66837. return false;
  66838. }
  66839. public function writeln($messages, int $options = self::OUTPUT_NORMAL)
  66840. {
  66841. }
  66842. public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
  66843. {
  66844. }
  66845. }
  66846. <?php
  66847. namespace Symfony\Component\Console\Output;
  66848. use Symfony\Component\Console\Formatter\OutputFormatter;
  66849. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  66850. abstract class Output implements OutputInterface
  66851. {
  66852. private $verbosity;
  66853. private $formatter;
  66854. public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null)
  66855. {
  66856. $this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL;
  66857. $this->formatter = $formatter ?? new OutputFormatter();
  66858. $this->formatter->setDecorated($decorated);
  66859. }
  66860. public function setFormatter(OutputFormatterInterface $formatter)
  66861. {
  66862. $this->formatter = $formatter;
  66863. }
  66864. public function getFormatter()
  66865. {
  66866. return $this->formatter;
  66867. }
  66868. public function setDecorated(bool $decorated)
  66869. {
  66870. $this->formatter->setDecorated($decorated);
  66871. }
  66872. public function isDecorated()
  66873. {
  66874. return $this->formatter->isDecorated();
  66875. }
  66876. public function setVerbosity(int $level)
  66877. {
  66878. $this->verbosity = $level;
  66879. }
  66880. public function getVerbosity()
  66881. {
  66882. return $this->verbosity;
  66883. }
  66884. public function isQuiet()
  66885. {
  66886. return self::VERBOSITY_QUIET === $this->verbosity;
  66887. }
  66888. public function isVerbose()
  66889. {
  66890. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  66891. }
  66892. public function isVeryVerbose()
  66893. {
  66894. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  66895. }
  66896. public function isDebug()
  66897. {
  66898. return self::VERBOSITY_DEBUG <= $this->verbosity;
  66899. }
  66900. public function writeln($messages, int $options = self::OUTPUT_NORMAL)
  66901. {
  66902. $this->write($messages, true, $options);
  66903. }
  66904. public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
  66905. {
  66906. if (!is_iterable($messages)) {
  66907. $messages = [$messages];
  66908. }
  66909. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  66910. $type = $types & $options ?: self::OUTPUT_NORMAL;
  66911. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  66912. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  66913. if ($verbosity > $this->getVerbosity()) {
  66914. return;
  66915. }
  66916. foreach ($messages as $message) {
  66917. switch ($type) {
  66918. case OutputInterface::OUTPUT_NORMAL:
  66919. $message = $this->formatter->format($message);
  66920. break;
  66921. case OutputInterface::OUTPUT_RAW:
  66922. break;
  66923. case OutputInterface::OUTPUT_PLAIN:
  66924. $message = strip_tags($this->formatter->format($message));
  66925. break;
  66926. }
  66927. $this->doWrite($message ?? '', $newline);
  66928. }
  66929. }
  66930. abstract protected function doWrite(string $message, bool $newline);
  66931. }
  66932. <?php
  66933. namespace Symfony\Component\Console\Output;
  66934. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  66935. interface OutputInterface
  66936. {
  66937. public const VERBOSITY_QUIET = 16;
  66938. public const VERBOSITY_NORMAL = 32;
  66939. public const VERBOSITY_VERBOSE = 64;
  66940. public const VERBOSITY_VERY_VERBOSE = 128;
  66941. public const VERBOSITY_DEBUG = 256;
  66942. public const OUTPUT_NORMAL = 1;
  66943. public const OUTPUT_RAW = 2;
  66944. public const OUTPUT_PLAIN = 4;
  66945. public function write($messages, bool $newline = false, int $options = 0);
  66946. public function writeln($messages, int $options = 0);
  66947. public function setVerbosity(int $level);
  66948. public function getVerbosity();
  66949. public function isQuiet();
  66950. public function isVerbose();
  66951. public function isVeryVerbose();
  66952. public function isDebug();
  66953. public function setDecorated(bool $decorated);
  66954. public function isDecorated();
  66955. public function setFormatter(OutputFormatterInterface $formatter);
  66956. public function getFormatter();
  66957. }
  66958. <?php
  66959. namespace Symfony\Component\Console\Output;
  66960. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66961. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  66962. class StreamOutput extends Output
  66963. {
  66964. private $stream;
  66965. public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null)
  66966. {
  66967. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  66968. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  66969. }
  66970. $this->stream = $stream;
  66971. if (null === $decorated) {
  66972. $decorated = $this->hasColorSupport();
  66973. }
  66974. parent::__construct($verbosity, $decorated, $formatter);
  66975. }
  66976. public function getStream()
  66977. {
  66978. return $this->stream;
  66979. }
  66980. protected function doWrite(string $message, bool $newline)
  66981. {
  66982. if ($newline) {
  66983. $message .= \PHP_EOL;
  66984. }
  66985. @fwrite($this->stream, $message);
  66986. fflush($this->stream);
  66987. }
  66988. protected function hasColorSupport()
  66989. {
  66990. if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
  66991. return false;
  66992. }
  66993. if (!$this->isTty()) {
  66994. return false;
  66995. }
  66996. if (\DIRECTORY_SEPARATOR === '\\'
  66997. && \function_exists('sapi_windows_vt100_support')
  66998. && @sapi_windows_vt100_support($this->stream)
  66999. ) {
  67000. return true;
  67001. }
  67002. return 'Hyper' === getenv('TERM_PROGRAM')
  67003. || false !== getenv('ANSICON')
  67004. || 'ON' === getenv('ConEmuANSI')
  67005. || str_starts_with((string) getenv('TERM'), 'xterm');
  67006. }
  67007. private function isTty(): bool
  67008. {
  67009. if (\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
  67010. return true;
  67011. }
  67012. if (\function_exists('stream_isatty')) {
  67013. return stream_isatty($this->stream);
  67014. }
  67015. if (\function_exists('posix_isatty') && posix_isatty($this->stream)) {
  67016. return true;
  67017. }
  67018. $stat = @fstat($this->stream);
  67019. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  67020. }
  67021. }
  67022. <?php
  67023. namespace Symfony\Component\Console\Output;
  67024. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67025. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  67026. class TrimmedBufferOutput extends Output
  67027. {
  67028. private $maxLength;
  67029. private $buffer = '';
  67030. public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null)
  67031. {
  67032. if ($maxLength <= 0) {
  67033. throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
  67034. }
  67035. parent::__construct($verbosity, $decorated, $formatter);
  67036. $this->maxLength = $maxLength;
  67037. }
  67038. public function fetch()
  67039. {
  67040. $content = $this->buffer;
  67041. $this->buffer = '';
  67042. return $content;
  67043. }
  67044. protected function doWrite(string $message, bool $newline)
  67045. {
  67046. $this->buffer .= $message;
  67047. if ($newline) {
  67048. $this->buffer .= \PHP_EOL;
  67049. }
  67050. $this->buffer = substr($this->buffer, 0 - $this->maxLength);
  67051. }
  67052. }
  67053. <?php
  67054. namespace Symfony\Component\Console\Question;
  67055. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67056. class ChoiceQuestion extends Question
  67057. {
  67058. private $choices;
  67059. private $multiselect = false;
  67060. private $prompt = ' > ';
  67061. private $errorMessage = 'Value "%s" is invalid';
  67062. public function __construct(string $question, array $choices, $default = null)
  67063. {
  67064. if (!$choices) {
  67065. throw new \LogicException('Choice question must have at least 1 choice available.');
  67066. }
  67067. parent::__construct($question, $default);
  67068. $this->choices = $choices;
  67069. $this->setValidator($this->getDefaultValidator());
  67070. $this->setAutocompleterValues($choices);
  67071. }
  67072. public function getChoices()
  67073. {
  67074. return $this->choices;
  67075. }
  67076. public function setMultiselect(bool $multiselect)
  67077. {
  67078. $this->multiselect = $multiselect;
  67079. $this->setValidator($this->getDefaultValidator());
  67080. return $this;
  67081. }
  67082. public function isMultiselect()
  67083. {
  67084. return $this->multiselect;
  67085. }
  67086. public function getPrompt()
  67087. {
  67088. return $this->prompt;
  67089. }
  67090. public function setPrompt(string $prompt)
  67091. {
  67092. $this->prompt = $prompt;
  67093. return $this;
  67094. }
  67095. public function setErrorMessage(string $errorMessage)
  67096. {
  67097. $this->errorMessage = $errorMessage;
  67098. $this->setValidator($this->getDefaultValidator());
  67099. return $this;
  67100. }
  67101. private function getDefaultValidator(): callable
  67102. {
  67103. $choices = $this->choices;
  67104. $errorMessage = $this->errorMessage;
  67105. $multiselect = $this->multiselect;
  67106. $isAssoc = $this->isAssoc($choices);
  67107. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  67108. if ($multiselect) {
  67109. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
  67110. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  67111. }
  67112. $selectedChoices = explode(',', (string) $selected);
  67113. } else {
  67114. $selectedChoices = [$selected];
  67115. }
  67116. if ($this->isTrimmable()) {
  67117. foreach ($selectedChoices as $k => $v) {
  67118. $selectedChoices[$k] = trim((string) $v);
  67119. }
  67120. }
  67121. $multiselectChoices = [];
  67122. foreach ($selectedChoices as $value) {
  67123. $results = [];
  67124. foreach ($choices as $key => $choice) {
  67125. if ($choice === $value) {
  67126. $results[] = $key;
  67127. }
  67128. }
  67129. if (\count($results) > 1) {
  67130. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
  67131. }
  67132. $result = array_search($value, $choices);
  67133. if (!$isAssoc) {
  67134. if (false !== $result) {
  67135. $result = $choices[$result];
  67136. } elseif (isset($choices[$value])) {
  67137. $result = $choices[$value];
  67138. }
  67139. } elseif (false === $result && isset($choices[$value])) {
  67140. $result = $value;
  67141. }
  67142. if (false === $result) {
  67143. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  67144. }
  67145. $multiselectChoices[] = $isAssoc ? (string) $result : $result;
  67146. }
  67147. if ($multiselect) {
  67148. return $multiselectChoices;
  67149. }
  67150. return current($multiselectChoices);
  67151. };
  67152. }
  67153. }
  67154. <?php
  67155. namespace Symfony\Component\Console\Question;
  67156. class ConfirmationQuestion extends Question
  67157. {
  67158. private $trueAnswerRegex;
  67159. public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i')
  67160. {
  67161. parent::__construct($question, $default);
  67162. $this->trueAnswerRegex = $trueAnswerRegex;
  67163. $this->setNormalizer($this->getDefaultNormalizer());
  67164. }
  67165. private function getDefaultNormalizer(): callable
  67166. {
  67167. $default = $this->getDefault();
  67168. $regex = $this->trueAnswerRegex;
  67169. return function ($answer) use ($default, $regex) {
  67170. if (\is_bool($answer)) {
  67171. return $answer;
  67172. }
  67173. $answerIsTrue = (bool) preg_match($regex, $answer);
  67174. if (false === $default) {
  67175. return $answer && $answerIsTrue;
  67176. }
  67177. return '' === $answer || $answerIsTrue;
  67178. };
  67179. }
  67180. }
  67181. <?php
  67182. namespace Symfony\Component\Console\Question;
  67183. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67184. use Symfony\Component\Console\Exception\LogicException;
  67185. class Question
  67186. {
  67187. private $question;
  67188. private $attempts;
  67189. private $hidden = false;
  67190. private $hiddenFallback = true;
  67191. private $autocompleterCallback;
  67192. private $validator;
  67193. private $default;
  67194. private $normalizer;
  67195. private $trimmable = true;
  67196. private $multiline = false;
  67197. public function __construct(string $question, $default = null)
  67198. {
  67199. $this->question = $question;
  67200. $this->default = $default;
  67201. }
  67202. public function getQuestion()
  67203. {
  67204. return $this->question;
  67205. }
  67206. public function getDefault()
  67207. {
  67208. return $this->default;
  67209. }
  67210. public function isMultiline(): bool
  67211. {
  67212. return $this->multiline;
  67213. }
  67214. public function setMultiline(bool $multiline): self
  67215. {
  67216. $this->multiline = $multiline;
  67217. return $this;
  67218. }
  67219. public function isHidden()
  67220. {
  67221. return $this->hidden;
  67222. }
  67223. public function setHidden(bool $hidden)
  67224. {
  67225. if ($this->autocompleterCallback) {
  67226. throw new LogicException('A hidden question cannot use the autocompleter.');
  67227. }
  67228. $this->hidden = $hidden;
  67229. return $this;
  67230. }
  67231. public function isHiddenFallback()
  67232. {
  67233. return $this->hiddenFallback;
  67234. }
  67235. public function setHiddenFallback(bool $fallback)
  67236. {
  67237. $this->hiddenFallback = $fallback;
  67238. return $this;
  67239. }
  67240. public function getAutocompleterValues()
  67241. {
  67242. $callback = $this->getAutocompleterCallback();
  67243. return $callback ? $callback('') : null;
  67244. }
  67245. public function setAutocompleterValues(?iterable $values)
  67246. {
  67247. if (\is_array($values)) {
  67248. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  67249. $callback = static function () use ($values) {
  67250. return $values;
  67251. };
  67252. } elseif ($values instanceof \Traversable) {
  67253. $valueCache = null;
  67254. $callback = static function () use ($values, &$valueCache) {
  67255. return $valueCache ?? $valueCache = iterator_to_array($values, false);
  67256. };
  67257. } else {
  67258. $callback = null;
  67259. }
  67260. return $this->setAutocompleterCallback($callback);
  67261. }
  67262. public function getAutocompleterCallback(): ?callable
  67263. {
  67264. return $this->autocompleterCallback;
  67265. }
  67266. public function setAutocompleterCallback(?callable $callback = null): self
  67267. {
  67268. if ($this->hidden && null !== $callback) {
  67269. throw new LogicException('A hidden question cannot use the autocompleter.');
  67270. }
  67271. $this->autocompleterCallback = $callback;
  67272. return $this;
  67273. }
  67274. public function setValidator(?callable $validator = null)
  67275. {
  67276. $this->validator = $validator;
  67277. return $this;
  67278. }
  67279. public function getValidator()
  67280. {
  67281. return $this->validator;
  67282. }
  67283. public function setMaxAttempts(?int $attempts)
  67284. {
  67285. if (null !== $attempts && $attempts < 1) {
  67286. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  67287. }
  67288. $this->attempts = $attempts;
  67289. return $this;
  67290. }
  67291. public function getMaxAttempts()
  67292. {
  67293. return $this->attempts;
  67294. }
  67295. public function setNormalizer(callable $normalizer)
  67296. {
  67297. $this->normalizer = $normalizer;
  67298. return $this;
  67299. }
  67300. public function getNormalizer()
  67301. {
  67302. return $this->normalizer;
  67303. }
  67304. protected function isAssoc(array $array)
  67305. {
  67306. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  67307. }
  67308. public function isTrimmable(): bool
  67309. {
  67310. return $this->trimmable;
  67311. }
  67312. public function setTrimmable(bool $trimmable): self
  67313. {
  67314. $this->trimmable = $trimmable;
  67315. return $this;
  67316. }
  67317. }
  67318. MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  67319. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  67320. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  67321. ����������������� ��`.rdata����� ���
  67322. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  67323. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  67324. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  67325. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  67326. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  67327. <security>
  67328. <requestedPrivileges>
  67329. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  67330. </requestedPrivileges>
  67331. </security>
  67332. </trustInfo>
  67333. <dependency>
  67334. <dependentAssembly>
  67335. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  67336. </dependentAssembly>
  67337. </dependency>
  67338. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������# This file is part of the Symfony package.
  67339. #
  67340. # (c) Fabien Potencier <fabien@symfony.com>
  67341. #
  67342. # For the full copyright and license information, please view
  67343. # https://symfony.com/doc/current/contributing/code/license.html
  67344. _sf_{{ COMMAND_NAME }}() {
  67345. # Use newline as only separator to allow space in completion values
  67346. IFS=$'\n'
  67347. local sf_cmd="${COMP_WORDS[0]}"
  67348. # for an alias, get the real script behind it
  67349. sf_cmd_type=$(type -t $sf_cmd)
  67350. if [[ $sf_cmd_type == "alias" ]]; then
  67351. sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
  67352. elif [[ $sf_cmd_type == "file" ]]; then
  67353. sf_cmd=$(type -p $sf_cmd)
  67354. fi
  67355. if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
  67356. return 1
  67357. fi
  67358. local cur prev words cword
  67359. _get_comp_words_by_ref -n := cur prev words cword
  67360. local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S{{ VERSION }}")
  67361. for w in ${words[@]}; do
  67362. w=$(printf -- '%b' "$w")
  67363. # remove quotes from typed values
  67364. quote="${w:0:1}"
  67365. if [ "$quote" == \' ]; then
  67366. w="${w%\'}"
  67367. w="${w#\'}"
  67368. elif [ "$quote" == \" ]; then
  67369. w="${w%\"}"
  67370. w="${w#\"}"
  67371. fi
  67372. # empty values are ignored
  67373. if [ ! -z "$w" ]; then
  67374. completecmd+=("-i$w")
  67375. fi
  67376. done
  67377. local sfcomplete
  67378. if sfcomplete=$(${completecmd[@]} 2>&1); then
  67379. local quote suggestions
  67380. quote=${cur:0:1}
  67381. # Use single quotes by default if suggestions contains backslash (FQCN)
  67382. if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then
  67383. quote=\'
  67384. fi
  67385. if [ "$quote" == \' ]; then
  67386. # single quotes: no additional escaping (does not accept ' in values)
  67387. suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done)
  67388. elif [ "$quote" == \" ]; then
  67389. # double quotes: double escaping for \ $ ` "
  67390. suggestions=$(for s in $sfcomplete; do
  67391. s=${s//\\/\\\\}
  67392. s=${s//\$/\\\$}
  67393. s=${s//\`/\\\`}
  67394. s=${s//\"/\\\"}
  67395. printf $'%q%q%q\n' "$quote" "$s" "$quote";
  67396. done)
  67397. else
  67398. # no quotes: double escaping
  67399. suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done)
  67400. fi
  67401. COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur")))
  67402. __ltrim_colon_completions "$cur"
  67403. else
  67404. if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then
  67405. >&2 echo
  67406. >&2 echo $sfcomplete
  67407. fi
  67408. return 1
  67409. fi
  67410. }
  67411. complete -F _sf_{{ COMMAND_NAME }} {{ COMMAND_NAME }}
  67412. <?php
  67413. namespace Symfony\Component\Console\SignalRegistry;
  67414. final class SignalRegistry
  67415. {
  67416. private $signalHandlers = [];
  67417. public function __construct()
  67418. {
  67419. if (\function_exists('pcntl_async_signals')) {
  67420. pcntl_async_signals(true);
  67421. }
  67422. }
  67423. public function register(int $signal, callable $signalHandler): void
  67424. {
  67425. if (!isset($this->signalHandlers[$signal])) {
  67426. $previousCallback = pcntl_signal_get_handler($signal);
  67427. if (\is_callable($previousCallback)) {
  67428. $this->signalHandlers[$signal][] = $previousCallback;
  67429. }
  67430. }
  67431. $this->signalHandlers[$signal][] = $signalHandler;
  67432. pcntl_signal($signal, [$this, 'handle']);
  67433. }
  67434. public static function isSupported(): bool
  67435. {
  67436. if (!\function_exists('pcntl_signal')) {
  67437. return false;
  67438. }
  67439. if (\in_array('pcntl_signal', explode(',', \ini_get('disable_functions')))) {
  67440. return false;
  67441. }
  67442. return true;
  67443. }
  67444. public function handle(int $signal): void
  67445. {
  67446. $count = \count($this->signalHandlers[$signal]);
  67447. foreach ($this->signalHandlers[$signal] as $i => $signalHandler) {
  67448. $hasNext = $i !== $count - 1;
  67449. $signalHandler($signal, $hasNext);
  67450. }
  67451. }
  67452. }
  67453. <?php
  67454. namespace Symfony\Component\Console;
  67455. use Symfony\Component\Console\Command\Command;
  67456. use Symfony\Component\Console\Input\InputInterface;
  67457. use Symfony\Component\Console\Output\OutputInterface;
  67458. class SingleCommandApplication extends Command
  67459. {
  67460. private $version = 'UNKNOWN';
  67461. private $autoExit = true;
  67462. private $running = false;
  67463. public function setVersion(string $version): self
  67464. {
  67465. $this->version = $version;
  67466. return $this;
  67467. }
  67468. public function setAutoExit(bool $autoExit): self
  67469. {
  67470. $this->autoExit = $autoExit;
  67471. return $this;
  67472. }
  67473. public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
  67474. {
  67475. if ($this->running) {
  67476. return parent::run($input, $output);
  67477. }
  67478. $application = new Application($this->getName() ?: 'UNKNOWN', $this->version);
  67479. $application->setAutoExit($this->autoExit);
  67480. $this->setName($_SERVER['argv'][0]);
  67481. $application->add($this);
  67482. $application->setDefaultCommand($this->getName(), true);
  67483. $this->running = true;
  67484. try {
  67485. $ret = $application->run($input, $output);
  67486. } finally {
  67487. $this->running = false;
  67488. }
  67489. return $ret ?? 1;
  67490. }
  67491. }
  67492. <?php
  67493. namespace Symfony\Component\Console\Style;
  67494. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  67495. use Symfony\Component\Console\Helper\ProgressBar;
  67496. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  67497. use Symfony\Component\Console\Output\OutputInterface;
  67498. abstract class OutputStyle implements OutputInterface, StyleInterface
  67499. {
  67500. private $output;
  67501. public function __construct(OutputInterface $output)
  67502. {
  67503. $this->output = $output;
  67504. }
  67505. public function newLine(int $count = 1)
  67506. {
  67507. $this->output->write(str_repeat(\PHP_EOL, $count));
  67508. }
  67509. public function createProgressBar(int $max = 0)
  67510. {
  67511. return new ProgressBar($this->output, $max);
  67512. }
  67513. public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
  67514. {
  67515. $this->output->write($messages, $newline, $type);
  67516. }
  67517. public function writeln($messages, int $type = self::OUTPUT_NORMAL)
  67518. {
  67519. $this->output->writeln($messages, $type);
  67520. }
  67521. public function setVerbosity(int $level)
  67522. {
  67523. $this->output->setVerbosity($level);
  67524. }
  67525. public function getVerbosity()
  67526. {
  67527. return $this->output->getVerbosity();
  67528. }
  67529. public function setDecorated(bool $decorated)
  67530. {
  67531. $this->output->setDecorated($decorated);
  67532. }
  67533. public function isDecorated()
  67534. {
  67535. return $this->output->isDecorated();
  67536. }
  67537. public function setFormatter(OutputFormatterInterface $formatter)
  67538. {
  67539. $this->output->setFormatter($formatter);
  67540. }
  67541. public function getFormatter()
  67542. {
  67543. return $this->output->getFormatter();
  67544. }
  67545. public function isQuiet()
  67546. {
  67547. return $this->output->isQuiet();
  67548. }
  67549. public function isVerbose()
  67550. {
  67551. return $this->output->isVerbose();
  67552. }
  67553. public function isVeryVerbose()
  67554. {
  67555. return $this->output->isVeryVerbose();
  67556. }
  67557. public function isDebug()
  67558. {
  67559. return $this->output->isDebug();
  67560. }
  67561. protected function getErrorOutput()
  67562. {
  67563. if (!$this->output instanceof ConsoleOutputInterface) {
  67564. return $this->output;
  67565. }
  67566. return $this->output->getErrorOutput();
  67567. }
  67568. }
  67569. <?php
  67570. namespace Symfony\Component\Console\Style;
  67571. interface StyleInterface
  67572. {
  67573. public function title(string $message);
  67574. public function section(string $message);
  67575. public function listing(array $elements);
  67576. public function text($message);
  67577. public function success($message);
  67578. public function error($message);
  67579. public function warning($message);
  67580. public function note($message);
  67581. public function caution($message);
  67582. public function table(array $headers, array $rows);
  67583. public function ask(string $question, ?string $default = null, ?callable $validator = null);
  67584. public function askHidden(string $question, ?callable $validator = null);
  67585. public function confirm(string $question, bool $default = true);
  67586. public function choice(string $question, array $choices, $default = null);
  67587. public function newLine(int $count = 1);
  67588. public function progressStart(int $max = 0);
  67589. public function progressAdvance(int $step = 1);
  67590. public function progressFinish();
  67591. }
  67592. <?php
  67593. namespace Symfony\Component\Console\Style;
  67594. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67595. use Symfony\Component\Console\Exception\RuntimeException;
  67596. use Symfony\Component\Console\Formatter\OutputFormatter;
  67597. use Symfony\Component\Console\Helper\Helper;
  67598. use Symfony\Component\Console\Helper\ProgressBar;
  67599. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  67600. use Symfony\Component\Console\Helper\Table;
  67601. use Symfony\Component\Console\Helper\TableCell;
  67602. use Symfony\Component\Console\Helper\TableSeparator;
  67603. use Symfony\Component\Console\Input\InputInterface;
  67604. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  67605. use Symfony\Component\Console\Output\OutputInterface;
  67606. use Symfony\Component\Console\Output\TrimmedBufferOutput;
  67607. use Symfony\Component\Console\Question\ChoiceQuestion;
  67608. use Symfony\Component\Console\Question\ConfirmationQuestion;
  67609. use Symfony\Component\Console\Question\Question;
  67610. use Symfony\Component\Console\Terminal;
  67611. class SymfonyStyle extends OutputStyle
  67612. {
  67613. public const MAX_LINE_LENGTH = 120;
  67614. private $input;
  67615. private $output;
  67616. private $questionHelper;
  67617. private $progressBar;
  67618. private $lineLength;
  67619. private $bufferedOutput;
  67620. public function __construct(InputInterface $input, OutputInterface $output)
  67621. {
  67622. $this->input = $input;
  67623. $this->bufferedOutput = new TrimmedBufferOutput(\DIRECTORY_SEPARATOR === '\\' ? 4 : 2, $output->getVerbosity(), false, clone $output->getFormatter());
  67624. $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
  67625. $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  67626. parent::__construct($this->output = $output);
  67627. }
  67628. public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
  67629. {
  67630. $messages = \is_array($messages) ? array_values($messages) : [$messages];
  67631. $this->autoPrependBlock();
  67632. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
  67633. $this->newLine();
  67634. }
  67635. public function title(string $message)
  67636. {
  67637. $this->autoPrependBlock();
  67638. $this->writeln([
  67639. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  67640. sprintf('<comment>%s</>', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
  67641. ]);
  67642. $this->newLine();
  67643. }
  67644. public function section(string $message)
  67645. {
  67646. $this->autoPrependBlock();
  67647. $this->writeln([
  67648. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  67649. sprintf('<comment>%s</>', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
  67650. ]);
  67651. $this->newLine();
  67652. }
  67653. public function listing(array $elements)
  67654. {
  67655. $this->autoPrependText();
  67656. $elements = array_map(function ($element) {
  67657. return sprintf(' * %s', $element);
  67658. }, $elements);
  67659. $this->writeln($elements);
  67660. $this->newLine();
  67661. }
  67662. public function text($message)
  67663. {
  67664. $this->autoPrependText();
  67665. $messages = \is_array($message) ? array_values($message) : [$message];
  67666. foreach ($messages as $message) {
  67667. $this->writeln(sprintf(' %s', $message));
  67668. }
  67669. }
  67670. public function comment($message)
  67671. {
  67672. $this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
  67673. }
  67674. public function success($message)
  67675. {
  67676. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  67677. }
  67678. public function error($message)
  67679. {
  67680. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  67681. }
  67682. public function warning($message)
  67683. {
  67684. $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true);
  67685. }
  67686. public function note($message)
  67687. {
  67688. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  67689. }
  67690. public function info($message)
  67691. {
  67692. $this->block($message, 'INFO', 'fg=green', ' ', true);
  67693. }
  67694. public function caution($message)
  67695. {
  67696. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  67697. }
  67698. public function table(array $headers, array $rows)
  67699. {
  67700. $this->createTable()
  67701. ->setHeaders($headers)
  67702. ->setRows($rows)
  67703. ->render()
  67704. ;
  67705. $this->newLine();
  67706. }
  67707. public function horizontalTable(array $headers, array $rows)
  67708. {
  67709. $this->createTable()
  67710. ->setHorizontal(true)
  67711. ->setHeaders($headers)
  67712. ->setRows($rows)
  67713. ->render()
  67714. ;
  67715. $this->newLine();
  67716. }
  67717. public function definitionList(...$list)
  67718. {
  67719. $headers = [];
  67720. $row = [];
  67721. foreach ($list as $value) {
  67722. if ($value instanceof TableSeparator) {
  67723. $headers[] = $value;
  67724. $row[] = $value;
  67725. continue;
  67726. }
  67727. if (\is_string($value)) {
  67728. $headers[] = new TableCell($value, ['colspan' => 2]);
  67729. $row[] = null;
  67730. continue;
  67731. }
  67732. if (!\is_array($value)) {
  67733. throw new InvalidArgumentException('Value should be an array, string, or an instance of TableSeparator.');
  67734. }
  67735. $headers[] = key($value);
  67736. $row[] = current($value);
  67737. }
  67738. $this->horizontalTable($headers, [$row]);
  67739. }
  67740. public function ask(string $question, ?string $default = null, ?callable $validator = null)
  67741. {
  67742. $question = new Question($question, $default);
  67743. $question->setValidator($validator);
  67744. return $this->askQuestion($question);
  67745. }
  67746. public function askHidden(string $question, ?callable $validator = null)
  67747. {
  67748. $question = new Question($question);
  67749. $question->setHidden(true);
  67750. $question->setValidator($validator);
  67751. return $this->askQuestion($question);
  67752. }
  67753. public function confirm(string $question, bool $default = true)
  67754. {
  67755. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  67756. }
  67757. public function choice(string $question, array $choices, $default = null)
  67758. {
  67759. if (null !== $default) {
  67760. $values = array_flip($choices);
  67761. $default = $values[$default] ?? $default;
  67762. }
  67763. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  67764. }
  67765. public function progressStart(int $max = 0)
  67766. {
  67767. $this->progressBar = $this->createProgressBar($max);
  67768. $this->progressBar->start();
  67769. }
  67770. public function progressAdvance(int $step = 1)
  67771. {
  67772. $this->getProgressBar()->advance($step);
  67773. }
  67774. public function progressFinish()
  67775. {
  67776. $this->getProgressBar()->finish();
  67777. $this->newLine(2);
  67778. $this->progressBar = null;
  67779. }
  67780. public function createProgressBar(int $max = 0)
  67781. {
  67782. $progressBar = parent::createProgressBar($max);
  67783. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  67784. $progressBar->setEmptyBarCharacter('â–‘');
  67785. $progressBar->setProgressCharacter('');
  67786. $progressBar->setBarCharacter('â–“');
  67787. }
  67788. return $progressBar;
  67789. }
  67790. public function progressIterate(iterable $iterable, ?int $max = null): iterable
  67791. {
  67792. yield from $this->createProgressBar()->iterate($iterable, $max);
  67793. $this->newLine(2);
  67794. }
  67795. public function askQuestion(Question $question)
  67796. {
  67797. if ($this->input->isInteractive()) {
  67798. $this->autoPrependBlock();
  67799. }
  67800. if (!$this->questionHelper) {
  67801. $this->questionHelper = new SymfonyQuestionHelper();
  67802. }
  67803. $answer = $this->questionHelper->ask($this->input, $this, $question);
  67804. if ($this->input->isInteractive()) {
  67805. $this->newLine();
  67806. $this->bufferedOutput->write("\n");
  67807. }
  67808. return $answer;
  67809. }
  67810. public function writeln($messages, int $type = self::OUTPUT_NORMAL)
  67811. {
  67812. if (!is_iterable($messages)) {
  67813. $messages = [$messages];
  67814. }
  67815. foreach ($messages as $message) {
  67816. parent::writeln($message, $type);
  67817. $this->writeBuffer($message, true, $type);
  67818. }
  67819. }
  67820. public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
  67821. {
  67822. if (!is_iterable($messages)) {
  67823. $messages = [$messages];
  67824. }
  67825. foreach ($messages as $message) {
  67826. parent::write($message, $newline, $type);
  67827. $this->writeBuffer($message, $newline, $type);
  67828. }
  67829. }
  67830. public function newLine(int $count = 1)
  67831. {
  67832. parent::newLine($count);
  67833. $this->bufferedOutput->write(str_repeat("\n", $count));
  67834. }
  67835. public function getErrorStyle()
  67836. {
  67837. return new self($this->input, $this->getErrorOutput());
  67838. }
  67839. public function createTable(): Table
  67840. {
  67841. $output = $this->output instanceof ConsoleOutputInterface ? $this->output->section() : $this->output;
  67842. $style = clone Table::getStyleDefinition('symfony-style-guide');
  67843. $style->setCellHeaderFormat('<info>%s</info>');
  67844. return (new Table($output))->setStyle($style);
  67845. }
  67846. private function getProgressBar(): ProgressBar
  67847. {
  67848. if (!$this->progressBar) {
  67849. throw new RuntimeException('The ProgressBar is not started.');
  67850. }
  67851. return $this->progressBar;
  67852. }
  67853. private function autoPrependBlock(): void
  67854. {
  67855. $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  67856. if (!isset($chars[0])) {
  67857. $this->newLine();
  67858. return;
  67859. }
  67860. $this->newLine(2 - substr_count($chars, "\n"));
  67861. }
  67862. private function autoPrependText(): void
  67863. {
  67864. $fetched = $this->bufferedOutput->fetch();
  67865. if (!str_ends_with($fetched, "\n")) {
  67866. $this->newLine();
  67867. }
  67868. }
  67869. private function writeBuffer(string $message, bool $newLine, int $type): void
  67870. {
  67871. $this->bufferedOutput->write($message, $newLine, $type);
  67872. }
  67873. private function createBlock(iterable $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
  67874. {
  67875. $indentLength = 0;
  67876. $prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix));
  67877. $lines = [];
  67878. if (null !== $type) {
  67879. $type = sprintf('[%s] ', $type);
  67880. $indentLength = \strlen($type);
  67881. $lineIndentation = str_repeat(' ', $indentLength);
  67882. }
  67883. foreach ($messages as $key => $message) {
  67884. if ($escape) {
  67885. $message = OutputFormatter::escape($message);
  67886. }
  67887. $decorationLength = Helper::width($message) - Helper::width(Helper::removeDecoration($this->getFormatter(), $message));
  67888. $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
  67889. $messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
  67890. foreach ($messageLines as $messageLine) {
  67891. $lines[] = $messageLine;
  67892. }
  67893. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  67894. $lines[] = '';
  67895. }
  67896. }
  67897. $firstLineIndex = 0;
  67898. if ($padding && $this->isDecorated()) {
  67899. $firstLineIndex = 1;
  67900. array_unshift($lines, '');
  67901. $lines[] = '';
  67902. }
  67903. foreach ($lines as $i => &$line) {
  67904. if (null !== $type) {
  67905. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  67906. }
  67907. $line = $prefix.$line;
  67908. $line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0));
  67909. if ($style) {
  67910. $line = sprintf('<%s>%s</>', $style, $line);
  67911. }
  67912. }
  67913. return $lines;
  67914. }
  67915. }
  67916. <?php
  67917. namespace Symfony\Component\Console;
  67918. class Terminal
  67919. {
  67920. private static $width;
  67921. private static $height;
  67922. private static $stty;
  67923. public function getWidth()
  67924. {
  67925. $width = getenv('COLUMNS');
  67926. if (false !== $width) {
  67927. return (int) trim($width);
  67928. }
  67929. if (null === self::$width) {
  67930. self::initDimensions();
  67931. }
  67932. return self::$width ?: 80;
  67933. }
  67934. public function getHeight()
  67935. {
  67936. $height = getenv('LINES');
  67937. if (false !== $height) {
  67938. return (int) trim($height);
  67939. }
  67940. if (null === self::$height) {
  67941. self::initDimensions();
  67942. }
  67943. return self::$height ?: 50;
  67944. }
  67945. public static function hasSttyAvailable(): bool
  67946. {
  67947. if (null !== self::$stty) {
  67948. return self::$stty;
  67949. }
  67950. if (!\function_exists('shell_exec')) {
  67951. return false;
  67952. }
  67953. return self::$stty = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
  67954. }
  67955. private static function initDimensions()
  67956. {
  67957. if ('\\' === \DIRECTORY_SEPARATOR) {
  67958. $ansicon = getenv('ANSICON');
  67959. if (false !== $ansicon && preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim($ansicon), $matches)) {
  67960. self::$width = (int) $matches[1];
  67961. self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
  67962. } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {
  67963. self::initDimensionsUsingStty();
  67964. } elseif (null !== $dimensions = self::getConsoleMode()) {
  67965. self::$width = (int) $dimensions[0];
  67966. self::$height = (int) $dimensions[1];
  67967. }
  67968. } else {
  67969. self::initDimensionsUsingStty();
  67970. }
  67971. }
  67972. private static function hasVt100Support(): bool
  67973. {
  67974. return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));
  67975. }
  67976. private static function initDimensionsUsingStty()
  67977. {
  67978. if ($sttyString = self::getSttyColumns()) {
  67979. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  67980. self::$width = (int) $matches[2];
  67981. self::$height = (int) $matches[1];
  67982. } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  67983. self::$width = (int) $matches[2];
  67984. self::$height = (int) $matches[1];
  67985. }
  67986. }
  67987. }
  67988. private static function getConsoleMode(): ?array
  67989. {
  67990. $info = self::readFromProcess('mode CON');
  67991. if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  67992. return null;
  67993. }
  67994. return [(int) $matches[2], (int) $matches[1]];
  67995. }
  67996. private static function getSttyColumns(): ?string
  67997. {
  67998. return self::readFromProcess('stty -a | grep columns');
  67999. }
  68000. private static function readFromProcess(string $command): ?string
  68001. {
  68002. if (!\function_exists('proc_open')) {
  68003. return null;
  68004. }
  68005. $descriptorspec = [
  68006. 1 => ['pipe', 'w'],
  68007. 2 => ['pipe', 'w'],
  68008. ];
  68009. $cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;
  68010. $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
  68011. if (!\is_resource($process)) {
  68012. return null;
  68013. }
  68014. $info = stream_get_contents($pipes[1]);
  68015. fclose($pipes[1]);
  68016. fclose($pipes[2]);
  68017. proc_close($process);
  68018. if ($cp) {
  68019. sapi_windows_cp_set($cp);
  68020. }
  68021. return $info;
  68022. }
  68023. }
  68024. <?php
  68025. namespace Symfony\Component\Console\Tester;
  68026. use Symfony\Component\Console\Application;
  68027. use Symfony\Component\Console\Input\ArrayInput;
  68028. class ApplicationTester
  68029. {
  68030. use TesterTrait;
  68031. private $application;
  68032. public function __construct(Application $application)
  68033. {
  68034. $this->application = $application;
  68035. }
  68036. public function run(array $input, array $options = [])
  68037. {
  68038. $prevShellVerbosity = getenv('SHELL_VERBOSITY');
  68039. try {
  68040. $this->input = new ArrayInput($input);
  68041. if (isset($options['interactive'])) {
  68042. $this->input->setInteractive($options['interactive']);
  68043. }
  68044. if ($this->inputs) {
  68045. $this->input->setStream(self::createStream($this->inputs));
  68046. }
  68047. $this->initOutput($options);
  68048. return $this->statusCode = $this->application->run($this->input, $this->output);
  68049. } finally {
  68050. if (false === $prevShellVerbosity) {
  68051. if (\function_exists('putenv')) {
  68052. @putenv('SHELL_VERBOSITY');
  68053. }
  68054. unset($_ENV['SHELL_VERBOSITY']);
  68055. unset($_SERVER['SHELL_VERBOSITY']);
  68056. } else {
  68057. if (\function_exists('putenv')) {
  68058. @putenv('SHELL_VERBOSITY='.$prevShellVerbosity);
  68059. }
  68060. $_ENV['SHELL_VERBOSITY'] = $prevShellVerbosity;
  68061. $_SERVER['SHELL_VERBOSITY'] = $prevShellVerbosity;
  68062. }
  68063. }
  68064. }
  68065. }
  68066. <?php
  68067. namespace Symfony\Component\Console\Tester;
  68068. use Symfony\Component\Console\Command\Command;
  68069. use Symfony\Component\Console\Completion\CompletionInput;
  68070. use Symfony\Component\Console\Completion\CompletionSuggestions;
  68071. class CommandCompletionTester
  68072. {
  68073. private $command;
  68074. public function __construct(Command $command)
  68075. {
  68076. $this->command = $command;
  68077. }
  68078. public function complete(array $input): array
  68079. {
  68080. $currentIndex = \count($input);
  68081. if ('' === end($input)) {
  68082. array_pop($input);
  68083. }
  68084. array_unshift($input, $this->command->getName());
  68085. $completionInput = CompletionInput::fromTokens($input, $currentIndex);
  68086. $completionInput->bind($this->command->getDefinition());
  68087. $suggestions = new CompletionSuggestions();
  68088. $this->command->complete($completionInput, $suggestions);
  68089. $options = [];
  68090. foreach ($suggestions->getOptionSuggestions() as $option) {
  68091. $options[] = '--'.$option->getName();
  68092. }
  68093. return array_map('strval', array_merge($options, $suggestions->getValueSuggestions()));
  68094. }
  68095. }
  68096. <?php
  68097. namespace Symfony\Component\Console\Tester;
  68098. use Symfony\Component\Console\Command\Command;
  68099. use Symfony\Component\Console\Input\ArrayInput;
  68100. class CommandTester
  68101. {
  68102. use TesterTrait;
  68103. private $command;
  68104. public function __construct(Command $command)
  68105. {
  68106. $this->command = $command;
  68107. }
  68108. public function execute(array $input, array $options = [])
  68109. {
  68110. if (!isset($input['command'])
  68111. && (null !== $application = $this->command->getApplication())
  68112. && $application->getDefinition()->hasArgument('command')
  68113. ) {
  68114. $input = array_merge(['command' => $this->command->getName()], $input);
  68115. }
  68116. $this->input = new ArrayInput($input);
  68117. $this->input->setStream(self::createStream($this->inputs));
  68118. if (isset($options['interactive'])) {
  68119. $this->input->setInteractive($options['interactive']);
  68120. }
  68121. if (!isset($options['decorated'])) {
  68122. $options['decorated'] = false;
  68123. }
  68124. $this->initOutput($options);
  68125. return $this->statusCode = $this->command->run($this->input, $this->output);
  68126. }
  68127. }
  68128. <?php
  68129. namespace Symfony\Component\Console\Tester\Constraint;
  68130. use PHPUnit\Framework\Constraint\Constraint;
  68131. use Symfony\Component\Console\Command\Command;
  68132. final class CommandIsSuccessful extends Constraint
  68133. {
  68134. public function toString(): string
  68135. {
  68136. return 'is successful';
  68137. }
  68138. protected function matches($other): bool
  68139. {
  68140. return Command::SUCCESS === $other;
  68141. }
  68142. protected function failureDescription($other): string
  68143. {
  68144. return 'the command '.$this->toString();
  68145. }
  68146. protected function additionalFailureDescription($other): string
  68147. {
  68148. $mapping = [
  68149. Command::FAILURE => 'Command failed.',
  68150. Command::INVALID => 'Command was invalid.',
  68151. ];
  68152. return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
  68153. }
  68154. }
  68155. <?php
  68156. namespace Symfony\Component\Console\Tester;
  68157. use PHPUnit\Framework\Assert;
  68158. use Symfony\Component\Console\Input\InputInterface;
  68159. use Symfony\Component\Console\Output\ConsoleOutput;
  68160. use Symfony\Component\Console\Output\OutputInterface;
  68161. use Symfony\Component\Console\Output\StreamOutput;
  68162. use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
  68163. trait TesterTrait
  68164. {
  68165. private $output;
  68166. private $inputs = [];
  68167. private $captureStreamsIndependently = false;
  68168. private $input;
  68169. private $statusCode;
  68170. public function getDisplay(bool $normalize = false)
  68171. {
  68172. if (null === $this->output) {
  68173. throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
  68174. }
  68175. rewind($this->output->getStream());
  68176. $display = stream_get_contents($this->output->getStream());
  68177. if ($normalize) {
  68178. $display = str_replace(\PHP_EOL, "\n", $display);
  68179. }
  68180. return $display;
  68181. }
  68182. public function getErrorOutput(bool $normalize = false)
  68183. {
  68184. if (!$this->captureStreamsIndependently) {
  68185. throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
  68186. }
  68187. rewind($this->output->getErrorOutput()->getStream());
  68188. $display = stream_get_contents($this->output->getErrorOutput()->getStream());
  68189. if ($normalize) {
  68190. $display = str_replace(\PHP_EOL, "\n", $display);
  68191. }
  68192. return $display;
  68193. }
  68194. public function getInput()
  68195. {
  68196. return $this->input;
  68197. }
  68198. public function getOutput()
  68199. {
  68200. return $this->output;
  68201. }
  68202. public function getStatusCode()
  68203. {
  68204. if (null === $this->statusCode) {
  68205. throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
  68206. }
  68207. return $this->statusCode;
  68208. }
  68209. public function assertCommandIsSuccessful(string $message = ''): void
  68210. {
  68211. Assert::assertThat($this->statusCode, new CommandIsSuccessful(), $message);
  68212. }
  68213. public function setInputs(array $inputs)
  68214. {
  68215. $this->inputs = $inputs;
  68216. return $this;
  68217. }
  68218. private function initOutput(array $options)
  68219. {
  68220. $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
  68221. if (!$this->captureStreamsIndependently) {
  68222. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  68223. if (isset($options['decorated'])) {
  68224. $this->output->setDecorated($options['decorated']);
  68225. }
  68226. if (isset($options['verbosity'])) {
  68227. $this->output->setVerbosity($options['verbosity']);
  68228. }
  68229. } else {
  68230. $this->output = new ConsoleOutput(
  68231. $options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
  68232. $options['decorated'] ?? null
  68233. );
  68234. $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
  68235. $errorOutput->setFormatter($this->output->getFormatter());
  68236. $errorOutput->setVerbosity($this->output->getVerbosity());
  68237. $errorOutput->setDecorated($this->output->isDecorated());
  68238. $reflectedOutput = new \ReflectionObject($this->output);
  68239. $strErrProperty = $reflectedOutput->getProperty('stderr');
  68240. $strErrProperty->setAccessible(true);
  68241. $strErrProperty->setValue($this->output, $errorOutput);
  68242. $reflectedParent = $reflectedOutput->getParentClass();
  68243. $streamProperty = $reflectedParent->getProperty('stream');
  68244. $streamProperty->setAccessible(true);
  68245. $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
  68246. }
  68247. }
  68248. private static function createStream(array $inputs)
  68249. {
  68250. $stream = fopen('php://memory', 'r+', false);
  68251. foreach ($inputs as $input) {
  68252. fwrite($stream, $input.\PHP_EOL);
  68253. }
  68254. rewind($stream);
  68255. return $stream;
  68256. }
  68257. }
  68258. Copyright (c) 2020-2022 Fabien Potencier
  68259. Permission is hereby granted, free of charge, to any person obtaining a copy
  68260. of this software and associated documentation files (the "Software"), to deal
  68261. in the Software without restriction, including without limitation the rights
  68262. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  68263. copies of the Software, and to permit persons to whom the Software is furnished
  68264. to do so, subject to the following conditions:
  68265. The above copyright notice and this permission notice shall be included in all
  68266. copies or substantial portions of the Software.
  68267. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  68268. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  68269. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  68270. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  68271. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  68272. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  68273. THE SOFTWARE.
  68274. <?php
  68275. if (!function_exists('trigger_deprecation')) {
  68276. function trigger_deprecation(string $package, string $version, string $message, ...$args): void
  68277. {
  68278. @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
  68279. }
  68280. }
  68281. <?php
  68282. namespace Symfony\Component\Filesystem\Exception;
  68283. interface ExceptionInterface extends \Throwable
  68284. {
  68285. }
  68286. <?php
  68287. namespace Symfony\Component\Filesystem\Exception;
  68288. class FileNotFoundException extends IOException
  68289. {
  68290. public function __construct(?string $message = null, int $code = 0, ?\Throwable $previous = null, ?string $path = null)
  68291. {
  68292. if (null === $message) {
  68293. if (null === $path) {
  68294. $message = 'File could not be found.';
  68295. } else {
  68296. $message = sprintf('File "%s" could not be found.', $path);
  68297. }
  68298. }
  68299. parent::__construct($message, $code, $previous, $path);
  68300. }
  68301. }
  68302. <?php
  68303. namespace Symfony\Component\Filesystem\Exception;
  68304. class IOException extends \RuntimeException implements IOExceptionInterface
  68305. {
  68306. private $path;
  68307. public function __construct(string $message, int $code = 0, ?\Throwable $previous = null, ?string $path = null)
  68308. {
  68309. $this->path = $path;
  68310. parent::__construct($message, $code, $previous);
  68311. }
  68312. public function getPath()
  68313. {
  68314. return $this->path;
  68315. }
  68316. }
  68317. <?php
  68318. namespace Symfony\Component\Filesystem\Exception;
  68319. interface IOExceptionInterface extends ExceptionInterface
  68320. {
  68321. public function getPath();
  68322. }
  68323. <?php
  68324. namespace Symfony\Component\Filesystem\Exception;
  68325. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  68326. {
  68327. }
  68328. <?php
  68329. namespace Symfony\Component\Filesystem\Exception;
  68330. class RuntimeException extends \RuntimeException implements ExceptionInterface
  68331. {
  68332. }
  68333. <?php
  68334. namespace Symfony\Component\Filesystem;
  68335. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  68336. use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
  68337. use Symfony\Component\Filesystem\Exception\IOException;
  68338. class Filesystem
  68339. {
  68340. private static $lastError;
  68341. public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false)
  68342. {
  68343. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  68344. if ($originIsLocal && !is_file($originFile)) {
  68345. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  68346. }
  68347. $this->mkdir(\dirname($targetFile));
  68348. $doCopy = true;
  68349. if (!$overwriteNewerFiles && null === parse_url($originFile, \PHP_URL_HOST) && is_file($targetFile)) {
  68350. $doCopy = filemtime($originFile) > filemtime($targetFile);
  68351. }
  68352. if ($doCopy) {
  68353. if (!$source = self::box('fopen', $originFile, 'r')) {
  68354. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
  68355. }
  68356. if (!$target = self::box('fopen', $targetFile, 'w', false, stream_context_create(['ftp' => ['overwrite' => true]]))) {
  68357. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
  68358. }
  68359. $bytesCopied = stream_copy_to_stream($source, $target);
  68360. fclose($source);
  68361. fclose($target);
  68362. unset($source, $target);
  68363. if (!is_file($targetFile)) {
  68364. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  68365. }
  68366. if ($originIsLocal) {
  68367. self::box('chmod', $targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  68368. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  68369. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  68370. }
  68371. }
  68372. }
  68373. }
  68374. public function mkdir($dirs, int $mode = 0777)
  68375. {
  68376. foreach ($this->toIterable($dirs) as $dir) {
  68377. if (is_dir($dir)) {
  68378. continue;
  68379. }
  68380. if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) {
  68381. throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
  68382. }
  68383. }
  68384. }
  68385. public function exists($files)
  68386. {
  68387. $maxPathLength = \PHP_MAXPATHLEN - 2;
  68388. foreach ($this->toIterable($files) as $file) {
  68389. if (\strlen($file) > $maxPathLength) {
  68390. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  68391. }
  68392. if (!file_exists($file)) {
  68393. return false;
  68394. }
  68395. }
  68396. return true;
  68397. }
  68398. public function touch($files, ?int $time = null, ?int $atime = null)
  68399. {
  68400. foreach ($this->toIterable($files) as $file) {
  68401. if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
  68402. throw new IOException(sprintf('Failed to touch "%s": ', $file).self::$lastError, 0, null, $file);
  68403. }
  68404. }
  68405. }
  68406. public function remove($files)
  68407. {
  68408. if ($files instanceof \Traversable) {
  68409. $files = iterator_to_array($files, false);
  68410. } elseif (!\is_array($files)) {
  68411. $files = [$files];
  68412. }
  68413. self::doRemove($files, false);
  68414. }
  68415. private static function doRemove(array $files, bool $isRecursive): void
  68416. {
  68417. $files = array_reverse($files);
  68418. foreach ($files as $file) {
  68419. if (is_link($file)) {
  68420. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  68421. throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
  68422. }
  68423. } elseif (is_dir($file)) {
  68424. if (!$isRecursive) {
  68425. $tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-_'));
  68426. if (file_exists($tmpName)) {
  68427. try {
  68428. self::doRemove([$tmpName], true);
  68429. } catch (IOException $e) {
  68430. }
  68431. }
  68432. if (!file_exists($tmpName) && self::box('rename', $file, $tmpName)) {
  68433. $origFile = $file;
  68434. $file = $tmpName;
  68435. } else {
  68436. $origFile = null;
  68437. }
  68438. }
  68439. $files = new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS);
  68440. self::doRemove(iterator_to_array($files, true), true);
  68441. if (!self::box('rmdir', $file) && file_exists($file) && !$isRecursive) {
  68442. $lastError = self::$lastError;
  68443. if (null !== $origFile && self::box('rename', $file, $origFile)) {
  68444. $file = $origFile;
  68445. }
  68446. throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
  68447. }
  68448. } elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
  68449. throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
  68450. }
  68451. }
  68452. }
  68453. public function chmod($files, int $mode, int $umask = 0000, bool $recursive = false)
  68454. {
  68455. foreach ($this->toIterable($files) as $file) {
  68456. if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && !self::box('chmod', $file, $mode & ~$umask)) {
  68457. throw new IOException(sprintf('Failed to chmod file "%s": ', $file).self::$lastError, 0, null, $file);
  68458. }
  68459. if ($recursive && is_dir($file) && !is_link($file)) {
  68460. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  68461. }
  68462. }
  68463. }
  68464. public function chown($files, $user, bool $recursive = false)
  68465. {
  68466. foreach ($this->toIterable($files) as $file) {
  68467. if ($recursive && is_dir($file) && !is_link($file)) {
  68468. $this->chown(new \FilesystemIterator($file), $user, true);
  68469. }
  68470. if (is_link($file) && \function_exists('lchown')) {
  68471. if (!self::box('lchown', $file, $user)) {
  68472. throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
  68473. }
  68474. } else {
  68475. if (!self::box('chown', $file, $user)) {
  68476. throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
  68477. }
  68478. }
  68479. }
  68480. }
  68481. public function chgrp($files, $group, bool $recursive = false)
  68482. {
  68483. foreach ($this->toIterable($files) as $file) {
  68484. if ($recursive && is_dir($file) && !is_link($file)) {
  68485. $this->chgrp(new \FilesystemIterator($file), $group, true);
  68486. }
  68487. if (is_link($file) && \function_exists('lchgrp')) {
  68488. if (!self::box('lchgrp', $file, $group)) {
  68489. throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
  68490. }
  68491. } else {
  68492. if (!self::box('chgrp', $file, $group)) {
  68493. throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
  68494. }
  68495. }
  68496. }
  68497. }
  68498. public function rename(string $origin, string $target, bool $overwrite = false)
  68499. {
  68500. if (!$overwrite && $this->isReadable($target)) {
  68501. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  68502. }
  68503. if (!self::box('rename', $origin, $target)) {
  68504. if (is_dir($origin)) {
  68505. $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
  68506. $this->remove($origin);
  68507. return;
  68508. }
  68509. throw new IOException(sprintf('Cannot rename "%s" to "%s": ', $origin, $target).self::$lastError, 0, null, $target);
  68510. }
  68511. }
  68512. private function isReadable(string $filename): bool
  68513. {
  68514. $maxPathLength = \PHP_MAXPATHLEN - 2;
  68515. if (\strlen($filename) > $maxPathLength) {
  68516. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  68517. }
  68518. return is_readable($filename);
  68519. }
  68520. public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false)
  68521. {
  68522. self::assertFunctionExists('symlink');
  68523. if ('\\' === \DIRECTORY_SEPARATOR) {
  68524. $originDir = strtr($originDir, '/', '\\');
  68525. $targetDir = strtr($targetDir, '/', '\\');
  68526. if ($copyOnWindows) {
  68527. $this->mirror($originDir, $targetDir);
  68528. return;
  68529. }
  68530. }
  68531. $this->mkdir(\dirname($targetDir));
  68532. if (is_link($targetDir)) {
  68533. if (readlink($targetDir) === $originDir) {
  68534. return;
  68535. }
  68536. $this->remove($targetDir);
  68537. }
  68538. if (!self::box('symlink', $originDir, $targetDir)) {
  68539. $this->linkException($originDir, $targetDir, 'symbolic');
  68540. }
  68541. }
  68542. public function hardlink(string $originFile, $targetFiles)
  68543. {
  68544. self::assertFunctionExists('link');
  68545. if (!$this->exists($originFile)) {
  68546. throw new FileNotFoundException(null, 0, null, $originFile);
  68547. }
  68548. if (!is_file($originFile)) {
  68549. throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile));
  68550. }
  68551. foreach ($this->toIterable($targetFiles) as $targetFile) {
  68552. if (is_file($targetFile)) {
  68553. if (fileinode($originFile) === fileinode($targetFile)) {
  68554. continue;
  68555. }
  68556. $this->remove($targetFile);
  68557. }
  68558. if (!self::box('link', $originFile, $targetFile)) {
  68559. $this->linkException($originFile, $targetFile, 'hard');
  68560. }
  68561. }
  68562. }
  68563. private function linkException(string $origin, string $target, string $linkType)
  68564. {
  68565. if (self::$lastError) {
  68566. if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
  68567. throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
  68568. }
  68569. }
  68570. throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
  68571. }
  68572. public function readlink(string $path, bool $canonicalize = false)
  68573. {
  68574. if (!$canonicalize && !is_link($path)) {
  68575. return null;
  68576. }
  68577. if ($canonicalize) {
  68578. if (!$this->exists($path)) {
  68579. return null;
  68580. }
  68581. if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) {
  68582. $path = readlink($path);
  68583. }
  68584. return realpath($path);
  68585. }
  68586. if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
  68587. return realpath($path);
  68588. }
  68589. return readlink($path);
  68590. }
  68591. public function makePathRelative(string $endPath, string $startPath)
  68592. {
  68593. if (!$this->isAbsolutePath($startPath)) {
  68594. throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
  68595. }
  68596. if (!$this->isAbsolutePath($endPath)) {
  68597. throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
  68598. }
  68599. if ('\\' === \DIRECTORY_SEPARATOR) {
  68600. $endPath = str_replace('\\', '/', $endPath);
  68601. $startPath = str_replace('\\', '/', $startPath);
  68602. }
  68603. $splitDriveLetter = function ($path) {
  68604. return (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
  68605. ? [substr($path, 2), strtoupper($path[0])]
  68606. : [$path, null];
  68607. };
  68608. $splitPath = function ($path) {
  68609. $result = [];
  68610. foreach (explode('/', trim($path, '/')) as $segment) {
  68611. if ('..' === $segment) {
  68612. array_pop($result);
  68613. } elseif ('.' !== $segment && '' !== $segment) {
  68614. $result[] = $segment;
  68615. }
  68616. }
  68617. return $result;
  68618. };
  68619. [$endPath, $endDriveLetter] = $splitDriveLetter($endPath);
  68620. [$startPath, $startDriveLetter] = $splitDriveLetter($startPath);
  68621. $startPathArr = $splitPath($startPath);
  68622. $endPathArr = $splitPath($endPath);
  68623. if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) {
  68624. return $endDriveLetter.':/'.($endPathArr ? implode('/', $endPathArr).'/' : '');
  68625. }
  68626. $index = 0;
  68627. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  68628. ++$index;
  68629. }
  68630. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  68631. $depth = 0;
  68632. } else {
  68633. $depth = \count($startPathArr) - $index;
  68634. }
  68635. $traverser = str_repeat('../', $depth);
  68636. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  68637. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  68638. return '' === $relativePath ? './' : $relativePath;
  68639. }
  68640. public function mirror(string $originDir, string $targetDir, ?\Traversable $iterator = null, array $options = [])
  68641. {
  68642. $targetDir = rtrim($targetDir, '/\\');
  68643. $originDir = rtrim($originDir, '/\\');
  68644. $originDirLen = \strlen($originDir);
  68645. if (!$this->exists($originDir)) {
  68646. throw new IOException(sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir);
  68647. }
  68648. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  68649. $deleteIterator = $iterator;
  68650. if (null === $deleteIterator) {
  68651. $flags = \FilesystemIterator::SKIP_DOTS;
  68652. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  68653. }
  68654. $targetDirLen = \strlen($targetDir);
  68655. foreach ($deleteIterator as $file) {
  68656. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  68657. if (!$this->exists($origin)) {
  68658. $this->remove($file);
  68659. }
  68660. }
  68661. }
  68662. $copyOnWindows = $options['copy_on_windows'] ?? false;
  68663. if (null === $iterator) {
  68664. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  68665. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  68666. }
  68667. $this->mkdir($targetDir);
  68668. $filesCreatedWhileMirroring = [];
  68669. foreach ($iterator as $file) {
  68670. if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) {
  68671. continue;
  68672. }
  68673. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  68674. $filesCreatedWhileMirroring[$target] = true;
  68675. if (!$copyOnWindows && is_link($file)) {
  68676. $this->symlink($file->getLinkTarget(), $target);
  68677. } elseif (is_dir($file)) {
  68678. $this->mkdir($target);
  68679. } elseif (is_file($file)) {
  68680. $this->copy($file, $target, $options['override'] ?? false);
  68681. } else {
  68682. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  68683. }
  68684. }
  68685. }
  68686. public function isAbsolutePath(string $file)
  68687. {
  68688. return '' !== $file && (strspn($file, '/\\', 0, 1)
  68689. || (\strlen($file) > 3 && ctype_alpha($file[0])
  68690. && ':' === $file[1]
  68691. && strspn($file, '/\\', 2, 1)
  68692. )
  68693. || null !== parse_url($file, \PHP_URL_SCHEME)
  68694. );
  68695. }
  68696. public function tempnam(string $dir, string $prefix)
  68697. {
  68698. $suffix = \func_num_args() > 2 ? func_get_arg(2) : '';
  68699. [$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir);
  68700. if ((null === $scheme || 'file' === $scheme || 'gs' === $scheme) && '' === $suffix) {
  68701. if ($tmpFile = self::box('tempnam', $hierarchy, $prefix)) {
  68702. if (null !== $scheme && 'gs' !== $scheme) {
  68703. return $scheme.'://'.$tmpFile;
  68704. }
  68705. return $tmpFile;
  68706. }
  68707. throw new IOException('A temporary file could not be created: '.self::$lastError);
  68708. }
  68709. for ($i = 0; $i < 10; ++$i) {
  68710. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true).$suffix;
  68711. if (!$handle = self::box('fopen', $tmpFile, 'x+')) {
  68712. continue;
  68713. }
  68714. self::box('fclose', $handle);
  68715. return $tmpFile;
  68716. }
  68717. throw new IOException('A temporary file could not be created: '.self::$lastError);
  68718. }
  68719. public function dumpFile(string $filename, $content)
  68720. {
  68721. if (\is_array($content)) {
  68722. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
  68723. }
  68724. $dir = \dirname($filename);
  68725. if (is_link($filename) && $linkTarget = $this->readlink($filename)) {
  68726. $this->dumpFile(Path::makeAbsolute($linkTarget, $dir), $content);
  68727. return;
  68728. }
  68729. if (!is_dir($dir)) {
  68730. $this->mkdir($dir);
  68731. }
  68732. $tmpFile = $this->tempnam($dir, basename($filename));
  68733. try {
  68734. if (false === self::box('file_put_contents', $tmpFile, $content)) {
  68735. throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
  68736. }
  68737. self::box('chmod', $tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());
  68738. $this->rename($tmpFile, $filename, true);
  68739. } finally {
  68740. if (file_exists($tmpFile)) {
  68741. self::box('unlink', $tmpFile);
  68742. }
  68743. }
  68744. }
  68745. public function appendToFile(string $filename, $content)
  68746. {
  68747. if (\is_array($content)) {
  68748. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
  68749. }
  68750. $dir = \dirname($filename);
  68751. if (!is_dir($dir)) {
  68752. $this->mkdir($dir);
  68753. }
  68754. $lock = \func_num_args() > 2 && func_get_arg(2);
  68755. if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) {
  68756. throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
  68757. }
  68758. }
  68759. private function toIterable($files): iterable
  68760. {
  68761. return is_iterable($files) ? $files : [$files];
  68762. }
  68763. private function getSchemeAndHierarchy(string $filename): array
  68764. {
  68765. $components = explode('://', $filename, 2);
  68766. return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
  68767. }
  68768. private static function assertFunctionExists(string $func): void
  68769. {
  68770. if (!\function_exists($func)) {
  68771. throw new IOException(sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func));
  68772. }
  68773. }
  68774. private static function box(string $func, ...$args)
  68775. {
  68776. self::assertFunctionExists($func);
  68777. self::$lastError = null;
  68778. set_error_handler(__CLASS__.'::handleError');
  68779. try {
  68780. return $func(...$args);
  68781. } finally {
  68782. restore_error_handler();
  68783. }
  68784. }
  68785. public static function handleError(int $type, string $msg)
  68786. {
  68787. self::$lastError = $msg;
  68788. }
  68789. }
  68790. Copyright (c) 2004-present Fabien Potencier
  68791. Permission is hereby granted, free of charge, to any person obtaining a copy
  68792. of this software and associated documentation files (the "Software"), to deal
  68793. in the Software without restriction, including without limitation the rights
  68794. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  68795. copies of the Software, and to permit persons to whom the Software is furnished
  68796. to do so, subject to the following conditions:
  68797. The above copyright notice and this permission notice shall be included in all
  68798. copies or substantial portions of the Software.
  68799. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  68800. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  68801. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  68802. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  68803. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  68804. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  68805. THE SOFTWARE.
  68806. <?php
  68807. namespace Symfony\Component\Filesystem;
  68808. use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
  68809. use Symfony\Component\Filesystem\Exception\RuntimeException;
  68810. final class Path
  68811. {
  68812. private const CLEANUP_THRESHOLD = 1250;
  68813. private const CLEANUP_SIZE = 1000;
  68814. private static $buffer = [];
  68815. private static $bufferSize = 0;
  68816. public static function canonicalize(string $path): string
  68817. {
  68818. if ('' === $path) {
  68819. return '';
  68820. }
  68821. if (isset(self::$buffer[$path])) {
  68822. return self::$buffer[$path];
  68823. }
  68824. if ('~' === $path[0]) {
  68825. $path = self::getHomeDirectory().substr($path, 1);
  68826. }
  68827. $path = self::normalize($path);
  68828. [$root, $pathWithoutRoot] = self::split($path);
  68829. $canonicalParts = self::findCanonicalParts($root, $pathWithoutRoot);
  68830. self::$buffer[$path] = $canonicalPath = $root.implode('/', $canonicalParts);
  68831. ++self::$bufferSize;
  68832. if (self::$bufferSize > self::CLEANUP_THRESHOLD) {
  68833. self::$buffer = \array_slice(self::$buffer, -self::CLEANUP_SIZE, null, true);
  68834. self::$bufferSize = self::CLEANUP_SIZE;
  68835. }
  68836. return $canonicalPath;
  68837. }
  68838. public static function normalize(string $path): string
  68839. {
  68840. return str_replace('\\', '/', $path);
  68841. }
  68842. public static function getDirectory(string $path): string
  68843. {
  68844. if ('' === $path) {
  68845. return '';
  68846. }
  68847. $path = self::canonicalize($path);
  68848. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  68849. $scheme = substr($path, 0, $schemeSeparatorPosition + 3);
  68850. $path = substr($path, $schemeSeparatorPosition + 3);
  68851. } else {
  68852. $scheme = '';
  68853. }
  68854. if (false === $dirSeparatorPosition = strrpos($path, '/')) {
  68855. return '';
  68856. }
  68857. if (0 === $dirSeparatorPosition) {
  68858. return $scheme.'/';
  68859. }
  68860. if (2 === $dirSeparatorPosition && ctype_alpha($path[0]) && ':' === $path[1]) {
  68861. return $scheme.substr($path, 0, 3);
  68862. }
  68863. return $scheme.substr($path, 0, $dirSeparatorPosition);
  68864. }
  68865. public static function getHomeDirectory(): string
  68866. {
  68867. if (getenv('HOME')) {
  68868. return self::canonicalize(getenv('HOME'));
  68869. }
  68870. if (getenv('HOMEDRIVE') && getenv('HOMEPATH')) {
  68871. return self::canonicalize(getenv('HOMEDRIVE').getenv('HOMEPATH'));
  68872. }
  68873. throw new RuntimeException("Cannot find the home directory path: Your environment or operating system isn't supported.");
  68874. }
  68875. public static function getRoot(string $path): string
  68876. {
  68877. if ('' === $path) {
  68878. return '';
  68879. }
  68880. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  68881. $scheme = substr($path, 0, $schemeSeparatorPosition + 3);
  68882. $path = substr($path, $schemeSeparatorPosition + 3);
  68883. } else {
  68884. $scheme = '';
  68885. }
  68886. $firstCharacter = $path[0];
  68887. if ('/' === $firstCharacter || '\\' === $firstCharacter) {
  68888. return $scheme.'/';
  68889. }
  68890. $length = \strlen($path);
  68891. if ($length > 1 && ':' === $path[1] && ctype_alpha($firstCharacter)) {
  68892. if (2 === $length) {
  68893. return $scheme.$path.'/';
  68894. }
  68895. if ('/' === $path[2] || '\\' === $path[2]) {
  68896. return $scheme.$firstCharacter.$path[1].'/';
  68897. }
  68898. }
  68899. return '';
  68900. }
  68901. public static function getFilenameWithoutExtension(string $path, ?string $extension = null): string
  68902. {
  68903. if ('' === $path) {
  68904. return '';
  68905. }
  68906. if (null !== $extension) {
  68907. return rtrim(basename($path, $extension), '.');
  68908. }
  68909. return pathinfo($path, \PATHINFO_FILENAME);
  68910. }
  68911. public static function getExtension(string $path, bool $forceLowerCase = false): string
  68912. {
  68913. if ('' === $path) {
  68914. return '';
  68915. }
  68916. $extension = pathinfo($path, \PATHINFO_EXTENSION);
  68917. if ($forceLowerCase) {
  68918. $extension = self::toLower($extension);
  68919. }
  68920. return $extension;
  68921. }
  68922. public static function hasExtension(string $path, $extensions = null, bool $ignoreCase = false): bool
  68923. {
  68924. if ('' === $path) {
  68925. return false;
  68926. }
  68927. $actualExtension = self::getExtension($path, $ignoreCase);
  68928. if ([] === $extensions || null === $extensions) {
  68929. return '' !== $actualExtension;
  68930. }
  68931. if (\is_string($extensions)) {
  68932. $extensions = [$extensions];
  68933. }
  68934. foreach ($extensions as $key => $extension) {
  68935. if ($ignoreCase) {
  68936. $extension = self::toLower($extension);
  68937. }
  68938. $extensions[$key] = ltrim($extension, '.');
  68939. }
  68940. return \in_array($actualExtension, $extensions, true);
  68941. }
  68942. public static function changeExtension(string $path, string $extension): string
  68943. {
  68944. if ('' === $path) {
  68945. return '';
  68946. }
  68947. $actualExtension = self::getExtension($path);
  68948. $extension = ltrim($extension, '.');
  68949. if ('/' === substr($path, -1)) {
  68950. return $path;
  68951. }
  68952. if (empty($actualExtension)) {
  68953. return $path.('.' === substr($path, -1) ? '' : '.').$extension;
  68954. }
  68955. return substr($path, 0, -\strlen($actualExtension)).$extension;
  68956. }
  68957. public static function isAbsolute(string $path): bool
  68958. {
  68959. if ('' === $path) {
  68960. return false;
  68961. }
  68962. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  68963. $path = substr($path, $schemeSeparatorPosition + 3);
  68964. }
  68965. $firstCharacter = $path[0];
  68966. if ('/' === $firstCharacter || '\\' === $firstCharacter) {
  68967. return true;
  68968. }
  68969. if (\strlen($path) > 1 && ctype_alpha($firstCharacter) && ':' === $path[1]) {
  68970. if (2 === \strlen($path)) {
  68971. return true;
  68972. }
  68973. if ('/' === $path[2] || '\\' === $path[2]) {
  68974. return true;
  68975. }
  68976. }
  68977. return false;
  68978. }
  68979. public static function isRelative(string $path): bool
  68980. {
  68981. return !self::isAbsolute($path);
  68982. }
  68983. public static function makeAbsolute(string $path, string $basePath): string
  68984. {
  68985. if ('' === $basePath) {
  68986. throw new InvalidArgumentException(sprintf('The base path must be a non-empty string. Got: "%s".', $basePath));
  68987. }
  68988. if (!self::isAbsolute($basePath)) {
  68989. throw new InvalidArgumentException(sprintf('The base path "%s" is not an absolute path.', $basePath));
  68990. }
  68991. if (self::isAbsolute($path)) {
  68992. return self::canonicalize($path);
  68993. }
  68994. if (false !== $schemeSeparatorPosition = strpos($basePath, '://')) {
  68995. $scheme = substr($basePath, 0, $schemeSeparatorPosition + 3);
  68996. $basePath = substr($basePath, $schemeSeparatorPosition + 3);
  68997. } else {
  68998. $scheme = '';
  68999. }
  69000. return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
  69001. }
  69002. public static function makeRelative(string $path, string $basePath): string
  69003. {
  69004. $path = self::canonicalize($path);
  69005. $basePath = self::canonicalize($basePath);
  69006. [$root, $relativePath] = self::split($path);
  69007. [$baseRoot, $relativeBasePath] = self::split($basePath);
  69008. if ('' === $root && '' !== $baseRoot) {
  69009. if ('' === $relativeBasePath) {
  69010. $relativePath = ltrim($relativePath, './\\');
  69011. }
  69012. return $relativePath;
  69013. }
  69014. if ('' !== $root && '' === $baseRoot) {
  69015. throw new InvalidArgumentException(sprintf('The absolute path "%s" cannot be made relative to the relative path "%s". You should provide an absolute base path instead.', $path, $basePath));
  69016. }
  69017. if ($baseRoot && $root !== $baseRoot) {
  69018. throw new InvalidArgumentException(sprintf('The path "%s" cannot be made relative to "%s", because they have different roots ("%s" and "%s").', $path, $basePath, $root, $baseRoot));
  69019. }
  69020. if ('' === $relativeBasePath) {
  69021. return $relativePath;
  69022. }
  69023. $parts = explode('/', $relativePath);
  69024. $baseParts = explode('/', $relativeBasePath);
  69025. $dotDotPrefix = '';
  69026. $match = true;
  69027. foreach ($baseParts as $index => $basePart) {
  69028. if ($match && isset($parts[$index]) && $basePart === $parts[$index]) {
  69029. unset($parts[$index]);
  69030. continue;
  69031. }
  69032. $match = false;
  69033. $dotDotPrefix .= '../';
  69034. }
  69035. return rtrim($dotDotPrefix.implode('/', $parts), '/');
  69036. }
  69037. public static function isLocal(string $path): bool
  69038. {
  69039. return '' !== $path && false === strpos($path, '://');
  69040. }
  69041. public static function getLongestCommonBasePath(string ...$paths): ?string
  69042. {
  69043. [$bpRoot, $basePath] = self::split(self::canonicalize(reset($paths)));
  69044. for (next($paths); null !== key($paths) && '' !== $basePath; next($paths)) {
  69045. [$root, $path] = self::split(self::canonicalize(current($paths)));
  69046. if ($root !== $bpRoot) {
  69047. return null;
  69048. }
  69049. while (true) {
  69050. if ('.' === $basePath) {
  69051. $basePath = '';
  69052. continue 2;
  69053. }
  69054. if (0 === strpos($path.'/', $basePath.'/')) {
  69055. continue 2;
  69056. }
  69057. $basePath = \dirname($basePath);
  69058. }
  69059. }
  69060. return $bpRoot.$basePath;
  69061. }
  69062. public static function join(string ...$paths): string
  69063. {
  69064. $finalPath = null;
  69065. $wasScheme = false;
  69066. foreach ($paths as $path) {
  69067. if ('' === $path) {
  69068. continue;
  69069. }
  69070. if (null === $finalPath) {
  69071. $finalPath = $path;
  69072. $wasScheme = (false !== strpos($path, '://'));
  69073. continue;
  69074. }
  69075. if (!\in_array(substr($finalPath, -1), ['/', '\\'])) {
  69076. $finalPath .= '/';
  69077. }
  69078. $finalPath .= $wasScheme ? $path : ltrim($path, '/');
  69079. $wasScheme = false;
  69080. }
  69081. if (null === $finalPath) {
  69082. return '';
  69083. }
  69084. return self::canonicalize($finalPath);
  69085. }
  69086. public static function isBasePath(string $basePath, string $ofPath): bool
  69087. {
  69088. $basePath = self::canonicalize($basePath);
  69089. $ofPath = self::canonicalize($ofPath);
  69090. return 0 === strpos($ofPath.'/', rtrim($basePath, '/').'/');
  69091. }
  69092. private static function findCanonicalParts(string $root, string $pathWithoutRoot): array
  69093. {
  69094. $parts = explode('/', $pathWithoutRoot);
  69095. $canonicalParts = [];
  69096. foreach ($parts as $part) {
  69097. if ('.' === $part || '' === $part) {
  69098. continue;
  69099. }
  69100. if ('..' === $part && \count($canonicalParts) > 0 && '..' !== $canonicalParts[\count($canonicalParts) - 1]) {
  69101. array_pop($canonicalParts);
  69102. continue;
  69103. }
  69104. if ('..' !== $part || '' === $root) {
  69105. $canonicalParts[] = $part;
  69106. }
  69107. }
  69108. return $canonicalParts;
  69109. }
  69110. private static function split(string $path): array
  69111. {
  69112. if ('' === $path) {
  69113. return ['', ''];
  69114. }
  69115. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  69116. $root = substr($path, 0, $schemeSeparatorPosition + 3);
  69117. $path = substr($path, $schemeSeparatorPosition + 3);
  69118. } else {
  69119. $root = '';
  69120. }
  69121. $length = \strlen($path);
  69122. if (0 === strpos($path, '/')) {
  69123. $root .= '/';
  69124. $path = $length > 1 ? substr($path, 1) : '';
  69125. } elseif ($length > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {
  69126. if (2 === $length) {
  69127. $root .= $path.'/';
  69128. $path = '';
  69129. } elseif ('/' === $path[2]) {
  69130. $root .= substr($path, 0, 3);
  69131. $path = $length > 3 ? substr($path, 3) : '';
  69132. }
  69133. }
  69134. return [$root, $path];
  69135. }
  69136. private static function toLower(string $string): string
  69137. {
  69138. if (false !== $encoding = mb_detect_encoding($string, null, true)) {
  69139. return mb_strtolower($string, $encoding);
  69140. }
  69141. return strtolower($string);
  69142. }
  69143. private function __construct()
  69144. {
  69145. }
  69146. }
  69147. <?php
  69148. namespace Symfony\Component\Finder\Comparator;
  69149. class Comparator
  69150. {
  69151. private $target;
  69152. private $operator = '==';
  69153. public function __construct(?string $target = null, string $operator = '==')
  69154. {
  69155. if (null === $target) {
  69156. trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
  69157. }
  69158. $this->target = $target;
  69159. $this->doSetOperator($operator);
  69160. }
  69161. public function getTarget()
  69162. {
  69163. if (null === $this->target) {
  69164. trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
  69165. }
  69166. return $this->target;
  69167. }
  69168. public function setTarget(string $target)
  69169. {
  69170. trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the target via the constructor instead.', __METHOD__);
  69171. $this->target = $target;
  69172. }
  69173. public function getOperator()
  69174. {
  69175. return $this->operator;
  69176. }
  69177. public function setOperator(string $operator)
  69178. {
  69179. trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the operator via the constructor instead.', __METHOD__);
  69180. $this->doSetOperator('' === $operator ? '==' : $operator);
  69181. }
  69182. public function test($test)
  69183. {
  69184. if (null === $this->target) {
  69185. trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
  69186. }
  69187. switch ($this->operator) {
  69188. case '>':
  69189. return $test > $this->target;
  69190. case '>=':
  69191. return $test >= $this->target;
  69192. case '<':
  69193. return $test < $this->target;
  69194. case '<=':
  69195. return $test <= $this->target;
  69196. case '!=':
  69197. return $test != $this->target;
  69198. }
  69199. return $test == $this->target;
  69200. }
  69201. private function doSetOperator(string $operator): void
  69202. {
  69203. if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
  69204. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  69205. }
  69206. $this->operator = $operator;
  69207. }
  69208. }
  69209. <?php
  69210. namespace Symfony\Component\Finder\Comparator;
  69211. class DateComparator extends Comparator
  69212. {
  69213. public function __construct(string $test)
  69214. {
  69215. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  69216. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  69217. }
  69218. try {
  69219. $date = new \DateTime($matches[2]);
  69220. $target = $date->format('U');
  69221. } catch (\Exception $e) {
  69222. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  69223. }
  69224. $operator = $matches[1] ?? '==';
  69225. if ('since' === $operator || 'after' === $operator) {
  69226. $operator = '>';
  69227. }
  69228. if ('until' === $operator || 'before' === $operator) {
  69229. $operator = '<';
  69230. }
  69231. parent::__construct($target, $operator);
  69232. }
  69233. }
  69234. <?php
  69235. namespace Symfony\Component\Finder\Comparator;
  69236. class NumberComparator extends Comparator
  69237. {
  69238. public function __construct(?string $test)
  69239. {
  69240. if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  69241. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
  69242. }
  69243. $target = $matches[2];
  69244. if (!is_numeric($target)) {
  69245. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  69246. }
  69247. if (isset($matches[3])) {
  69248. switch (strtolower($matches[3])) {
  69249. case 'k':
  69250. $target *= 1000;
  69251. break;
  69252. case 'ki':
  69253. $target *= 1024;
  69254. break;
  69255. case 'm':
  69256. $target *= 1000000;
  69257. break;
  69258. case 'mi':
  69259. $target *= 1024 * 1024;
  69260. break;
  69261. case 'g':
  69262. $target *= 1000000000;
  69263. break;
  69264. case 'gi':
  69265. $target *= 1024 * 1024 * 1024;
  69266. break;
  69267. }
  69268. }
  69269. parent::__construct($target, $matches[1] ?: '==');
  69270. }
  69271. }
  69272. <?php
  69273. namespace Symfony\Component\Finder\Exception;
  69274. class AccessDeniedException extends \UnexpectedValueException
  69275. {
  69276. }
  69277. <?php
  69278. namespace Symfony\Component\Finder\Exception;
  69279. class DirectoryNotFoundException extends \InvalidArgumentException
  69280. {
  69281. }
  69282. <?php
  69283. namespace Symfony\Component\Finder;
  69284. use Symfony\Component\Finder\Comparator\DateComparator;
  69285. use Symfony\Component\Finder\Comparator\NumberComparator;
  69286. use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
  69287. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  69288. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  69289. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  69290. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  69291. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  69292. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  69293. use Symfony\Component\Finder\Iterator\LazyIterator;
  69294. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  69295. use Symfony\Component\Finder\Iterator\SortableIterator;
  69296. class Finder implements \IteratorAggregate, \Countable
  69297. {
  69298. public const IGNORE_VCS_FILES = 1;
  69299. public const IGNORE_DOT_FILES = 2;
  69300. public const IGNORE_VCS_IGNORED_FILES = 4;
  69301. private $mode = 0;
  69302. private $names = [];
  69303. private $notNames = [];
  69304. private $exclude = [];
  69305. private $filters = [];
  69306. private $depths = [];
  69307. private $sizes = [];
  69308. private $followLinks = false;
  69309. private $reverseSorting = false;
  69310. private $sort = false;
  69311. private $ignore = 0;
  69312. private $dirs = [];
  69313. private $dates = [];
  69314. private $iterators = [];
  69315. private $contains = [];
  69316. private $notContains = [];
  69317. private $paths = [];
  69318. private $notPaths = [];
  69319. private $ignoreUnreadableDirs = false;
  69320. private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
  69321. public function __construct()
  69322. {
  69323. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  69324. }
  69325. public static function create()
  69326. {
  69327. return new static();
  69328. }
  69329. public function directories()
  69330. {
  69331. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  69332. return $this;
  69333. }
  69334. public function files()
  69335. {
  69336. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  69337. return $this;
  69338. }
  69339. public function depth($levels)
  69340. {
  69341. foreach ((array) $levels as $level) {
  69342. $this->depths[] = new Comparator\NumberComparator($level);
  69343. }
  69344. return $this;
  69345. }
  69346. public function date($dates)
  69347. {
  69348. foreach ((array) $dates as $date) {
  69349. $this->dates[] = new Comparator\DateComparator($date);
  69350. }
  69351. return $this;
  69352. }
  69353. public function name($patterns)
  69354. {
  69355. $this->names = array_merge($this->names, (array) $patterns);
  69356. return $this;
  69357. }
  69358. public function notName($patterns)
  69359. {
  69360. $this->notNames = array_merge($this->notNames, (array) $patterns);
  69361. return $this;
  69362. }
  69363. public function contains($patterns)
  69364. {
  69365. $this->contains = array_merge($this->contains, (array) $patterns);
  69366. return $this;
  69367. }
  69368. public function notContains($patterns)
  69369. {
  69370. $this->notContains = array_merge($this->notContains, (array) $patterns);
  69371. return $this;
  69372. }
  69373. public function path($patterns)
  69374. {
  69375. $this->paths = array_merge($this->paths, (array) $patterns);
  69376. return $this;
  69377. }
  69378. public function notPath($patterns)
  69379. {
  69380. $this->notPaths = array_merge($this->notPaths, (array) $patterns);
  69381. return $this;
  69382. }
  69383. public function size($sizes)
  69384. {
  69385. foreach ((array) $sizes as $size) {
  69386. $this->sizes[] = new Comparator\NumberComparator($size);
  69387. }
  69388. return $this;
  69389. }
  69390. public function exclude($dirs)
  69391. {
  69392. $this->exclude = array_merge($this->exclude, (array) $dirs);
  69393. return $this;
  69394. }
  69395. public function ignoreDotFiles(bool $ignoreDotFiles)
  69396. {
  69397. if ($ignoreDotFiles) {
  69398. $this->ignore |= static::IGNORE_DOT_FILES;
  69399. } else {
  69400. $this->ignore &= ~static::IGNORE_DOT_FILES;
  69401. }
  69402. return $this;
  69403. }
  69404. public function ignoreVCS(bool $ignoreVCS)
  69405. {
  69406. if ($ignoreVCS) {
  69407. $this->ignore |= static::IGNORE_VCS_FILES;
  69408. } else {
  69409. $this->ignore &= ~static::IGNORE_VCS_FILES;
  69410. }
  69411. return $this;
  69412. }
  69413. public function ignoreVCSIgnored(bool $ignoreVCSIgnored)
  69414. {
  69415. if ($ignoreVCSIgnored) {
  69416. $this->ignore |= static::IGNORE_VCS_IGNORED_FILES;
  69417. } else {
  69418. $this->ignore &= ~static::IGNORE_VCS_IGNORED_FILES;
  69419. }
  69420. return $this;
  69421. }
  69422. public static function addVCSPattern($pattern)
  69423. {
  69424. foreach ((array) $pattern as $p) {
  69425. self::$vcsPatterns[] = $p;
  69426. }
  69427. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  69428. }
  69429. public function sort(\Closure $closure)
  69430. {
  69431. $this->sort = $closure;
  69432. return $this;
  69433. }
  69434. public function sortByName(bool $useNaturalSort = false)
  69435. {
  69436. $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
  69437. return $this;
  69438. }
  69439. public function sortByType()
  69440. {
  69441. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  69442. return $this;
  69443. }
  69444. public function sortByAccessedTime()
  69445. {
  69446. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  69447. return $this;
  69448. }
  69449. public function reverseSorting()
  69450. {
  69451. $this->reverseSorting = true;
  69452. return $this;
  69453. }
  69454. public function sortByChangedTime()
  69455. {
  69456. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  69457. return $this;
  69458. }
  69459. public function sortByModifiedTime()
  69460. {
  69461. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  69462. return $this;
  69463. }
  69464. public function filter(\Closure $closure)
  69465. {
  69466. $this->filters[] = $closure;
  69467. return $this;
  69468. }
  69469. public function followLinks()
  69470. {
  69471. $this->followLinks = true;
  69472. return $this;
  69473. }
  69474. public function ignoreUnreadableDirs(bool $ignore = true)
  69475. {
  69476. $this->ignoreUnreadableDirs = $ignore;
  69477. return $this;
  69478. }
  69479. public function in($dirs)
  69480. {
  69481. $resolvedDirs = [];
  69482. foreach ((array) $dirs as $dir) {
  69483. if (is_dir($dir)) {
  69484. $resolvedDirs[] = [$this->normalizeDir($dir)];
  69485. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) {
  69486. sort($glob);
  69487. $resolvedDirs[] = array_map([$this, 'normalizeDir'], $glob);
  69488. } else {
  69489. throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
  69490. }
  69491. }
  69492. $this->dirs = array_merge($this->dirs, ...$resolvedDirs);
  69493. return $this;
  69494. }
  69495. #[\ReturnTypeWillChange]
  69496. public function getIterator()
  69497. {
  69498. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  69499. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  69500. }
  69501. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  69502. $iterator = $this->searchInDirectory($this->dirs[0]);
  69503. if ($this->sort || $this->reverseSorting) {
  69504. $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
  69505. }
  69506. return $iterator;
  69507. }
  69508. $iterator = new \AppendIterator();
  69509. foreach ($this->dirs as $dir) {
  69510. $iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) {
  69511. return $this->searchInDirectory($dir);
  69512. })));
  69513. }
  69514. foreach ($this->iterators as $it) {
  69515. $iterator->append($it);
  69516. }
  69517. if ($this->sort || $this->reverseSorting) {
  69518. $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
  69519. }
  69520. return $iterator;
  69521. }
  69522. public function append(iterable $iterator)
  69523. {
  69524. if ($iterator instanceof \IteratorAggregate) {
  69525. $this->iterators[] = $iterator->getIterator();
  69526. } elseif ($iterator instanceof \Iterator) {
  69527. $this->iterators[] = $iterator;
  69528. } elseif (is_iterable($iterator)) {
  69529. $it = new \ArrayIterator();
  69530. foreach ($iterator as $file) {
  69531. $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
  69532. $it[$file->getPathname()] = $file;
  69533. }
  69534. $this->iterators[] = $it;
  69535. } else {
  69536. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  69537. }
  69538. return $this;
  69539. }
  69540. public function hasResults()
  69541. {
  69542. foreach ($this->getIterator() as $_) {
  69543. return true;
  69544. }
  69545. return false;
  69546. }
  69547. #[\ReturnTypeWillChange]
  69548. public function count()
  69549. {
  69550. return iterator_count($this->getIterator());
  69551. }
  69552. private function searchInDirectory(string $dir): \Iterator
  69553. {
  69554. $exclude = $this->exclude;
  69555. $notPaths = $this->notPaths;
  69556. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  69557. $exclude = array_merge($exclude, self::$vcsPatterns);
  69558. }
  69559. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  69560. $notPaths[] = '#(^|/)\..+(/|$)#';
  69561. }
  69562. $minDepth = 0;
  69563. $maxDepth = \PHP_INT_MAX;
  69564. foreach ($this->depths as $comparator) {
  69565. switch ($comparator->getOperator()) {
  69566. case '>':
  69567. $minDepth = $comparator->getTarget() + 1;
  69568. break;
  69569. case '>=':
  69570. $minDepth = $comparator->getTarget();
  69571. break;
  69572. case '<':
  69573. $maxDepth = $comparator->getTarget() - 1;
  69574. break;
  69575. case '<=':
  69576. $maxDepth = $comparator->getTarget();
  69577. break;
  69578. default:
  69579. $minDepth = $maxDepth = $comparator->getTarget();
  69580. }
  69581. }
  69582. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  69583. if ($this->followLinks) {
  69584. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  69585. }
  69586. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  69587. if ($exclude) {
  69588. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude);
  69589. }
  69590. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  69591. if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) {
  69592. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  69593. }
  69594. if ($this->mode) {
  69595. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  69596. }
  69597. if ($this->names || $this->notNames) {
  69598. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  69599. }
  69600. if ($this->contains || $this->notContains) {
  69601. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  69602. }
  69603. if ($this->sizes) {
  69604. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  69605. }
  69606. if ($this->dates) {
  69607. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  69608. }
  69609. if ($this->filters) {
  69610. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  69611. }
  69612. if ($this->paths || $notPaths) {
  69613. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
  69614. }
  69615. if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) {
  69616. $iterator = new Iterator\VcsIgnoredFilterIterator($iterator, $dir);
  69617. }
  69618. return $iterator;
  69619. }
  69620. private function normalizeDir(string $dir): string
  69621. {
  69622. if ('/' === $dir) {
  69623. return $dir;
  69624. }
  69625. $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  69626. if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
  69627. $dir .= '/';
  69628. }
  69629. return $dir;
  69630. }
  69631. }
  69632. <?php
  69633. namespace Symfony\Component\Finder;
  69634. class Gitignore
  69635. {
  69636. public static function toRegex(string $gitignoreFileContent): string
  69637. {
  69638. return self::buildRegex($gitignoreFileContent, false);
  69639. }
  69640. public static function toRegexMatchingNegatedPatterns(string $gitignoreFileContent): string
  69641. {
  69642. return self::buildRegex($gitignoreFileContent, true);
  69643. }
  69644. private static function buildRegex(string $gitignoreFileContent, bool $inverted): string
  69645. {
  69646. $gitignoreFileContent = preg_replace('~(?<!\\\\)#[^\n\r]*~', '', $gitignoreFileContent);
  69647. $gitignoreLines = preg_split('~\r\n?|\n~', $gitignoreFileContent);
  69648. $res = self::lineToRegex('');
  69649. foreach ($gitignoreLines as $line) {
  69650. $line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
  69651. if ('!' === substr($line, 0, 1)) {
  69652. $line = substr($line, 1);
  69653. $isNegative = true;
  69654. } else {
  69655. $isNegative = false;
  69656. }
  69657. if ('' !== $line) {
  69658. if ($isNegative xor $inverted) {
  69659. $res = '(?!'.self::lineToRegex($line).'$)'.$res;
  69660. } else {
  69661. $res = '(?:'.$res.'|'.self::lineToRegex($line).')';
  69662. }
  69663. }
  69664. }
  69665. return '~^(?:'.$res.')~s';
  69666. }
  69667. private static function lineToRegex(string $gitignoreLine): string
  69668. {
  69669. if ('' === $gitignoreLine) {
  69670. return '$f';
  69671. }
  69672. $slashPos = strpos($gitignoreLine, '/');
  69673. if (false !== $slashPos && \strlen($gitignoreLine) - 1 !== $slashPos) {
  69674. if (0 === $slashPos) {
  69675. $gitignoreLine = substr($gitignoreLine, 1);
  69676. }
  69677. $isAbsolute = true;
  69678. } else {
  69679. $isAbsolute = false;
  69680. }
  69681. $regex = preg_quote(str_replace('\\', '', $gitignoreLine), '~');
  69682. $regex = preg_replace_callback('~\\\\\[((?:\\\\!)?)([^\[\]]*)\\\\\]~', function (array $matches): string {
  69683. return '['.('' !== $matches[1] ? '^' : '').str_replace('\\-', '-', $matches[2]).']';
  69684. }, $regex);
  69685. $regex = preg_replace('~(?:(?:\\\\\*){2,}(/?))+~', '(?:(?:(?!//).(?<!//))+$1)?', $regex);
  69686. $regex = preg_replace('~\\\\\*~', '[^/]*', $regex);
  69687. $regex = preg_replace('~\\\\\?~', '[^/]', $regex);
  69688. return ($isAbsolute ? '' : '(?:[^/]+/)*')
  69689. .$regex
  69690. .(!str_ends_with($gitignoreLine, '/') ? '(?:$|/)' : '');
  69691. }
  69692. }
  69693. <?php
  69694. namespace Symfony\Component\Finder;
  69695. class Glob
  69696. {
  69697. public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#')
  69698. {
  69699. $firstByte = true;
  69700. $escaping = false;
  69701. $inCurlies = 0;
  69702. $regex = '';
  69703. $sizeGlob = \strlen($glob);
  69704. for ($i = 0; $i < $sizeGlob; ++$i) {
  69705. $car = $glob[$i];
  69706. if ($firstByte && $strictLeadingDot && '.' !== $car) {
  69707. $regex .= '(?=[^\.])';
  69708. }
  69709. $firstByte = '/' === $car;
  69710. if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) {
  69711. $car = '[^/]++/';
  69712. if (!isset($glob[$i + 3])) {
  69713. $car .= '?';
  69714. }
  69715. if ($strictLeadingDot) {
  69716. $car = '(?=[^\.])'.$car;
  69717. }
  69718. $car = '/(?:'.$car.')*';
  69719. $i += 2 + isset($glob[$i + 3]);
  69720. if ('/' === $delimiter) {
  69721. $car = str_replace('/', '\\/', $car);
  69722. }
  69723. }
  69724. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  69725. $regex .= "\\$car";
  69726. } elseif ('*' === $car) {
  69727. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  69728. } elseif ('?' === $car) {
  69729. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  69730. } elseif ('{' === $car) {
  69731. $regex .= $escaping ? '\\{' : '(';
  69732. if (!$escaping) {
  69733. ++$inCurlies;
  69734. }
  69735. } elseif ('}' === $car && $inCurlies) {
  69736. $regex .= $escaping ? '}' : ')';
  69737. if (!$escaping) {
  69738. --$inCurlies;
  69739. }
  69740. } elseif (',' === $car && $inCurlies) {
  69741. $regex .= $escaping ? ',' : '|';
  69742. } elseif ('\\' === $car) {
  69743. if ($escaping) {
  69744. $regex .= '\\\\';
  69745. $escaping = false;
  69746. } else {
  69747. $escaping = true;
  69748. }
  69749. continue;
  69750. } else {
  69751. $regex .= $car;
  69752. }
  69753. $escaping = false;
  69754. }
  69755. return $delimiter.'^'.$regex.'$'.$delimiter;
  69756. }
  69757. }
  69758. <?php
  69759. namespace Symfony\Component\Finder\Iterator;
  69760. class CustomFilterIterator extends \FilterIterator
  69761. {
  69762. private $filters = [];
  69763. public function __construct(\Iterator $iterator, array $filters)
  69764. {
  69765. foreach ($filters as $filter) {
  69766. if (!\is_callable($filter)) {
  69767. throw new \InvalidArgumentException('Invalid PHP callback.');
  69768. }
  69769. }
  69770. $this->filters = $filters;
  69771. parent::__construct($iterator);
  69772. }
  69773. #[\ReturnTypeWillChange]
  69774. public function accept()
  69775. {
  69776. $fileinfo = $this->current();
  69777. foreach ($this->filters as $filter) {
  69778. if (false === $filter($fileinfo)) {
  69779. return false;
  69780. }
  69781. }
  69782. return true;
  69783. }
  69784. }
  69785. <?php
  69786. namespace Symfony\Component\Finder\Iterator;
  69787. use Symfony\Component\Finder\Comparator\DateComparator;
  69788. class DateRangeFilterIterator extends \FilterIterator
  69789. {
  69790. private $comparators = [];
  69791. public function __construct(\Iterator $iterator, array $comparators)
  69792. {
  69793. $this->comparators = $comparators;
  69794. parent::__construct($iterator);
  69795. }
  69796. #[\ReturnTypeWillChange]
  69797. public function accept()
  69798. {
  69799. $fileinfo = $this->current();
  69800. if (!file_exists($fileinfo->getPathname())) {
  69801. return false;
  69802. }
  69803. $filedate = $fileinfo->getMTime();
  69804. foreach ($this->comparators as $compare) {
  69805. if (!$compare->test($filedate)) {
  69806. return false;
  69807. }
  69808. }
  69809. return true;
  69810. }
  69811. }
  69812. <?php
  69813. namespace Symfony\Component\Finder\Iterator;
  69814. class DepthRangeFilterIterator extends \FilterIterator
  69815. {
  69816. private $minDepth = 0;
  69817. public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth = 0, int $maxDepth = \PHP_INT_MAX)
  69818. {
  69819. $this->minDepth = $minDepth;
  69820. $iterator->setMaxDepth(\PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  69821. parent::__construct($iterator);
  69822. }
  69823. #[\ReturnTypeWillChange]
  69824. public function accept()
  69825. {
  69826. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  69827. }
  69828. }
  69829. <?php
  69830. namespace Symfony\Component\Finder\Iterator;
  69831. class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator
  69832. {
  69833. private $iterator;
  69834. private $isRecursive;
  69835. private $excludedDirs = [];
  69836. private $excludedPattern;
  69837. public function __construct(\Iterator $iterator, array $directories)
  69838. {
  69839. $this->iterator = $iterator;
  69840. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  69841. $patterns = [];
  69842. foreach ($directories as $directory) {
  69843. $directory = rtrim($directory, '/');
  69844. if (!$this->isRecursive || str_contains($directory, '/')) {
  69845. $patterns[] = preg_quote($directory, '#');
  69846. } else {
  69847. $this->excludedDirs[$directory] = true;
  69848. }
  69849. }
  69850. if ($patterns) {
  69851. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  69852. }
  69853. parent::__construct($iterator);
  69854. }
  69855. #[\ReturnTypeWillChange]
  69856. public function accept()
  69857. {
  69858. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  69859. return false;
  69860. }
  69861. if ($this->excludedPattern) {
  69862. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  69863. $path = str_replace('\\', '/', $path);
  69864. return !preg_match($this->excludedPattern, $path);
  69865. }
  69866. return true;
  69867. }
  69868. #[\ReturnTypeWillChange]
  69869. public function hasChildren()
  69870. {
  69871. return $this->isRecursive && $this->iterator->hasChildren();
  69872. }
  69873. #[\ReturnTypeWillChange]
  69874. public function getChildren()
  69875. {
  69876. $children = new self($this->iterator->getChildren(), []);
  69877. $children->excludedDirs = $this->excludedDirs;
  69878. $children->excludedPattern = $this->excludedPattern;
  69879. return $children;
  69880. }
  69881. }
  69882. <?php
  69883. namespace Symfony\Component\Finder\Iterator;
  69884. class FileTypeFilterIterator extends \FilterIterator
  69885. {
  69886. public const ONLY_FILES = 1;
  69887. public const ONLY_DIRECTORIES = 2;
  69888. private $mode;
  69889. public function __construct(\Iterator $iterator, int $mode)
  69890. {
  69891. $this->mode = $mode;
  69892. parent::__construct($iterator);
  69893. }
  69894. #[\ReturnTypeWillChange]
  69895. public function accept()
  69896. {
  69897. $fileinfo = $this->current();
  69898. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  69899. return false;
  69900. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  69901. return false;
  69902. }
  69903. return true;
  69904. }
  69905. }
  69906. <?php
  69907. namespace Symfony\Component\Finder\Iterator;
  69908. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  69909. {
  69910. #[\ReturnTypeWillChange]
  69911. public function accept()
  69912. {
  69913. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  69914. return true;
  69915. }
  69916. $fileinfo = $this->current();
  69917. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  69918. return false;
  69919. }
  69920. $content = $fileinfo->getContents();
  69921. if (!$content) {
  69922. return false;
  69923. }
  69924. return $this->isAccepted($content);
  69925. }
  69926. protected function toRegex(string $str)
  69927. {
  69928. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  69929. }
  69930. }
  69931. <?php
  69932. namespace Symfony\Component\Finder\Iterator;
  69933. use Symfony\Component\Finder\Glob;
  69934. class FilenameFilterIterator extends MultiplePcreFilterIterator
  69935. {
  69936. #[\ReturnTypeWillChange]
  69937. public function accept()
  69938. {
  69939. return $this->isAccepted($this->current()->getFilename());
  69940. }
  69941. protected function toRegex(string $str)
  69942. {
  69943. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  69944. }
  69945. }
  69946. <?php
  69947. namespace Symfony\Component\Finder\Iterator;
  69948. class LazyIterator implements \IteratorAggregate
  69949. {
  69950. private $iteratorFactory;
  69951. public function __construct(callable $iteratorFactory)
  69952. {
  69953. $this->iteratorFactory = $iteratorFactory;
  69954. }
  69955. public function getIterator(): \Traversable
  69956. {
  69957. yield from ($this->iteratorFactory)();
  69958. }
  69959. }
  69960. <?php
  69961. namespace Symfony\Component\Finder\Iterator;
  69962. abstract class MultiplePcreFilterIterator extends \FilterIterator
  69963. {
  69964. protected $matchRegexps = [];
  69965. protected $noMatchRegexps = [];
  69966. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  69967. {
  69968. foreach ($matchPatterns as $pattern) {
  69969. $this->matchRegexps[] = $this->toRegex($pattern);
  69970. }
  69971. foreach ($noMatchPatterns as $pattern) {
  69972. $this->noMatchRegexps[] = $this->toRegex($pattern);
  69973. }
  69974. parent::__construct($iterator);
  69975. }
  69976. protected function isAccepted(string $string)
  69977. {
  69978. foreach ($this->noMatchRegexps as $regex) {
  69979. if (preg_match($regex, $string)) {
  69980. return false;
  69981. }
  69982. }
  69983. if ($this->matchRegexps) {
  69984. foreach ($this->matchRegexps as $regex) {
  69985. if (preg_match($regex, $string)) {
  69986. return true;
  69987. }
  69988. }
  69989. return false;
  69990. }
  69991. return true;
  69992. }
  69993. protected function isRegex(string $str)
  69994. {
  69995. $availableModifiers = 'imsxuADU';
  69996. if (\PHP_VERSION_ID >= 80200) {
  69997. $availableModifiers .= 'n';
  69998. }
  69999. if (preg_match('/^(.{3,}?)['.$availableModifiers.']*$/', $str, $m)) {
  70000. $start = substr($m[1], 0, 1);
  70001. $end = substr($m[1], -1);
  70002. if ($start === $end) {
  70003. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  70004. }
  70005. foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
  70006. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  70007. return true;
  70008. }
  70009. }
  70010. }
  70011. return false;
  70012. }
  70013. abstract protected function toRegex(string $str);
  70014. }
  70015. <?php
  70016. namespace Symfony\Component\Finder\Iterator;
  70017. class PathFilterIterator extends MultiplePcreFilterIterator
  70018. {
  70019. #[\ReturnTypeWillChange]
  70020. public function accept()
  70021. {
  70022. $filename = $this->current()->getRelativePathname();
  70023. if ('\\' === \DIRECTORY_SEPARATOR) {
  70024. $filename = str_replace('\\', '/', $filename);
  70025. }
  70026. return $this->isAccepted($filename);
  70027. }
  70028. protected function toRegex(string $str)
  70029. {
  70030. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  70031. }
  70032. }
  70033. <?php
  70034. namespace Symfony\Component\Finder\Iterator;
  70035. use Symfony\Component\Finder\Exception\AccessDeniedException;
  70036. use Symfony\Component\Finder\SplFileInfo;
  70037. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  70038. {
  70039. private $ignoreUnreadableDirs;
  70040. private $ignoreFirstRewind = true;
  70041. private $rootPath;
  70042. private $subPath;
  70043. private $directorySeparator = '/';
  70044. public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false)
  70045. {
  70046. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  70047. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  70048. }
  70049. parent::__construct($path, $flags);
  70050. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  70051. $this->rootPath = $path;
  70052. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  70053. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  70054. }
  70055. }
  70056. #[\ReturnTypeWillChange]
  70057. public function current()
  70058. {
  70059. if (null === $subPathname = $this->subPath) {
  70060. $subPathname = $this->subPath = $this->getSubPath();
  70061. }
  70062. if ('' !== $subPathname) {
  70063. $subPathname .= $this->directorySeparator;
  70064. }
  70065. $subPathname .= $this->getFilename();
  70066. if ('/' !== $basePath = $this->rootPath) {
  70067. $basePath .= $this->directorySeparator;
  70068. }
  70069. return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
  70070. }
  70071. #[\ReturnTypeWillChange]
  70072. public function hasChildren($allowLinks = false)
  70073. {
  70074. $hasChildren = parent::hasChildren($allowLinks);
  70075. if (!$hasChildren || !$this->ignoreUnreadableDirs) {
  70076. return $hasChildren;
  70077. }
  70078. try {
  70079. parent::getChildren();
  70080. return true;
  70081. } catch (\UnexpectedValueException $e) {
  70082. return false;
  70083. }
  70084. }
  70085. #[\ReturnTypeWillChange]
  70086. public function getChildren()
  70087. {
  70088. try {
  70089. $children = parent::getChildren();
  70090. if ($children instanceof self) {
  70091. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  70092. $children->rootPath = $this->rootPath;
  70093. }
  70094. return $children;
  70095. } catch (\UnexpectedValueException $e) {
  70096. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  70097. }
  70098. }
  70099. #[\ReturnTypeWillChange]
  70100. public function next()
  70101. {
  70102. $this->ignoreFirstRewind = false;
  70103. parent::next();
  70104. }
  70105. #[\ReturnTypeWillChange]
  70106. public function rewind()
  70107. {
  70108. if ($this->ignoreFirstRewind) {
  70109. $this->ignoreFirstRewind = false;
  70110. return;
  70111. }
  70112. parent::rewind();
  70113. }
  70114. }
  70115. <?php
  70116. namespace Symfony\Component\Finder\Iterator;
  70117. use Symfony\Component\Finder\Comparator\NumberComparator;
  70118. class SizeRangeFilterIterator extends \FilterIterator
  70119. {
  70120. private $comparators = [];
  70121. public function __construct(\Iterator $iterator, array $comparators)
  70122. {
  70123. $this->comparators = $comparators;
  70124. parent::__construct($iterator);
  70125. }
  70126. #[\ReturnTypeWillChange]
  70127. public function accept()
  70128. {
  70129. $fileinfo = $this->current();
  70130. if (!$fileinfo->isFile()) {
  70131. return true;
  70132. }
  70133. $filesize = $fileinfo->getSize();
  70134. foreach ($this->comparators as $compare) {
  70135. if (!$compare->test($filesize)) {
  70136. return false;
  70137. }
  70138. }
  70139. return true;
  70140. }
  70141. }
  70142. <?php
  70143. namespace Symfony\Component\Finder\Iterator;
  70144. class SortableIterator implements \IteratorAggregate
  70145. {
  70146. public const SORT_BY_NONE = 0;
  70147. public const SORT_BY_NAME = 1;
  70148. public const SORT_BY_TYPE = 2;
  70149. public const SORT_BY_ACCESSED_TIME = 3;
  70150. public const SORT_BY_CHANGED_TIME = 4;
  70151. public const SORT_BY_MODIFIED_TIME = 5;
  70152. public const SORT_BY_NAME_NATURAL = 6;
  70153. private $iterator;
  70154. private $sort;
  70155. public function __construct(\Traversable $iterator, $sort, bool $reverseOrder = false)
  70156. {
  70157. $this->iterator = $iterator;
  70158. $order = $reverseOrder ? -1 : 1;
  70159. if (self::SORT_BY_NAME === $sort) {
  70160. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  70161. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  70162. };
  70163. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  70164. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  70165. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  70166. };
  70167. } elseif (self::SORT_BY_TYPE === $sort) {
  70168. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  70169. if ($a->isDir() && $b->isFile()) {
  70170. return -$order;
  70171. } elseif ($a->isFile() && $b->isDir()) {
  70172. return $order;
  70173. }
  70174. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  70175. };
  70176. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  70177. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  70178. return $order * ($a->getATime() - $b->getATime());
  70179. };
  70180. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  70181. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  70182. return $order * ($a->getCTime() - $b->getCTime());
  70183. };
  70184. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  70185. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  70186. return $order * ($a->getMTime() - $b->getMTime());
  70187. };
  70188. } elseif (self::SORT_BY_NONE === $sort) {
  70189. $this->sort = $order;
  70190. } elseif (\is_callable($sort)) {
  70191. $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort;
  70192. } else {
  70193. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  70194. }
  70195. }
  70196. #[\ReturnTypeWillChange]
  70197. public function getIterator()
  70198. {
  70199. if (1 === $this->sort) {
  70200. return $this->iterator;
  70201. }
  70202. $array = iterator_to_array($this->iterator, true);
  70203. if (-1 === $this->sort) {
  70204. $array = array_reverse($array);
  70205. } else {
  70206. uasort($array, $this->sort);
  70207. }
  70208. return new \ArrayIterator($array);
  70209. }
  70210. }
  70211. <?php
  70212. namespace Symfony\Component\Finder\Iterator;
  70213. use Symfony\Component\Finder\Gitignore;
  70214. final class VcsIgnoredFilterIterator extends \FilterIterator
  70215. {
  70216. private $baseDir;
  70217. private $gitignoreFilesCache = [];
  70218. private $ignoredPathsCache = [];
  70219. public function __construct(\Iterator $iterator, string $baseDir)
  70220. {
  70221. $this->baseDir = $this->normalizePath($baseDir);
  70222. parent::__construct($iterator);
  70223. }
  70224. public function accept(): bool
  70225. {
  70226. $file = $this->current();
  70227. $fileRealPath = $this->normalizePath($file->getRealPath());
  70228. return !$this->isIgnored($fileRealPath);
  70229. }
  70230. private function isIgnored(string $fileRealPath): bool
  70231. {
  70232. if (is_dir($fileRealPath) && !str_ends_with($fileRealPath, '/')) {
  70233. $fileRealPath .= '/';
  70234. }
  70235. if (isset($this->ignoredPathsCache[$fileRealPath])) {
  70236. return $this->ignoredPathsCache[$fileRealPath];
  70237. }
  70238. $ignored = false;
  70239. foreach ($this->parentsDirectoryDownward($fileRealPath) as $parentDirectory) {
  70240. if ($this->isIgnored($parentDirectory)) {
  70241. break;
  70242. }
  70243. $fileRelativePath = substr($fileRealPath, \strlen($parentDirectory) + 1);
  70244. if (null === $regexps = $this->readGitignoreFile("{$parentDirectory}/.gitignore")) {
  70245. continue;
  70246. }
  70247. [$exclusionRegex, $inclusionRegex] = $regexps;
  70248. if (preg_match($exclusionRegex, $fileRelativePath)) {
  70249. $ignored = true;
  70250. continue;
  70251. }
  70252. if (preg_match($inclusionRegex, $fileRelativePath)) {
  70253. $ignored = false;
  70254. }
  70255. }
  70256. return $this->ignoredPathsCache[$fileRealPath] = $ignored;
  70257. }
  70258. private function parentsDirectoryDownward(string $fileRealPath): array
  70259. {
  70260. $parentDirectories = [];
  70261. $parentDirectory = $fileRealPath;
  70262. while (true) {
  70263. $newParentDirectory = \dirname($parentDirectory);
  70264. if ($newParentDirectory === $parentDirectory) {
  70265. break;
  70266. }
  70267. $parentDirectory = $newParentDirectory;
  70268. if (0 !== strpos($parentDirectory, $this->baseDir)) {
  70269. break;
  70270. }
  70271. $parentDirectories[] = $parentDirectory;
  70272. }
  70273. return array_reverse($parentDirectories);
  70274. }
  70275. private function readGitignoreFile(string $path): ?array
  70276. {
  70277. if (\array_key_exists($path, $this->gitignoreFilesCache)) {
  70278. return $this->gitignoreFilesCache[$path];
  70279. }
  70280. if (!file_exists($path)) {
  70281. return $this->gitignoreFilesCache[$path] = null;
  70282. }
  70283. if (!is_file($path) || !is_readable($path)) {
  70284. throw new \RuntimeException("The \"ignoreVCSIgnored\" option cannot be used by the Finder as the \"{$path}\" file is not readable.");
  70285. }
  70286. $gitignoreFileContent = file_get_contents($path);
  70287. return $this->gitignoreFilesCache[$path] = [
  70288. Gitignore::toRegex($gitignoreFileContent),
  70289. Gitignore::toRegexMatchingNegatedPatterns($gitignoreFileContent),
  70290. ];
  70291. }
  70292. private function normalizePath(string $path): string
  70293. {
  70294. if ('\\' === \DIRECTORY_SEPARATOR) {
  70295. return str_replace('\\', '/', $path);
  70296. }
  70297. return $path;
  70298. }
  70299. }
  70300. Copyright (c) 2004-present Fabien Potencier
  70301. Permission is hereby granted, free of charge, to any person obtaining a copy
  70302. of this software and associated documentation files (the "Software"), to deal
  70303. in the Software without restriction, including without limitation the rights
  70304. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  70305. copies of the Software, and to permit persons to whom the Software is furnished
  70306. to do so, subject to the following conditions:
  70307. The above copyright notice and this permission notice shall be included in all
  70308. copies or substantial portions of the Software.
  70309. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  70310. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70311. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70312. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  70313. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70314. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70315. THE SOFTWARE.
  70316. <?php
  70317. namespace Symfony\Component\Finder;
  70318. class SplFileInfo extends \SplFileInfo
  70319. {
  70320. private $relativePath;
  70321. private $relativePathname;
  70322. public function __construct(string $file, string $relativePath, string $relativePathname)
  70323. {
  70324. parent::__construct($file);
  70325. $this->relativePath = $relativePath;
  70326. $this->relativePathname = $relativePathname;
  70327. }
  70328. public function getRelativePath()
  70329. {
  70330. return $this->relativePath;
  70331. }
  70332. public function getRelativePathname()
  70333. {
  70334. return $this->relativePathname;
  70335. }
  70336. public function getFilenameWithoutExtension(): string
  70337. {
  70338. $filename = $this->getFilename();
  70339. return pathinfo($filename, \PATHINFO_FILENAME);
  70340. }
  70341. public function getContents()
  70342. {
  70343. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  70344. try {
  70345. $content = file_get_contents($this->getPathname());
  70346. } finally {
  70347. restore_error_handler();
  70348. }
  70349. if (false === $content) {
  70350. throw new \RuntimeException($error);
  70351. }
  70352. return $content;
  70353. }
  70354. }
  70355. <?php
  70356. namespace Symfony\Polyfill\Ctype;
  70357. final class Ctype
  70358. {
  70359. public static function ctype_alnum($text)
  70360. {
  70361. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70362. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  70363. }
  70364. public static function ctype_alpha($text)
  70365. {
  70366. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70367. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  70368. }
  70369. public static function ctype_cntrl($text)
  70370. {
  70371. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70372. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  70373. }
  70374. public static function ctype_digit($text)
  70375. {
  70376. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70377. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  70378. }
  70379. public static function ctype_graph($text)
  70380. {
  70381. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70382. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  70383. }
  70384. public static function ctype_lower($text)
  70385. {
  70386. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70387. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  70388. }
  70389. public static function ctype_print($text)
  70390. {
  70391. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70392. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  70393. }
  70394. public static function ctype_punct($text)
  70395. {
  70396. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70397. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  70398. }
  70399. public static function ctype_space($text)
  70400. {
  70401. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70402. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  70403. }
  70404. public static function ctype_upper($text)
  70405. {
  70406. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70407. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  70408. }
  70409. public static function ctype_xdigit($text)
  70410. {
  70411. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  70412. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  70413. }
  70414. private static function convert_int_to_char_for_ctype($int, $function)
  70415. {
  70416. if (!\is_int($int)) {
  70417. return $int;
  70418. }
  70419. if ($int < -128 || $int > 255) {
  70420. return (string) $int;
  70421. }
  70422. if (\PHP_VERSION_ID >= 80100) {
  70423. @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
  70424. }
  70425. if ($int < 0) {
  70426. $int += 256;
  70427. }
  70428. return \chr($int);
  70429. }
  70430. }
  70431. Copyright (c) 2018-present Fabien Potencier
  70432. Permission is hereby granted, free of charge, to any person obtaining a copy
  70433. of this software and associated documentation files (the "Software"), to deal
  70434. in the Software without restriction, including without limitation the rights
  70435. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  70436. copies of the Software, and to permit persons to whom the Software is furnished
  70437. to do so, subject to the following conditions:
  70438. The above copyright notice and this permission notice shall be included in all
  70439. copies or substantial portions of the Software.
  70440. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  70441. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70442. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70443. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  70444. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70445. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70446. THE SOFTWARE.
  70447. <?php
  70448. use Symfony\Polyfill\Ctype as p;
  70449. if (\PHP_VERSION_ID >= 80000) {
  70450. return require __DIR__.'/bootstrap80.php';
  70451. }
  70452. if (!function_exists('ctype_alnum')) {
  70453. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  70454. }
  70455. if (!function_exists('ctype_alpha')) {
  70456. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  70457. }
  70458. if (!function_exists('ctype_cntrl')) {
  70459. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  70460. }
  70461. if (!function_exists('ctype_digit')) {
  70462. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  70463. }
  70464. if (!function_exists('ctype_graph')) {
  70465. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  70466. }
  70467. if (!function_exists('ctype_lower')) {
  70468. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  70469. }
  70470. if (!function_exists('ctype_print')) {
  70471. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  70472. }
  70473. if (!function_exists('ctype_punct')) {
  70474. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  70475. }
  70476. if (!function_exists('ctype_space')) {
  70477. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  70478. }
  70479. if (!function_exists('ctype_upper')) {
  70480. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  70481. }
  70482. if (!function_exists('ctype_xdigit')) {
  70483. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  70484. }
  70485. <?php
  70486. use Symfony\Polyfill\Ctype as p;
  70487. if (!function_exists('ctype_alnum')) {
  70488. function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
  70489. }
  70490. if (!function_exists('ctype_alpha')) {
  70491. function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
  70492. }
  70493. if (!function_exists('ctype_cntrl')) {
  70494. function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
  70495. }
  70496. if (!function_exists('ctype_digit')) {
  70497. function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
  70498. }
  70499. if (!function_exists('ctype_graph')) {
  70500. function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
  70501. }
  70502. if (!function_exists('ctype_lower')) {
  70503. function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
  70504. }
  70505. if (!function_exists('ctype_print')) {
  70506. function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
  70507. }
  70508. if (!function_exists('ctype_punct')) {
  70509. function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
  70510. }
  70511. if (!function_exists('ctype_space')) {
  70512. function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
  70513. }
  70514. if (!function_exists('ctype_upper')) {
  70515. function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
  70516. }
  70517. if (!function_exists('ctype_xdigit')) {
  70518. function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
  70519. }
  70520. <?php
  70521. namespace Symfony\Polyfill\Intl\Grapheme;
  70522. \define('SYMFONY_GRAPHEME_CLUSTER_RX', ((float) \PCRE_VERSION < 10 ? (float) \PCRE_VERSION >= 8.32 : (float) \PCRE_VERSION >= 10.39) ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX);
  70523. final class Grapheme
  70524. {
  70525. public const GRAPHEME_CLUSTER_RX = '(?:\r\n|(?:[ -~\x{200C}\x{200D}]|[ᆨ-ᇹ]+|[ᄀ-ᅟ]*(?:[가개갸걔거게겨계고과괘괴�구궈궤귀규그긔기까깨꺄꺠꺼께껴�꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨���나내�냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴�늬니다대댜댸��뎌뎨������둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴�똬뙈뙤뚀뚜뚸뛔뛰뜌뜨���래랴�러레려례로롸뢔뢰료루뤄뤠뤼류르�리마매먀먜머메며몌모뫄뫠뫼묘무�뭬뮈뮤므믜미바배뱌뱨버베벼볘보�봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴�뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼���사새샤섀서세셔셰소솨쇄쇠쇼수숴�쉬슈스싀시싸쌔쌰��쎄쎠쎼����쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어�여예오와왜외요우워웨위유으���재쟈쟤저제져졔조좌좨죄죠주줘줴�쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴�쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체�쳬초촤쵀최쵸추춰췌취츄츠츼치카�캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴��킈키타태탸턔터테텨톄토톼퇘퇴�투퉈퉤튀튜트틔티파패���페펴����푀표푸풔풰퓌퓨프픠피하해�햬허헤혀혜호화홰회효후훠훼휘휴��히]?[ᅠ-ᆢ]+|[가-힣])[ᆨ-ᇹ]*|[ᄀ-ᅟ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])';
  70526. private const CASE_FOLD = [
  70527. ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
  70528. ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
  70529. ];
  70530. public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0)
  70531. {
  70532. if (0 > $start) {
  70533. $start = \strlen($s) + $start;
  70534. }
  70535. if (!\is_scalar($s)) {
  70536. $hasError = false;
  70537. set_error_handler(function () use (&$hasError) { $hasError = true; });
  70538. $next = substr($s, $start);
  70539. restore_error_handler();
  70540. if ($hasError) {
  70541. substr($s, $start);
  70542. $s = '';
  70543. } else {
  70544. $s = $next;
  70545. }
  70546. } else {
  70547. $s = substr($s, $start);
  70548. }
  70549. $size = (int) $size;
  70550. $type = (int) $type;
  70551. $start = (int) $start;
  70552. if (\GRAPHEME_EXTR_COUNT !== $type && \GRAPHEME_EXTR_MAXBYTES !== $type && \GRAPHEME_EXTR_MAXCHARS !== $type) {
  70553. if (80000 > \PHP_VERSION_ID) {
  70554. return false;
  70555. }
  70556. throw new \ValueError('grapheme_extract(): Argument #3 ($type) must be one of GRAPHEME_EXTR_COUNT, GRAPHEME_EXTR_MAXBYTES, or GRAPHEME_EXTR_MAXCHARS');
  70557. }
  70558. if (!isset($s[0]) || 0 > $size || 0 > $start) {
  70559. return false;
  70560. }
  70561. if (0 === $size) {
  70562. return '';
  70563. }
  70564. $next = $start;
  70565. $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
  70566. if (!isset($s[1])) {
  70567. return false;
  70568. }
  70569. $i = 1;
  70570. $ret = '';
  70571. do {
  70572. if (\GRAPHEME_EXTR_COUNT === $type) {
  70573. --$size;
  70574. } elseif (\GRAPHEME_EXTR_MAXBYTES === $type) {
  70575. $size -= \strlen($s[$i]);
  70576. } else {
  70577. $size -= iconv_strlen($s[$i], 'UTF-8//IGNORE');
  70578. }
  70579. if ($size >= 0) {
  70580. $ret .= $s[$i];
  70581. }
  70582. } while (isset($s[++$i]) && $size > 0);
  70583. $next += \strlen($ret);
  70584. return $ret;
  70585. }
  70586. public static function grapheme_strlen($s)
  70587. {
  70588. preg_replace('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', '', $s, -1, $len);
  70589. return 0 === $len && '' !== $s ? null : $len;
  70590. }
  70591. public static function grapheme_substr($s, $start, $len = null)
  70592. {
  70593. if (null === $len) {
  70594. $len = 2147483647;
  70595. }
  70596. preg_match_all('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', $s, $s);
  70597. $slen = \count($s[0]);
  70598. $start = (int) $start;
  70599. if (0 > $start) {
  70600. $start += $slen;
  70601. }
  70602. if (0 > $start) {
  70603. if (\PHP_VERSION_ID < 80000) {
  70604. return false;
  70605. }
  70606. $start = 0;
  70607. }
  70608. if ($start >= $slen) {
  70609. return \PHP_VERSION_ID >= 80000 ? '' : false;
  70610. }
  70611. $rem = $slen - $start;
  70612. if (0 > $len) {
  70613. $len += $rem;
  70614. }
  70615. if (0 === $len) {
  70616. return '';
  70617. }
  70618. if (0 > $len) {
  70619. return \PHP_VERSION_ID >= 80000 ? '' : false;
  70620. }
  70621. if ($len > $rem) {
  70622. $len = $rem;
  70623. }
  70624. return implode('', \array_slice($s[0], $start, $len));
  70625. }
  70626. public static function grapheme_strpos($s, $needle, $offset = 0)
  70627. {
  70628. return self::grapheme_position($s, $needle, $offset, 0);
  70629. }
  70630. public static function grapheme_stripos($s, $needle, $offset = 0)
  70631. {
  70632. return self::grapheme_position($s, $needle, $offset, 1);
  70633. }
  70634. public static function grapheme_strrpos($s, $needle, $offset = 0)
  70635. {
  70636. return self::grapheme_position($s, $needle, $offset, 2);
  70637. }
  70638. public static function grapheme_strripos($s, $needle, $offset = 0)
  70639. {
  70640. return self::grapheme_position($s, $needle, $offset, 3);
  70641. }
  70642. public static function grapheme_stristr($s, $needle, $beforeNeedle = false)
  70643. {
  70644. return mb_stristr($s, $needle, $beforeNeedle, 'UTF-8');
  70645. }
  70646. public static function grapheme_strstr($s, $needle, $beforeNeedle = false)
  70647. {
  70648. return mb_strstr($s, $needle, $beforeNeedle, 'UTF-8');
  70649. }
  70650. private static function grapheme_position($s, $needle, $offset, $mode)
  70651. {
  70652. $needle = (string) $needle;
  70653. if (80000 > \PHP_VERSION_ID && !preg_match('/./us', $needle)) {
  70654. return false;
  70655. }
  70656. $s = (string) $s;
  70657. if (!preg_match('/./us', $s)) {
  70658. return false;
  70659. }
  70660. if ($offset > 0) {
  70661. $s = self::grapheme_substr($s, $offset);
  70662. } elseif ($offset < 0) {
  70663. if (2 > $mode) {
  70664. $offset += self::grapheme_strlen($s);
  70665. $s = self::grapheme_substr($s, $offset);
  70666. if (0 > $offset) {
  70667. $offset = 0;
  70668. }
  70669. } elseif (0 > $offset += self::grapheme_strlen($needle)) {
  70670. $s = self::grapheme_substr($s, 0, $offset);
  70671. $offset = 0;
  70672. } else {
  70673. $offset = 0;
  70674. }
  70675. }
  70676. $caseInsensitive = $mode & 1;
  70677. $reverse = $mode & 2;
  70678. if ($caseInsensitive) {
  70679. $mode = \defined('MB_CASE_FOLD_SIMPLE') ? \MB_CASE_FOLD_SIMPLE : \MB_CASE_LOWER;
  70680. $s = mb_convert_case($s, $mode, 'UTF-8');
  70681. $needle = mb_convert_case($needle, $mode, 'UTF-8');
  70682. if (!\defined('MB_CASE_FOLD_SIMPLE')) {
  70683. $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
  70684. $needle = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $needle);
  70685. }
  70686. }
  70687. if ($reverse) {
  70688. $needlePos = strrpos($s, $needle);
  70689. } else {
  70690. $needlePos = strpos($s, $needle);
  70691. }
  70692. return false !== $needlePos ? self::grapheme_strlen(substr($s, 0, $needlePos)) + $offset : false;
  70693. }
  70694. }
  70695. Copyright (c) 2015-present Fabien Potencier
  70696. Permission is hereby granted, free of charge, to any person obtaining a copy
  70697. of this software and associated documentation files (the "Software"), to deal
  70698. in the Software without restriction, including without limitation the rights
  70699. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  70700. copies of the Software, and to permit persons to whom the Software is furnished
  70701. to do so, subject to the following conditions:
  70702. The above copyright notice and this permission notice shall be included in all
  70703. copies or substantial portions of the Software.
  70704. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  70705. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70706. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70707. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  70708. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70709. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70710. THE SOFTWARE.
  70711. <?php
  70712. use Symfony\Polyfill\Intl\Grapheme as p;
  70713. if (extension_loaded('intl')) {
  70714. return;
  70715. }
  70716. if (\PHP_VERSION_ID >= 80000) {
  70717. return require __DIR__.'/bootstrap80.php';
  70718. }
  70719. if (!defined('GRAPHEME_EXTR_COUNT')) {
  70720. define('GRAPHEME_EXTR_COUNT', 0);
  70721. }
  70722. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  70723. define('GRAPHEME_EXTR_MAXBYTES', 1);
  70724. }
  70725. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  70726. define('GRAPHEME_EXTR_MAXCHARS', 2);
  70727. }
  70728. if (!function_exists('grapheme_extract')) {
  70729. function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); }
  70730. }
  70731. if (!function_exists('grapheme_stripos')) {
  70732. function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); }
  70733. }
  70734. if (!function_exists('grapheme_stristr')) {
  70735. function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); }
  70736. }
  70737. if (!function_exists('grapheme_strlen')) {
  70738. function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); }
  70739. }
  70740. if (!function_exists('grapheme_strpos')) {
  70741. function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); }
  70742. }
  70743. if (!function_exists('grapheme_strripos')) {
  70744. function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); }
  70745. }
  70746. if (!function_exists('grapheme_strrpos')) {
  70747. function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); }
  70748. }
  70749. if (!function_exists('grapheme_strstr')) {
  70750. function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); }
  70751. }
  70752. if (!function_exists('grapheme_substr')) {
  70753. function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); }
  70754. }
  70755. <?php
  70756. use Symfony\Polyfill\Intl\Grapheme as p;
  70757. if (!defined('GRAPHEME_EXTR_COUNT')) {
  70758. define('GRAPHEME_EXTR_COUNT', 0);
  70759. }
  70760. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  70761. define('GRAPHEME_EXTR_MAXBYTES', 1);
  70762. }
  70763. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  70764. define('GRAPHEME_EXTR_MAXCHARS', 2);
  70765. }
  70766. if (!function_exists('grapheme_extract')) {
  70767. function grapheme_extract(?string $haystack, ?int $size, ?int $type = GRAPHEME_EXTR_COUNT, ?int $offset = 0, &$next = null): string|false { return p\Grapheme::grapheme_extract((string) $haystack, (int) $size, (int) $type, (int) $offset, $next); }
  70768. }
  70769. if (!function_exists('grapheme_stripos')) {
  70770. function grapheme_stripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_stripos((string) $haystack, (string) $needle, (int) $offset); }
  70771. }
  70772. if (!function_exists('grapheme_stristr')) {
  70773. function grapheme_stristr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_stristr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  70774. }
  70775. if (!function_exists('grapheme_strlen')) {
  70776. function grapheme_strlen(?string $string): int|false|null { return p\Grapheme::grapheme_strlen((string) $string); }
  70777. }
  70778. if (!function_exists('grapheme_strpos')) {
  70779. function grapheme_strpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strpos((string) $haystack, (string) $needle, (int) $offset); }
  70780. }
  70781. if (!function_exists('grapheme_strripos')) {
  70782. function grapheme_strripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strripos((string) $haystack, (string) $needle, (int) $offset); }
  70783. }
  70784. if (!function_exists('grapheme_strrpos')) {
  70785. function grapheme_strrpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strrpos((string) $haystack, (string) $needle, (int) $offset); }
  70786. }
  70787. if (!function_exists('grapheme_strstr')) {
  70788. function grapheme_strstr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_strstr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  70789. }
  70790. if (!function_exists('grapheme_substr')) {
  70791. function grapheme_substr(?string $string, ?int $offset, ?int $length = null): string|false { return p\Grapheme::grapheme_substr((string) $string, (int) $offset, $length); }
  70792. }
  70793. Copyright (c) 2015-present Fabien Potencier
  70794. Permission is hereby granted, free of charge, to any person obtaining a copy
  70795. of this software and associated documentation files (the "Software"), to deal
  70796. in the Software without restriction, including without limitation the rights
  70797. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  70798. copies of the Software, and to permit persons to whom the Software is furnished
  70799. to do so, subject to the following conditions:
  70800. The above copyright notice and this permission notice shall be included in all
  70801. copies or substantial portions of the Software.
  70802. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  70803. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70804. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70805. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  70806. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70807. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70808. THE SOFTWARE.
  70809. <?php
  70810. namespace Symfony\Polyfill\Intl\Normalizer;
  70811. class Normalizer
  70812. {
  70813. public const FORM_D = \Normalizer::FORM_D;
  70814. public const FORM_KD = \Normalizer::FORM_KD;
  70815. public const FORM_C = \Normalizer::FORM_C;
  70816. public const FORM_KC = \Normalizer::FORM_KC;
  70817. public const NFD = \Normalizer::NFD;
  70818. public const NFKD = \Normalizer::NFKD;
  70819. public const NFC = \Normalizer::NFC;
  70820. public const NFKC = \Normalizer::NFKC;
  70821. private static $C;
  70822. private static $D;
  70823. private static $KD;
  70824. private static $cC;
  70825. private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  70826. private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  70827. public static function isNormalized(string $s, int $form = self::FORM_C)
  70828. {
  70829. if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) {
  70830. return false;
  70831. }
  70832. if (!isset($s[strspn($s, self::$ASCII)])) {
  70833. return true;
  70834. }
  70835. if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) {
  70836. return true;
  70837. }
  70838. return self::normalize($s, $form) === $s;
  70839. }
  70840. public static function normalize(string $s, int $form = self::FORM_C)
  70841. {
  70842. if (!preg_match('//u', $s)) {
  70843. return false;
  70844. }
  70845. switch ($form) {
  70846. case self::NFC: $C = true; $K = false; break;
  70847. case self::NFD: $C = false; $K = false; break;
  70848. case self::NFKC: $C = true; $K = true; break;
  70849. case self::NFKD: $C = false; $K = true; break;
  70850. default:
  70851. if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) {
  70852. return $s;
  70853. }
  70854. if (80000 > \PHP_VERSION_ID) {
  70855. return false;
  70856. }
  70857. throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form');
  70858. }
  70859. if ('' === $s) {
  70860. return '';
  70861. }
  70862. if ($K && null === self::$KD) {
  70863. self::$KD = self::getData('compatibilityDecomposition');
  70864. }
  70865. if (null === self::$D) {
  70866. self::$D = self::getData('canonicalDecomposition');
  70867. self::$cC = self::getData('combiningClass');
  70868. }
  70869. if (null !== $mbEncoding = (2 & (int) \ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) {
  70870. mb_internal_encoding('8bit');
  70871. }
  70872. $r = self::decompose($s, $K);
  70873. if ($C) {
  70874. if (null === self::$C) {
  70875. self::$C = self::getData('canonicalComposition');
  70876. }
  70877. $r = self::recompose($r);
  70878. }
  70879. if (null !== $mbEncoding) {
  70880. mb_internal_encoding($mbEncoding);
  70881. }
  70882. return $r;
  70883. }
  70884. private static function recompose($s)
  70885. {
  70886. $ASCII = self::$ASCII;
  70887. $compMap = self::$C;
  70888. $combClass = self::$cC;
  70889. $ulenMask = self::$ulenMask;
  70890. $result = $tail = '';
  70891. $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"];
  70892. $len = \strlen($s);
  70893. $lastUchr = substr($s, 0, $i);
  70894. $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0;
  70895. while ($i < $len) {
  70896. if ($s[$i] < "\x80") {
  70897. if ($tail) {
  70898. $lastUchr .= $tail;
  70899. $tail = '';
  70900. }
  70901. if ($j = strspn($s, $ASCII, $i + 1)) {
  70902. $lastUchr .= substr($s, $i, $j);
  70903. $i += $j;
  70904. }
  70905. $result .= $lastUchr;
  70906. $lastUchr = $s[$i];
  70907. $lastUcls = 0;
  70908. ++$i;
  70909. continue;
  70910. }
  70911. $ulen = $ulenMask[$s[$i] & "\xF0"];
  70912. $uchr = substr($s, $i, $ulen);
  70913. if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr
  70914. || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr
  70915. || $lastUcls) {
  70916. $ucls = $combClass[$uchr] ?? 0;
  70917. if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) {
  70918. $lastUchr = $compMap[$lastUchr.$uchr];
  70919. } elseif ($lastUcls = $ucls) {
  70920. $tail .= $uchr;
  70921. } else {
  70922. if ($tail) {
  70923. $lastUchr .= $tail;
  70924. $tail = '';
  70925. }
  70926. $result .= $lastUchr;
  70927. $lastUchr = $uchr;
  70928. }
  70929. } else {
  70930. $L = \ord($lastUchr[2]) - 0x80;
  70931. $V = \ord($uchr[2]) - 0xA1;
  70932. $T = 0;
  70933. $uchr = substr($s, $i + $ulen, 3);
  70934. if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") {
  70935. $T = \ord($uchr[2]) - 0xA7;
  70936. 0 > $T && $T += 0x40;
  70937. $ulen += 3;
  70938. }
  70939. $L = 0xAC00 + ($L * 21 + $V) * 28 + $T;
  70940. $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F);
  70941. }
  70942. $i += $ulen;
  70943. }
  70944. return $result.$lastUchr.$tail;
  70945. }
  70946. private static function decompose($s, $c)
  70947. {
  70948. $result = '';
  70949. $ASCII = self::$ASCII;
  70950. $decompMap = self::$D;
  70951. $combClass = self::$cC;
  70952. $ulenMask = self::$ulenMask;
  70953. if ($c) {
  70954. $compatMap = self::$KD;
  70955. }
  70956. $c = [];
  70957. $i = 0;
  70958. $len = \strlen($s);
  70959. while ($i < $len) {
  70960. if ($s[$i] < "\x80") {
  70961. if ($c) {
  70962. ksort($c);
  70963. $result .= implode('', $c);
  70964. $c = [];
  70965. }
  70966. $j = 1 + strspn($s, $ASCII, $i + 1);
  70967. $result .= substr($s, $i, $j);
  70968. $i += $j;
  70969. continue;
  70970. }
  70971. $ulen = $ulenMask[$s[$i] & "\xF0"];
  70972. $uchr = substr($s, $i, $ulen);
  70973. $i += $ulen;
  70974. if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) {
  70975. if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) {
  70976. $uchr = $j;
  70977. $j = \strlen($uchr);
  70978. $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"];
  70979. if ($ulen != $j) {
  70980. $j -= $ulen;
  70981. $i -= $j;
  70982. if (0 > $i) {
  70983. $s = str_repeat(' ', -$i).$s;
  70984. $len -= $i;
  70985. $i = 0;
  70986. }
  70987. while ($j--) {
  70988. $s[$i + $j] = $uchr[$ulen + $j];
  70989. }
  70990. $uchr = substr($uchr, 0, $ulen);
  70991. }
  70992. }
  70993. if (isset($combClass[$uchr])) {
  70994. if (!isset($c[$combClass[$uchr]])) {
  70995. $c[$combClass[$uchr]] = '';
  70996. }
  70997. $c[$combClass[$uchr]] .= $uchr;
  70998. continue;
  70999. }
  71000. } else {
  71001. $uchr = unpack('C*', $uchr);
  71002. $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80;
  71003. $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588))
  71004. ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28));
  71005. if ($j %= 28) {
  71006. $uchr .= $j < 25
  71007. ? ("\xE1\x86".\chr(0xA7 + $j))
  71008. : ("\xE1\x87".\chr(0x67 + $j));
  71009. }
  71010. }
  71011. if ($c) {
  71012. ksort($c);
  71013. $result .= implode('', $c);
  71014. $c = [];
  71015. }
  71016. $result .= $uchr;
  71017. }
  71018. if ($c) {
  71019. ksort($c);
  71020. $result .= implode('', $c);
  71021. }
  71022. return $result;
  71023. }
  71024. private static function getData($file)
  71025. {
  71026. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  71027. return require $file;
  71028. }
  71029. return false;
  71030. }
  71031. }
  71032. <?php
  71033. class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer
  71034. {
  71035. public const NONE = 2;
  71036. public const FORM_D = 4;
  71037. public const FORM_KD = 8;
  71038. public const FORM_C = 16;
  71039. public const FORM_KC = 32;
  71040. public const NFD = 4;
  71041. public const NFKD = 8;
  71042. public const NFC = 16;
  71043. public const NFKC = 32;
  71044. }
  71045. <?php
  71046. return array (
  71047. 'À' => 'À',
  71048. 'A�' => '�',
  71049. 'Â' => 'Â',
  71050. 'Ã' => 'Ã',
  71051. 'Ä' => 'Ä',
  71052. 'AÌŠ' => 'Ã…',
  71053. 'Ç' => 'Ç',
  71054. 'È' => 'È',
  71055. 'E�' => 'É',
  71056. 'Ê' => 'Ê',
  71057. 'Ë' => 'Ë',
  71058. 'Ì' => 'Ì',
  71059. 'I�' => '�',
  71060. 'IÌ‚' => 'ÃŽ',
  71061. 'Ï' => '�',
  71062. 'Ñ' => 'Ñ',
  71063. 'OÌ€' => 'Ã’',
  71064. 'O�' => 'Ó',
  71065. 'Ô' => 'Ô',
  71066. 'Õ' => 'Õ',
  71067. 'Ö' => 'Ö',
  71068. 'Ù' => 'Ù',
  71069. 'U�' => 'Ú',
  71070. 'Û' => 'Û',
  71071. 'Ü' => 'Ü',
  71072. 'Y�' => '�',
  71073. 'à' => 'à',
  71074. 'a�' => 'á',
  71075. 'â' => 'â',
  71076. 'ã' => 'ã',
  71077. 'ä' => 'ä',
  71078. 'aÌŠ' => 'Ã¥',
  71079. 'ç' => 'ç',
  71080. 'è' => 'è',
  71081. 'e�' => 'é',
  71082. 'ê' => 'ê',
  71083. 'ë' => 'ë',
  71084. 'ì' => 'ì',
  71085. 'i�' => 'í',
  71086. 'î' => 'î',
  71087. 'ï' => 'ï',
  71088. 'ñ' => 'ñ',
  71089. 'ò' => 'ò',
  71090. 'o�' => 'ó',
  71091. 'ô' => 'ô',
  71092. 'õ' => 'õ',
  71093. 'ö' => 'ö',
  71094. 'ù' => 'ù',
  71095. 'u�' => 'ú',
  71096. 'û' => 'û',
  71097. 'ü' => 'ü',
  71098. 'y�' => 'ý',
  71099. 'ÿ' => 'ÿ',
  71100. 'AÌ„' => 'Ä€',
  71101. 'ā' => '�',
  71102. 'Ă' => 'Ă',
  71103. 'ă' => 'ă',
  71104. 'Ą' => 'Ą',
  71105. 'ą' => 'ą',
  71106. 'C�' => 'Ć',
  71107. 'c�' => 'ć',
  71108. 'Ĉ' => 'Ĉ',
  71109. 'ĉ' => 'ĉ',
  71110. 'Ċ' => 'Ċ',
  71111. 'ċ' => 'ċ',
  71112. 'Č' => 'Č',
  71113. 'č' => '�',
  71114. 'Ď' => 'Ď',
  71115. 'ď' => '�',
  71116. 'EÌ„' => 'Ä’',
  71117. 'ē' => 'ē',
  71118. 'Ĕ' => 'Ĕ',
  71119. 'ĕ' => 'ĕ',
  71120. 'Ė' => 'Ė',
  71121. 'ė' => 'ė',
  71122. 'Ę' => 'Ę',
  71123. 'ę' => 'ę',
  71124. 'Ě' => 'Ě',
  71125. 'ě' => 'ě',
  71126. 'Ĝ' => 'Ĝ',
  71127. 'ĝ' => '�',
  71128. 'Ğ' => 'Ğ',
  71129. 'ğ' => 'ğ',
  71130. 'Ġ' => 'Ġ',
  71131. 'ġ' => 'ġ',
  71132. 'Ģ' => 'Ģ',
  71133. 'ģ' => 'ģ',
  71134. 'Ĥ' => 'Ĥ',
  71135. 'ĥ' => 'ĥ',
  71136. 'Ĩ' => 'Ĩ',
  71137. 'ĩ' => 'ĩ',
  71138. 'Ī' => 'Ī',
  71139. 'ī' => 'ī',
  71140. 'Ĭ' => 'Ĭ',
  71141. 'ĭ' => 'ĭ',
  71142. 'Į' => 'Į',
  71143. 'į' => 'į',
  71144. 'İ' => 'İ',
  71145. 'JÌ‚' => 'Ä´',
  71146. 'ĵ' => 'ĵ',
  71147. 'Ķ' => 'Ķ',
  71148. 'ķ' => 'ķ',
  71149. 'L�' => 'Ĺ',
  71150. 'l�' => 'ĺ',
  71151. 'Ļ' => 'Ļ',
  71152. 'ļ' => 'ļ',
  71153. 'Ľ' => 'Ľ',
  71154. 'ľ' => 'ľ',
  71155. 'N�' => 'Ń',
  71156. 'n�' => 'ń',
  71157. 'Ņ' => 'Ņ',
  71158. 'ņ' => 'ņ',
  71159. 'Ň' => 'Ň',
  71160. 'ň' => 'ň',
  71161. 'Ō' => 'Ō',
  71162. 'ō' => '�',
  71163. 'Ŏ' => 'Ŏ',
  71164. 'ŏ' => '�',
  71165. 'Ő' => '�',
  71166. 'ő' => 'ő',
  71167. 'R�' => 'Ŕ',
  71168. 'r�' => 'ŕ',
  71169. 'Ŗ' => 'Ŗ',
  71170. 'ŗ' => 'ŗ',
  71171. 'Ř' => 'Ř',
  71172. 'ř' => 'ř',
  71173. 'S�' => 'Ś',
  71174. 's�' => 'ś',
  71175. 'Ŝ' => 'Ŝ',
  71176. 'ŝ' => '�',
  71177. 'Ş' => 'Ş',
  71178. 'ş' => 'ş',
  71179. 'Š' => 'Š',
  71180. 'š' => 'š',
  71181. 'Ţ' => 'Ţ',
  71182. 'ţ' => 'ţ',
  71183. 'Ť' => 'Ť',
  71184. 'ť' => 'ť',
  71185. 'Ũ' => 'Ũ',
  71186. 'ũ' => 'ũ',
  71187. 'Ū' => 'Ū',
  71188. 'ū' => 'ū',
  71189. 'Ŭ' => 'Ŭ',
  71190. 'ŭ' => 'ŭ',
  71191. 'UÌŠ' => 'Å®',
  71192. 'ů' => 'ů',
  71193. 'UÌ‹' => 'Å°',
  71194. 'ű' => 'ű',
  71195. 'Ų' => 'Ų',
  71196. 'ų' => 'ų',
  71197. 'WÌ‚' => 'Å´',
  71198. 'ŵ' => 'ŵ',
  71199. 'Ŷ' => 'Ŷ',
  71200. 'ŷ' => 'ŷ',
  71201. 'Ÿ' => 'Ÿ',
  71202. 'Z�' => 'Ź',
  71203. 'z�' => 'ź',
  71204. 'Ż' => 'Ż',
  71205. 'ż' => 'ż',
  71206. 'Ž' => 'Ž',
  71207. 'ž' => 'ž',
  71208. 'OÌ›' => 'Æ ',
  71209. 'oÌ›' => 'Æ¡',
  71210. 'Ư' => 'Ư',
  71211. 'uÌ›' => 'Æ°',
  71212. 'Ǎ' => '�',
  71213. 'ǎ' => 'ǎ',
  71214. 'Ǐ' => '�',
  71215. 'ǐ' => '�',
  71216. 'Ǒ' => 'Ǒ',
  71217. 'ǒ' => 'ǒ',
  71218. 'Ǔ' => 'Ǔ',
  71219. 'ǔ' => 'ǔ',
  71220. 'Ǖ' => 'Ǖ',
  71221. 'ǖ' => 'ǖ',
  71222. 'Ü�' => 'Ǘ',
  71223. 'ü�' => 'ǘ',
  71224. 'Ǚ' => 'Ǚ',
  71225. 'ǚ' => 'ǚ',
  71226. 'Ǜ' => 'Ǜ',
  71227. 'ǜ' => 'ǜ',
  71228. 'Ǟ' => 'Ǟ',
  71229. 'ǟ' => 'ǟ',
  71230. 'Ǡ' => 'Ǡ',
  71231. 'ǡ' => 'ǡ',
  71232. 'Ǣ' => 'Ǣ',
  71233. 'ǣ' => 'ǣ',
  71234. 'Ǧ' => 'Ǧ',
  71235. 'ǧ' => 'ǧ',
  71236. 'Ǩ' => 'Ǩ',
  71237. 'ǩ' => 'ǩ',
  71238. 'Ǫ' => 'Ǫ',
  71239. 'ǫ' => 'ǫ',
  71240. 'Ǭ' => 'Ǭ',
  71241. 'Ç«Ì„' => 'Ç­',
  71242. 'Ǯ' => 'Ǯ',
  71243. 'ǯ' => 'ǯ',
  71244. 'ǰ' => 'ǰ',
  71245. 'G�' => 'Ǵ',
  71246. 'g�' => 'ǵ',
  71247. 'Ǹ' => 'Ǹ',
  71248. 'ǹ' => 'ǹ',
  71249. 'Å�' => 'Ǻ',
  71250. 'å�' => 'ǻ',
  71251. 'Æ�' => 'Ǽ',
  71252. 'æ�' => 'ǽ',
  71253. 'Ø�' => 'Ǿ',
  71254. 'ø�' => 'ǿ',
  71255. 'A�' => 'Ȁ',
  71256. 'a�' => '�',
  71257. 'AÌ‘' => 'È‚',
  71258. 'ȃ' => 'ȃ',
  71259. 'E�' => 'Ȅ',
  71260. 'e�' => 'ȅ',
  71261. 'Ȇ' => 'Ȇ',
  71262. 'ȇ' => 'ȇ',
  71263. 'I�' => 'Ȉ',
  71264. 'i�' => 'ȉ',
  71265. 'IÌ‘' => 'ÈŠ',
  71266. 'ȋ' => 'ȋ',
  71267. 'O�' => 'Ȍ',
  71268. 'o�' => '�',
  71269. 'OÌ‘' => 'ÈŽ',
  71270. 'ȏ' => '�',
  71271. 'R�' => '�',
  71272. 'r�' => 'ȑ',
  71273. 'RÌ‘' => 'È’',
  71274. 'ȓ' => 'ȓ',
  71275. 'U�' => 'Ȕ',
  71276. 'u�' => 'ȕ',
  71277. 'UÌ‘' => 'È–',
  71278. 'ȗ' => 'ȗ',
  71279. 'Ș' => 'Ș',
  71280. 'ș' => 'ș',
  71281. 'Ț' => 'Ț',
  71282. 'ț' => 'ț',
  71283. 'Ȟ' => 'Ȟ',
  71284. 'ȟ' => 'ȟ',
  71285. 'Ȧ' => 'Ȧ',
  71286. 'ȧ' => 'ȧ',
  71287. 'Ȩ' => 'Ȩ',
  71288. 'ȩ' => 'ȩ',
  71289. 'Ȫ' => 'Ȫ',
  71290. 'ȫ' => 'ȫ',
  71291. 'Ȭ' => 'Ȭ',
  71292. 'ȭ' => 'ȭ',
  71293. 'Ȯ' => 'Ȯ',
  71294. 'ȯ' => 'ȯ',
  71295. 'Ȱ' => 'Ȱ',
  71296. 'ȱ' => 'ȱ',
  71297. 'Ȳ' => 'Ȳ',
  71298. 'ȳ' => 'ȳ',
  71299. '¨�' => '΅',
  71300. 'Α�' => 'Ά',
  71301. 'Ε�' => 'Έ',
  71302. 'Η�' => 'Ή',
  71303. 'Ι�' => 'Ί',
  71304. 'Ο�' => 'Ό',
  71305. 'Υ�' => 'Ύ',
  71306. 'Ω�' => '�',
  71307. 'ϊ�' => '�',
  71308. 'Ϊ' => 'Ϊ',
  71309. 'Ϋ' => 'Ϋ',
  71310. 'α�' => 'ά',
  71311. 'ε�' => 'έ',
  71312. 'η�' => 'ή',
  71313. 'ι�' => 'ί',
  71314. 'ϋ�' => 'ΰ',
  71315. 'ϊ' => 'ϊ',
  71316. 'ϋ' => 'ϋ',
  71317. 'ο�' => 'ό',
  71318. 'υ�' => '�',
  71319. 'ω�' => 'ώ',
  71320. 'ϒ�' => 'ϓ',
  71321. 'ϔ' => 'ϔ',
  71322. 'Ѐ' => 'Ѐ',
  71323. 'Ё' => '�',
  71324. 'Г�' => 'Ѓ',
  71325. 'Ї' => 'Ї',
  71326. 'К�' => 'Ќ',
  71327. 'Ѝ' => '�',
  71328. 'Ў' => 'Ў',
  71329. 'Й' => 'Й',
  71330. 'й' => 'й',
  71331. 'ѐ' => '�',
  71332. 'ё' => 'ё',
  71333. 'г�' => 'ѓ',
  71334. 'ї' => 'ї',
  71335. 'к�' => 'ќ',
  71336. 'ѝ' => '�',
  71337. 'ў' => 'ў',
  71338. 'Ѵ�' => 'Ѷ',
  71339. 'ѵ�' => 'ѷ',
  71340. 'Ӂ' => '�',
  71341. 'ӂ' => 'ӂ',
  71342. '�̆' => '�',
  71343. 'ӑ' => 'ӑ',
  71344. '�̈' => 'Ӓ',
  71345. 'ӓ' => 'ӓ',
  71346. 'Ӗ' => 'Ӗ',
  71347. 'ӗ' => 'ӗ',
  71348. 'Ӛ' => 'Ӛ',
  71349. 'ӛ' => 'ӛ',
  71350. 'Ӝ' => 'Ӝ',
  71351. 'ӝ' => '�',
  71352. 'Ӟ' => 'Ӟ',
  71353. 'ӟ' => 'ӟ',
  71354. 'Ӣ' => 'Ӣ',
  71355. 'ӣ' => 'ӣ',
  71356. 'Ӥ' => 'Ӥ',
  71357. 'ӥ' => 'ӥ',
  71358. 'Ӧ' => 'Ӧ',
  71359. 'ӧ' => 'ӧ',
  71360. 'Ӫ' => 'Ӫ',
  71361. 'ӫ' => 'ӫ',
  71362. 'Ӭ' => 'Ӭ',
  71363. '�̈' => 'ӭ',
  71364. 'Ӯ' => 'Ӯ',
  71365. 'ӯ' => 'ӯ',
  71366. 'Ӱ' => 'Ӱ',
  71367. 'ӱ' => 'ӱ',
  71368. 'Ӳ' => 'Ӳ',
  71369. 'ӳ' => 'ӳ',
  71370. 'Ӵ' => 'Ӵ',
  71371. 'ӵ' => 'ӵ',
  71372. 'Ӹ' => 'Ӹ',
  71373. 'ӹ' => 'ӹ',
  71374. 'آ' => 'آ',
  71375. 'أ' => 'أ',
  71376. 'ؤ' => 'ؤ',
  71377. 'إ' => 'إ',
  71378. 'ئ' => 'ئ',
  71379. 'Û•Ù”' => 'Û€',
  71380. 'Û�Ù”' => 'Û‚',
  71381. 'Û’Ù”' => 'Û“',
  71382. 'ऩ' => 'ऩ',
  71383. 'ऱ' => 'ऱ',
  71384. 'ऴ' => 'ऴ',
  71385. 'ো' => 'ো',
  71386. 'ৌ' => 'ৌ',
  71387. 'ୈ' => 'ୈ',
  71388. 'ୋ' => 'ୋ',
  71389. 'ୌ' => 'ୌ',
  71390. 'ஔ' => 'ஔ',
  71391. 'ொ' => 'ொ',
  71392. 'ோ' => 'ோ',
  71393. 'ௌ' => 'ௌ',
  71394. 'ై' => 'ై',
  71395. 'ೀ' => 'ೀ',
  71396. 'ೇ' => 'ೇ',
  71397. 'ೈ' => 'ೈ',
  71398. 'ೊ' => 'ೊ',
  71399. 'ೋ' => 'ೋ',
  71400. 'ൊ' => 'ൊ',
  71401. 'ോ' => 'ോ',
  71402. 'ൌ' => 'ൌ',
  71403. 'ේ' => 'ේ',
  71404. 'ෙ�' => 'ො',
  71405. 'ෝ' => '�',
  71406. 'ෞ' => 'ෞ',
  71407. 'ဦ' => 'ဦ',
  71408. 'ᬆ' => 'ᬆ',
  71409. 'ᬈ' => 'ᬈ',
  71410. 'ᬊ' => 'ᬊ',
  71411. 'ᬌ' => 'ᬌ',
  71412. '�ᬵ' => 'ᬎ',
  71413. 'ᬒ' => 'ᬒ',
  71414. 'ᬻ' => 'ᬻ',
  71415. 'ᬽ' => 'ᬽ',
  71416. 'ᭀ' => 'ᭀ',
  71417. 'ᭁ' => '�',
  71418. 'ᭃ' => 'ᭃ',
  71419. 'Ḁ' => 'Ḁ',
  71420. 'ḁ' => '�',
  71421. 'Ḃ' => 'Ḃ',
  71422. 'ḃ' => 'ḃ',
  71423. 'Ḅ' => 'Ḅ',
  71424. 'ḅ' => 'ḅ',
  71425. 'Ḇ' => 'Ḇ',
  71426. 'ḇ' => 'ḇ',
  71427. 'Ç�' => 'Ḉ',
  71428. 'ç�' => 'ḉ',
  71429. 'Ḋ' => 'Ḋ',
  71430. 'ḋ' => 'ḋ',
  71431. 'Ḍ' => 'Ḍ',
  71432. 'ḍ' => '�',
  71433. 'Ḏ' => 'Ḏ',
  71434. 'ḏ' => '�',
  71435. 'Ḑ' => '�',
  71436. 'ḑ' => 'ḑ',
  71437. 'Ḓ' => 'Ḓ',
  71438. 'ḓ' => 'ḓ',
  71439. 'Ḕ' => 'Ḕ',
  71440. 'ḕ' => 'ḕ',
  71441. 'Ē�' => 'Ḗ',
  71442. 'ē�' => 'ḗ',
  71443. 'Ḙ' => 'Ḙ',
  71444. 'ḙ' => 'ḙ',
  71445. 'Ḛ' => 'Ḛ',
  71446. 'ḛ' => 'ḛ',
  71447. 'Ḝ' => 'Ḝ',
  71448. 'ḝ' => '�',
  71449. 'Ḟ' => 'Ḟ',
  71450. 'ḟ' => 'ḟ',
  71451. 'Ḡ' => 'Ḡ',
  71452. 'ḡ' => 'ḡ',
  71453. 'Ḣ' => 'Ḣ',
  71454. 'ḣ' => 'ḣ',
  71455. 'Ḥ' => 'Ḥ',
  71456. 'ḥ' => 'ḥ',
  71457. 'Ḧ' => 'Ḧ',
  71458. 'ḧ' => 'ḧ',
  71459. 'Ḩ' => 'Ḩ',
  71460. 'ḩ' => 'ḩ',
  71461. 'Ḫ' => 'Ḫ',
  71462. 'ḫ' => 'ḫ',
  71463. 'Ḭ' => 'Ḭ',
  71464. 'ḭ' => 'ḭ',
  71465. '��' => 'Ḯ',
  71466. 'ï�' => 'ḯ',
  71467. 'K�' => 'Ḱ',
  71468. 'k�' => 'ḱ',
  71469. 'Ḳ' => 'Ḳ',
  71470. 'ḳ' => 'ḳ',
  71471. 'Ḵ' => 'Ḵ',
  71472. 'ḵ' => 'ḵ',
  71473. 'Ḷ' => 'Ḷ',
  71474. 'ḷ' => 'ḷ',
  71475. 'Ḹ' => 'Ḹ',
  71476. 'ḹ' => 'ḹ',
  71477. 'Ḻ' => 'Ḻ',
  71478. 'ḻ' => 'ḻ',
  71479. 'Ḽ' => 'Ḽ',
  71480. 'ḽ' => 'ḽ',
  71481. 'M�' => 'Ḿ',
  71482. 'm�' => 'ḿ',
  71483. 'Ṁ' => 'Ṁ',
  71484. 'ṁ' => '�',
  71485. 'Ṃ' => 'Ṃ',
  71486. 'ṃ' => 'ṃ',
  71487. 'Ṅ' => 'Ṅ',
  71488. 'ṅ' => 'ṅ',
  71489. 'Ṇ' => 'Ṇ',
  71490. 'ṇ' => 'ṇ',
  71491. 'Ṉ' => 'Ṉ',
  71492. 'ṉ' => 'ṉ',
  71493. 'Ṋ' => 'Ṋ',
  71494. 'ṋ' => 'ṋ',
  71495. 'Õ�' => 'Ṍ',
  71496. 'õ�' => '�',
  71497. 'Ṏ' => 'Ṏ',
  71498. 'ṏ' => '�',
  71499. 'Ṑ' => '�',
  71500. '�̀' => 'ṑ',
  71501. 'Ō�' => 'Ṓ',
  71502. '��' => 'ṓ',
  71503. 'P�' => 'Ṕ',
  71504. 'p�' => 'ṕ',
  71505. 'Ṗ' => 'Ṗ',
  71506. 'ṗ' => 'ṗ',
  71507. 'Ṙ' => 'Ṙ',
  71508. 'ṙ' => 'ṙ',
  71509. 'Ṛ' => 'Ṛ',
  71510. 'ṛ' => 'ṛ',
  71511. 'Ṝ' => 'Ṝ',
  71512. 'ṝ' => '�',
  71513. 'Ṟ' => 'Ṟ',
  71514. 'ṟ' => 'ṟ',
  71515. 'Ṡ' => 'Ṡ',
  71516. 'ṡ' => 'ṡ',
  71517. 'SÌ£' => 'á¹¢',
  71518. 'ṣ' => 'ṣ',
  71519. 'Ṥ' => 'Ṥ',
  71520. 'ṥ' => 'ṥ',
  71521. 'Ṧ' => 'Ṧ',
  71522. 'ṧ' => 'ṧ',
  71523. 'Ṩ' => 'Ṩ',
  71524. 'ṩ' => 'ṩ',
  71525. 'Ṫ' => 'Ṫ',
  71526. 'ṫ' => 'ṫ',
  71527. 'Ṭ' => 'Ṭ',
  71528. 'ṭ' => 'ṭ',
  71529. 'Ṯ' => 'Ṯ',
  71530. 'ṯ' => 'ṯ',
  71531. 'TÌ­' => 'á¹°',
  71532. 'tÌ­' => 'á¹±',
  71533. 'Ṳ' => 'Ṳ',
  71534. 'ṳ' => 'ṳ',
  71535. 'UÌ°' => 'á¹´',
  71536. 'uÌ°' => 'á¹µ',
  71537. 'Ṷ' => 'Ṷ',
  71538. 'uÌ­' => 'á¹·',
  71539. 'Ũ�' => 'Ṹ',
  71540. 'ũ�' => 'ṹ',
  71541. 'Ṻ' => 'Ṻ',
  71542. 'ṻ' => 'ṻ',
  71543. 'Ṽ' => 'Ṽ',
  71544. 'ṽ' => 'ṽ',
  71545. 'VÌ£' => 'á¹¾',
  71546. 'ṿ' => 'ṿ',
  71547. 'Ẁ' => 'Ẁ',
  71548. 'ẁ' => '�',
  71549. 'W�' => 'Ẃ',
  71550. 'w�' => 'ẃ',
  71551. 'Ẅ' => 'Ẅ',
  71552. 'ẅ' => 'ẅ',
  71553. 'Ẇ' => 'Ẇ',
  71554. 'ẇ' => 'ẇ',
  71555. 'Ẉ' => 'Ẉ',
  71556. 'ẉ' => 'ẉ',
  71557. 'Ẋ' => 'Ẋ',
  71558. 'ẋ' => 'ẋ',
  71559. 'Ẍ' => 'Ẍ',
  71560. 'ẍ' => '�',
  71561. 'Ẏ' => 'Ẏ',
  71562. 'ẏ' => '�',
  71563. 'Ẑ' => '�',
  71564. 'ẑ' => 'ẑ',
  71565. 'Ẓ' => 'Ẓ',
  71566. 'ẓ' => 'ẓ',
  71567. 'Ẕ' => 'Ẕ',
  71568. 'ẕ' => 'ẕ',
  71569. 'ẖ' => 'ẖ',
  71570. 'ẗ' => 'ẗ',
  71571. 'ẘ' => 'ẘ',
  71572. 'ẙ' => 'ẙ',
  71573. 'ẛ' => 'ẛ',
  71574. 'Ạ' => 'Ạ',
  71575. 'ạ' => 'ạ',
  71576. 'Ả' => 'Ả',
  71577. 'ả' => 'ả',
  71578. 'Â�' => 'Ấ',
  71579. 'â�' => 'ấ',
  71580. 'Ầ' => 'Ầ',
  71581. 'ầ' => 'ầ',
  71582. 'Ẩ' => 'Ẩ',
  71583. 'ẩ' => 'ẩ',
  71584. 'Ẫ' => 'Ẫ',
  71585. 'ẫ' => 'ẫ',
  71586. 'Ậ' => 'Ậ',
  71587. 'ậ' => 'ậ',
  71588. 'Ă�' => 'Ắ',
  71589. 'ă�' => 'ắ',
  71590. 'Ằ' => 'Ằ',
  71591. 'ằ' => 'ằ',
  71592. 'Ẳ' => 'Ẳ',
  71593. 'ẳ' => 'ẳ',
  71594. 'Ẵ' => 'Ẵ',
  71595. 'ẵ' => 'ẵ',
  71596. 'Ặ' => 'Ặ',
  71597. 'ặ' => 'ặ',
  71598. 'Ẹ' => 'Ẹ',
  71599. 'ẹ' => 'ẹ',
  71600. 'Ẻ' => 'Ẻ',
  71601. 'ẻ' => 'ẻ',
  71602. 'Ẽ' => 'Ẽ',
  71603. 'ẽ' => 'ẽ',
  71604. 'Ê�' => 'Ế',
  71605. 'ê�' => 'ế',
  71606. 'Ề' => 'Ề',
  71607. 'ề' => '�',
  71608. 'Ể' => 'Ể',
  71609. 'ể' => 'ể',
  71610. 'Ễ' => 'Ễ',
  71611. 'ễ' => 'ễ',
  71612. 'Ệ' => 'Ệ',
  71613. 'ệ' => 'ệ',
  71614. 'Ỉ' => 'Ỉ',
  71615. 'ỉ' => 'ỉ',
  71616. 'Ị' => 'Ị',
  71617. 'ị' => 'ị',
  71618. 'Ọ' => 'Ọ',
  71619. 'ọ' => '�',
  71620. 'Ỏ' => 'Ỏ',
  71621. 'ỏ' => '�',
  71622. 'Ô�' => '�',
  71623. 'ô�' => 'ố',
  71624. 'Ồ' => 'Ồ',
  71625. 'ồ' => 'ồ',
  71626. 'Ổ' => 'Ổ',
  71627. 'ổ' => 'ổ',
  71628. 'Ỗ' => 'Ỗ',
  71629. 'ỗ' => 'ỗ',
  71630. 'Ộ' => 'Ộ',
  71631. '�̂' => 'ộ',
  71632. 'Ơ�' => 'Ớ',
  71633. 'ơ�' => 'ớ',
  71634. 'Ờ' => 'Ờ',
  71635. 'ờ' => '�',
  71636. 'Ở' => 'Ở',
  71637. 'ở' => 'ở',
  71638. 'Ỡ' => 'Ỡ',
  71639. 'ỡ' => 'ỡ',
  71640. 'Ợ' => 'Ợ',
  71641. 'ợ' => 'ợ',
  71642. 'Ụ' => 'Ụ',
  71643. 'ụ' => 'ụ',
  71644. 'Ủ' => 'Ủ',
  71645. 'ủ' => 'ủ',
  71646. 'Ư�' => 'Ứ',
  71647. 'ư�' => 'ứ',
  71648. 'Ừ' => 'Ừ',
  71649. 'ừ' => 'ừ',
  71650. 'Ử' => 'Ử',
  71651. 'ử' => 'ử',
  71652. 'Ữ' => 'Ữ',
  71653. 'ữ' => 'ữ',
  71654. 'Ự' => 'Ự',
  71655. 'Æ°Ì£' => 'á»±',
  71656. 'Ỳ' => 'Ỳ',
  71657. 'ỳ' => 'ỳ',
  71658. 'YÌ£' => 'á»´',
  71659. 'ỵ' => 'ỵ',
  71660. 'Ỷ' => 'Ỷ',
  71661. 'ỷ' => 'ỷ',
  71662. 'Ỹ' => 'Ỹ',
  71663. 'ỹ' => 'ỹ',
  71664. 'ἀ' => 'ἀ',
  71665. 'ἁ' => '�',
  71666. 'ἂ' => 'ἂ',
  71667. '�̀' => 'ἃ',
  71668. 'ἀ�' => 'ἄ',
  71669. '��' => 'ἅ',
  71670. 'ἆ' => 'ἆ',
  71671. '�͂' => 'ἇ',
  71672. 'Ἀ' => 'Ἀ',
  71673. 'Ἁ' => 'Ἁ',
  71674. 'Ἂ' => 'Ἂ',
  71675. 'Ἃ' => 'Ἃ',
  71676. 'Ἀ�' => 'Ἄ',
  71677. 'Ἁ�' => '�',
  71678. 'Ἆ' => 'Ἆ',
  71679. 'Ἇ' => '�',
  71680. 'ἐ' => '�',
  71681. 'ἑ' => 'ἑ',
  71682. '�̀' => 'ἒ',
  71683. 'ἓ' => 'ἓ',
  71684. '��' => 'ἔ',
  71685. 'ἑ�' => 'ἕ',
  71686. 'Ἐ' => 'Ἐ',
  71687. 'Ἑ' => 'Ἑ',
  71688. 'Ἒ' => 'Ἒ',
  71689. 'Ἓ' => 'Ἓ',
  71690. 'Ἐ�' => 'Ἔ',
  71691. 'Ἑ�' => '�',
  71692. 'ἠ' => 'ἠ',
  71693. 'ἡ' => 'ἡ',
  71694. 'ἢ' => 'ἢ',
  71695. 'ἣ' => 'ἣ',
  71696. 'ἠ�' => 'ἤ',
  71697. 'ἡ�' => 'ἥ',
  71698. 'ἦ' => 'ἦ',
  71699. 'ἧ' => 'ἧ',
  71700. 'Ἠ' => 'Ἠ',
  71701. 'Ἡ' => 'Ἡ',
  71702. 'Ἢ' => 'Ἢ',
  71703. 'Ἣ' => 'Ἣ',
  71704. 'Ἠ�' => 'Ἤ',
  71705. 'Ἡ�' => 'Ἥ',
  71706. 'Ἦ' => 'Ἦ',
  71707. 'Ἧ' => 'Ἧ',
  71708. 'ἰ' => 'ἰ',
  71709. 'ἱ' => 'ἱ',
  71710. 'á¼°Ì€' => 'á¼²',
  71711. 'ἳ' => 'ἳ',
  71712. 'ἰ�' => 'ἴ',
  71713. 'ἱ�' => 'ἵ',
  71714. 'ἶ' => 'ἶ',
  71715. 'ἷ' => 'ἷ',
  71716. 'Ἰ' => 'Ἰ',
  71717. 'Ἱ' => 'Ἱ',
  71718. 'Ἲ' => 'Ἲ',
  71719. 'Ἳ' => 'Ἳ',
  71720. 'Ἰ�' => 'Ἴ',
  71721. 'Ἱ�' => 'Ἵ',
  71722. 'Ἶ' => 'Ἶ',
  71723. 'Ἷ' => 'Ἷ',
  71724. 'ὀ' => 'ὀ',
  71725. 'ὁ' => '�',
  71726. 'ὂ' => 'ὂ',
  71727. '�̀' => 'ὃ',
  71728. 'ὀ�' => 'ὄ',
  71729. '��' => 'ὅ',
  71730. 'Ὀ' => 'Ὀ',
  71731. 'Ὁ' => 'Ὁ',
  71732. 'Ὂ' => 'Ὂ',
  71733. 'Ὃ' => 'Ὃ',
  71734. 'Ὀ�' => 'Ὄ',
  71735. 'Ὁ�' => '�',
  71736. 'ὐ' => '�',
  71737. 'ὑ' => 'ὑ',
  71738. '�̀' => 'ὒ',
  71739. 'ὓ' => 'ὓ',
  71740. '��' => 'ὔ',
  71741. 'ὑ�' => 'ὕ',
  71742. '�͂' => 'ὖ',
  71743. 'ὗ' => 'ὗ',
  71744. 'Ὑ' => 'Ὑ',
  71745. 'Ὓ' => 'Ὓ',
  71746. 'Ὑ�' => '�',
  71747. 'Ὗ' => 'Ὗ',
  71748. 'ὠ' => 'ὠ',
  71749. 'ὡ' => 'ὡ',
  71750. 'ὢ' => 'ὢ',
  71751. 'ὣ' => 'ὣ',
  71752. 'ὠ�' => 'ὤ',
  71753. 'ὡ�' => 'ὥ',
  71754. 'ὦ' => 'ὦ',
  71755. 'ὧ' => 'ὧ',
  71756. 'Ὠ' => 'Ὠ',
  71757. 'Ὡ' => 'Ὡ',
  71758. 'Ὢ' => 'Ὢ',
  71759. 'Ὣ' => 'Ὣ',
  71760. 'Ὠ�' => 'Ὤ',
  71761. 'Ὡ�' => 'Ὥ',
  71762. 'Ὦ' => 'Ὦ',
  71763. 'Ὧ' => 'Ὧ',
  71764. 'ὰ' => 'ὰ',
  71765. 'ὲ' => 'ὲ',
  71766. 'ὴ' => 'ὴ',
  71767. 'ὶ' => 'ὶ',
  71768. 'ὸ' => 'ὸ',
  71769. 'ὺ' => 'ὺ',
  71770. 'ὼ' => 'ὼ',
  71771. 'ᾀ' => 'ᾀ',
  71772. '�ͅ' => '�',
  71773. 'ᾂ' => 'ᾂ',
  71774. 'ᾃ' => 'ᾃ',
  71775. 'ᾄ' => 'ᾄ',
  71776. 'á¼…Í…' => 'á¾…',
  71777. 'ᾆ' => 'ᾆ',
  71778. 'ᾇ' => 'ᾇ',
  71779. 'ᾈ' => 'ᾈ',
  71780. 'ᾉ' => 'ᾉ',
  71781. 'ᾊ' => 'ᾊ',
  71782. 'ᾋ' => 'ᾋ',
  71783. 'ᾌ' => 'ᾌ',
  71784. '�ͅ' => '�',
  71785. 'ᾎ' => 'ᾎ',
  71786. '�ͅ' => '�',
  71787. 'ᾐ' => '�',
  71788. 'ᾑ' => 'ᾑ',
  71789. 'ᾒ' => 'ᾒ',
  71790. 'ᾓ' => 'ᾓ',
  71791. 'ᾔ' => 'ᾔ',
  71792. 'ᾕ' => 'ᾕ',
  71793. 'ᾖ' => 'ᾖ',
  71794. 'ᾗ' => 'ᾗ',
  71795. 'ᾘ' => 'ᾘ',
  71796. 'ᾙ' => 'ᾙ',
  71797. 'ᾚ' => 'ᾚ',
  71798. 'ᾛ' => 'ᾛ',
  71799. 'ᾜ' => 'ᾜ',
  71800. 'ᾝ' => '�',
  71801. 'ᾞ' => 'ᾞ',
  71802. 'ᾟ' => 'ᾟ',
  71803. 'á½ Í…' => 'á¾ ',
  71804. 'ᾡ' => 'ᾡ',
  71805. 'ᾢ' => 'ᾢ',
  71806. 'ᾣ' => 'ᾣ',
  71807. 'ᾤ' => 'ᾤ',
  71808. 'ᾥ' => 'ᾥ',
  71809. 'ᾦ' => 'ᾦ',
  71810. 'ᾧ' => 'ᾧ',
  71811. 'ᾨ' => 'ᾨ',
  71812. 'ᾩ' => 'ᾩ',
  71813. 'ᾪ' => 'ᾪ',
  71814. 'ᾫ' => 'ᾫ',
  71815. 'ᾬ' => 'ᾬ',
  71816. 'á½­Í…' => 'á¾­',
  71817. 'ᾮ' => 'ᾮ',
  71818. 'ᾯ' => 'ᾯ',
  71819. 'ᾰ' => 'ᾰ',
  71820. 'ᾱ' => 'ᾱ',
  71821. 'á½°Í…' => 'á¾²',
  71822. 'ᾳ' => 'ᾳ',
  71823. 'ᾴ' => 'ᾴ',
  71824. 'ᾶ' => 'ᾶ',
  71825. 'ᾷ' => 'ᾷ',
  71826. 'Ᾰ' => 'Ᾰ',
  71827. 'Ᾱ' => 'Ᾱ',
  71828. 'Ὰ' => 'Ὰ',
  71829. 'ᾼ' => 'ᾼ',
  71830. '῁' => '�',
  71831. 'á½´Í…' => 'á¿‚',
  71832. 'ῃ' => 'ῃ',
  71833. 'ῄ' => 'ῄ',
  71834. 'ῆ' => 'ῆ',
  71835. 'ῇ' => 'ῇ',
  71836. 'Ὲ' => 'Ὲ',
  71837. 'Ὴ' => 'Ὴ',
  71838. 'ῌ' => 'ῌ',
  71839. '῍' => '�',
  71840. '᾿�' => '῎',
  71841. '῏' => '�',
  71842. 'ῐ' => '�',
  71843. 'ῑ' => 'ῑ',
  71844. 'ÏŠÌ€' => 'á¿’',
  71845. 'ῖ' => 'ῖ',
  71846. 'ÏŠÍ‚' => 'á¿—',
  71847. 'Ῐ' => 'Ῐ',
  71848. 'Ῑ' => 'Ῑ',
  71849. 'Ὶ' => 'Ὶ',
  71850. '῝' => '�',
  71851. '῾�' => '῞',
  71852. '῟' => '῟',
  71853. 'ῠ' => 'ῠ',
  71854. 'Ï…Ì„' => 'á¿¡',
  71855. 'Ï‹Ì€' => 'á¿¢',
  71856. '�̓' => 'ῤ',
  71857. '�̔' => 'ῥ',
  71858. 'ῦ' => 'ῦ',
  71859. 'ῧ' => 'ῧ',
  71860. 'Ῠ' => 'Ῠ',
  71861. 'Ῡ' => 'Ῡ',
  71862. 'Ὺ' => 'Ὺ',
  71863. 'Ῥ' => 'Ῥ',
  71864. '῭' => '῭',
  71865. 'ῲ' => 'ῲ',
  71866. 'ῳ' => 'ῳ',
  71867. 'ÏŽÍ…' => 'á¿´',
  71868. 'ῶ' => 'ῶ',
  71869. 'ῷ' => 'ῷ',
  71870. 'Ὸ' => 'Ὸ',
  71871. 'Ὼ' => 'Ὼ',
  71872. 'ῼ' => 'ῼ',
  71873. '�̸' => '↚',
  71874. '↛' => '↛',
  71875. '↮' => '↮',
  71876. '�̸' => '�',
  71877. '⇎' => '⇎',
  71878. '⇏' => '�',
  71879. '∄' => '∄',
  71880. '∉' => '∉',
  71881. '∌' => '∌',
  71882. '∤' => '∤',
  71883. '∦' => '∦',
  71884. '≁' => '�',
  71885. '≄' => '≄',
  71886. '≇' => '≇',
  71887. '≉' => '≉',
  71888. '≠' => '≠',
  71889. '≢' => '≢',
  71890. '�̸' => '≭',
  71891. '≮' => '≮',
  71892. '≯' => '≯',
  71893. '≰' => '≰',
  71894. '≱' => '≱',
  71895. '≴' => '≴',
  71896. '≵' => '≵',
  71897. '≸' => '≸',
  71898. '≹' => '≹',
  71899. '⊀' => '⊀',
  71900. '⊁' => '�',
  71901. '⊄' => '⊄',
  71902. '⊅' => '⊅',
  71903. '⊈' => '⊈',
  71904. '⊉' => '⊉',
  71905. '⊬' => '⊬',
  71906. '⊭' => '⊭',
  71907. '⊮' => '⊮',
  71908. '⊯' => '⊯',
  71909. '⋠' => '⋠',
  71910. '⋡' => '⋡',
  71911. '⋢' => '⋢',
  71912. '⋣' => '⋣',
  71913. '⋪' => '⋪',
  71914. '⋫' => '⋫',
  71915. '⋬' => '⋬',
  71916. '⋭' => '⋭',
  71917. '�゙' => '�',
  71918. '�゙' => '�',
  71919. '�゙' => '�',
  71920. '�゙' => '�',
  71921. '�゙' => '�',
  71922. '�゙' => '�',
  71923. '�゙' => '�',
  71924. '�゙' => '�',
  71925. '�゙' => '�',
  71926. '�゙' => '�',
  71927. '�゙' => '�',
  71928. '�゙' => '�',
  71929. '�゙' => '�',
  71930. '�゙' => '�',
  71931. '�゙' => '�',
  71932. '�゙' => '�',
  71933. '�゚' => '�',
  71934. '�゙' => '�',
  71935. '�゚' => '�',
  71936. '�゙' => '�',
  71937. '�゚' => '�',
  71938. '�゙' => '�',
  71939. '�゚' => '�',
  71940. '�゙' => '�',
  71941. '�゚' => '�',
  71942. '�゙' => 'ゔ',
  71943. '�゙' => 'ゞ',
  71944. 'ガ' => 'ガ',
  71945. 'ã‚­ã‚™' => 'ã‚®',
  71946. 'グ' => 'グ',
  71947. 'ゲ' => 'ゲ',
  71948. 'ゴ' => 'ゴ',
  71949. 'ザ' => 'ザ',
  71950. 'ジ' => 'ジ',
  71951. 'ズ' => 'ズ',
  71952. 'ゼ' => 'ゼ',
  71953. 'ゾ' => 'ゾ',
  71954. 'ダ' => 'ダ',
  71955. '�゙' => 'ヂ',
  71956. 'ヅ' => 'ヅ',
  71957. 'デ' => 'デ',
  71958. 'ド' => 'ド',
  71959. '�゙' => '�',
  71960. '�゚' => 'パ',
  71961. 'ビ' => 'ビ',
  71962. 'ピ' => 'ピ',
  71963. 'ブ' => 'ブ',
  71964. 'プ' => 'プ',
  71965. 'ベ' => 'ベ',
  71966. 'ペ' => 'ペ',
  71967. 'ボ' => 'ボ',
  71968. 'ポ' => '�',
  71969. 'ヴ' => 'ヴ',
  71970. 'ヷ' => 'ヷ',
  71971. 'ヸ' => 'ヸ',
  71972. 'ヹ' => 'ヹ',
  71973. 'ヺ' => 'ヺ',
  71974. 'ヾ' => 'ヾ',
  71975. '𑂚' => '𑂚',
  71976. '𑂜' => '𑂜',
  71977. '𑂫' => '𑂫',
  71978. '𑄮' => '𑄮',
  71979. '𑄯' => '𑄯',
  71980. '�𑌾' => '�',
  71981. '��' => '�',
  71982. '𑒻' => '𑒻',
  71983. '𑒼' => '𑒼',
  71984. '𑒾' => '𑒾',
  71985. '𑖺' => '𑖺',
  71986. '𑖻' => '𑖻',
  71987. '𑤸' => '𑤸',
  71988. );
  71989. <?php
  71990. return array (
  71991. 'À' => 'À',
  71992. '�' => 'A�',
  71993. 'Â' => 'Â',
  71994. 'Ã' => 'Ã',
  71995. 'Ä' => 'Ä',
  71996. 'Ã…' => 'AÌŠ',
  71997. 'Ç' => 'Ç',
  71998. 'È' => 'È',
  71999. 'É' => 'E�',
  72000. 'Ê' => 'Ê',
  72001. 'Ë' => 'Ë',
  72002. 'Ì' => 'Ì',
  72003. '�' => 'I�',
  72004. 'ÃŽ' => 'IÌ‚',
  72005. '�' => 'Ï',
  72006. 'Ñ' => 'Ñ',
  72007. 'Ã’' => 'OÌ€',
  72008. 'Ó' => 'O�',
  72009. 'Ô' => 'Ô',
  72010. 'Õ' => 'Õ',
  72011. 'Ö' => 'Ö',
  72012. 'Ù' => 'Ù',
  72013. 'Ú' => 'U�',
  72014. 'Û' => 'Û',
  72015. 'Ü' => 'Ü',
  72016. '�' => 'Y�',
  72017. 'à' => 'à',
  72018. 'á' => 'a�',
  72019. 'â' => 'â',
  72020. 'ã' => 'ã',
  72021. 'ä' => 'ä',
  72022. 'Ã¥' => 'aÌŠ',
  72023. 'ç' => 'ç',
  72024. 'è' => 'è',
  72025. 'é' => 'e�',
  72026. 'ê' => 'ê',
  72027. 'ë' => 'ë',
  72028. 'ì' => 'ì',
  72029. 'í' => 'i�',
  72030. 'î' => 'î',
  72031. 'ï' => 'ï',
  72032. 'ñ' => 'ñ',
  72033. 'ò' => 'ò',
  72034. 'ó' => 'o�',
  72035. 'ô' => 'ô',
  72036. 'õ' => 'õ',
  72037. 'ö' => 'ö',
  72038. 'ù' => 'ù',
  72039. 'ú' => 'u�',
  72040. 'û' => 'û',
  72041. 'ü' => 'ü',
  72042. 'ý' => 'y�',
  72043. 'ÿ' => 'ÿ',
  72044. 'Ä€' => 'AÌ„',
  72045. '�' => 'ā',
  72046. 'Ă' => 'Ă',
  72047. 'ă' => 'ă',
  72048. 'Ą' => 'Ą',
  72049. 'ą' => 'ą',
  72050. 'Ć' => 'C�',
  72051. 'ć' => 'c�',
  72052. 'Ĉ' => 'Ĉ',
  72053. 'ĉ' => 'ĉ',
  72054. 'Ċ' => 'Ċ',
  72055. 'ċ' => 'ċ',
  72056. 'Č' => 'Č',
  72057. '�' => 'č',
  72058. 'Ď' => 'Ď',
  72059. '�' => 'ď',
  72060. 'Ä’' => 'EÌ„',
  72061. 'ē' => 'ē',
  72062. 'Ĕ' => 'Ĕ',
  72063. 'ĕ' => 'ĕ',
  72064. 'Ė' => 'Ė',
  72065. 'ė' => 'ė',
  72066. 'Ę' => 'Ę',
  72067. 'ę' => 'ę',
  72068. 'Ě' => 'Ě',
  72069. 'ě' => 'ě',
  72070. 'Ĝ' => 'Ĝ',
  72071. '�' => 'ĝ',
  72072. 'Ğ' => 'Ğ',
  72073. 'ğ' => 'ğ',
  72074. 'Ġ' => 'Ġ',
  72075. 'ġ' => 'ġ',
  72076. 'Ģ' => 'Ģ',
  72077. 'ģ' => 'ģ',
  72078. 'Ĥ' => 'Ĥ',
  72079. 'ĥ' => 'ĥ',
  72080. 'Ĩ' => 'Ĩ',
  72081. 'ĩ' => 'ĩ',
  72082. 'Ī' => 'Ī',
  72083. 'ī' => 'ī',
  72084. 'Ĭ' => 'Ĭ',
  72085. 'ĭ' => 'ĭ',
  72086. 'Į' => 'Į',
  72087. 'į' => 'į',
  72088. 'İ' => 'İ',
  72089. 'Ä´' => 'JÌ‚',
  72090. 'ĵ' => 'ĵ',
  72091. 'Ķ' => 'Ķ',
  72092. 'ķ' => 'ķ',
  72093. 'Ĺ' => 'L�',
  72094. 'ĺ' => 'l�',
  72095. 'Ļ' => 'Ļ',
  72096. 'ļ' => 'ļ',
  72097. 'Ľ' => 'Ľ',
  72098. 'ľ' => 'ľ',
  72099. 'Ń' => 'N�',
  72100. 'ń' => 'n�',
  72101. 'Ņ' => 'Ņ',
  72102. 'ņ' => 'ņ',
  72103. 'Ň' => 'Ň',
  72104. 'ň' => 'ň',
  72105. 'Ō' => 'Ō',
  72106. '�' => 'ō',
  72107. 'Ŏ' => 'Ŏ',
  72108. '�' => 'ŏ',
  72109. '�' => 'Ő',
  72110. 'ő' => 'ő',
  72111. 'Ŕ' => 'R�',
  72112. 'ŕ' => 'r�',
  72113. 'Ŗ' => 'Ŗ',
  72114. 'ŗ' => 'ŗ',
  72115. 'Ř' => 'Ř',
  72116. 'ř' => 'ř',
  72117. 'Ś' => 'S�',
  72118. 'ś' => 's�',
  72119. 'Ŝ' => 'Ŝ',
  72120. '�' => 'ŝ',
  72121. 'Ş' => 'Ş',
  72122. 'ş' => 'ş',
  72123. 'Š' => 'Š',
  72124. 'š' => 'š',
  72125. 'Ţ' => 'Ţ',
  72126. 'ţ' => 'ţ',
  72127. 'Ť' => 'Ť',
  72128. 'ť' => 'ť',
  72129. 'Ũ' => 'Ũ',
  72130. 'ũ' => 'ũ',
  72131. 'Ū' => 'Ū',
  72132. 'ū' => 'ū',
  72133. 'Ŭ' => 'Ŭ',
  72134. 'ŭ' => 'ŭ',
  72135. 'Å®' => 'UÌŠ',
  72136. 'ů' => 'ů',
  72137. 'Å°' => 'UÌ‹',
  72138. 'ű' => 'ű',
  72139. 'Ų' => 'Ų',
  72140. 'ų' => 'ų',
  72141. 'Å´' => 'WÌ‚',
  72142. 'ŵ' => 'ŵ',
  72143. 'Ŷ' => 'Ŷ',
  72144. 'ŷ' => 'ŷ',
  72145. 'Ÿ' => 'Ÿ',
  72146. 'Ź' => 'Z�',
  72147. 'ź' => 'z�',
  72148. 'Ż' => 'Ż',
  72149. 'ż' => 'ż',
  72150. 'Ž' => 'Ž',
  72151. 'ž' => 'ž',
  72152. 'Æ ' => 'OÌ›',
  72153. 'Æ¡' => 'oÌ›',
  72154. 'Ư' => 'Ư',
  72155. 'Æ°' => 'uÌ›',
  72156. '�' => 'Ǎ',
  72157. 'ǎ' => 'ǎ',
  72158. '�' => 'Ǐ',
  72159. '�' => 'ǐ',
  72160. 'Ǒ' => 'Ǒ',
  72161. 'ǒ' => 'ǒ',
  72162. 'Ǔ' => 'Ǔ',
  72163. 'ǔ' => 'ǔ',
  72164. 'Ǖ' => 'Ǖ',
  72165. 'ǖ' => 'ǖ',
  72166. 'Ǘ' => 'Ü�',
  72167. 'ǘ' => 'ü�',
  72168. 'Ǚ' => 'Ǚ',
  72169. 'ǚ' => 'ǚ',
  72170. 'Ǜ' => 'Ǜ',
  72171. 'ǜ' => 'ǜ',
  72172. 'Ǟ' => 'Ǟ',
  72173. 'ǟ' => 'ǟ',
  72174. 'Ǡ' => 'Ǡ',
  72175. 'ǡ' => 'ǡ',
  72176. 'Ǣ' => 'Ǣ',
  72177. 'ǣ' => 'ǣ',
  72178. 'Ǧ' => 'Ǧ',
  72179. 'ǧ' => 'ǧ',
  72180. 'Ǩ' => 'Ǩ',
  72181. 'ǩ' => 'ǩ',
  72182. 'Ǫ' => 'Ǫ',
  72183. 'ǫ' => 'ǫ',
  72184. 'Ǭ' => 'Ǭ',
  72185. 'ǭ' => 'ǭ',
  72186. 'Ǯ' => 'Ǯ',
  72187. 'ǯ' => 'ǯ',
  72188. 'ǰ' => 'ǰ',
  72189. 'Ǵ' => 'G�',
  72190. 'ǵ' => 'g�',
  72191. 'Ǹ' => 'Ǹ',
  72192. 'ǹ' => 'ǹ',
  72193. 'Ǻ' => 'Å�',
  72194. 'ǻ' => 'å�',
  72195. 'Ǽ' => 'Æ�',
  72196. 'ǽ' => 'æ�',
  72197. 'Ǿ' => 'Ø�',
  72198. 'ǿ' => 'ø�',
  72199. 'Ȁ' => 'A�',
  72200. '�' => 'a�',
  72201. 'È‚' => 'AÌ‘',
  72202. 'ȃ' => 'ȃ',
  72203. 'Ȅ' => 'E�',
  72204. 'ȅ' => 'e�',
  72205. 'Ȇ' => 'Ȇ',
  72206. 'ȇ' => 'ȇ',
  72207. 'Ȉ' => 'I�',
  72208. 'ȉ' => 'i�',
  72209. 'ÈŠ' => 'IÌ‘',
  72210. 'ȋ' => 'ȋ',
  72211. 'Ȍ' => 'O�',
  72212. '�' => 'o�',
  72213. 'ÈŽ' => 'OÌ‘',
  72214. '�' => 'ȏ',
  72215. '�' => 'R�',
  72216. 'ȑ' => 'r�',
  72217. 'È’' => 'RÌ‘',
  72218. 'ȓ' => 'ȓ',
  72219. 'Ȕ' => 'U�',
  72220. 'ȕ' => 'u�',
  72221. 'È–' => 'UÌ‘',
  72222. 'ȗ' => 'ȗ',
  72223. 'Ș' => 'Ș',
  72224. 'ș' => 'ș',
  72225. 'Ț' => 'Ț',
  72226. 'ț' => 'ț',
  72227. 'Ȟ' => 'Ȟ',
  72228. 'ȟ' => 'ȟ',
  72229. 'Ȧ' => 'Ȧ',
  72230. 'ȧ' => 'ȧ',
  72231. 'Ȩ' => 'Ȩ',
  72232. 'ȩ' => 'ȩ',
  72233. 'Ȫ' => 'Ȫ',
  72234. 'ȫ' => 'ȫ',
  72235. 'Ȭ' => 'Ȭ',
  72236. 'ȭ' => 'ȭ',
  72237. 'Ȯ' => 'Ȯ',
  72238. 'ȯ' => 'ȯ',
  72239. 'Ȱ' => 'Ȱ',
  72240. 'ȱ' => 'ȱ',
  72241. 'Ȳ' => 'Ȳ',
  72242. 'ȳ' => 'ȳ',
  72243. 'Í€' => 'Ì€',
  72244. '�' => '�',
  72245. '̓' => '̓',
  72246. '̈́' => '̈�',
  72247. 'ʹ' => 'ʹ',
  72248. ';' => ';',
  72249. '΅' => '¨�',
  72250. 'Ά' => 'Α�',
  72251. '·' => '·',
  72252. 'Έ' => 'Ε�',
  72253. 'Ή' => 'Η�',
  72254. 'Ί' => 'Ι�',
  72255. 'Ό' => 'Ο�',
  72256. 'Ύ' => 'Υ�',
  72257. '�' => 'Ω�',
  72258. '�' => 'ϊ�',
  72259. 'Ϊ' => 'Ϊ',
  72260. 'Ϋ' => 'Ϋ',
  72261. 'ά' => 'α�',
  72262. 'έ' => 'ε�',
  72263. 'ή' => 'η�',
  72264. 'ί' => 'ι�',
  72265. 'ΰ' => 'ϋ�',
  72266. 'ϊ' => 'ϊ',
  72267. 'ϋ' => 'ϋ',
  72268. 'ό' => 'ο�',
  72269. '�' => 'υ�',
  72270. 'ώ' => 'ω�',
  72271. 'ϓ' => 'ϒ�',
  72272. 'ϔ' => 'ϔ',
  72273. 'Ѐ' => 'Ѐ',
  72274. '�' => 'Ё',
  72275. 'Ѓ' => 'Г�',
  72276. 'Ї' => 'Ї',
  72277. 'Ќ' => 'К�',
  72278. '�' => 'Ѝ',
  72279. 'Ў' => 'Ў',
  72280. 'Й' => 'Й',
  72281. 'й' => 'й',
  72282. '�' => 'ѐ',
  72283. 'ё' => 'ё',
  72284. 'ѓ' => 'г�',
  72285. 'ї' => 'ї',
  72286. 'ќ' => 'к�',
  72287. '�' => 'ѝ',
  72288. 'ў' => 'ў',
  72289. 'Ѷ' => 'Ѵ�',
  72290. 'ѷ' => 'ѵ�',
  72291. '�' => 'Ӂ',
  72292. 'ӂ' => 'ӂ',
  72293. '�' => '�̆',
  72294. 'ӑ' => 'ӑ',
  72295. 'Ӓ' => '�̈',
  72296. 'ӓ' => 'ӓ',
  72297. 'Ӗ' => 'Ӗ',
  72298. 'ӗ' => 'ӗ',
  72299. 'Ӛ' => 'Ӛ',
  72300. 'ӛ' => 'ӛ',
  72301. 'Ӝ' => 'Ӝ',
  72302. '�' => 'ӝ',
  72303. 'Ӟ' => 'Ӟ',
  72304. 'ӟ' => 'ӟ',
  72305. 'Ӣ' => 'Ӣ',
  72306. 'ӣ' => 'ӣ',
  72307. 'Ӥ' => 'Ӥ',
  72308. 'ӥ' => 'ӥ',
  72309. 'Ӧ' => 'Ӧ',
  72310. 'ӧ' => 'ӧ',
  72311. 'Ӫ' => 'Ӫ',
  72312. 'ӫ' => 'ӫ',
  72313. 'Ӭ' => 'Ӭ',
  72314. 'ӭ' => '�̈',
  72315. 'Ӯ' => 'Ӯ',
  72316. 'ӯ' => 'ӯ',
  72317. 'Ӱ' => 'Ӱ',
  72318. 'ӱ' => 'ӱ',
  72319. 'Ӳ' => 'Ӳ',
  72320. 'ӳ' => 'ӳ',
  72321. 'Ӵ' => 'Ӵ',
  72322. 'ӵ' => 'ӵ',
  72323. 'Ӹ' => 'Ӹ',
  72324. 'ӹ' => 'ӹ',
  72325. 'آ' => 'آ',
  72326. 'أ' => 'أ',
  72327. 'ؤ' => 'ؤ',
  72328. 'إ' => 'إ',
  72329. 'ئ' => 'ئ',
  72330. 'Û€' => 'Û•Ù”',
  72331. 'Û‚' => 'Û�Ù”',
  72332. 'Û“' => 'Û’Ù”',
  72333. 'ऩ' => 'ऩ',
  72334. 'ऱ' => 'ऱ',
  72335. 'ऴ' => 'ऴ',
  72336. 'क़' => 'क़',
  72337. 'ख़' => 'ख़',
  72338. 'ग़' => 'ग़',
  72339. 'ज़' => 'ज़',
  72340. 'ड़' => 'ड़',
  72341. '�' => 'ढ़',
  72342. 'फ़' => 'फ़',
  72343. 'य़' => 'य़',
  72344. 'ো' => 'ো',
  72345. 'ৌ' => 'ৌ',
  72346. 'ড়' => 'ড়',
  72347. '�' => 'ঢ়',
  72348. 'য়' => 'য়',
  72349. 'ਲ਼' => 'ਲ਼',
  72350. 'ਸ਼' => 'ਸ਼',
  72351. 'ਖ਼' => 'ਖ਼',
  72352. 'ਗ਼' => 'ਗ਼',
  72353. 'ਜ਼' => 'ਜ਼',
  72354. 'ਫ਼' => 'ਫ਼',
  72355. 'ୈ' => 'ୈ',
  72356. 'ୋ' => 'ୋ',
  72357. 'ୌ' => 'ୌ',
  72358. 'ଡ଼' => 'ଡ଼',
  72359. '�' => 'ଢ଼',
  72360. 'ஔ' => 'ஔ',
  72361. 'ொ' => 'ொ',
  72362. 'ோ' => 'ோ',
  72363. 'ௌ' => 'ௌ',
  72364. 'ై' => 'ై',
  72365. 'ೀ' => 'ೀ',
  72366. 'ೇ' => 'ೇ',
  72367. 'ೈ' => 'ೈ',
  72368. 'ೊ' => 'ೊ',
  72369. 'ೋ' => 'ೋ',
  72370. 'ൊ' => 'ൊ',
  72371. 'ോ' => 'ോ',
  72372. 'ൌ' => 'ൌ',
  72373. 'ේ' => 'ේ',
  72374. 'ො' => 'ෙ�',
  72375. '�' => 'ෙ�්',
  72376. 'ෞ' => 'ෞ',
  72377. 'གྷ' => 'གྷ',
  72378. '�' => 'ཌྷ',
  72379. 'དྷ' => 'དྷ',
  72380. 'བྷ' => 'བྷ',
  72381. 'ཛྷ' => 'ཛྷ',
  72382. 'ཀྵ' => 'ཀྵ',
  72383. 'ཱི' => 'ཱི',
  72384. 'ཱུ' => 'ཱུ',
  72385. 'ྲྀ' => 'ྲྀ',
  72386. 'ླྀ' => 'ླྀ',
  72387. '�' => 'ཱྀ',
  72388. 'ྒྷ' => 'ྒྷ',
  72389. '�' => 'ྜྷ',
  72390. 'ྡྷ' => 'ྡྷ',
  72391. 'ྦྷ' => 'ྦྷ',
  72392. 'ྫྷ' => 'ྫྷ',
  72393. 'ྐྵ' => '�ྵ',
  72394. 'ဦ' => 'ဦ',
  72395. 'ᬆ' => 'ᬆ',
  72396. 'ᬈ' => 'ᬈ',
  72397. 'ᬊ' => 'ᬊ',
  72398. 'ᬌ' => 'ᬌ',
  72399. 'ᬎ' => '�ᬵ',
  72400. 'ᬒ' => 'ᬒ',
  72401. 'ᬻ' => 'ᬻ',
  72402. 'ᬽ' => 'ᬽ',
  72403. 'ᭀ' => 'ᭀ',
  72404. '�' => 'ᭁ',
  72405. 'ᭃ' => 'ᭃ',
  72406. 'Ḁ' => 'Ḁ',
  72407. '�' => 'ḁ',
  72408. 'Ḃ' => 'Ḃ',
  72409. 'ḃ' => 'ḃ',
  72410. 'Ḅ' => 'Ḅ',
  72411. 'ḅ' => 'ḅ',
  72412. 'Ḇ' => 'Ḇ',
  72413. 'ḇ' => 'ḇ',
  72414. 'Ḉ' => 'Ç�',
  72415. 'ḉ' => 'ç�',
  72416. 'Ḋ' => 'Ḋ',
  72417. 'ḋ' => 'ḋ',
  72418. 'Ḍ' => 'Ḍ',
  72419. '�' => 'ḍ',
  72420. 'Ḏ' => 'Ḏ',
  72421. '�' => 'ḏ',
  72422. '�' => 'Ḑ',
  72423. 'ḑ' => 'ḑ',
  72424. 'Ḓ' => 'Ḓ',
  72425. 'ḓ' => 'ḓ',
  72426. 'Ḕ' => 'Ḕ',
  72427. 'ḕ' => 'ḕ',
  72428. 'Ḗ' => 'Ē�',
  72429. 'ḗ' => 'ē�',
  72430. 'Ḙ' => 'Ḙ',
  72431. 'ḙ' => 'ḙ',
  72432. 'Ḛ' => 'Ḛ',
  72433. 'ḛ' => 'ḛ',
  72434. 'Ḝ' => 'Ḝ',
  72435. '�' => 'ḝ',
  72436. 'Ḟ' => 'Ḟ',
  72437. 'ḟ' => 'ḟ',
  72438. 'Ḡ' => 'Ḡ',
  72439. 'ḡ' => 'ḡ',
  72440. 'Ḣ' => 'Ḣ',
  72441. 'ḣ' => 'ḣ',
  72442. 'Ḥ' => 'Ḥ',
  72443. 'ḥ' => 'ḥ',
  72444. 'Ḧ' => 'Ḧ',
  72445. 'ḧ' => 'ḧ',
  72446. 'Ḩ' => 'Ḩ',
  72447. 'ḩ' => 'ḩ',
  72448. 'Ḫ' => 'Ḫ',
  72449. 'ḫ' => 'ḫ',
  72450. 'Ḭ' => 'Ḭ',
  72451. 'ḭ' => 'ḭ',
  72452. 'Ḯ' => 'Ï�',
  72453. 'ḯ' => 'ï�',
  72454. 'Ḱ' => 'K�',
  72455. 'ḱ' => 'k�',
  72456. 'Ḳ' => 'Ḳ',
  72457. 'ḳ' => 'ḳ',
  72458. 'Ḵ' => 'Ḵ',
  72459. 'ḵ' => 'ḵ',
  72460. 'Ḷ' => 'Ḷ',
  72461. 'ḷ' => 'ḷ',
  72462. 'Ḹ' => 'Ḹ',
  72463. 'ḹ' => 'ḹ',
  72464. 'Ḻ' => 'Ḻ',
  72465. 'ḻ' => 'ḻ',
  72466. 'Ḽ' => 'Ḽ',
  72467. 'ḽ' => 'ḽ',
  72468. 'Ḿ' => 'M�',
  72469. 'ḿ' => 'm�',
  72470. 'Ṁ' => 'Ṁ',
  72471. '�' => 'ṁ',
  72472. 'Ṃ' => 'Ṃ',
  72473. 'ṃ' => 'ṃ',
  72474. 'Ṅ' => 'Ṅ',
  72475. 'ṅ' => 'ṅ',
  72476. 'Ṇ' => 'Ṇ',
  72477. 'ṇ' => 'ṇ',
  72478. 'Ṉ' => 'Ṉ',
  72479. 'ṉ' => 'ṉ',
  72480. 'Ṋ' => 'Ṋ',
  72481. 'ṋ' => 'ṋ',
  72482. 'Ṍ' => 'Õ�',
  72483. '�' => 'õ�',
  72484. 'Ṏ' => 'Ṏ',
  72485. '�' => 'ṏ',
  72486. '�' => 'Ṑ',
  72487. 'ṑ' => 'ṑ',
  72488. 'Ṓ' => 'Ō�',
  72489. 'ṓ' => 'ō�',
  72490. 'Ṕ' => 'P�',
  72491. 'ṕ' => 'p�',
  72492. 'Ṗ' => 'Ṗ',
  72493. 'ṗ' => 'ṗ',
  72494. 'Ṙ' => 'Ṙ',
  72495. 'ṙ' => 'ṙ',
  72496. 'Ṛ' => 'Ṛ',
  72497. 'ṛ' => 'ṛ',
  72498. 'Ṝ' => 'Ṝ',
  72499. '�' => 'ṝ',
  72500. 'Ṟ' => 'Ṟ',
  72501. 'ṟ' => 'ṟ',
  72502. 'Ṡ' => 'Ṡ',
  72503. 'ṡ' => 'ṡ',
  72504. 'á¹¢' => 'SÌ£',
  72505. 'ṣ' => 'ṣ',
  72506. 'Ṥ' => 'S�̇',
  72507. 'ṥ' => 's�̇',
  72508. 'Ṧ' => 'Ṧ',
  72509. 'ṧ' => 'ṧ',
  72510. 'Ṩ' => 'Ṩ',
  72511. 'ṩ' => 'ṩ',
  72512. 'Ṫ' => 'Ṫ',
  72513. 'ṫ' => 'ṫ',
  72514. 'Ṭ' => 'Ṭ',
  72515. 'ṭ' => 'ṭ',
  72516. 'Ṯ' => 'Ṯ',
  72517. 'ṯ' => 'ṯ',
  72518. 'á¹°' => 'TÌ­',
  72519. 'á¹±' => 'tÌ­',
  72520. 'Ṳ' => 'Ṳ',
  72521. 'ṳ' => 'ṳ',
  72522. 'á¹´' => 'UÌ°',
  72523. 'á¹µ' => 'uÌ°',
  72524. 'Ṷ' => 'Ṷ',
  72525. 'á¹·' => 'uÌ­',
  72526. 'Ṹ' => 'Ũ�',
  72527. 'ṹ' => 'ũ�',
  72528. 'Ṻ' => 'Ṻ',
  72529. 'ṻ' => 'ṻ',
  72530. 'Ṽ' => 'Ṽ',
  72531. 'ṽ' => 'ṽ',
  72532. 'á¹¾' => 'VÌ£',
  72533. 'ṿ' => 'ṿ',
  72534. 'Ẁ' => 'Ẁ',
  72535. '�' => 'ẁ',
  72536. 'Ẃ' => 'W�',
  72537. 'ẃ' => 'w�',
  72538. 'Ẅ' => 'Ẅ',
  72539. 'ẅ' => 'ẅ',
  72540. 'Ẇ' => 'Ẇ',
  72541. 'ẇ' => 'ẇ',
  72542. 'Ẉ' => 'Ẉ',
  72543. 'ẉ' => 'ẉ',
  72544. 'Ẋ' => 'Ẋ',
  72545. 'ẋ' => 'ẋ',
  72546. 'Ẍ' => 'Ẍ',
  72547. '�' => 'ẍ',
  72548. 'Ẏ' => 'Ẏ',
  72549. '�' => 'ẏ',
  72550. '�' => 'Ẑ',
  72551. 'ẑ' => 'ẑ',
  72552. 'Ẓ' => 'Ẓ',
  72553. 'ẓ' => 'ẓ',
  72554. 'Ẕ' => 'Ẕ',
  72555. 'ẕ' => 'ẕ',
  72556. 'ẖ' => 'ẖ',
  72557. 'ẗ' => 'ẗ',
  72558. 'ẘ' => 'ẘ',
  72559. 'ẙ' => 'ẙ',
  72560. 'ẛ' => 'ẛ',
  72561. 'Ạ' => 'Ạ',
  72562. 'ạ' => 'ạ',
  72563. 'Ả' => 'Ả',
  72564. 'ả' => 'ả',
  72565. 'Ấ' => 'Â�',
  72566. 'ấ' => 'â�',
  72567. 'Ầ' => 'Ầ',
  72568. 'ầ' => 'ầ',
  72569. 'Ẩ' => 'Ẩ',
  72570. 'ẩ' => 'ẩ',
  72571. 'Ẫ' => 'Ẫ',
  72572. 'ẫ' => 'ẫ',
  72573. 'Ậ' => 'Ậ',
  72574. 'ậ' => 'ậ',
  72575. 'Ắ' => 'Ă�',
  72576. 'ắ' => 'ă�',
  72577. 'Ằ' => 'Ằ',
  72578. 'ằ' => 'ằ',
  72579. 'Ẳ' => 'Ẳ',
  72580. 'ẳ' => 'ẳ',
  72581. 'Ẵ' => 'Ẵ',
  72582. 'ẵ' => 'ẵ',
  72583. 'Ặ' => 'Ặ',
  72584. 'ặ' => 'ặ',
  72585. 'Ẹ' => 'Ẹ',
  72586. 'ẹ' => 'ẹ',
  72587. 'Ẻ' => 'Ẻ',
  72588. 'ẻ' => 'ẻ',
  72589. 'Ẽ' => 'Ẽ',
  72590. 'ẽ' => 'ẽ',
  72591. 'Ế' => 'Ê�',
  72592. 'ế' => 'ê�',
  72593. 'Ề' => 'Ề',
  72594. '�' => 'ề',
  72595. 'Ể' => 'Ể',
  72596. 'ể' => 'ể',
  72597. 'Ễ' => 'Ễ',
  72598. 'ễ' => 'ễ',
  72599. 'Ệ' => 'Ệ',
  72600. 'ệ' => 'ệ',
  72601. 'Ỉ' => 'Ỉ',
  72602. 'ỉ' => 'ỉ',
  72603. 'Ị' => 'Ị',
  72604. 'ị' => 'ị',
  72605. 'Ọ' => 'Ọ',
  72606. '�' => 'ọ',
  72607. 'Ỏ' => 'Ỏ',
  72608. '�' => 'ỏ',
  72609. '�' => 'Ô�',
  72610. 'ố' => 'ô�',
  72611. 'á»’' => 'OÌ‚Ì€',
  72612. 'ồ' => 'ồ',
  72613. 'Ổ' => 'Ổ',
  72614. 'ổ' => 'ổ',
  72615. 'Ỗ' => 'Ỗ',
  72616. 'ỗ' => 'ỗ',
  72617. 'Ộ' => 'Ộ',
  72618. 'ộ' => 'ộ',
  72619. 'Ớ' => 'Ơ�',
  72620. 'ớ' => 'ơ�',
  72621. 'Ờ' => 'Ờ',
  72622. '�' => 'ờ',
  72623. 'Ở' => 'Ở',
  72624. 'ở' => 'ở',
  72625. 'Ỡ' => 'Ỡ',
  72626. 'ỡ' => 'ỡ',
  72627. 'Ợ' => 'Ợ',
  72628. 'ợ' => 'ợ',
  72629. 'Ụ' => 'Ụ',
  72630. 'ụ' => 'ụ',
  72631. 'Ủ' => 'Ủ',
  72632. 'ủ' => 'ủ',
  72633. 'Ứ' => 'Ư�',
  72634. 'ứ' => 'ư�',
  72635. 'Ừ' => 'Ừ',
  72636. 'ừ' => 'ừ',
  72637. 'Ử' => 'Ử',
  72638. 'ử' => 'ử',
  72639. 'Ữ' => 'Ữ',
  72640. 'ữ' => 'ữ',
  72641. 'Ự' => 'Ự',
  72642. 'ự' => 'ự',
  72643. 'Ỳ' => 'Ỳ',
  72644. 'ỳ' => 'ỳ',
  72645. 'á»´' => 'YÌ£',
  72646. 'ỵ' => 'ỵ',
  72647. 'Ỷ' => 'Ỷ',
  72648. 'ỷ' => 'ỷ',
  72649. 'Ỹ' => 'Ỹ',
  72650. 'ỹ' => 'ỹ',
  72651. 'ἀ' => 'ἀ',
  72652. '�' => 'ἁ',
  72653. 'ἂ' => 'ἂ',
  72654. 'ἃ' => 'ἃ',
  72655. 'ἄ' => 'ἀ�',
  72656. 'ἅ' => 'ἁ�',
  72657. 'ἆ' => 'ἆ',
  72658. 'ἇ' => 'ἇ',
  72659. 'Ἀ' => 'Ἀ',
  72660. 'Ἁ' => 'Ἁ',
  72661. 'Ἂ' => 'Ἂ',
  72662. 'Ἃ' => 'Ἃ',
  72663. 'Ἄ' => 'Ἀ�',
  72664. '�' => 'Ἁ�',
  72665. 'Ἆ' => 'Ἆ',
  72666. '�' => 'Ἇ',
  72667. '�' => 'ἐ',
  72668. 'ἑ' => 'ἑ',
  72669. 'ἒ' => 'ἒ',
  72670. 'ἓ' => 'ἓ',
  72671. 'ἔ' => 'ἐ�',
  72672. 'ἕ' => 'ἑ�',
  72673. 'Ἐ' => 'Ἐ',
  72674. 'Ἑ' => 'Ἑ',
  72675. 'Ἒ' => 'Ἒ',
  72676. 'Ἓ' => 'Ἓ',
  72677. 'Ἔ' => 'Ἐ�',
  72678. '�' => 'Ἑ�',
  72679. 'ἠ' => 'ἠ',
  72680. 'ἡ' => 'ἡ',
  72681. 'ἢ' => 'ἢ',
  72682. 'ἣ' => 'ἣ',
  72683. 'ἤ' => 'ἠ�',
  72684. 'ἥ' => 'ἡ�',
  72685. 'ἦ' => 'ἦ',
  72686. 'ἧ' => 'ἧ',
  72687. 'Ἠ' => 'Ἠ',
  72688. 'Ἡ' => 'Ἡ',
  72689. 'Ἢ' => 'Ἢ',
  72690. 'Ἣ' => 'Ἣ',
  72691. 'Ἤ' => 'Ἠ�',
  72692. 'Ἥ' => 'Ἡ�',
  72693. 'Ἦ' => 'Ἦ',
  72694. 'Ἧ' => 'Ἧ',
  72695. 'ἰ' => 'ἰ',
  72696. 'ἱ' => 'ἱ',
  72697. 'ἲ' => 'ἲ',
  72698. 'ἳ' => 'ἳ',
  72699. 'ἴ' => 'ἰ�',
  72700. 'ἵ' => 'ἱ�',
  72701. 'ἶ' => 'ἶ',
  72702. 'ἷ' => 'ἷ',
  72703. 'Ἰ' => 'Ἰ',
  72704. 'Ἱ' => 'Ἱ',
  72705. 'Ἲ' => 'Ἲ',
  72706. 'Ἳ' => 'Ἳ',
  72707. 'Ἴ' => 'Ἰ�',
  72708. 'Ἵ' => 'Ἱ�',
  72709. 'Ἶ' => 'Ἶ',
  72710. 'Ἷ' => 'Ἷ',
  72711. 'ὀ' => 'ὀ',
  72712. '�' => 'ὁ',
  72713. 'ὂ' => 'ὂ',
  72714. 'ὃ' => 'ὃ',
  72715. 'ὄ' => 'ὀ�',
  72716. 'ὅ' => 'ὁ�',
  72717. 'Ὀ' => 'Ὀ',
  72718. 'Ὁ' => 'Ὁ',
  72719. 'Ὂ' => 'Ὂ',
  72720. 'Ὃ' => 'Ὃ',
  72721. 'Ὄ' => 'Ὀ�',
  72722. '�' => 'Ὁ�',
  72723. '�' => 'ὐ',
  72724. 'ὑ' => 'ὑ',
  72725. 'á½’' => 'Ï…Ì“Ì€',
  72726. 'ὓ' => 'ὓ',
  72727. 'ὔ' => 'ὐ�',
  72728. 'ὕ' => 'ὑ�',
  72729. 'á½–' => 'Ï…Ì“Í‚',
  72730. 'ὗ' => 'ὗ',
  72731. 'Ὑ' => 'Ὑ',
  72732. 'Ὓ' => 'Ὓ',
  72733. '�' => 'Ὑ�',
  72734. 'Ὗ' => 'Ὗ',
  72735. 'ὠ' => 'ὠ',
  72736. 'ὡ' => 'ὡ',
  72737. 'ὢ' => 'ὢ',
  72738. 'ὣ' => 'ὣ',
  72739. 'ὤ' => 'ὠ�',
  72740. 'ὥ' => 'ὡ�',
  72741. 'ὦ' => 'ὦ',
  72742. 'ὧ' => 'ὧ',
  72743. 'Ὠ' => 'Ὠ',
  72744. 'Ὡ' => 'Ὡ',
  72745. 'Ὢ' => 'Ὢ',
  72746. 'Ὣ' => 'Ὣ',
  72747. 'Ὤ' => 'Ὠ�',
  72748. 'Ὥ' => 'Ὡ�',
  72749. 'Ὦ' => 'Ὦ',
  72750. 'Ὧ' => 'Ὧ',
  72751. 'ὰ' => 'ὰ',
  72752. 'ά' => 'α�',
  72753. 'ὲ' => 'ὲ',
  72754. 'έ' => 'ε�',
  72755. 'ὴ' => 'ὴ',
  72756. 'ή' => 'η�',
  72757. 'ὶ' => 'ὶ',
  72758. 'ί' => 'ι�',
  72759. 'ὸ' => 'ὸ',
  72760. 'ό' => 'ο�',
  72761. 'ὺ' => 'ὺ',
  72762. 'ύ' => 'υ�',
  72763. 'ὼ' => 'ὼ',
  72764. 'ώ' => 'ω�',
  72765. 'ᾀ' => 'ᾀ',
  72766. '�' => 'ᾁ',
  72767. 'ᾂ' => 'ᾂ',
  72768. 'ᾃ' => 'ᾃ',
  72769. 'ᾄ' => 'ἀ�ͅ',
  72770. 'ᾅ' => 'ἁ�ͅ',
  72771. 'ᾆ' => 'ᾆ',
  72772. 'ᾇ' => 'ᾇ',
  72773. 'ᾈ' => 'ᾈ',
  72774. 'ᾉ' => 'ᾉ',
  72775. 'ᾊ' => 'ᾊ',
  72776. 'ᾋ' => 'ᾋ',
  72777. 'ᾌ' => 'Ἀ�ͅ',
  72778. '�' => 'Ἁ�ͅ',
  72779. 'ᾎ' => 'ᾎ',
  72780. '�' => 'ᾏ',
  72781. '�' => 'ᾐ',
  72782. 'ᾑ' => 'ᾑ',
  72783. 'ᾒ' => 'ᾒ',
  72784. 'ᾓ' => 'ᾓ',
  72785. 'ᾔ' => 'ἠ�ͅ',
  72786. 'ᾕ' => 'ἡ�ͅ',
  72787. 'ᾖ' => 'ᾖ',
  72788. 'ᾗ' => 'ᾗ',
  72789. 'ᾘ' => 'ᾘ',
  72790. 'ᾙ' => 'ᾙ',
  72791. 'ᾚ' => 'ᾚ',
  72792. 'ᾛ' => 'ᾛ',
  72793. 'ᾜ' => 'Ἠ�ͅ',
  72794. '�' => 'Ἡ�ͅ',
  72795. 'ᾞ' => 'ᾞ',
  72796. 'ᾟ' => 'ᾟ',
  72797. 'ᾠ' => 'ᾠ',
  72798. 'ᾡ' => 'ᾡ',
  72799. 'ᾢ' => 'ᾢ',
  72800. 'ᾣ' => 'ᾣ',
  72801. 'ᾤ' => 'ὠ�ͅ',
  72802. 'ᾥ' => 'ὡ�ͅ',
  72803. 'ᾦ' => 'ᾦ',
  72804. 'ᾧ' => 'ᾧ',
  72805. 'ᾨ' => 'ᾨ',
  72806. 'ᾩ' => 'ᾩ',
  72807. 'ᾪ' => 'ᾪ',
  72808. 'ᾫ' => 'ᾫ',
  72809. 'ᾬ' => 'Ὠ�ͅ',
  72810. 'ᾭ' => 'Ὡ�ͅ',
  72811. 'ᾮ' => 'ᾮ',
  72812. 'ᾯ' => 'ᾯ',
  72813. 'ᾰ' => 'ᾰ',
  72814. 'ᾱ' => 'ᾱ',
  72815. 'ᾲ' => 'ᾲ',
  72816. 'ᾳ' => 'ᾳ',
  72817. 'ᾴ' => 'α�ͅ',
  72818. 'ᾶ' => 'ᾶ',
  72819. 'ᾷ' => 'ᾷ',
  72820. 'Ᾰ' => 'Ᾰ',
  72821. 'Ᾱ' => 'Ᾱ',
  72822. 'Ὰ' => 'Ὰ',
  72823. 'Ά' => 'Α�',
  72824. 'ᾼ' => 'ᾼ',
  72825. 'ι' => 'ι',
  72826. '�' => '῁',
  72827. 'ῂ' => 'ῂ',
  72828. 'ῃ' => 'ῃ',
  72829. 'ῄ' => 'η�ͅ',
  72830. 'ῆ' => 'ῆ',
  72831. 'ῇ' => 'ῇ',
  72832. 'Ὲ' => 'Ὲ',
  72833. 'Έ' => 'Ε�',
  72834. 'Ὴ' => 'Ὴ',
  72835. 'Ή' => 'Η�',
  72836. 'ῌ' => 'ῌ',
  72837. '�' => '῍',
  72838. '῎' => '᾿�',
  72839. '�' => '῏',
  72840. '�' => 'ῐ',
  72841. 'ῑ' => 'ῑ',
  72842. 'ῒ' => 'ῒ',
  72843. 'ΐ' => 'ϊ�',
  72844. 'ῖ' => 'ῖ',
  72845. 'ῗ' => 'ῗ',
  72846. 'Ῐ' => 'Ῐ',
  72847. 'Ῑ' => 'Ῑ',
  72848. 'Ὶ' => 'Ὶ',
  72849. 'Ί' => 'Ι�',
  72850. '�' => '῝',
  72851. '῞' => '῾�',
  72852. '῟' => '῟',
  72853. 'ῠ' => 'ῠ',
  72854. 'á¿¡' => 'Ï…Ì„',
  72855. 'ῢ' => 'ῢ',
  72856. 'ΰ' => 'ϋ�',
  72857. 'ῤ' => '�̓',
  72858. 'ῥ' => '�̔',
  72859. 'ῦ' => 'ῦ',
  72860. 'ῧ' => 'ῧ',
  72861. 'Ῠ' => 'Ῠ',
  72862. 'Ῡ' => 'Ῡ',
  72863. 'Ὺ' => 'Ὺ',
  72864. 'Ύ' => 'Υ�',
  72865. 'Ῥ' => 'Ῥ',
  72866. '῭' => '῭',
  72867. '΅' => '¨�',
  72868. '`' => '`',
  72869. 'ῲ' => 'ῲ',
  72870. 'ῳ' => 'ῳ',
  72871. 'ῴ' => 'ω�ͅ',
  72872. 'ῶ' => 'ῶ',
  72873. 'ῷ' => 'ῷ',
  72874. 'Ὸ' => 'Ὸ',
  72875. 'Ό' => 'Ο�',
  72876. 'Ὼ' => 'Ὼ',
  72877. 'Ώ' => 'Ω�',
  72878. 'ῼ' => 'ῼ',
  72879. '´' => '´',
  72880. ' ' => ' ',
  72881. '�' => ' ',
  72882. 'Ω' => 'Ω',
  72883. 'K' => 'K',
  72884. 'â„«' => 'AÌŠ',
  72885. '↚' => '�̸',
  72886. '↛' => '↛',
  72887. '↮' => '↮',
  72888. '�' => '�̸',
  72889. '⇎' => '⇎',
  72890. '�' => '⇏',
  72891. '∄' => '∄',
  72892. '∉' => '∉',
  72893. '∌' => '∌',
  72894. '∤' => '∤',
  72895. '∦' => '∦',
  72896. '�' => '≁',
  72897. '≄' => '≄',
  72898. '≇' => '≇',
  72899. '≉' => '≉',
  72900. '≠' => '≠',
  72901. '≢' => '≢',
  72902. '≭' => '�̸',
  72903. '≮' => '≮',
  72904. '≯' => '≯',
  72905. '≰' => '≰',
  72906. '≱' => '≱',
  72907. '≴' => '≴',
  72908. '≵' => '≵',
  72909. '≸' => '≸',
  72910. '≹' => '≹',
  72911. '⊀' => '⊀',
  72912. '�' => '⊁',
  72913. '⊄' => '⊄',
  72914. '⊅' => '⊅',
  72915. '⊈' => '⊈',
  72916. '⊉' => '⊉',
  72917. '⊬' => '⊬',
  72918. '⊭' => '⊭',
  72919. '⊮' => '⊮',
  72920. '⊯' => '⊯',
  72921. '⋠' => '⋠',
  72922. '⋡' => '⋡',
  72923. '⋢' => '⋢',
  72924. '⋣' => '⋣',
  72925. '⋪' => '⋪',
  72926. '⋫' => '⋫',
  72927. '⋬' => '⋬',
  72928. '⋭' => '⋭',
  72929. '〈' => '〈',
  72930. '〉' => '〉',
  72931. '⫝̸' => '�̸',
  72932. '�' => '�゙',
  72933. '�' => '�゙',
  72934. '�' => '�゙',
  72935. '�' => '�゙',
  72936. '�' => '�゙',
  72937. '�' => '�゙',
  72938. '�' => '�゙',
  72939. '�' => '�゙',
  72940. '�' => '�゙',
  72941. '�' => '�゙',
  72942. '�' => '�゙',
  72943. '�' => '�゙',
  72944. '�' => '�゙',
  72945. '�' => '�゙',
  72946. '�' => '�゙',
  72947. '�' => '�゙',
  72948. '�' => '�゚',
  72949. '�' => '�゙',
  72950. '�' => '�゚',
  72951. '�' => '�゙',
  72952. '�' => '�゚',
  72953. '�' => '�゙',
  72954. '�' => '�゚',
  72955. '�' => '�゙',
  72956. '�' => '�゚',
  72957. 'ゔ' => '�゙',
  72958. 'ゞ' => '�゙',
  72959. 'ガ' => 'ガ',
  72960. 'ã‚®' => 'ã‚­ã‚™',
  72961. 'グ' => 'グ',
  72962. 'ゲ' => 'ゲ',
  72963. 'ゴ' => 'ゴ',
  72964. 'ザ' => 'ザ',
  72965. 'ジ' => 'ジ',
  72966. 'ズ' => 'ズ',
  72967. 'ゼ' => 'ゼ',
  72968. 'ゾ' => 'ゾ',
  72969. 'ダ' => 'ダ',
  72970. 'ヂ' => '�゙',
  72971. 'ヅ' => 'ヅ',
  72972. 'デ' => 'デ',
  72973. 'ド' => 'ド',
  72974. '�' => '�゙',
  72975. 'パ' => '�゚',
  72976. 'ビ' => 'ビ',
  72977. 'ピ' => 'ピ',
  72978. 'ブ' => 'ブ',
  72979. 'プ' => 'プ',
  72980. 'ベ' => 'ベ',
  72981. 'ペ' => 'ペ',
  72982. 'ボ' => 'ボ',
  72983. '�' => 'ポ',
  72984. 'ヴ' => 'ヴ',
  72985. 'ヷ' => 'ヷ',
  72986. 'ヸ' => 'ヸ',
  72987. 'ヹ' => 'ヹ',
  72988. 'ヺ' => 'ヺ',
  72989. 'ヾ' => 'ヾ',
  72990. '豈' => '豈',
  72991. '�' => '更',
  72992. '車' => '車',
  72993. '賈' => '賈',
  72994. '滑' => '滑',
  72995. '串' => '串',
  72996. '句' => '�',
  72997. '龜' => '龜',
  72998. '龜' => '龜',
  72999. '契' => '契',
  73000. '金' => '金',
  73001. '喇' => '喇',
  73002. '奈' => '奈',
  73003. '�' => '懶',
  73004. '癩' => '癩',
  73005. '�' => '羅',
  73006. '�' => '蘿',
  73007. '螺' => '螺',
  73008. '裸' => '裸',
  73009. '邏' => '�',
  73010. '樂' => '樂',
  73011. '洛' => '洛',
  73012. '烙' => '烙',
  73013. '珞' => '�',
  73014. '落' => '�',
  73015. '酪' => '酪',
  73016. '駱' => '駱',
  73017. '亂' => '亂',
  73018. '卵' => '�',
  73019. '�' => '欄',
  73020. '爛' => '爛',
  73021. '蘭' => '蘭',
  73022. '鸞' => '鸞',
  73023. '嵐' => '�',
  73024. '濫' => '濫',
  73025. '藍' => '�',
  73026. '襤' => '襤',
  73027. '拉' => '拉',
  73028. '臘' => '臘',
  73029. '蠟' => '蠟',
  73030. '廊' => '廊',
  73031. '朗' => '朗',
  73032. '浪' => '浪',
  73033. '狼' => '狼',
  73034. '郎' => '郎',
  73035. '來' => '來',
  73036. '冷' => '冷',
  73037. '勞' => '勞',
  73038. '擄' => '擄',
  73039. '櫓' => '櫓',
  73040. '爐' => '�',
  73041. '盧' => '盧',
  73042. '老' => '�',
  73043. '蘆' => '蘆',
  73044. '虜' => '虜',
  73045. '路' => '路',
  73046. '露' => '露',
  73047. '魯' => '魯',
  73048. '鷺' => '鷺',
  73049. '碌' => '碌',
  73050. '祿' => '祿',
  73051. '綠' => '綠',
  73052. '菉' => '�',
  73053. '錄' => '錄',
  73054. '鹿' => '鹿',
  73055. '�' => '論',
  73056. '壟' => '壟',
  73057. '弄' => '弄',
  73058. '籠' => '籠',
  73059. '聾' => '�',
  73060. '牢' => '牢',
  73061. '磊' => '磊',
  73062. '賂' => '賂',
  73063. '雷' => '雷',
  73064. '壘' => '壘',
  73065. '屢' => '屢',
  73066. '樓' => '樓',
  73067. '�' => '淚',
  73068. '漏' => '�',
  73069. '�' => '累',
  73070. '�' => '縷',
  73071. '陋' => '陋',
  73072. '勒' => '勒',
  73073. '肋' => '肋',
  73074. '凜' => '凜',
  73075. '凌' => '凌',
  73076. '稜' => '稜',
  73077. '綾' => '綾',
  73078. '菱' => '�',
  73079. '陵' => '陵',
  73080. '讀' => '讀',
  73081. '拏' => '�',
  73082. '樂' => '樂',
  73083. '�' => '諾',
  73084. '丹' => '丹',
  73085. '寧' => '寧',
  73086. '怒' => '怒',
  73087. '率' => '率',
  73088. '異' => '異',
  73089. '北' => '北',
  73090. '磻' => '磻',
  73091. '便' => '便',
  73092. '復' => '復',
  73093. '不' => '�',
  73094. '泌' => '泌',
  73095. '數' => '數',
  73096. '索' => '索',
  73097. '參' => '�',
  73098. '塞' => '塞',
  73099. '省' => '�',
  73100. '葉' => '葉',
  73101. '說' => '說',
  73102. '殺' => '殺',
  73103. '辰' => '辰',
  73104. '沈' => '沈',
  73105. '拾' => '拾',
  73106. '若' => '若',
  73107. '掠' => '掠',
  73108. '略' => '略',
  73109. '亮' => '亮',
  73110. '兩' => '兩',
  73111. '凉' => '凉',
  73112. '梁' => '�',
  73113. '糧' => '糧',
  73114. '良' => '良',
  73115. '諒' => '諒',
  73116. '量' => '�',
  73117. '勵' => '勵',
  73118. '呂' => '呂',
  73119. '�' => '女',
  73120. '廬' => '廬',
  73121. '旅' => '旅',
  73122. '濾' => '濾',
  73123. '礪' => '礪',
  73124. '閭' => '閭',
  73125. '驪' => '驪',
  73126. '麗' => '麗',
  73127. '黎' => '黎',
  73128. '力' => '力',
  73129. '曆' => '曆',
  73130. '歷' => '歷',
  73131. '�' => '轢',
  73132. '年' => '年',
  73133. '�' => '�',
  73134. '�' => '戀',
  73135. '撚' => '撚',
  73136. '漣' => '漣',
  73137. '煉' => '煉',
  73138. '璉' => '璉',
  73139. '秊' => '秊',
  73140. '練' => '練',
  73141. '聯' => '�',
  73142. '輦' => '輦',
  73143. '蓮' => '蓮',
  73144. '連' => '連',
  73145. '鍊' => '�',
  73146. '列' => '列',
  73147. '�' => '劣',
  73148. '咽' => '咽',
  73149. '烈' => '烈',
  73150. '裂' => '裂',
  73151. '說' => '說',
  73152. '廉' => '廉',
  73153. '念' => '念',
  73154. '捻' => '�',
  73155. '殮' => '殮',
  73156. '簾' => '簾',
  73157. '獵' => '�',
  73158. '令' => '令',
  73159. '囹' => '囹',
  73160. '寧' => '寧',
  73161. '嶺' => '嶺',
  73162. '怜' => '怜',
  73163. '玲' => '玲',
  73164. '瑩' => '瑩',
  73165. '羚' => '羚',
  73166. '聆' => '�',
  73167. '鈴' => '鈴',
  73168. '零' => '零',
  73169. '靈' => '�',
  73170. '領' => '領',
  73171. '例' => '例',
  73172. '禮' => '禮',
  73173. '醴' => '醴',
  73174. '隸' => '隸',
  73175. '惡' => '惡',
  73176. '了' => '了',
  73177. '僚' => '僚',
  73178. '寮' => '寮',
  73179. '尿' => '尿',
  73180. '料' => '料',
  73181. '樂' => '樂',
  73182. '燎' => '燎',
  73183. '�' => '療',
  73184. '蓼' => '蓼',
  73185. '遼' => '�',
  73186. '龍' => '�',
  73187. '暈' => '暈',
  73188. '阮' => '阮',
  73189. '劉' => '劉',
  73190. '杻' => '�',
  73191. '柳' => '柳',
  73192. '流' => '�',
  73193. '溜' => '溜',
  73194. '琉' => '�',
  73195. '�' => '留',
  73196. '硫' => '硫',
  73197. '�' => '�',
  73198. '�' => '類',
  73199. '六' => '六',
  73200. '戮' => '戮',
  73201. '陸' => '陸',
  73202. '倫' => '倫',
  73203. '崙' => '崙',
  73204. '淪' => '淪',
  73205. '輪' => '輪',
  73206. '律' => '律',
  73207. '慄' => '慄',
  73208. '栗' => '栗',
  73209. '率' => '率',
  73210. '隆' => '隆',
  73211. '�' => '利',
  73212. '吏' => '�',
  73213. '履' => '履',
  73214. '易' => '易',
  73215. '李' => '�',
  73216. '梨' => '梨',
  73217. '泥' => '泥',
  73218. '理' => '�',
  73219. '痢' => '痢',
  73220. '罹' => '罹',
  73221. '裏' => '�',
  73222. '裡' => '裡',
  73223. '里' => '里',
  73224. '離' => '離',
  73225. '匿' => '匿',
  73226. '溺' => '溺',
  73227. '吝' => '�',
  73228. '燐' => '�',
  73229. '璘' => '璘',
  73230. '藺' => '藺',
  73231. '隣' => '隣',
  73232. '鱗' => '鱗',
  73233. '麟' => '麟',
  73234. '林' => '林',
  73235. '淋' => '淋',
  73236. '臨' => '臨',
  73237. '立' => '立',
  73238. '笠' => '笠',
  73239. '粒' => '粒',
  73240. '狀' => '狀',
  73241. '炙' => '炙',
  73242. '識' => '識',
  73243. '什' => '什',
  73244. '茶' => '茶',
  73245. '刺' => '刺',
  73246. '切' => '切',
  73247. '�' => '度',
  73248. '拓' => '拓',
  73249. '糖' => '糖',
  73250. '宅' => '宅',
  73251. '洞' => '洞',
  73252. '暴' => '暴',
  73253. '輻' => '輻',
  73254. '行' => '行',
  73255. '降' => '�',
  73256. '見' => '見',
  73257. '廓' => '廓',
  73258. '兀' => '兀',
  73259. '�' => '嗀',
  73260. '�' => '塚',
  73261. '晴' => '晴',
  73262. '凞' => '凞',
  73263. '猪' => '猪',
  73264. '益' => '益',
  73265. '礼' => '礼',
  73266. '神' => '神',
  73267. '祥' => '祥',
  73268. '福' => '�',
  73269. '靖' => '�',
  73270. '�' => '精',
  73271. '羽' => '羽',
  73272. '蘒' => '蘒',
  73273. '諸' => '諸',
  73274. '逸' => '逸',
  73275. '都' => '都',
  73276. '飯' => '飯',
  73277. '飼' => '飼',
  73278. '館' => '館',
  73279. '鶴' => '鶴',
  73280. '郞' => '郞',
  73281. '隷' => '隷',
  73282. '侮' => '侮',
  73283. '僧' => '僧',
  73284. '免' => '�',
  73285. '勉' => '勉',
  73286. '勤' => '勤',
  73287. '卑' => '�',
  73288. '喝' => '�',
  73289. '嘆' => '嘆',
  73290. '器' => '器',
  73291. '塀' => '塀',
  73292. '墨' => '墨',
  73293. '層' => '層',
  73294. '屮' => '屮',
  73295. '悔' => '悔',
  73296. '慨' => '慨',
  73297. '憎' => '憎',
  73298. '懲' => '懲',
  73299. '�' => '�',
  73300. 'ï©‚' => 'æ—¢',
  73301. '暑' => '暑',
  73302. '梅' => '梅',
  73303. 'ï©…' => 'æµ·',
  73304. '渚' => '渚',
  73305. '漢' => '漢',
  73306. '煮' => '煮',
  73307. '爫' => '爫',
  73308. '琢' => '�',
  73309. '碑' => '碑',
  73310. '社' => '社',
  73311. '�' => '祉',
  73312. '祈' => '祈',
  73313. '�' => '�',
  73314. '�' => '祖',
  73315. '祝' => '�',
  73316. '禍' => '�',
  73317. '禎' => '禎',
  73318. 'ï©”' => 'ç©€',
  73319. '突' => '�',
  73320. '節' => '節',
  73321. 'ï©—' => 'ç·´',
  73322. '縉' => '縉',
  73323. '繁' => '�',
  73324. 'ï©š' => 'ç½²',
  73325. '者' => '者',
  73326. '臭' => '臭',
  73327. '�' => '艹',
  73328. '艹' => '艹',
  73329. 'ï©Ÿ' => 'è‘—',
  73330. '褐' => '�',
  73331. '視' => '視',
  73332. '謁' => '�',
  73333. '謹' => '謹',
  73334. '賓' => '賓',
  73335. 'ï©¥' => 'è´ˆ',
  73336. '辶' => '辶',
  73337. '逸' => '逸',
  73338. '難' => '難',
  73339. '響' => '響',
  73340. '頻' => '頻',
  73341. '恵' => '�',
  73342. '𤋮' => '𤋮',
  73343. '舘' => '舘',
  73344. '並' => '並',
  73345. '况' => '况',
  73346. '全' => '全',
  73347. '侀' => '侀',
  73348. 'ï©´' => 'å……',
  73349. '冀' => '冀',
  73350. '勇' => '勇',
  73351. '勺' => '勺',
  73352. '喝' => '�',
  73353. '啕' => '啕',
  73354. '喙' => '喙',
  73355. 'ï©»' => 'å—¢',
  73356. '塚' => '塚',
  73357. '墳' => '墳',
  73358. '奄' => '奄',
  73359. '奔' => '奔',
  73360. '婢' => '婢',
  73361. '�' => '嬨',
  73362. '廒' => '廒',
  73363. '廙' => '廙',
  73364. '彩' => '彩',
  73365. '徭' => '徭',
  73366. '惘' => '惘',
  73367. '慎' => '慎',
  73368. '愈' => '愈',
  73369. '憎' => '憎',
  73370. '慠' => '慠',
  73371. '懲' => '懲',
  73372. '戴' => '戴',
  73373. '�' => '�',
  73374. '搜' => '�',
  73375. '�' => '摒',
  73376. '�' => '敖',
  73377. '晴' => '晴',
  73378. '朗' => '朗',
  73379. '望' => '望',
  73380. '杖' => '�',
  73381. '歹' => '歹',
  73382. '殺' => '殺',
  73383. '流' => '�',
  73384. '滛' => '滛',
  73385. '滋' => '滋',
  73386. '漢' => '漢',
  73387. '瀞' => '瀞',
  73388. '煮' => '煮',
  73389. '�' => '瞧',
  73390. '爵' => '爵',
  73391. '犯' => '犯',
  73392. '猪' => '猪',
  73393. '瑱' => '瑱',
  73394. '甆' => '甆',
  73395. '画' => '画',
  73396. '瘝' => '�',
  73397. '瘟' => '瘟',
  73398. '益' => '益',
  73399. '盛' => '盛',
  73400. '直' => '直',
  73401. '睊' => '�',
  73402. '着' => '�',
  73403. '磌' => '磌',
  73404. '窱' => '窱',
  73405. '節' => '節',
  73406. '类' => '类',
  73407. '絛' => '絛',
  73408. '練' => '練',
  73409. '缾' => '缾',
  73410. '者' => '者',
  73411. '荒' => '�',
  73412. '華' => '�',
  73413. '蝹' => '�',
  73414. '襁' => '�',
  73415. '覆' => '覆',
  73416. '視' => '視',
  73417. '調' => '調',
  73418. '諸' => '諸',
  73419. '請' => '請',
  73420. '謁' => '�',
  73421. '諾' => '諾',
  73422. '諭' => '諭',
  73423. '謹' => '謹',
  73424. '變' => '變',
  73425. '�' => '贈',
  73426. '輸' => '輸',
  73427. '遲' => '�',
  73428. '醙' => '醙',
  73429. '鉶' => '鉶',
  73430. '陼' => '陼',
  73431. '難' => '難',
  73432. '靖' => '�',
  73433. '韛' => '韛',
  73434. '響' => '響',
  73435. 'ï«‹' => 'é ‹',
  73436. '頻' => '頻',
  73437. '�' => '鬒',
  73438. '龜' => '龜',
  73439. '�' => '𢡊',
  73440. '�' => '𢡄',
  73441. '𣏕' => '�',
  73442. '㮝' => '�',
  73443. '䀘' => '䀘',
  73444. '䀹' => '䀹',
  73445. '𥉉' => '𥉉',
  73446. '𥳐' => '�',
  73447. '𧻓' => '𧻓',
  73448. '齃' => '齃',
  73449. '龎' => '龎',
  73450. '�' => 'יִ',
  73451. 'ײַ' => 'ײַ',
  73452. 'שׁ' => 'ש�',
  73453. 'שׂ' => 'שׂ',
  73454. 'שּׁ' => 'שּ�',
  73455. 'שּׂ' => 'שּׂ',
  73456. 'אַ' => '�ַ',
  73457. 'אָ' => '�ָ',
  73458. 'אּ' => '�ּ',
  73459. 'בּ' => 'בּ',
  73460. 'גּ' => 'גּ',
  73461. 'דּ' => 'דּ',
  73462. 'הּ' => 'הּ',
  73463. 'וּ' => 'וּ',
  73464. 'זּ' => 'זּ',
  73465. 'טּ' => 'טּ',
  73466. 'יּ' => 'יּ',
  73467. 'ךּ' => 'ךּ',
  73468. 'כּ' => 'כּ',
  73469. 'לּ' => 'לּ',
  73470. 'מּ' => 'מּ',
  73471. 'ï­€' => '× Ö¼',
  73472. '�' => 'סּ',
  73473. 'ï­ƒ' => '×£Ö¼',
  73474. 'פּ' => 'פּ',
  73475. 'צּ' => 'צּ',
  73476. 'קּ' => 'קּ',
  73477. 'רּ' => 'רּ',
  73478. 'שּ' => 'שּ',
  73479. 'תּ' => 'תּ',
  73480. 'וֹ' => 'וֹ',
  73481. 'בֿ' => 'בֿ',
  73482. 'ï­�' => '×›Ö¿',
  73483. 'פֿ' => 'פֿ',
  73484. '𑂚' => '𑂚',
  73485. '𑂜' => '𑂜',
  73486. '𑂫' => '𑂫',
  73487. '𑄮' => '𑄮',
  73488. '𑄯' => '𑄯',
  73489. '�' => '�𑌾',
  73490. '�' => '��',
  73491. '𑒻' => '𑒻',
  73492. '𑒼' => '𑒼',
  73493. '𑒾' => '𑒾',
  73494. '𑖺' => '𑖺',
  73495. '𑖻' => '𑖻',
  73496. '𑤸' => '𑤸',
  73497. '�' => '��',
  73498. '�' => '��',
  73499. '�' => '���',
  73500. '�' => '���',
  73501. '�' => '���',
  73502. '�' => '���',
  73503. '�' => '���',
  73504. '�' => '��',
  73505. '�' => '��',
  73506. '�' => '���',
  73507. '�' => '���',
  73508. '�' => '���',
  73509. '�' => '���',
  73510. '丽' => '丽',
  73511. '�' => '丸',
  73512. '乁' => '�',
  73513. '𠄢' => '𠄢',
  73514. '你' => '你',
  73515. '侮' => '侮',
  73516. '侻' => '侻',
  73517. '倂' => '倂',
  73518. '偺' => '�',
  73519. '備' => '備',
  73520. '僧' => '僧',
  73521. '像' => '�',
  73522. '㒞' => '㒞',
  73523. '�' => '𠘺',
  73524. '免' => '�',
  73525. '�' => '兔',
  73526. '�' => '兤',
  73527. '具' => '具',
  73528. '𠔜' => '𠔜',
  73529. '㒹' => '㒹',
  73530. '內' => '內',
  73531. '再' => '�',
  73532. '𠕋' => '𠕋',
  73533. '冗' => '冗',
  73534. '冤' => '冤',
  73535. '仌' => '仌',
  73536. '冬' => '冬',
  73537. '况' => '况',
  73538. '𩇟' => '𩇟',
  73539. '�' => '凵',
  73540. '刃' => '刃',
  73541. '㓟' => '㓟',
  73542. '刻' => '刻',
  73543. '剆' => '剆',
  73544. '割' => '割',
  73545. '剷' => '剷',
  73546. '㔕' => '㔕',
  73547. '勇' => '勇',
  73548. '勉' => '勉',
  73549. '勤' => '勤',
  73550. '勺' => '勺',
  73551. '包' => '包',
  73552. '匆' => '匆',
  73553. '北' => '北',
  73554. '卉' => '�',
  73555. '卑' => '�',
  73556. '博' => '�',
  73557. '即' => '�',
  73558. '卽' => '�',
  73559. '卿' => '�',
  73560. '卿' => '�',
  73561. '卿' => '�',
  73562. '𠨬' => '𠨬',
  73563. '灰' => '�',
  73564. '及' => '�',
  73565. '叟' => '�',
  73566. '𠭣' => '𠭣',
  73567. '叫' => '�',
  73568. '叱' => '�',
  73569. '吆' => '�',
  73570. '咞' => '咞',
  73571. '吸' => '�',
  73572. '呈' => '呈',
  73573. '周' => '周',
  73574. '咢' => '咢',
  73575. '�' => '哶',
  73576. '唐' => '�',
  73577. '啓' => '啓',
  73578. '啣' => '啣',
  73579. '善' => '善',
  73580. '善' => '善',
  73581. '喙' => '喙',
  73582. '喫' => '喫',
  73583. '喳' => '喳',
  73584. '嗂' => '嗂',
  73585. '圖' => '圖',
  73586. '嘆' => '嘆',
  73587. '�' => '圗',
  73588. '噑' => '噑',
  73589. '�' => '噴',
  73590. '�' => '切',
  73591. '壮' => '壮',
  73592. '城' => '城',
  73593. '埴' => '埴',
  73594. '堍' => '�',
  73595. '型' => '型',
  73596. '堲' => '堲',
  73597. '報' => '報',
  73598. '墬' => '墬',
  73599. '𡓤' => '𡓤',
  73600. '売' => '売',
  73601. '壷' => '壷',
  73602. '夆' => '夆',
  73603. '�' => '多',
  73604. '夢' => '夢',
  73605. '奢' => '奢',
  73606. '𡚨' => '𡚨',
  73607. '𡛪' => '𡛪',
  73608. '姬' => '姬',
  73609. '娛' => '娛',
  73610. '娧' => '娧',
  73611. '姘' => '姘',
  73612. '婦' => '婦',
  73613. '㛮' => '㛮',
  73614. '㛼' => '㛼',
  73615. '嬈' => '嬈',
  73616. '嬾' => '嬾',
  73617. '嬾' => '嬾',
  73618. '𡧈' => '𡧈',
  73619. '寃' => '寃',
  73620. '寘' => '寘',
  73621. '寧' => '寧',
  73622. '寳' => '寳',
  73623. '𡬘' => '𡬘',
  73624. '寿' => '寿',
  73625. '将' => '将',
  73626. '当' => '当',
  73627. '尢' => '尢',
  73628. '㞁' => '�',
  73629. '屠' => '屠',
  73630. '屮' => '屮',
  73631. '峀' => '峀',
  73632. '岍' => '�',
  73633. '𡷤' => '𡷤',
  73634. '嵃' => '嵃',
  73635. '𡷦' => '𡷦',
  73636. '嵮' => '嵮',
  73637. '嵫' => '嵫',
  73638. '嵼' => '嵼',
  73639. '�' => '巡',
  73640. '巢' => '巢',
  73641. '㠯' => '㠯',
  73642. '巽' => '巽',
  73643. '帨' => '帨',
  73644. '帽' => '帽',
  73645. '幩' => '幩',
  73646. '㡢' => '㡢',
  73647. '𢆃' => '𢆃',
  73648. '㡼' => '㡼',
  73649. '庰' => '庰',
  73650. '庳' => '庳',
  73651. '�' => '庶',
  73652. '廊' => '廊',
  73653. '�' => '𪎒',
  73654. '�' => '廾',
  73655. '𢌱' => '𢌱',
  73656. '𢌱' => '𢌱',
  73657. '舁' => '�',
  73658. '弢' => '弢',
  73659. '弢' => '弢',
  73660. '㣇' => '㣇',
  73661. '𣊸' => '𣊸',
  73662. '𦇚' => '𦇚',
  73663. '形' => '形',
  73664. '彫' => '彫',
  73665. '㣣' => '㣣',
  73666. '徚' => '徚',
  73667. '�' => '�',
  73668. '志' => '志',
  73669. '忹' => '忹',
  73670. '悁' => '�',
  73671. '㤺' => '㤺',
  73672. '㤜' => '㤜',
  73673. '悔' => '悔',
  73674. '𢛔' => '𢛔',
  73675. '惇' => '惇',
  73676. '慈' => '慈',
  73677. '慌' => '慌',
  73678. '慎' => '慎',
  73679. '慌' => '慌',
  73680. '慺' => '慺',
  73681. '憎' => '憎',
  73682. '憲' => '憲',
  73683. '憤' => '憤',
  73684. '憯' => '憯',
  73685. '懞' => '懞',
  73686. '懲' => '懲',
  73687. '懶' => '懶',
  73688. '成' => '�',
  73689. '戛' => '戛',
  73690. '扝' => '�',
  73691. '抱' => '抱',
  73692. '拔' => '拔',
  73693. '捐' => '�',
  73694. '𢬌' => '𢬌',
  73695. '挽' => '挽',
  73696. '拼' => '拼',
  73697. '捨' => '�',
  73698. '掃' => '掃',
  73699. '揤' => '�',
  73700. '𢯱' => '𢯱',
  73701. '搢' => '�',
  73702. '揅' => '�',
  73703. '�' => '掩',
  73704. '㨮' => '㨮',
  73705. '摩' => '摩',
  73706. '摾' => '摾',
  73707. '撝' => '�',
  73708. '摷' => '摷',
  73709. '㩬' => '㩬',
  73710. '敏' => '�',
  73711. '敬' => '敬',
  73712. '𣀊' => '𣀊',
  73713. '旣' => '旣',
  73714. '書' => '書',
  73715. '�' => '晉',
  73716. '㬙' => '㬙',
  73717. '�' => '暑',
  73718. '�' => '㬈',
  73719. '㫤' => '㫤',
  73720. '冒' => '冒',
  73721. '冕' => '冕',
  73722. '最' => '最',
  73723. '暜' => '暜',
  73724. '肭' => '肭',
  73725. '䏙' => '�',
  73726. '朗' => '朗',
  73727. '望' => '望',
  73728. '朡' => '朡',
  73729. '杞' => '�',
  73730. '杓' => '�',
  73731. '�' => '�',
  73732. '㭉' => '㭉',
  73733. '柺' => '柺',
  73734. '枅' => '枅',
  73735. '桒' => '桒',
  73736. '梅' => '梅',
  73737. '𣑭' => '𣑭',
  73738. '梎' => '梎',
  73739. '栟' => '栟',
  73740. '椔' => '椔',
  73741. '㮝' => '�',
  73742. '楂' => '楂',
  73743. '榣' => '榣',
  73744. '槪' => '槪',
  73745. '檨' => '檨',
  73746. '𣚣' => '𣚣',
  73747. '櫛' => '櫛',
  73748. '㰘' => '㰘',
  73749. '次' => '次',
  73750. '𣢧' => '𣢧',
  73751. '歔' => '歔',
  73752. '㱎' => '㱎',
  73753. '歲' => '歲',
  73754. '殟' => '殟',
  73755. '殺' => '殺',
  73756. '殻' => '殻',
  73757. '𣪍' => '�',
  73758. '𡴋' => '𡴋',
  73759. '𣫺' => '𣫺',
  73760. '汎' => '汎',
  73761. '𣲼' => '𣲼',
  73762. '沿' => '沿',
  73763. '泍' => '�',
  73764. '汧' => '汧',
  73765. '洖' => '洖',
  73766. '派' => '派',
  73767. '�' => '海',
  73768. '流' => '�',
  73769. '浩' => '浩',
  73770. '浸' => '浸',
  73771. '涅' => '涅',
  73772. '𣴞' => '𣴞',
  73773. '洴' => '洴',
  73774. '港' => '港',
  73775. '湮' => '湮',
  73776. '㴳' => '㴳',
  73777. '滋' => '滋',
  73778. '滇' => '滇',
  73779. '�' => '𣻑',
  73780. '淹' => '淹',
  73781. '�' => '潮',
  73782. '�' => '𣽞',
  73783. '𣾎' => '𣾎',
  73784. '濆' => '濆',
  73785. '瀹' => '瀹',
  73786. '瀞' => '瀞',
  73787. '瀛' => '瀛',
  73788. '㶖' => '㶖',
  73789. '灊' => '�',
  73790. '災' => '�',
  73791. '灷' => '�',
  73792. '炭' => '炭',
  73793. '𠔥' => '𠔥',
  73794. '煅' => '煅',
  73795. '�' => '𤉣',
  73796. '熜' => '熜',
  73797. '𤎫' => '𤎫',
  73798. '爨' => '爨',
  73799. '爵' => '爵',
  73800. '牐' => '�',
  73801. '𤘈' => '𤘈',
  73802. '犀' => '犀',
  73803. '犕' => '犕',
  73804. '𤜵' => '𤜵',
  73805. '𤠔' => '𤠔',
  73806. '獺' => '�',
  73807. '王' => '王',
  73808. '㺬' => '㺬',
  73809. '玥' => '玥',
  73810. '㺸' => '㺸',
  73811. '㺸' => '㺸',
  73812. '瑇' => '瑇',
  73813. '瑜' => '瑜',
  73814. '瑱' => '瑱',
  73815. '璅' => '璅',
  73816. '瓊' => '瓊',
  73817. '㼛' => '㼛',
  73818. '甤' => '甤',
  73819. '𤰶' => '𤰶',
  73820. '甾' => '甾',
  73821. '𤲒' => '𤲒',
  73822. '異' => '異',
  73823. '𢆟' => '𢆟',
  73824. '瘐' => '�',
  73825. '𤾡' => '𤾡',
  73826. '𤾸' => '𤾸',
  73827. '𥁄' => '�',
  73828. '㿼' => '㿼',
  73829. '䀈' => '䀈',
  73830. '直' => '直',
  73831. '�' => '𥃳',
  73832. '𥃲' => '𥃲',
  73833. '𥄙' => '𥄙',
  73834. '𥄳' => '𥄳',
  73835. '眞' => '眞',
  73836. '真' => '真',
  73837. '真' => '真',
  73838. '睊' => '�',
  73839. '䀹' => '䀹',
  73840. '瞋' => '瞋',
  73841. '䁆' => '�',
  73842. '䂖' => '䂖',
  73843. '�' => '�',
  73844. '硎' => '硎',
  73845. '�' => '碌',
  73846. '�' => '磌',
  73847. '䃣' => '䃣',
  73848. '𥘦' => '𥘦',
  73849. '祖' => '祖',
  73850. '𥚚' => '𥚚',
  73851. '𥛅' => '𥛅',
  73852. '福' => '�',
  73853. '秫' => '秫',
  73854. '䄯' => '䄯',
  73855. '穀' => '穀',
  73856. '穊' => '穊',
  73857. '穏' => '�',
  73858. '𥥼' => '𥥼',
  73859. '�' => '𥪧',
  73860. '𥪧' => '𥪧',
  73861. '竮' => '竮',
  73862. '䈂' => '䈂',
  73863. '𥮫' => '𥮫',
  73864. '篆' => '篆',
  73865. '築' => '築',
  73866. '䈧' => '䈧',
  73867. '𥲀' => '𥲀',
  73868. '糒' => '糒',
  73869. '䊠' => '䊠',
  73870. '糨' => '糨',
  73871. '糣' => '糣',
  73872. '紀' => '紀',
  73873. '𥾆' => '𥾆',
  73874. '絣' => '絣',
  73875. '䌁' => '�',
  73876. '緇' => '緇',
  73877. '縂' => '縂',
  73878. '繅' => '繅',
  73879. '䌴' => '䌴',
  73880. '𦈨' => '𦈨',
  73881. '𦉇' => '𦉇',
  73882. '䍙' => '�',
  73883. '𦋙' => '𦋙',
  73884. '罺' => '罺',
  73885. '𦌾' => '𦌾',
  73886. '羕' => '羕',
  73887. '翺' => '翺',
  73888. '者' => '者',
  73889. '𦓚' => '𦓚',
  73890. '𦔣' => '𦔣',
  73891. '聠' => '�',
  73892. '𦖨' => '𦖨',
  73893. '聰' => '�',
  73894. '𣍟' => '�',
  73895. '�' => '�',
  73896. '育' => '育',
  73897. '脃' => '脃',
  73898. '䐋' => '�',
  73899. '脾' => '脾',
  73900. '媵' => '媵',
  73901. '𦞧' => '𦞧',
  73902. '𦞵' => '𦞵',
  73903. '𣎓' => '𣎓',
  73904. '𣎜' => '𣎜',
  73905. '舁' => '�',
  73906. '舄' => '舄',
  73907. '�' => '辞',
  73908. '䑫' => '䑫',
  73909. '�' => '芑',
  73910. '�' => '芋',
  73911. '芝' => '�',
  73912. '劳' => '劳',
  73913. '花' => '花',
  73914. '芳' => '芳',
  73915. '芽' => '芽',
  73916. '苦' => '苦',
  73917. '𦬼' => '𦬼',
  73918. '若' => '若',
  73919. '茝' => '�',
  73920. '荣' => '�',
  73921. '莭' => '莭',
  73922. '茣' => '茣',
  73923. '�' => '莽',
  73924. '菧' => '�',
  73925. '著' => '著',
  73926. '荓' => '�',
  73927. '菊' => '�',
  73928. '菌' => '�',
  73929. '菜' => '�',
  73930. '𦰶' => '𦰶',
  73931. '𦵫' => '𦵫',
  73932. '𦳕' => '𦳕',
  73933. '䔫' => '䔫',
  73934. '蓱' => '蓱',
  73935. '蓳' => '蓳',
  73936. '蔖' => '蔖',
  73937. '𧏊' => '�',
  73938. '蕤' => '蕤',
  73939. '𦼬' => '𦼬',
  73940. '䕝' => '�',
  73941. '䕡' => '䕡',
  73942. '𦾱' => '𦾱',
  73943. '𧃒' => '𧃒',
  73944. '䕫' => '䕫',
  73945. '虐' => '�',
  73946. '虜' => '虜',
  73947. '虧' => '虧',
  73948. '虩' => '虩',
  73949. '蚩' => '蚩',
  73950. '蚈' => '蚈',
  73951. '蜎' => '蜎',
  73952. '蛢' => '蛢',
  73953. '蝹' => '�',
  73954. '蜨' => '蜨',
  73955. '蝫' => '�',
  73956. '螆' => '螆',
  73957. '䗗' => '䗗',
  73958. '蟡' => '蟡',
  73959. '�' => '�',
  73960. '䗹' => '䗹',
  73961. '衠' => '衠',
  73962. '衣' => '衣',
  73963. '𧙧' => '𧙧',
  73964. '裗' => '裗',
  73965. '裞' => '裞',
  73966. '䘵' => '䘵',
  73967. '裺' => '裺',
  73968. '㒻' => '㒻',
  73969. '𧢮' => '𧢮',
  73970. '𧥦' => '𧥦',
  73971. '�' => '䚾',
  73972. '䛇' => '䛇',
  73973. '�' => '誠',
  73974. '�' => '諭',
  73975. '變' => '變',
  73976. '豕' => '豕',
  73977. '𧲨' => '𧲨',
  73978. '貫' => '貫',
  73979. '賁' => '�',
  73980. '贛' => '贛',
  73981. '起' => '起',
  73982. '𧼯' => '𧼯',
  73983. '𠠄' => '𠠄',
  73984. '跋' => '跋',
  73985. '趼' => '趼',
  73986. '跰' => '跰',
  73987. '�' => '𠣞',
  73988. '軔' => '軔',
  73989. '輸' => '輸',
  73990. '𨗒' => '𨗒',
  73991. '𨗭' => '𨗭',
  73992. '邔' => '邔',
  73993. '郱' => '郱',
  73994. '鄑' => '鄑',
  73995. '𨜮' => '𨜮',
  73996. '鄛' => '鄛',
  73997. '鈸' => '鈸',
  73998. '鋗' => '鋗',
  73999. '鋘' => '鋘',
  74000. '鉼' => '鉼',
  74001. '鏹' => '�',
  74002. '鐕' => '�',
  74003. '𨯺' => '𨯺',
  74004. '開' => '開',
  74005. '䦕' => '䦕',
  74006. '閷' => '閷',
  74007. '𨵷' => '𨵷',
  74008. '䧦' => '䧦',
  74009. '雃' => '雃',
  74010. '嶲' => '嶲',
  74011. '霣' => '霣',
  74012. '𩅅' => '𩅅',
  74013. '𩈚' => '𩈚',
  74014. '䩮' => '䩮',
  74015. '䩶' => '䩶',
  74016. '韠' => '韠',
  74017. '𩐊' => '�',
  74018. '䪲' => '䪲',
  74019. '𩒖' => '𩒖',
  74020. '頋' => '頋',
  74021. '頋' => '頋',
  74022. '頩' => '頩',
  74023. '�' => '𩖶',
  74024. '飢' => '飢',
  74025. '䬳' => '䬳',
  74026. '餩' => '餩',
  74027. '馧' => '馧',
  74028. '駂' => '駂',
  74029. '駾' => '駾',
  74030. '䯎' => '䯎',
  74031. '𩬰' => '𩬰',
  74032. '鬒' => '鬒',
  74033. '鱀' => '鱀',
  74034. '鳽' => '鳽',
  74035. '�' => '䳎',
  74036. '䳭' => '䳭',
  74037. '�' => '鵧',
  74038. '�' => '𪃎',
  74039. '䳸' => '䳸',
  74040. '𪄅' => '𪄅',
  74041. '𪈎' => '𪈎',
  74042. '𪊑' => '𪊑',
  74043. '麻' => '麻',
  74044. '䵖' => '䵖',
  74045. '黹' => '黹',
  74046. '黾' => '黾',
  74047. '鼅' => '鼅',
  74048. '鼏' => '�',
  74049. '鼖' => '鼖',
  74050. '鼻' => '鼻',
  74051. '�' => '𪘀',
  74052. );
  74053. <?php
  74054. return array (
  74055. 'Ì€' => 230,
  74056. '�' => 230,
  74057. 'Ì‚' => 230,
  74058. '̃' => 230,
  74059. 'Ì„' => 230,
  74060. 'Ì…' => 230,
  74061. '̆' => 230,
  74062. '̇' => 230,
  74063. '̈' => 230,
  74064. '̉' => 230,
  74065. 'ÌŠ' => 230,
  74066. 'Ì‹' => 230,
  74067. '̌' => 230,
  74068. '�' => 230,
  74069. 'ÌŽ' => 230,
  74070. '�' => 230,
  74071. '�' => 230,
  74072. 'Ì‘' => 230,
  74073. 'Ì’' => 230,
  74074. 'Ì“' => 230,
  74075. 'Ì”' => 230,
  74076. 'Ì•' => 232,
  74077. 'Ì–' => 220,
  74078. 'Ì—' => 220,
  74079. '̘' => 220,
  74080. 'Ì™' => 220,
  74081. 'Ìš' => 232,
  74082. 'Ì›' => 216,
  74083. '̜' => 220,
  74084. '�' => 220,
  74085. 'Ìž' => 220,
  74086. 'ÌŸ' => 220,
  74087. 'Ì ' => 220,
  74088. 'Ì¡' => 202,
  74089. 'Ì¢' => 202,
  74090. 'Ì£' => 220,
  74091. '̤' => 220,
  74092. 'Ì¥' => 220,
  74093. '̦' => 220,
  74094. '̧' => 202,
  74095. '̨' => 202,
  74096. 'Ì©' => 220,
  74097. '̪' => 220,
  74098. 'Ì«' => 220,
  74099. '̬' => 220,
  74100. 'Ì­' => 220,
  74101. 'Ì®' => 220,
  74102. '̯' => 220,
  74103. 'Ì°' => 220,
  74104. '̱' => 220,
  74105. '̲' => 220,
  74106. '̳' => 220,
  74107. 'Ì´' => 1,
  74108. '̵' => 1,
  74109. '̶' => 1,
  74110. 'Ì·' => 1,
  74111. '̸' => 1,
  74112. '̹' => 220,
  74113. '̺' => 220,
  74114. 'Ì»' => 220,
  74115. '̼' => 220,
  74116. '̽' => 230,
  74117. '̾' => 230,
  74118. 'Ì¿' => 230,
  74119. 'Í€' => 230,
  74120. '�' => 230,
  74121. 'Í‚' => 230,
  74122. '̓' => 230,
  74123. 'Í„' => 230,
  74124. 'Í…' => 240,
  74125. '͆' => 230,
  74126. '͇' => 220,
  74127. '͈' => 220,
  74128. '͉' => 220,
  74129. 'ÍŠ' => 230,
  74130. 'Í‹' => 230,
  74131. '͌' => 230,
  74132. '�' => 220,
  74133. 'ÍŽ' => 220,
  74134. '�' => 230,
  74135. 'Í‘' => 230,
  74136. 'Í’' => 230,
  74137. 'Í“' => 220,
  74138. 'Í”' => 220,
  74139. 'Í•' => 220,
  74140. 'Í–' => 220,
  74141. 'Í—' => 230,
  74142. '͘' => 232,
  74143. 'Í™' => 220,
  74144. 'Íš' => 220,
  74145. 'Í›' => 230,
  74146. '͜' => 233,
  74147. '�' => 234,
  74148. 'Íž' => 234,
  74149. 'ÍŸ' => 233,
  74150. 'Í ' => 234,
  74151. 'Í¡' => 234,
  74152. 'Í¢' => 233,
  74153. 'Í£' => 230,
  74154. 'ͤ' => 230,
  74155. 'Í¥' => 230,
  74156. 'ͦ' => 230,
  74157. 'ͧ' => 230,
  74158. 'ͨ' => 230,
  74159. 'Í©' => 230,
  74160. 'ͪ' => 230,
  74161. 'Í«' => 230,
  74162. 'ͬ' => 230,
  74163. 'Í­' => 230,
  74164. 'Í®' => 230,
  74165. 'ͯ' => 230,
  74166. 'Òƒ' => 230,
  74167. 'Ò„' => 230,
  74168. 'Ò…' => 230,
  74169. 'Ò†' => 230,
  74170. 'Ò‡' => 230,
  74171. 'Ö‘' => 220,
  74172. 'Ö’' => 230,
  74173. 'Ö“' => 230,
  74174. 'Ö”' => 230,
  74175. 'Ö•' => 230,
  74176. 'Ö–' => 220,
  74177. 'Ö—' => 230,
  74178. 'Ö˜' => 230,
  74179. 'Ö™' => 230,
  74180. 'Öš' => 222,
  74181. 'Ö›' => 220,
  74182. '֜' => 230,
  74183. 'Ö�' => 230,
  74184. 'Öž' => 230,
  74185. 'ÖŸ' => 230,
  74186. 'Ö ' => 230,
  74187. 'Ö¡' => 230,
  74188. 'Ö¢' => 220,
  74189. 'Ö£' => 220,
  74190. 'Ö¤' => 220,
  74191. 'Ö¥' => 220,
  74192. 'Ö¦' => 220,
  74193. 'Ö§' => 220,
  74194. 'Ö¨' => 230,
  74195. 'Ö©' => 230,
  74196. 'Öª' => 220,
  74197. 'Ö«' => 230,
  74198. 'Ö¬' => 230,
  74199. 'Ö­' => 222,
  74200. 'Ö®' => 228,
  74201. 'Ö¯' => 230,
  74202. 'Ö°' => 10,
  74203. 'Ö±' => 11,
  74204. 'Ö²' => 12,
  74205. 'Ö³' => 13,
  74206. 'Ö´' => 14,
  74207. 'Öµ' => 15,
  74208. 'Ö¶' => 16,
  74209. 'Ö·' => 17,
  74210. 'Ö¸' => 18,
  74211. 'Ö¹' => 19,
  74212. 'Öº' => 19,
  74213. 'Ö»' => 20,
  74214. 'Ö¼' => 21,
  74215. 'Ö½' => 22,
  74216. 'Ö¿' => 23,
  74217. '�' => 24,
  74218. 'ׂ' => 25,
  74219. 'ׄ' => 230,
  74220. '×…' => 220,
  74221. 'ׇ' => 18,
  74222. '�' => 230,
  74223. 'Ø‘' => 230,
  74224. 'Ø’' => 230,
  74225. 'Ø“' => 230,
  74226. 'Ø”' => 230,
  74227. 'Ø•' => 230,
  74228. 'Ø–' => 230,
  74229. 'Ø—' => 230,
  74230. 'ؘ' => 30,
  74231. 'Ø™' => 31,
  74232. 'Øš' => 32,
  74233. 'Ù‹' => 27,
  74234. 'ٌ' => 28,
  74235. 'Ù�' => 29,
  74236. 'ÙŽ' => 30,
  74237. 'Ù�' => 31,
  74238. 'Ù�' => 32,
  74239. 'Ù‘' => 33,
  74240. 'Ù’' => 34,
  74241. 'Ù“' => 230,
  74242. 'Ù”' => 230,
  74243. 'Ù•' => 220,
  74244. 'Ù–' => 220,
  74245. 'Ù—' => 230,
  74246. 'Ù˜' => 230,
  74247. 'Ù™' => 230,
  74248. 'Ùš' => 230,
  74249. 'Ù›' => 230,
  74250. 'ٜ' => 220,
  74251. 'Ù�' => 230,
  74252. 'Ùž' => 230,
  74253. 'ÙŸ' => 220,
  74254. 'Ù°' => 35,
  74255. 'Û–' => 230,
  74256. 'Û—' => 230,
  74257. 'Û˜' => 230,
  74258. 'Û™' => 230,
  74259. 'Ûš' => 230,
  74260. 'Û›' => 230,
  74261. 'ۜ' => 230,
  74262. 'ÛŸ' => 230,
  74263. 'Û ' => 230,
  74264. 'Û¡' => 230,
  74265. 'Û¢' => 230,
  74266. 'Û£' => 220,
  74267. 'Û¤' => 230,
  74268. 'Û§' => 230,
  74269. 'Û¨' => 230,
  74270. 'Ûª' => 220,
  74271. 'Û«' => 230,
  74272. 'Û¬' => 230,
  74273. 'Û­' => 220,
  74274. 'Ü‘' => 36,
  74275. 'Ü°' => 230,
  74276. 'ܱ' => 220,
  74277. 'ܲ' => 230,
  74278. 'ܳ' => 230,
  74279. 'Ü´' => 220,
  74280. 'ܵ' => 230,
  74281. 'ܶ' => 230,
  74282. 'Ü·' => 220,
  74283. 'ܸ' => 220,
  74284. 'ܹ' => 220,
  74285. 'ܺ' => 230,
  74286. 'Ü»' => 220,
  74287. 'ܼ' => 220,
  74288. 'ܽ' => 230,
  74289. 'ܾ' => 220,
  74290. 'Ü¿' => 230,
  74291. 'Ý€' => 230,
  74292. '�' => 230,
  74293. 'Ý‚' => 220,
  74294. '݃' => 230,
  74295. 'Ý„' => 220,
  74296. 'Ý…' => 230,
  74297. '݆' => 220,
  74298. '݇' => 230,
  74299. '݈' => 220,
  74300. '݉' => 230,
  74301. 'ÝŠ' => 230,
  74302. 'ß«' => 230,
  74303. '߬' => 230,
  74304. 'ß­' => 230,
  74305. 'ß®' => 230,
  74306. '߯' => 230,
  74307. 'ß°' => 230,
  74308. 'ß±' => 230,
  74309. 'ß²' => 220,
  74310. 'ß³' => 230,
  74311. 'ß½' => 220,
  74312. 'à –' => 230,
  74313. 'à —' => 230,
  74314. 'à ˜' => 230,
  74315. 'à ™' => 230,
  74316. 'à ›' => 230,
  74317. 'ࠜ' => 230,
  74318. 'à �' => 230,
  74319. 'à ž' => 230,
  74320. 'à Ÿ' => 230,
  74321. 'à  ' => 230,
  74322. 'à ¡' => 230,
  74323. 'à ¢' => 230,
  74324. 'à £' => 230,
  74325. 'à ¥' => 230,
  74326. 'à ¦' => 230,
  74327. 'à §' => 230,
  74328. 'à ©' => 230,
  74329. 'à ª' => 230,
  74330. 'à «' => 230,
  74331. 'à ¬' => 230,
  74332. 'à ­' => 230,
  74333. 'à¡™' => 220,
  74334. 'à¡š' => 220,
  74335. 'à¡›' => 220,
  74336. '࣓' => 220,
  74337. 'ࣔ' => 230,
  74338. 'ࣕ' => 230,
  74339. 'ࣖ' => 230,
  74340. 'ࣗ' => 230,
  74341. 'ࣘ' => 230,
  74342. 'ࣙ' => 230,
  74343. 'ࣚ' => 230,
  74344. 'ࣛ' => 230,
  74345. 'ࣜ' => 230,
  74346. '�' => 230,
  74347. 'ࣞ' => 230,
  74348. 'ࣟ' => 230,
  74349. '࣠' => 230,
  74350. '࣡' => 230,
  74351. 'ࣣ' => 220,
  74352. 'ࣤ' => 230,
  74353. 'ࣥ' => 230,
  74354. 'ࣦ' => 220,
  74355. 'ࣧ' => 230,
  74356. 'ࣨ' => 230,
  74357. 'ࣩ' => 220,
  74358. '࣪' => 230,
  74359. '࣫' => 230,
  74360. '࣬' => 230,
  74361. '࣭' => 220,
  74362. '࣮' => 220,
  74363. '࣯' => 220,
  74364. 'ࣰ' => 27,
  74365. 'ࣱ' => 28,
  74366. 'ࣲ' => 29,
  74367. 'ࣳ' => 230,
  74368. 'ࣴ' => 230,
  74369. 'ࣵ' => 230,
  74370. 'ࣶ' => 220,
  74371. 'ࣷ' => 230,
  74372. 'ࣸ' => 230,
  74373. 'ࣹ' => 220,
  74374. 'ࣺ' => 220,
  74375. 'ࣻ' => 230,
  74376. 'ࣼ' => 230,
  74377. 'ࣽ' => 230,
  74378. 'ࣾ' => 230,
  74379. 'ࣿ' => 230,
  74380. '़' => 7,
  74381. '�' => 9,
  74382. '॑' => 230,
  74383. '॒' => 220,
  74384. '॓' => 230,
  74385. '॔' => 230,
  74386. '়' => 7,
  74387. '�' => 9,
  74388. '৾' => 230,
  74389. '਼' => 7,
  74390. '�' => 9,
  74391. '઼' => 7,
  74392. '�' => 9,
  74393. '଼' => 7,
  74394. 'à­�' => 9,
  74395. '�' => 9,
  74396. '�' => 9,
  74397. 'ౕ' => 84,
  74398. 'à±–' => 91,
  74399. '಼' => 7,
  74400. '�' => 9,
  74401. 'à´»' => 9,
  74402. 'à´¼' => 9,
  74403. '�' => 9,
  74404. 'à·Š' => 9,
  74405. 'ุ' => 103,
  74406. 'ู' => 103,
  74407. 'ฺ' => 9,
  74408. '่' => 107,
  74409. '้' => 107,
  74410. '๊' => 107,
  74411. '๋' => 107,
  74412. 'ຸ' => 118,
  74413. 'ູ' => 118,
  74414. '຺' => 9,
  74415. '່' => 122,
  74416. '້' => 122,
  74417. '໊' => 122,
  74418. '໋' => 122,
  74419. '༘' => 220,
  74420. '༙' => 220,
  74421. '༵' => 220,
  74422. '༷' => 220,
  74423. '༹' => 216,
  74424. 'ཱ' => 129,
  74425. 'ི' => 130,
  74426. 'ུ' => 132,
  74427. 'ེ' => 130,
  74428. 'ཻ' => 130,
  74429. 'ོ' => 130,
  74430. 'ཽ' => 130,
  74431. 'ྀ' => 130,
  74432. 'ྂ' => 230,
  74433. 'ྃ' => 230,
  74434. '྄' => 9,
  74435. '྆' => 230,
  74436. '྇' => 230,
  74437. '࿆' => 220,
  74438. '့' => 7,
  74439. '္' => 9,
  74440. '်' => 9,
  74441. '�' => 220,
  74442. '�' => 230,
  74443. '�' => 230,
  74444. '�' => 230,
  74445. '᜔' => 9,
  74446. '᜴' => 9,
  74447. '្' => 9,
  74448. '�' => 230,
  74449. 'ᢩ' => 228,
  74450. '᤹' => 222,
  74451. '᤺' => 230,
  74452. '᤻' => 220,
  74453. 'ᨗ' => 230,
  74454. 'ᨘ' => 220,
  74455. 'á© ' => 9,
  74456. '᩵' => 230,
  74457. '᩶' => 230,
  74458. 'á©·' => 230,
  74459. '᩸' => 230,
  74460. '᩹' => 230,
  74461. '᩺' => 230,
  74462. 'á©»' => 230,
  74463. '᩼' => 230,
  74464. 'á©¿' => 220,
  74465. '᪰' => 230,
  74466. '᪱' => 230,
  74467. '᪲' => 230,
  74468. '᪳' => 230,
  74469. '᪴' => 230,
  74470. '᪵' => 220,
  74471. '᪶' => 220,
  74472. '᪷' => 220,
  74473. '᪸' => 220,
  74474. '᪹' => 220,
  74475. '᪺' => 220,
  74476. '᪻' => 230,
  74477. '᪼' => 230,
  74478. '᪽' => 220,
  74479. 'ᪿ' => 220,
  74480. 'á«€' => 220,
  74481. '᬴' => 7,
  74482. 'á­„' => 9,
  74483. 'á­«' => 230,
  74484. 'á­¬' => 220,
  74485. 'á­­' => 230,
  74486. 'á­®' => 230,
  74487. 'á­¯' => 230,
  74488. 'á­°' => 230,
  74489. 'á­±' => 230,
  74490. 'á­²' => 230,
  74491. 'á­³' => 230,
  74492. '᮪' => 9,
  74493. '᮫' => 9,
  74494. '᯦' => 7,
  74495. '᯲' => 9,
  74496. '᯳' => 9,
  74497. 'á°·' => 7,
  74498. '�' => 230,
  74499. '᳑' => 230,
  74500. 'á³’' => 230,
  74501. 'á³”' => 1,
  74502. '᳕' => 220,
  74503. 'á³–' => 220,
  74504. 'á³—' => 220,
  74505. '᳘' => 220,
  74506. 'á³™' => 220,
  74507. '᳚' => 230,
  74508. 'á³›' => 230,
  74509. '᳜' => 220,
  74510. '�' => 220,
  74511. '᳞' => 220,
  74512. '᳟' => 220,
  74513. 'á³ ' => 230,
  74514. 'á³¢' => 1,
  74515. 'á³£' => 1,
  74516. '᳤' => 1,
  74517. 'á³¥' => 1,
  74518. '᳦' => 1,
  74519. '᳧' => 1,
  74520. '᳨' => 1,
  74521. 'á³­' => 220,
  74522. 'á³´' => 230,
  74523. '᳸' => 230,
  74524. 'á³¹' => 230,
  74525. 'á·€' => 230,
  74526. 'á·�' => 230,
  74527. 'á·‚' => 220,
  74528. 'á·ƒ' => 230,
  74529. 'á·„' => 230,
  74530. 'á·…' => 230,
  74531. 'á·†' => 230,
  74532. 'á·‡' => 230,
  74533. 'á·ˆ' => 230,
  74534. 'á·‰' => 230,
  74535. 'á·Š' => 220,
  74536. 'á·‹' => 230,
  74537. '᷌' => 230,
  74538. 'á·�' => 234,
  74539. 'á·Ž' => 214,
  74540. 'á·�' => 220,
  74541. 'á·�' => 202,
  74542. 'á·‘' => 230,
  74543. 'á·’' => 230,
  74544. 'á·“' => 230,
  74545. 'á·”' => 230,
  74546. 'á·•' => 230,
  74547. 'á·–' => 230,
  74548. 'á·—' => 230,
  74549. 'á·˜' => 230,
  74550. 'á·™' => 230,
  74551. 'á·š' => 230,
  74552. 'á·›' => 230,
  74553. 'ᷜ' => 230,
  74554. 'á·�' => 230,
  74555. 'á·ž' => 230,
  74556. 'á·Ÿ' => 230,
  74557. 'á· ' => 230,
  74558. 'á·¡' => 230,
  74559. 'á·¢' => 230,
  74560. 'á·£' => 230,
  74561. 'á·¤' => 230,
  74562. 'á·¥' => 230,
  74563. 'á·¦' => 230,
  74564. 'á·§' => 230,
  74565. 'á·¨' => 230,
  74566. 'á·©' => 230,
  74567. 'á·ª' => 230,
  74568. 'á·«' => 230,
  74569. 'á·¬' => 230,
  74570. 'á·­' => 230,
  74571. 'á·®' => 230,
  74572. 'á·¯' => 230,
  74573. 'á·°' => 230,
  74574. 'á·±' => 230,
  74575. 'á·²' => 230,
  74576. 'á·³' => 230,
  74577. 'á·´' => 230,
  74578. 'á·µ' => 230,
  74579. 'á·¶' => 232,
  74580. 'á··' => 228,
  74581. 'á·¸' => 228,
  74582. 'á·¹' => 220,
  74583. 'á·»' => 230,
  74584. 'á·¼' => 233,
  74585. 'á·½' => 220,
  74586. 'á·¾' => 230,
  74587. 'á·¿' => 220,
  74588. '�' => 230,
  74589. '⃑' => 230,
  74590. '⃒' => 1,
  74591. '⃓' => 1,
  74592. '⃔' => 230,
  74593. '⃕' => 230,
  74594. '⃖' => 230,
  74595. '⃗' => 230,
  74596. '⃘' => 1,
  74597. '⃙' => 1,
  74598. '⃚' => 1,
  74599. '⃛' => 230,
  74600. '⃜' => 230,
  74601. '⃡' => 230,
  74602. '⃥' => 1,
  74603. '⃦' => 1,
  74604. '⃧' => 230,
  74605. '⃨' => 220,
  74606. '⃩' => 230,
  74607. '⃪' => 1,
  74608. '⃫' => 1,
  74609. '⃬' => 220,
  74610. '⃭' => 220,
  74611. '⃮' => 220,
  74612. '⃯' => 220,
  74613. '⃰' => 230,
  74614. '⳯' => 230,
  74615. 'â³°' => 230,
  74616. 'â³±' => 230,
  74617. '⵿' => 9,
  74618. 'â· ' => 230,
  74619. 'â·¡' => 230,
  74620. 'â·¢' => 230,
  74621. 'â·£' => 230,
  74622. 'â·¤' => 230,
  74623. 'â·¥' => 230,
  74624. 'â·¦' => 230,
  74625. 'â·§' => 230,
  74626. 'â·¨' => 230,
  74627. 'â·©' => 230,
  74628. 'â·ª' => 230,
  74629. 'â·«' => 230,
  74630. 'â·¬' => 230,
  74631. 'â·­' => 230,
  74632. 'â·®' => 230,
  74633. 'â·¯' => 230,
  74634. 'â·°' => 230,
  74635. 'â·±' => 230,
  74636. 'â·²' => 230,
  74637. 'â·³' => 230,
  74638. 'â·´' => 230,
  74639. 'â·µ' => 230,
  74640. 'â·¶' => 230,
  74641. 'â··' => 230,
  74642. 'â·¸' => 230,
  74643. 'â·¹' => 230,
  74644. 'â·º' => 230,
  74645. 'â·»' => 230,
  74646. 'â·¼' => 230,
  74647. 'â·½' => 230,
  74648. 'â·¾' => 230,
  74649. 'â·¿' => 230,
  74650. '〪' => 218,
  74651. '〫' => 228,
  74652. '〬' => 232,
  74653. '〭' => 222,
  74654. '〮' => 224,
  74655. '〯' => 224,
  74656. 'ã‚™' => 8,
  74657. 'ã‚š' => 8,
  74658. '꙯' => 230,
  74659. 'ê™´' => 230,
  74660. 'ꙵ' => 230,
  74661. 'ꙶ' => 230,
  74662. 'ê™·' => 230,
  74663. 'ꙸ' => 230,
  74664. 'ꙹ' => 230,
  74665. 'ꙺ' => 230,
  74666. 'ê™»' => 230,
  74667. '꙼' => 230,
  74668. '꙽' => 230,
  74669. 'êšž' => 230,
  74670. 'ꚟ' => 230,
  74671. 'ê›°' => 230,
  74672. 'ê›±' => 230,
  74673. 'ê †' => 9,
  74674. 'ê ¬' => 9,
  74675. '꣄' => 9,
  74676. '꣠' => 230,
  74677. '꣡' => 230,
  74678. '꣢' => 230,
  74679. '꣣' => 230,
  74680. '꣤' => 230,
  74681. '꣥' => 230,
  74682. '꣦' => 230,
  74683. '꣧' => 230,
  74684. '꣨' => 230,
  74685. '꣩' => 230,
  74686. '꣪' => 230,
  74687. '꣫' => 230,
  74688. '꣬' => 230,
  74689. '꣭' => 230,
  74690. '꣮' => 230,
  74691. '꣯' => 230,
  74692. '꣰' => 230,
  74693. '꣱' => 230,
  74694. '꤫' => 220,
  74695. '꤬' => 220,
  74696. '꤭' => 220,
  74697. '꥓' => 9,
  74698. '꦳' => 7,
  74699. '꧀' => 9,
  74700. 'ꪰ' => 230,
  74701. 'ꪲ' => 230,
  74702. 'ꪳ' => 230,
  74703. 'ꪴ' => 220,
  74704. 'ꪷ' => 230,
  74705. 'ꪸ' => 230,
  74706. 'ꪾ' => 230,
  74707. '꪿' => 230,
  74708. '�' => 230,
  74709. '꫶' => 9,
  74710. '꯭' => 9,
  74711. 'ﬞ' => 26,
  74712. '︠' => 230,
  74713. '︡' => 230,
  74714. '︢' => 230,
  74715. '︣' => 230,
  74716. '︤' => 230,
  74717. '︥' => 230,
  74718. '︦' => 230,
  74719. '︧' => 220,
  74720. '︨' => 220,
  74721. '︩' => 220,
  74722. '︪' => 220,
  74723. '︫' => 220,
  74724. '︬' => 220,
  74725. '︭' => 220,
  74726. '︮' => 230,
  74727. '︯' => 230,
  74728. '�' => 220,
  74729. '�' => 220,
  74730. '�' => 230,
  74731. '�' => 230,
  74732. '�' => 230,
  74733. '�' => 230,
  74734. '�' => 230,
  74735. '�' => 220,
  74736. '�' => 230,
  74737. '�' => 230,
  74738. '�' => 1,
  74739. '�' => 220,
  74740. '�' => 9,
  74741. '�' => 230,
  74742. '�' => 220,
  74743. '�' => 230,
  74744. '�' => 230,
  74745. '�' => 230,
  74746. '�' => 230,
  74747. '�' => 230,
  74748. '�' => 230,
  74749. '�' => 220,
  74750. '�' => 220,
  74751. '�' => 230,
  74752. '�' => 230,
  74753. '�' => 230,
  74754. '�' => 220,
  74755. '�' => 230,
  74756. '�' => 220,
  74757. '�' => 220,
  74758. '�' => 220,
  74759. '�' => 220,
  74760. '�' => 9,
  74761. '�' => 9,
  74762. 'ð‘‚¹' => 9,
  74763. '𑂺' => 7,
  74764. 'ð‘„€' => 230,
  74765. '�' => 230,
  74766. 'ð‘„‚' => 230,
  74767. 'ð‘„³' => 9,
  74768. 'ð‘„´' => 9,
  74769. 'ð‘…³' => 7,
  74770. '𑇀' => 9,
  74771. '𑇊' => 7,
  74772. '𑈵' => 9,
  74773. '𑈶' => 7,
  74774. 'ð‘‹©' => 7,
  74775. '𑋪' => 9,
  74776. '𑌻' => 7,
  74777. '𑌼' => 7,
  74778. '�' => 9,
  74779. '�' => 230,
  74780. '�' => 230,
  74781. '�' => 230,
  74782. '�' => 230,
  74783. '�' => 230,
  74784. '�' => 230,
  74785. '�' => 230,
  74786. '�' => 230,
  74787. '�' => 230,
  74788. '�' => 230,
  74789. '�' => 230,
  74790. '�' => 230,
  74791. 'ð‘‘‚' => 9,
  74792. '𑑆' => 7,
  74793. 'ð‘‘ž' => 230,
  74794. 'ð‘“‚' => 9,
  74795. '𑓃' => 7,
  74796. 'ð‘–¿' => 9,
  74797. 'ð‘—€' => 7,
  74798. '𑘿' => 9,
  74799. '𑚶' => 9,
  74800. 'ð‘š·' => 7,
  74801. '𑜫' => 9,
  74802. 'ð‘ ¹' => 9,
  74803. 'ð‘ º' => 7,
  74804. '𑤽' => 9,
  74805. '𑤾' => 9,
  74806. '𑥃' => 7,
  74807. '𑧠' => 9,
  74808. '𑨴' => 9,
  74809. '𑩇' => 9,
  74810. '𑪙' => 9,
  74811. 'ð‘°¿' => 9,
  74812. '𑵂' => 7,
  74813. '𑵄' => 9,
  74814. '𑵅' => 9,
  74815. '𑶗' => 9,
  74816. 'ð–«°' => 1,
  74817. 'ð–«±' => 1,
  74818. 'ð–«²' => 1,
  74819. 'ð–«³' => 1,
  74820. 'ð–«´' => 1,
  74821. 'ð–¬°' => 230,
  74822. '𖬱' => 230,
  74823. '𖬲' => 230,
  74824. '𖬳' => 230,
  74825. 'ð–¬´' => 230,
  74826. '𖬵' => 230,
  74827. '𖬶' => 230,
  74828. 'ð–¿°' => 6,
  74829. 'ð–¿±' => 6,
  74830. '𛲞' => 1,
  74831. '�' => 216,
  74832. '�' => 216,
  74833. '�' => 1,
  74834. '�' => 1,
  74835. '�' => 1,
  74836. '�' => 226,
  74837. '�' => 216,
  74838. '�' => 216,
  74839. '�' => 216,
  74840. '�' => 216,
  74841. '�' => 216,
  74842. '�' => 220,
  74843. '�' => 220,
  74844. '�' => 220,
  74845. '�' => 220,
  74846. '�' => 220,
  74847. '�' => 220,
  74848. '�' => 220,
  74849. '�' => 220,
  74850. '�' => 230,
  74851. '�' => 230,
  74852. '�' => 230,
  74853. '�' => 230,
  74854. '�' => 230,
  74855. '�' => 220,
  74856. '�' => 220,
  74857. '�' => 230,
  74858. '�' => 230,
  74859. '�' => 230,
  74860. '�' => 230,
  74861. '�' => 230,
  74862. '�' => 230,
  74863. '�' => 230,
  74864. '𞀀' => 230,
  74865. '�' => 230,
  74866. '𞀂' => 230,
  74867. '𞀃' => 230,
  74868. '𞀄' => 230,
  74869. '𞀅' => 230,
  74870. '𞀆' => 230,
  74871. '𞀈' => 230,
  74872. '𞀉' => 230,
  74873. '𞀊' => 230,
  74874. '𞀋' => 230,
  74875. '𞀌' => 230,
  74876. '�' => 230,
  74877. '𞀎' => 230,
  74878. '�' => 230,
  74879. '�' => 230,
  74880. '𞀑' => 230,
  74881. '𞀒' => 230,
  74882. '𞀓' => 230,
  74883. '𞀔' => 230,
  74884. '𞀕' => 230,
  74885. '𞀖' => 230,
  74886. '𞀗' => 230,
  74887. '𞀘' => 230,
  74888. '𞀛' => 230,
  74889. '𞀜' => 230,
  74890. '�' => 230,
  74891. '𞀞' => 230,
  74892. '𞀟' => 230,
  74893. '𞀠' => 230,
  74894. '𞀡' => 230,
  74895. '𞀣' => 230,
  74896. '𞀤' => 230,
  74897. '𞀦' => 230,
  74898. '𞀧' => 230,
  74899. '𞀨' => 230,
  74900. '𞀩' => 230,
  74901. '𞀪' => 230,
  74902. 'ðž„°' => 230,
  74903. '𞄱' => 230,
  74904. '𞄲' => 230,
  74905. '𞄳' => 230,
  74906. 'ðž„´' => 230,
  74907. '𞄵' => 230,
  74908. '𞄶' => 230,
  74909. '𞋬' => 230,
  74910. 'ðž‹­' => 230,
  74911. 'ðž‹®' => 230,
  74912. '𞋯' => 230,
  74913. '�' => 220,
  74914. '𞣑' => 220,
  74915. '𞣒' => 220,
  74916. '𞣓' => 220,
  74917. '𞣔' => 220,
  74918. '𞣕' => 220,
  74919. '𞣖' => 220,
  74920. '𞥄' => 230,
  74921. '𞥅' => 230,
  74922. '𞥆' => 230,
  74923. '𞥇' => 230,
  74924. '𞥈' => 230,
  74925. '𞥉' => 230,
  74926. '𞥊' => 7,
  74927. );
  74928. <?php
  74929. return array (
  74930. ' ' => ' ',
  74931. '¨' => ' ̈',
  74932. 'ª' => 'a',
  74933. '¯' => ' ̄',
  74934. '²' => '2',
  74935. '³' => '3',
  74936. '´' => ' �',
  74937. 'µ' => 'μ',
  74938. '¸' => ' ̧',
  74939. '¹' => '1',
  74940. 'º' => 'o',
  74941. '¼' => '1�4',
  74942. '½' => '1�2',
  74943. '¾' => '3�4',
  74944. 'IJ' => 'IJ',
  74945. 'ij' => 'ij',
  74946. 'Ŀ' => 'L·',
  74947. 'ŀ' => 'l·',
  74948. 'ʼn' => 'ʼn',
  74949. 'Å¿' => 's',
  74950. 'DŽ' => 'DŽ',
  74951. 'Dž' => 'Dž',
  74952. 'dž' => 'dž',
  74953. 'LJ' => 'LJ',
  74954. 'Lj' => 'Lj',
  74955. 'lj' => 'lj',
  74956. 'ÇŠ' => 'NJ',
  74957. 'Ç‹' => 'Nj',
  74958. 'nj' => 'nj',
  74959. 'DZ' => 'DZ',
  74960. 'Dz' => 'Dz',
  74961. 'dz' => 'dz',
  74962. 'Ê°' => 'h',
  74963. 'ʱ' => 'ɦ',
  74964. 'ʲ' => 'j',
  74965. 'ʳ' => 'r',
  74966. 'ʴ' => 'ɹ',
  74967. 'ʵ' => 'ɻ',
  74968. 'ʶ' => '�',
  74969. 'Ê·' => 'w',
  74970. 'ʸ' => 'y',
  74971. '˘' => ' ̆',
  74972. '˙' => ' ̇',
  74973. 'Ëš' => ' ÌŠ',
  74974. '˛' => ' ̨',
  74975. '˜' => ' ̃',
  74976. '�' => ' ̋',
  74977. 'Ë ' => 'É£',
  74978. 'Ë¡' => 'l',
  74979. 'Ë¢' => 's',
  74980. 'Ë£' => 'x',
  74981. 'ˤ' => 'ʕ',
  74982. 'ͺ' => ' ͅ',
  74983. '΄' => ' �',
  74984. '΅' => ' ̈�',
  74985. '�' => 'β',
  74986. 'ϑ' => 'θ',
  74987. 'Ï’' => 'Î¥',
  74988. 'ϓ' => 'Υ�',
  74989. 'ϔ' => 'Ϋ',
  74990. 'ϕ' => 'φ',
  74991. 'Ï–' => 'Ï€',
  74992. 'ϰ' => 'κ',
  74993. 'ϱ' => '�',
  74994. 'ϲ' => 'ς',
  74995. 'ϴ' => 'Θ',
  74996. 'ϵ' => 'ε',
  74997. 'Ϲ' => 'Σ',
  74998. 'Ö‡' => 'Õ¥Ö‚',
  74999. 'ٵ' => 'اٴ',
  75000. 'ٶ' => 'وٴ',
  75001. 'Ù·' => 'Û‡Ù´',
  75002. 'ٸ' => 'يٴ',
  75003. 'ำ' => '�า',
  75004. 'ຳ' => '�າ',
  75005. 'ໜ' => 'ຫນ',
  75006. '�' => 'ຫມ',
  75007. '༌' => '་',
  75008. 'ཷ' => 'ྲཱྀ',
  75009. 'ཹ' => 'ླཱྀ',
  75010. 'ჼ' => 'ნ',
  75011. 'á´¬' => 'A',
  75012. 'ᴭ' => 'Æ',
  75013. 'á´®' => 'B',
  75014. 'á´°' => 'D',
  75015. 'á´±' => 'E',
  75016. 'á´²' => 'ÆŽ',
  75017. 'á´³' => 'G',
  75018. 'á´´' => 'H',
  75019. 'á´µ' => 'I',
  75020. 'á´¶' => 'J',
  75021. 'á´·' => 'K',
  75022. 'á´¸' => 'L',
  75023. 'á´¹' => 'M',
  75024. 'á´º' => 'N',
  75025. 'á´¼' => 'O',
  75026. 'á´½' => 'È¢',
  75027. 'á´¾' => 'P',
  75028. 'á´¿' => 'R',
  75029. 'áµ€' => 'T',
  75030. '�' => 'U',
  75031. 'ᵂ' => 'W',
  75032. 'ᵃ' => 'a',
  75033. 'ᵄ' => '�',
  75034. 'áµ…' => 'É‘',
  75035. 'ᵆ' => 'ᴂ',
  75036. 'ᵇ' => 'b',
  75037. 'ᵈ' => 'd',
  75038. 'ᵉ' => 'e',
  75039. 'ᵊ' => 'ə',
  75040. 'ᵋ' => 'ɛ',
  75041. 'ᵌ' => 'ɜ',
  75042. '�' => 'g',
  75043. '�' => 'k',
  75044. '�' => 'm',
  75045. 'ᵑ' => 'ŋ',
  75046. 'áµ’' => 'o',
  75047. 'ᵓ' => 'ɔ',
  75048. 'áµ”' => 'á´–',
  75049. 'ᵕ' => 'ᴗ',
  75050. 'áµ–' => 'p',
  75051. 'áµ—' => 't',
  75052. 'ᵘ' => 'u',
  75053. 'áµ™' => 'á´�',
  75054. 'ᵚ' => 'ɯ',
  75055. 'áµ›' => 'v',
  75056. 'ᵜ' => 'ᴥ',
  75057. '�' => 'β',
  75058. 'ᵞ' => 'γ',
  75059. 'ᵟ' => 'δ',
  75060. 'ᵠ' => 'φ',
  75061. 'ᵡ' => 'χ',
  75062. 'áµ¢' => 'i',
  75063. 'áµ£' => 'r',
  75064. 'ᵤ' => 'u',
  75065. 'áµ¥' => 'v',
  75066. 'ᵦ' => 'β',
  75067. 'ᵧ' => 'γ',
  75068. 'ᵨ' => '�',
  75069. 'ᵩ' => 'φ',
  75070. 'ᵪ' => 'χ',
  75071. 'ᵸ' => 'н',
  75072. 'ᶛ' => 'ɒ',
  75073. 'ᶜ' => 'c',
  75074. '�' => 'ɕ',
  75075. 'ᶞ' => 'ð',
  75076. 'ᶟ' => 'ɜ',
  75077. 'ᶠ' => 'f',
  75078. 'ᶡ' => 'ɟ',
  75079. 'ᶢ' => 'ɡ',
  75080. 'ᶣ' => 'ɥ',
  75081. 'ᶤ' => 'ɨ',
  75082. 'ᶥ' => 'ɩ',
  75083. 'ᶦ' => 'ɪ',
  75084. 'ᶧ' => 'ᵻ',
  75085. 'ᶨ' => '�',
  75086. 'ᶩ' => 'ɭ',
  75087. 'ᶪ' => 'ᶅ',
  75088. 'ᶫ' => 'ʟ',
  75089. 'ᶬ' => 'ɱ',
  75090. 'ᶭ' => 'ɰ',
  75091. 'ᶮ' => 'ɲ',
  75092. 'ᶯ' => 'ɳ',
  75093. 'ᶰ' => 'ɴ',
  75094. 'ᶱ' => 'ɵ',
  75095. 'ᶲ' => 'ɸ',
  75096. 'ᶳ' => 'ʂ',
  75097. 'ᶴ' => 'ʃ',
  75098. 'ᶵ' => 'ƫ',
  75099. 'ᶶ' => 'ʉ',
  75100. 'ᶷ' => 'ʊ',
  75101. 'ᶸ' => 'ᴜ',
  75102. 'ᶹ' => 'ʋ',
  75103. 'ᶺ' => 'ʌ',
  75104. 'ᶻ' => 'z',
  75105. 'ᶼ' => '�',
  75106. 'ᶽ' => 'ʑ',
  75107. 'ᶾ' => 'ʒ',
  75108. 'ᶿ' => 'θ',
  75109. 'ẚ' => 'aʾ',
  75110. 'ẛ' => 'ṡ',
  75111. 'á¾½' => ' Ì“',
  75112. '᾿' => ' ̓',
  75113. 'á¿€' => ' Í‚',
  75114. '�' => ' ̈͂',
  75115. '�' => ' ̓̀',
  75116. '῎' => ' ̓�',
  75117. '�' => ' ̓͂',
  75118. '�' => ' ̔̀',
  75119. '῞' => ' ̔�',
  75120. '῟' => ' ̔͂',
  75121. '῭' => ' ̈̀',
  75122. '΅' => ' ̈�',
  75123. '´' => ' �',
  75124. '῾' => ' ̔',
  75125. ' ' => ' ',
  75126. '�' => ' ',
  75127. ' ' => ' ',
  75128. ' ' => ' ',
  75129. ' ' => ' ',
  75130. ' ' => ' ',
  75131. ' ' => ' ',
  75132. ' ' => ' ',
  75133. ' ' => ' ',
  75134. ' ' => ' ',
  75135. ' ' => ' ',
  75136. '‑' => '�',
  75137. '‗' => ' ̳',
  75138. '․' => '.',
  75139. '‥' => '..',
  75140. '…' => '...',
  75141. ' ' => ' ',
  75142. '″' => '′′',
  75143. '‴' => '′′′',
  75144. '‶' => '‵‵',
  75145. '‷' => '‵‵‵',
  75146. '‼' => '!!',
  75147. '‾' => ' ̅',
  75148. '�' => '??',
  75149. '�' => '?!',
  75150. '�' => '!?',
  75151. '�' => '′′′′',
  75152. '�' => ' ',
  75153. '�' => '0',
  75154. '�' => 'i',
  75155. '�' => '4',
  75156. '�' => '5',
  75157. '�' => '6',
  75158. '�' => '7',
  75159. '�' => '8',
  75160. '�' => '9',
  75161. '�' => '+',
  75162. '�' => '−',
  75163. '�' => '=',
  75164. '�' => '(',
  75165. '�' => ')',
  75166. '�' => 'n',
  75167. 'â‚€' => '0',
  75168. '�' => '1',
  75169. 'â‚‚' => '2',
  75170. '₃' => '3',
  75171. 'â‚„' => '4',
  75172. 'â‚…' => '5',
  75173. '₆' => '6',
  75174. '₇' => '7',
  75175. '₈' => '8',
  75176. '₉' => '9',
  75177. 'â‚Š' => '+',
  75178. '₋' => '−',
  75179. '₌' => '=',
  75180. '�' => '(',
  75181. 'â‚Ž' => ')',
  75182. '�' => 'a',
  75183. 'â‚‘' => 'e',
  75184. 'â‚’' => 'o',
  75185. 'â‚“' => 'x',
  75186. 'â‚”' => 'É™',
  75187. 'â‚•' => 'h',
  75188. 'â‚–' => 'k',
  75189. 'â‚—' => 'l',
  75190. 'ₘ' => 'm',
  75191. 'â‚™' => 'n',
  75192. 'â‚š' => 'p',
  75193. 'â‚›' => 's',
  75194. 'ₜ' => 't',
  75195. '₨' => 'Rs',
  75196. 'â„€' => 'a/c',
  75197. '�' => 'a/s',
  75198. 'â„‚' => 'C',
  75199. '℃' => '°C',
  75200. 'â„…' => 'c/o',
  75201. '℆' => 'c/u',
  75202. 'ℇ' => '�',
  75203. '℉' => '°F',
  75204. 'â„Š' => 'g',
  75205. 'â„‹' => 'H',
  75206. 'ℌ' => 'H',
  75207. '�' => 'H',
  75208. 'â„Ž' => 'h',
  75209. '�' => 'ħ',
  75210. '�' => 'I',
  75211. 'â„‘' => 'I',
  75212. 'â„’' => 'L',
  75213. 'â„“' => 'l',
  75214. 'â„•' => 'N',
  75215. 'â„–' => 'No',
  75216. 'â„™' => 'P',
  75217. 'â„š' => 'Q',
  75218. 'â„›' => 'R',
  75219. 'ℜ' => 'R',
  75220. '�' => 'R',
  75221. 'â„ ' => 'SM',
  75222. 'â„¡' => 'TEL',
  75223. 'â„¢' => 'TM',
  75224. 'ℤ' => 'Z',
  75225. 'ℨ' => 'Z',
  75226. 'ℬ' => 'B',
  75227. 'â„­' => 'C',
  75228. 'ℯ' => 'e',
  75229. 'â„°' => 'E',
  75230. 'ℱ' => 'F',
  75231. 'ℳ' => 'M',
  75232. 'â„´' => 'o',
  75233. 'ℵ' => '�',
  75234. 'ℶ' => 'ב',
  75235. 'â„·' => '×’',
  75236. 'ℸ' => 'ד',
  75237. 'ℹ' => 'i',
  75238. 'â„»' => 'FAX',
  75239. 'ℼ' => 'π',
  75240. 'ℽ' => 'γ',
  75241. 'ℾ' => 'Γ',
  75242. 'ℿ' => 'Π',
  75243. '⅀' => '∑',
  75244. 'â……' => 'D',
  75245. 'â…†' => 'd',
  75246. 'â…‡' => 'e',
  75247. 'â…ˆ' => 'i',
  75248. 'â…‰' => 'j',
  75249. '�' => '1�7',
  75250. '⅑' => '1�9',
  75251. '⅒' => '1�10',
  75252. '⅓' => '1�3',
  75253. '⅔' => '2�3',
  75254. '⅕' => '1�5',
  75255. '⅖' => '2�5',
  75256. '⅗' => '3�5',
  75257. '⅘' => '4�5',
  75258. '⅙' => '1�6',
  75259. '⅚' => '5�6',
  75260. '⅛' => '1�8',
  75261. '⅜' => '3�8',
  75262. '�' => '5�8',
  75263. '⅞' => '7�8',
  75264. '⅟' => '1�',
  75265. 'â… ' => 'I',
  75266. 'â…¡' => 'II',
  75267. 'â…¢' => 'III',
  75268. 'â…£' => 'IV',
  75269. 'â…¤' => 'V',
  75270. 'â…¥' => 'VI',
  75271. 'â…¦' => 'VII',
  75272. 'â…§' => 'VIII',
  75273. 'â…¨' => 'IX',
  75274. 'â…©' => 'X',
  75275. 'â…ª' => 'XI',
  75276. 'â…«' => 'XII',
  75277. 'â…¬' => 'L',
  75278. 'â…­' => 'C',
  75279. 'â…®' => 'D',
  75280. 'â…¯' => 'M',
  75281. 'â…°' => 'i',
  75282. 'â…±' => 'ii',
  75283. 'â…²' => 'iii',
  75284. 'â…³' => 'iv',
  75285. 'â…´' => 'v',
  75286. 'â…µ' => 'vi',
  75287. 'â…¶' => 'vii',
  75288. 'â…·' => 'viii',
  75289. 'â…¸' => 'ix',
  75290. 'â…¹' => 'x',
  75291. 'â…º' => 'xi',
  75292. 'â…»' => 'xii',
  75293. 'â…¼' => 'l',
  75294. 'â…½' => 'c',
  75295. 'â…¾' => 'd',
  75296. 'â…¿' => 'm',
  75297. '↉' => '0�3',
  75298. '∬' => '∫∫',
  75299. '∭' => '∫∫∫',
  75300. '∯' => '∮∮',
  75301. '∰' => '∮∮∮',
  75302. 'â‘ ' => '1',
  75303. 'â‘¡' => '2',
  75304. 'â‘¢' => '3',
  75305. 'â‘£' => '4',
  75306. '⑤' => '5',
  75307. 'â‘¥' => '6',
  75308. '⑦' => '7',
  75309. '⑧' => '8',
  75310. '⑨' => '9',
  75311. 'â‘©' => '10',
  75312. '⑪' => '11',
  75313. 'â‘«' => '12',
  75314. '⑬' => '13',
  75315. 'â‘­' => '14',
  75316. 'â‘®' => '15',
  75317. '⑯' => '16',
  75318. 'â‘°' => '17',
  75319. '⑱' => '18',
  75320. '⑲' => '19',
  75321. '⑳' => '20',
  75322. 'â‘´' => '(1)',
  75323. '⑵' => '(2)',
  75324. '⑶' => '(3)',
  75325. 'â‘·' => '(4)',
  75326. '⑸' => '(5)',
  75327. '⑹' => '(6)',
  75328. '⑺' => '(7)',
  75329. 'â‘»' => '(8)',
  75330. '⑼' => '(9)',
  75331. '⑽' => '(10)',
  75332. '⑾' => '(11)',
  75333. 'â‘¿' => '(12)',
  75334. 'â’€' => '(13)',
  75335. 'â’�' => '(14)',
  75336. 'â’‚' => '(15)',
  75337. 'â’ƒ' => '(16)',
  75338. 'â’„' => '(17)',
  75339. 'â’…' => '(18)',
  75340. 'â’†' => '(19)',
  75341. 'â’‡' => '(20)',
  75342. 'â’ˆ' => '1.',
  75343. 'â’‰' => '2.',
  75344. 'â’Š' => '3.',
  75345. 'â’‹' => '4.',
  75346. '⒌' => '5.',
  75347. 'â’�' => '6.',
  75348. 'â’Ž' => '7.',
  75349. 'â’�' => '8.',
  75350. 'â’�' => '9.',
  75351. 'â’‘' => '10.',
  75352. 'â’’' => '11.',
  75353. 'â’“' => '12.',
  75354. 'â’”' => '13.',
  75355. 'â’•' => '14.',
  75356. 'â’–' => '15.',
  75357. 'â’—' => '16.',
  75358. 'â’˜' => '17.',
  75359. 'â’™' => '18.',
  75360. 'â’š' => '19.',
  75361. 'â’›' => '20.',
  75362. '⒜' => '(a)',
  75363. 'â’�' => '(b)',
  75364. 'â’ž' => '(c)',
  75365. 'â’Ÿ' => '(d)',
  75366. 'â’ ' => '(e)',
  75367. 'â’¡' => '(f)',
  75368. 'â’¢' => '(g)',
  75369. 'â’£' => '(h)',
  75370. 'â’¤' => '(i)',
  75371. 'â’¥' => '(j)',
  75372. 'â’¦' => '(k)',
  75373. 'â’§' => '(l)',
  75374. 'â’¨' => '(m)',
  75375. 'â’©' => '(n)',
  75376. 'â’ª' => '(o)',
  75377. 'â’«' => '(p)',
  75378. 'â’¬' => '(q)',
  75379. 'â’­' => '(r)',
  75380. 'â’®' => '(s)',
  75381. 'â’¯' => '(t)',
  75382. 'â’°' => '(u)',
  75383. 'â’±' => '(v)',
  75384. 'â’²' => '(w)',
  75385. 'â’³' => '(x)',
  75386. 'â’´' => '(y)',
  75387. 'â’µ' => '(z)',
  75388. 'â’¶' => 'A',
  75389. 'â’·' => 'B',
  75390. 'â’¸' => 'C',
  75391. 'â’¹' => 'D',
  75392. 'â’º' => 'E',
  75393. 'â’»' => 'F',
  75394. 'â’¼' => 'G',
  75395. 'â’½' => 'H',
  75396. 'â’¾' => 'I',
  75397. 'â’¿' => 'J',
  75398. 'â“€' => 'K',
  75399. '�' => 'L',
  75400. 'â“‚' => 'M',
  75401. 'Ⓝ' => 'N',
  75402. 'â“„' => 'O',
  75403. 'â“…' => 'P',
  75404. 'Ⓠ' => 'Q',
  75405. 'Ⓡ' => 'R',
  75406. 'Ⓢ' => 'S',
  75407. 'Ⓣ' => 'T',
  75408. 'â“Š' => 'U',
  75409. 'â“‹' => 'V',
  75410. 'Ⓦ' => 'W',
  75411. '�' => 'X',
  75412. 'â“Ž' => 'Y',
  75413. '�' => 'Z',
  75414. '�' => 'a',
  75415. 'â“‘' => 'b',
  75416. 'â“’' => 'c',
  75417. 'â““' => 'd',
  75418. 'â“”' => 'e',
  75419. 'â“•' => 'f',
  75420. 'â“–' => 'g',
  75421. 'â“—' => 'h',
  75422. 'ⓘ' => 'i',
  75423. 'â“™' => 'j',
  75424. 'â“š' => 'k',
  75425. 'â“›' => 'l',
  75426. 'ⓜ' => 'm',
  75427. '�' => 'n',
  75428. 'â“ž' => 'o',
  75429. 'â“Ÿ' => 'p',
  75430. 'â“ ' => 'q',
  75431. 'â“¡' => 'r',
  75432. 'â“¢' => 's',
  75433. 'â“£' => 't',
  75434. 'ⓤ' => 'u',
  75435. 'â“¥' => 'v',
  75436. 'ⓦ' => 'w',
  75437. 'ⓧ' => 'x',
  75438. 'ⓨ' => 'y',
  75439. 'â“©' => 'z',
  75440. '⓪' => '0',
  75441. '⨌' => '∫∫∫∫',
  75442. 'â©´' => '::=',
  75443. '⩵' => '==',
  75444. '⩶' => '===',
  75445. 'â±¼' => 'j',
  75446. 'â±½' => 'V',
  75447. 'ⵯ' => 'ⵡ',
  75448. '⺟' => '�',
  75449. '⻳' => '龟',
  75450. '⼀' => '一',
  75451. '�' => '丨',
  75452. '⼂' => '丶',
  75453. '⼃' => '丿',
  75454. '⼄' => '乙',
  75455. '⼅' => '亅',
  75456. '⼆' => '二',
  75457. '⼇' => '亠',
  75458. '⼈' => '人',
  75459. '⼉' => '儿',
  75460. '⼊' => '入',
  75461. '⼋' => '八',
  75462. '⼌' => '冂',
  75463. '�' => '冖',
  75464. '⼎' => '冫',
  75465. '�' => '几',
  75466. '�' => '凵',
  75467. '⼑' => '刀',
  75468. '⼒' => '力',
  75469. '⼓' => '勹',
  75470. '⼔' => '匕',
  75471. '⼕' => '匚',
  75472. '⼖' => '匸',
  75473. '⼗' => '�',
  75474. '⼘' => '�',
  75475. '⼙' => '�',
  75476. '⼚' => '厂',
  75477. '⼛' => '厶',
  75478. '⼜' => '�',
  75479. '�' => '�',
  75480. '⼞' => '囗',
  75481. '⼟' => '土',
  75482. '⼠' => '士',
  75483. '⼡' => '夂',
  75484. '⼢' => '夊',
  75485. '⼣' => '夕',
  75486. '⼤' => '大',
  75487. '⼥' => '女',
  75488. '⼦' => '�',
  75489. '⼧' => '宀',
  75490. '⼨' => '寸',
  75491. '⼩' => '�',
  75492. '⼪' => '尢',
  75493. '⼫' => '尸',
  75494. '⼬' => '屮',
  75495. 'â¼­' => 'å±±',
  75496. 'â¼®' => 'å·›',
  75497. '⼯' => '工',
  75498. 'â¼°' => 'å·±',
  75499. 'â¼±' => 'å·¾',
  75500. 'â¼²' => 'å¹²',
  75501. '⼳' => '幺',
  75502. '⼴' => '广',
  75503. 'â¼µ' => 'å»´',
  75504. '⼶' => '廾',
  75505. '⼷' => '弋',
  75506. '⼸' => '弓',
  75507. '⼹' => '�',
  75508. '⼺' => '彡',
  75509. 'â¼»' => 'å½³',
  75510. '⼼' => '心',
  75511. '⼽' => '戈',
  75512. '⼾' => '戶',
  75513. '⼿' => '手',
  75514. '⽀' => '支',
  75515. '�' => '攴',
  75516. '⽂' => '文',
  75517. '⽃' => '斗',
  75518. '⽄' => '斤',
  75519. 'â½…' => 'æ–¹',
  75520. '⽆' => '无',
  75521. '⽇' => '日',
  75522. '⽈' => '曰',
  75523. '⽉' => '月',
  75524. '⽊' => '木',
  75525. '⽋' => '欠',
  75526. '⽌' => '止',
  75527. '�' => '歹',
  75528. '⽎' => '殳',
  75529. '�' => '毋',
  75530. '�' => '比',
  75531. '⽑' => '毛',
  75532. 'â½’' => 'æ°�',
  75533. '⽓' => '气',
  75534. 'â½”' => 'æ°´',
  75535. '⽕' => '�',
  75536. '⽖' => '爪',
  75537. '⽗' => '父',
  75538. '⽘' => '爻',
  75539. '⽙' => '爿',
  75540. '⽚' => '片',
  75541. '⽛' => '牙',
  75542. '⽜' => '牛',
  75543. '�' => '犬',
  75544. '⽞' => '玄',
  75545. '⽟' => '玉',
  75546. '⽠' => '瓜',
  75547. '⽡' => '瓦',
  75548. '⽢' => '甘',
  75549. '⽣' => '生',
  75550. '⽤' => '用',
  75551. 'â½¥' => 'ç”°',
  75552. '⽦' => '疋',
  75553. '⽧' => '疒',
  75554. '⽨' => '癶',
  75555. '⽩' => '白',
  75556. '⽪' => '皮',
  75557. '⽫' => '皿',
  75558. '⽬' => '目',
  75559. '⽭' => '矛',
  75560. '⽮' => '矢',
  75561. '⽯' => '石',
  75562. '⽰' => '示',
  75563. '⽱' => '禸',
  75564. '⽲' => '禾',
  75565. 'â½³' => 'ç©´',
  75566. 'â½´' => 'ç«‹',
  75567. '⽵' => '竹',
  75568. '⽶' => '米',
  75569. '⽷' => '糸',
  75570. '⽸' => '缶',
  75571. '⽹' => '网',
  75572. '⽺' => '羊',
  75573. 'â½»' => 'ç¾½',
  75574. '⽼' => '�',
  75575. '⽽' => '而',
  75576. '⽾' => '耒',
  75577. '⽿' => '耳',
  75578. '⾀' => '�',
  75579. '�' => '肉',
  75580. '⾂' => '臣',
  75581. '⾃' => '自',
  75582. '⾄' => '至',
  75583. '⾅' => '臼',
  75584. '⾆' => '舌',
  75585. '⾇' => '舛',
  75586. '⾈' => '舟',
  75587. '⾉' => '艮',
  75588. '⾊' => '色',
  75589. '⾋' => '艸',
  75590. '⾌' => '�',
  75591. '�' => '虫',
  75592. '⾎' => '血',
  75593. '�' => '行',
  75594. '�' => '衣',
  75595. '⾑' => '襾',
  75596. '⾒' => '見',
  75597. '⾓' => '角',
  75598. '⾔' => '言',
  75599. '⾕' => '谷',
  75600. '⾖' => '豆',
  75601. '⾗' => '豕',
  75602. '⾘' => '豸',
  75603. '⾙' => '�',
  75604. '⾚' => '赤',
  75605. 'â¾›' => 'èµ°',
  75606. '⾜' => '足',
  75607. '�' => '身',
  75608. '⾞' => '車',
  75609. '⾟' => '辛',
  75610. 'â¾ ' => 'è¾°',
  75611. '⾡' => '辵',
  75612. 'â¾¢' => 'é‚‘',
  75613. 'â¾£' => 'é…‰',
  75614. '⾤' => '釆',
  75615. '⾥' => '里',
  75616. '⾦' => '金',
  75617. '⾧' => '長',
  75618. '⾨' => '門',
  75619. '⾩' => '阜',
  75620. '⾪' => '隶',
  75621. '⾫' => '隹',
  75622. '⾬' => '雨',
  75623. '⾭' => '�',
  75624. '⾮' => '�',
  75625. '⾯' => '�',
  75626. '⾰' => '�',
  75627. '⾱' => '韋',
  75628. '⾲' => '韭',
  75629. '⾳' => '音',
  75630. 'â¾´' => 'é �',
  75631. '⾵' => '風',
  75632. '⾶' => '飛',
  75633. '⾷' => '食',
  75634. '⾸' => '首',
  75635. '⾹' => '香',
  75636. '⾺' => '馬',
  75637. '⾻' => '骨',
  75638. '⾼' => '高',
  75639. 'â¾½' => 'é«Ÿ',
  75640. '⾾' => '鬥',
  75641. '⾿' => '鬯',
  75642. '⿀' => '鬲',
  75643. '�' => '鬼',
  75644. 'â¿‚' => 'é­š',
  75645. '⿃' => '鳥',
  75646. 'â¿„' => 'é¹µ',
  75647. '⿅' => '鹿',
  75648. '⿆' => '麥',
  75649. '⿇' => '麻',
  75650. '⿈' => '黃',
  75651. '⿉' => '�',
  75652. '⿊' => '黑',
  75653. '⿋' => '黹',
  75654. '⿌' => '黽',
  75655. '�' => '鼎',
  75656. '⿎' => '鼓',
  75657. '�' => '鼠',
  75658. '�' => '鼻',
  75659. '⿑' => '齊',
  75660. 'â¿’' => 'é½’',
  75661. '⿓' => '�',
  75662. '⿔' => '龜',
  75663. 'â¿•' => 'é¾ ',
  75664. ' ' => ' ',
  75665. '〶' => '〒',
  75666. '〸' => '�',
  75667. '〹' => '�',
  75668. '〺' => '�',
  75669. 'ã‚›' => ' ã‚™',
  75670. '゜' => ' ゚',
  75671. 'ゟ' => 'より',
  75672. 'ヿ' => 'コト',
  75673. 'ㄱ' => 'ᄀ',
  75674. 'ㄲ' => '�',
  75675. 'ㄳ' => 'ᆪ',
  75676. 'ã„´' => 'á„‚',
  75677. 'ㄵ' => 'ᆬ',
  75678. 'ㄶ' => 'ᆭ',
  75679. 'ㄷ' => 'ᄃ',
  75680. 'ㄸ' => 'ᄄ',
  75681. 'ㄹ' => 'ᄅ',
  75682. 'ㄺ' => 'ᆰ',
  75683. 'ㄻ' => 'ᆱ',
  75684. 'ㄼ' => 'ᆲ',
  75685. 'ㄽ' => 'ᆳ',
  75686. 'ㄾ' => 'ᆴ',
  75687. 'ㄿ' => 'ᆵ',
  75688. 'ã…€' => 'á„š',
  75689. '�' => 'ᄆ',
  75690. 'ㅂ' => 'ᄇ',
  75691. 'ㅃ' => 'ᄈ',
  75692. 'ã…„' => 'á„¡',
  75693. 'ㅅ' => 'ᄉ',
  75694. 'ã…†' => 'á„Š',
  75695. 'ã…‡' => 'á„‹',
  75696. 'ㅈ' => 'ᄌ',
  75697. 'ㅉ' => '�',
  75698. 'ã…Š' => 'á„Ž',
  75699. 'ㅋ' => '�',
  75700. 'ㅌ' => '�',
  75701. 'ã…�' => 'á„‘',
  75702. 'ã…Ž' => 'á„’',
  75703. 'ã…�' => 'á…¡',
  75704. 'ã…�' => 'á…¢',
  75705. 'ã…‘' => 'á…£',
  75706. 'ã…’' => 'á…¤',
  75707. 'ã…“' => 'á…¥',
  75708. 'ã…”' => 'á…¦',
  75709. 'ã…•' => 'á…§',
  75710. 'ã…–' => 'á…¨',
  75711. 'ã…—' => 'á…©',
  75712. 'ã…˜' => 'á…ª',
  75713. 'ã…™' => 'á…«',
  75714. 'ã…š' => 'á…¬',
  75715. 'ã…›' => 'á…­',
  75716. 'ㅜ' => 'ᅮ',
  75717. 'ã…�' => 'á…¯',
  75718. 'ã…ž' => 'á…°',
  75719. 'ã…Ÿ' => 'á…±',
  75720. 'ã… ' => 'á…²',
  75721. 'ã…¡' => 'á…³',
  75722. 'ã…¢' => 'á…´',
  75723. 'ã…£' => 'á…µ',
  75724. 'ã…¤' => 'á… ',
  75725. 'ã…¥' => 'á„”',
  75726. 'ã…¦' => 'á„•',
  75727. 'ㅧ' => 'ᇇ',
  75728. 'ㅨ' => 'ᇈ',
  75729. 'ㅩ' => 'ᇌ',
  75730. 'ㅪ' => 'ᇎ',
  75731. 'ㅫ' => 'ᇓ',
  75732. 'ㅬ' => 'ᇗ',
  75733. 'ㅭ' => 'ᇙ',
  75734. 'ㅮ' => 'ᄜ',
  75735. 'ㅯ' => '�',
  75736. 'ㅰ' => 'ᇟ',
  75737. 'ㅱ' => '�',
  75738. 'ã…²' => 'á„ž',
  75739. 'ã…³' => 'á„ ',
  75740. 'ã…´' => 'á„¢',
  75741. 'ã…µ' => 'á„£',
  75742. 'ㅶ' => 'ᄧ',
  75743. 'ã…·' => 'á„©',
  75744. 'ã…¸' => 'á„«',
  75745. 'ㅹ' => 'ᄬ',
  75746. 'ã…º' => 'á„­',
  75747. 'ã…»' => 'á„®',
  75748. 'ㅼ' => 'ᄯ',
  75749. 'ㅽ' => 'ᄲ',
  75750. 'ㅾ' => 'ᄶ',
  75751. 'ã…¿' => 'á…€',
  75752. 'ㆀ' => 'ᅇ',
  75753. '�' => 'ᅌ',
  75754. 'ㆂ' => 'ᇱ',
  75755. 'ㆃ' => 'ᇲ',
  75756. 'ㆄ' => 'ᅗ',
  75757. 'ㆅ' => 'ᅘ',
  75758. 'ㆆ' => 'ᅙ',
  75759. 'ㆇ' => 'ᆄ',
  75760. 'ㆈ' => 'ᆅ',
  75761. 'ㆉ' => 'ᆈ',
  75762. 'ㆊ' => 'ᆑ',
  75763. 'ㆋ' => 'ᆒ',
  75764. 'ㆌ' => 'ᆔ',
  75765. '�' => 'ᆞ',
  75766. 'ㆎ' => 'ᆡ',
  75767. '㆒' => '一',
  75768. '㆓' => '二',
  75769. '㆔' => '三',
  75770. '㆕' => '四',
  75771. '㆖' => '上',
  75772. '㆗' => '中',
  75773. '㆘' => '下',
  75774. '㆙' => '甲',
  75775. '㆚' => '乙',
  75776. '㆛' => '丙',
  75777. '㆜' => '�',
  75778. '�' => '天',
  75779. '㆞' => '地',
  75780. '㆟' => '人',
  75781. '㈀' => '(ᄀ)',
  75782. '�' => '(ᄂ)',
  75783. '㈂' => '(ᄃ)',
  75784. '㈃' => '(ᄅ)',
  75785. '㈄' => '(ᄆ)',
  75786. '㈅' => '(ᄇ)',
  75787. '㈆' => '(ᄉ)',
  75788. '㈇' => '(ᄋ)',
  75789. '㈈' => '(ᄌ)',
  75790. '㈉' => '(ᄎ)',
  75791. '㈊' => '(�)',
  75792. '㈋' => '(�)',
  75793. '㈌' => '(ᄑ)',
  75794. '�' => '(ᄒ)',
  75795. '㈎' => '(가)',
  75796. '�' => '(나)',
  75797. '�' => '(다)',
  75798. '㈑' => '(라)',
  75799. '㈒' => '(마)',
  75800. '㈓' => '(바)',
  75801. '㈔' => '(사)',
  75802. '㈕' => '(아)',
  75803. '㈖' => '(자)',
  75804. '㈗' => '(차)',
  75805. '㈘' => '(�ᅡ)',
  75806. '㈙' => '(�ᅡ)',
  75807. '㈚' => '(파)',
  75808. '㈛' => '(하)',
  75809. '㈜' => '(주)',
  75810. '�' => '(오전)',
  75811. '㈞' => '(오후)',
  75812. '㈠' => '(一)',
  75813. '㈡' => '(二)',
  75814. '㈢' => '(三)',
  75815. '㈣' => '(四)',
  75816. '㈤' => '(五)',
  75817. '㈥' => '(六)',
  75818. '㈦' => '(七)',
  75819. '㈧' => '(八)',
  75820. '㈨' => '(�)',
  75821. '㈩' => '(�)',
  75822. '㈪' => '(月)',
  75823. '㈫' => '(�)',
  75824. '㈬' => '(水)',
  75825. '㈭' => '(木)',
  75826. '㈮' => '(金)',
  75827. '㈯' => '(土)',
  75828. '㈰' => '(日)',
  75829. '㈱' => '(株)',
  75830. '㈲' => '(有)',
  75831. '㈳' => '(社)',
  75832. '㈴' => '(�)',
  75833. '㈵' => '(特)',
  75834. '㈶' => '(財)',
  75835. '㈷' => '(�)',
  75836. '㈸' => '(労)',
  75837. '㈹' => '(代)',
  75838. '㈺' => '(呼)',
  75839. '㈻' => '(学)',
  75840. '㈼' => '(監)',
  75841. '㈽' => '(�)',
  75842. '㈾' => '(資)',
  75843. '㈿' => '(�)',
  75844. '㉀' => '(祭)',
  75845. '�' => '(休)',
  75846. '㉂' => '(自)',
  75847. '㉃' => '(至)',
  75848. '㉄' => '�',
  75849. '㉅' => '幼',
  75850. '㉆' => '文',
  75851. '㉇' => '�',
  75852. '�' => 'PTE',
  75853. '㉑' => '21',
  75854. '㉒' => '22',
  75855. '㉓' => '23',
  75856. '㉔' => '24',
  75857. '㉕' => '25',
  75858. '㉖' => '26',
  75859. '㉗' => '27',
  75860. '㉘' => '28',
  75861. '㉙' => '29',
  75862. '㉚' => '30',
  75863. '㉛' => '31',
  75864. '㉜' => '32',
  75865. '�' => '33',
  75866. '㉞' => '34',
  75867. '㉟' => '35',
  75868. '㉠' => 'ᄀ',
  75869. '㉡' => 'ᄂ',
  75870. '㉢' => 'ᄃ',
  75871. '㉣' => 'ᄅ',
  75872. '㉤' => 'ᄆ',
  75873. '㉥' => 'ᄇ',
  75874. '㉦' => 'ᄉ',
  75875. '㉧' => 'ᄋ',
  75876. '㉨' => 'ᄌ',
  75877. '㉩' => 'ᄎ',
  75878. '㉪' => '�',
  75879. '㉫' => '�',
  75880. '㉬' => 'ᄑ',
  75881. '㉭' => 'ᄒ',
  75882. '㉮' => '가',
  75883. '㉯' => '나',
  75884. '㉰' => '다',
  75885. '㉱' => '라',
  75886. '㉲' => '마',
  75887. '㉳' => '바',
  75888. '㉴' => '사',
  75889. '㉵' => '아',
  75890. '㉶' => '자',
  75891. '㉷' => '차',
  75892. '㉸' => '�ᅡ',
  75893. '㉹' => '�ᅡ',
  75894. '㉺' => '파',
  75895. '㉻' => '하',
  75896. '㉼' => '참고',
  75897. '㉽' => '주의',
  75898. '㉾' => '우',
  75899. '㊀' => '一',
  75900. '�' => '二',
  75901. '㊂' => '三',
  75902. '㊃' => '四',
  75903. '㊄' => '五',
  75904. '㊅' => '六',
  75905. '㊆' => '七',
  75906. '㊇' => '八',
  75907. '㊈' => '�',
  75908. '㊉' => '�',
  75909. '㊊' => '月',
  75910. '㊋' => '�',
  75911. '㊌' => '水',
  75912. '�' => '木',
  75913. '㊎' => '金',
  75914. '�' => '土',
  75915. '�' => '日',
  75916. '㊑' => '株',
  75917. '㊒' => '有',
  75918. '㊓' => '社',
  75919. '㊔' => '�',
  75920. '㊕' => '特',
  75921. '㊖' => '財',
  75922. '㊗' => '�',
  75923. '㊘' => '労',
  75924. '㊙' => '秘',
  75925. '㊚' => '男',
  75926. '㊛' => '女',
  75927. '㊜' => '�',
  75928. '�' => '優',
  75929. '㊞' => '�',
  75930. '㊟' => '注',
  75931. '㊠' => '項',
  75932. '㊡' => '休',
  75933. '㊢' => '写',
  75934. '㊣' => '正',
  75935. '㊤' => '上',
  75936. '㊥' => '中',
  75937. '㊦' => '下',
  75938. '㊧' => '左',
  75939. '㊨' => '�',
  75940. '㊩' => '医',
  75941. '㊪' => '宗',
  75942. '㊫' => '学',
  75943. '㊬' => '監',
  75944. '㊭' => '�',
  75945. '㊮' => '資',
  75946. '㊯' => '�',
  75947. '㊰' => '夜',
  75948. '㊱' => '36',
  75949. '㊲' => '37',
  75950. '㊳' => '38',
  75951. '㊴' => '39',
  75952. '㊵' => '40',
  75953. '㊶' => '41',
  75954. '㊷' => '42',
  75955. '㊸' => '43',
  75956. '㊹' => '44',
  75957. '㊺' => '45',
  75958. '㊻' => '46',
  75959. '㊼' => '47',
  75960. '㊽' => '48',
  75961. '㊾' => '49',
  75962. '㊿' => '50',
  75963. '㋀' => '1月',
  75964. '�' => '2月',
  75965. '㋂' => '3月',
  75966. '㋃' => '4月',
  75967. '㋄' => '5月',
  75968. '㋅' => '6月',
  75969. '㋆' => '7月',
  75970. '㋇' => '8月',
  75971. '㋈' => '9月',
  75972. '㋉' => '10月',
  75973. '㋊' => '11月',
  75974. '㋋' => '12月',
  75975. '㋌' => 'Hg',
  75976. '�' => 'erg',
  75977. 'ã‹Ž' => 'eV',
  75978. '�' => 'LTD',
  75979. '�' => 'ア',
  75980. '㋑' => 'イ',
  75981. '㋒' => 'ウ',
  75982. '㋓' => 'エ',
  75983. '㋔' => 'オ',
  75984. 'ã‹•' => 'ã‚«',
  75985. 'ã‹–' => 'ã‚­',
  75986. '㋗' => 'ク',
  75987. '㋘' => 'ケ',
  75988. '㋙' => 'コ',
  75989. '㋚' => 'サ',
  75990. 'ã‹›' => 'ã‚·',
  75991. '㋜' => 'ス',
  75992. '�' => 'セ',
  75993. '㋞' => 'ソ',
  75994. 'ã‹Ÿ' => 'ã‚¿',
  75995. '㋠' => '�',
  75996. '㋡' => 'ツ',
  75997. '㋢' => 'テ',
  75998. '㋣' => 'ト',
  75999. '㋤' => 'ナ',
  76000. '㋥' => 'ニ',
  76001. '㋦' => 'ヌ',
  76002. '㋧' => '�',
  76003. '㋨' => 'ノ',
  76004. '㋩' => '�',
  76005. '㋪' => 'ヒ',
  76006. '㋫' => 'フ',
  76007. '㋬' => 'ヘ',
  76008. '㋭' => 'ホ',
  76009. '㋮' => 'マ',
  76010. '㋯' => 'ミ',
  76011. '㋰' => 'ム',
  76012. '㋱' => 'メ',
  76013. '㋲' => 'モ',
  76014. '㋳' => 'ヤ',
  76015. '㋴' => 'ユ',
  76016. '㋵' => 'ヨ',
  76017. '㋶' => 'ラ',
  76018. '㋷' => 'リ',
  76019. '㋸' => 'ル',
  76020. '㋹' => 'レ',
  76021. '㋺' => 'ロ',
  76022. '㋻' => 'ワ',
  76023. '㋼' => 'ヰ',
  76024. '㋽' => 'ヱ',
  76025. '㋾' => 'ヲ',
  76026. '㋿' => '令和',
  76027. '㌀' => 'ア�゚ート',
  76028. '�' => 'アルファ',
  76029. '㌂' => 'アンペア',
  76030. '㌃' => 'アール',
  76031. '㌄' => 'イニング',
  76032. '㌅' => 'イン�',
  76033. '㌆' => 'ウォン',
  76034. '㌇' => 'エスクード',
  76035. '㌈' => 'エーカー',
  76036. '㌉' => 'オンス',
  76037. '㌊' => 'オーム',
  76038. '㌋' => 'カイリ',
  76039. '㌌' => 'カラット',
  76040. '�' => 'カロリー',
  76041. '㌎' => 'ガロン',
  76042. '�' => 'ガンマ',
  76043. '�' => 'ギガ',
  76044. '㌑' => 'ギニー',
  76045. '㌒' => 'キュリー',
  76046. '㌓' => 'ギルダー',
  76047. '㌔' => 'キロ',
  76048. '㌕' => 'キログラム',
  76049. '㌖' => 'キロメートル',
  76050. '㌗' => 'キロワット',
  76051. '㌘' => 'グラム',
  76052. '㌙' => 'グラムトン',
  76053. '㌚' => 'クルゼイロ',
  76054. '㌛' => 'クロー�',
  76055. '㌜' => 'ケース',
  76056. '�' => 'コルナ',
  76057. '㌞' => 'コーポ',
  76058. '㌟' => 'サイクル',
  76059. '㌠' => 'サン�ーム',
  76060. '㌡' => 'シリング',
  76061. '㌢' => 'セン�',
  76062. '㌣' => 'セント',
  76063. '㌤' => 'ダース',
  76064. '㌥' => 'デシ',
  76065. '㌦' => 'ドル',
  76066. '㌧' => 'トン',
  76067. '㌨' => 'ナノ',
  76068. '㌩' => 'ノット',
  76069. '㌪' => '�イツ',
  76070. '㌫' => '�゚ーセント',
  76071. '㌬' => '�゚ーツ',
  76072. '㌭' => '�゙ーレル',
  76073. '㌮' => 'ピアストル',
  76074. '㌯' => 'ピクル',
  76075. '㌰' => 'ピコ',
  76076. '㌱' => 'ビル',
  76077. '㌲' => 'ファラッド',
  76078. '㌳' => 'フィート',
  76079. '㌴' => 'ブッシェル',
  76080. '㌵' => 'フラン',
  76081. '㌶' => 'ヘクタール',
  76082. '㌷' => 'ペソ',
  76083. '㌸' => 'ペニヒ',
  76084. '㌹' => 'ヘルツ',
  76085. '㌺' => 'ペンス',
  76086. '㌻' => 'ページ',
  76087. '㌼' => 'ベータ',
  76088. '㌽' => 'ポイント',
  76089. '㌾' => 'ボルト',
  76090. '㌿' => 'ホン',
  76091. '�' => 'ポンド',
  76092. '�' => 'ホール',
  76093. '�' => 'ホーン',
  76094. '�' => 'マイクロ',
  76095. '�' => 'マイル',
  76096. '�' => 'マッ�',
  76097. '�' => 'マルク',
  76098. '�' => 'マンション',
  76099. '�' => 'ミクロン',
  76100. '�' => 'ミリ',
  76101. '�' => 'ミリ�゙ール',
  76102. '�' => 'メガ',
  76103. '�' => 'メガトン',
  76104. '�' => 'メートル',
  76105. '�' => 'ヤード',
  76106. '�' => 'ヤール',
  76107. '�' => 'ユアン',
  76108. '�' => 'リットル',
  76109. '�' => 'リラ',
  76110. '�' => 'ルピー',
  76111. '�' => 'ルーブル',
  76112. '�' => 'レム',
  76113. '�' => 'レントゲン',
  76114. '�' => 'ワット',
  76115. '�' => '0点',
  76116. '�' => '1点',
  76117. '�' => '2点',
  76118. '�' => '3点',
  76119. '�' => '4点',
  76120. '�' => '5点',
  76121. '�' => '6点',
  76122. '�' => '7点',
  76123. '�' => '8点',
  76124. '�' => '9点',
  76125. '�' => '10点',
  76126. '�' => '11点',
  76127. '�' => '12点',
  76128. '�' => '13点',
  76129. '�' => '14点',
  76130. '�' => '15点',
  76131. '�' => '16点',
  76132. '�' => '17点',
  76133. '�' => '18点',
  76134. '�' => '19点',
  76135. '�' => '20点',
  76136. '�' => '21点',
  76137. '�' => '22点',
  76138. '�' => '23点',
  76139. '�' => '24点',
  76140. '�' => 'hPa',
  76141. '�' => 'da',
  76142. '�' => 'AU',
  76143. '�' => 'bar',
  76144. '�' => 'oV',
  76145. '�' => 'pc',
  76146. '�' => 'dm',
  76147. '�' => 'dm2',
  76148. '�' => 'dm3',
  76149. '�' => 'IU',
  76150. '�' => '平�',
  76151. '�' => '昭和',
  76152. '�' => '大正',
  76153. '�' => '明治',
  76154. '�' => '株�会社',
  76155. '㎀' => 'pA',
  76156. '�' => 'nA',
  76157. '㎂' => 'μA',
  76158. '㎃' => 'mA',
  76159. '㎄' => 'kA',
  76160. '㎅' => 'KB',
  76161. '㎆' => 'MB',
  76162. '㎇' => 'GB',
  76163. '㎈' => 'cal',
  76164. '㎉' => 'kcal',
  76165. '㎊' => 'pF',
  76166. '㎋' => 'nF',
  76167. '㎌' => 'μF',
  76168. '�' => 'μg',
  76169. '㎎' => 'mg',
  76170. '�' => 'kg',
  76171. '�' => 'Hz',
  76172. '㎑' => 'kHz',
  76173. '㎒' => 'MHz',
  76174. '㎓' => 'GHz',
  76175. '㎔' => 'THz',
  76176. '㎕' => 'μl',
  76177. '㎖' => 'ml',
  76178. '㎗' => 'dl',
  76179. '㎘' => 'kl',
  76180. '㎙' => 'fm',
  76181. '㎚' => 'nm',
  76182. '㎛' => 'μm',
  76183. '㎜' => 'mm',
  76184. '�' => 'cm',
  76185. '㎞' => 'km',
  76186. '㎟' => 'mm2',
  76187. '㎠' => 'cm2',
  76188. '㎡' => 'm2',
  76189. '㎢' => 'km2',
  76190. '㎣' => 'mm3',
  76191. '㎤' => 'cm3',
  76192. '㎥' => 'm3',
  76193. '㎦' => 'km3',
  76194. '㎧' => 'm∕s',
  76195. '㎨' => 'm∕s2',
  76196. '㎩' => 'Pa',
  76197. '㎪' => 'kPa',
  76198. '㎫' => 'MPa',
  76199. '㎬' => 'GPa',
  76200. '㎭' => 'rad',
  76201. '㎮' => 'rad∕s',
  76202. '㎯' => 'rad∕s2',
  76203. '㎰' => 'ps',
  76204. '㎱' => 'ns',
  76205. '㎲' => 'μs',
  76206. '㎳' => 'ms',
  76207. '㎴' => 'pV',
  76208. '㎵' => 'nV',
  76209. '㎶' => 'μV',
  76210. '㎷' => 'mV',
  76211. '㎸' => 'kV',
  76212. '㎹' => 'MV',
  76213. '㎺' => 'pW',
  76214. '㎻' => 'nW',
  76215. '㎼' => 'μW',
  76216. '㎽' => 'mW',
  76217. '㎾' => 'kW',
  76218. '㎿' => 'MW',
  76219. '�' => 'kΩ',
  76220. '�' => 'MΩ',
  76221. '�' => 'a.m.',
  76222. '�' => 'Bq',
  76223. '�' => 'cc',
  76224. '�' => 'cd',
  76225. '�' => 'C∕kg',
  76226. '�' => 'Co.',
  76227. '�' => 'dB',
  76228. '�' => 'Gy',
  76229. '�' => 'ha',
  76230. '�' => 'HP',
  76231. '�' => 'in',
  76232. '�' => 'KK',
  76233. '�' => 'KM',
  76234. '�' => 'kt',
  76235. '�' => 'lm',
  76236. '�' => 'ln',
  76237. '�' => 'log',
  76238. '�' => 'lx',
  76239. '�' => 'mb',
  76240. '�' => 'mil',
  76241. '�' => 'mol',
  76242. '�' => 'PH',
  76243. '�' => 'p.m.',
  76244. '�' => 'PPM',
  76245. '�' => 'PR',
  76246. '�' => 'sr',
  76247. '�' => 'Sv',
  76248. '�' => 'Wb',
  76249. '�' => 'V∕m',
  76250. '�' => 'A∕m',
  76251. '�' => '1日',
  76252. '�' => '2日',
  76253. '�' => '3日',
  76254. '�' => '4日',
  76255. '�' => '5日',
  76256. '�' => '6日',
  76257. '�' => '7日',
  76258. '�' => '8日',
  76259. '�' => '9日',
  76260. '�' => '10日',
  76261. '�' => '11日',
  76262. '�' => '12日',
  76263. '�' => '13日',
  76264. '�' => '14日',
  76265. '�' => '15日',
  76266. '�' => '16日',
  76267. '�' => '17日',
  76268. '�' => '18日',
  76269. '�' => '19日',
  76270. '�' => '20日',
  76271. '�' => '21日',
  76272. '�' => '22日',
  76273. '�' => '23日',
  76274. '�' => '24日',
  76275. '�' => '25日',
  76276. '�' => '26日',
  76277. '�' => '27日',
  76278. '�' => '28日',
  76279. '�' => '29日',
  76280. '�' => '30日',
  76281. '�' => '31日',
  76282. '�' => 'gal',
  76283. 'ꚜ' => 'ъ',
  76284. '�' => 'ь',
  76285. '�' => '�',
  76286. 'ꟸ' => 'Ħ',
  76287. 'ꟹ' => 'œ',
  76288. 'ꭜ' => 'ꜧ',
  76289. '�' => 'ꬷ',
  76290. 'ê­ž' => 'É«',
  76291. 'ê­Ÿ' => 'ê­’',
  76292. 'ꭩ' => '�',
  76293. 'ff' => 'ff',
  76294. '�' => 'fi',
  76295. 'fl' => 'fl',
  76296. 'ffi' => 'ffi',
  76297. 'ffl' => 'ffl',
  76298. 'ſt' => 'st',
  76299. 'st' => 'st',
  76300. 'ﬓ' => 'մն',
  76301. 'ﬔ' => 'մե',
  76302. 'ﬕ' => 'մի',
  76303. 'ﬖ' => 'վն',
  76304. 'ﬗ' => 'մխ',
  76305. 'ﬠ' => 'ע',
  76306. 'ﬡ' => '�',
  76307. 'ﬢ' => 'ד',
  76308. 'ﬣ' => 'ה',
  76309. 'ﬤ' => 'כ',
  76310. 'ﬥ' => 'ל',
  76311. 'ﬦ' => '�',
  76312. 'ﬧ' => 'ר',
  76313. 'ﬨ' => 'ת',
  76314. '﬩' => '+',
  76315. '�' => '�ל',
  76316. 'ï­�' => 'Ù±',
  76317. 'ï­‘' => 'Ù±',
  76318. 'ï­’' => 'Ù»',
  76319. 'ï­“' => 'Ù»',
  76320. 'ï­”' => 'Ù»',
  76321. 'ï­•' => 'Ù»',
  76322. 'ï­–' => 'Ù¾',
  76323. 'ï­—' => 'Ù¾',
  76324. 'ï­˜' => 'Ù¾',
  76325. 'ï­™' => 'Ù¾',
  76326. 'ï­š' => 'Ú€',
  76327. 'ï­›' => 'Ú€',
  76328. 'ﭜ' => 'ڀ',
  76329. 'ï­�' => 'Ú€',
  76330. 'ï­ž' => 'Ùº',
  76331. 'ï­Ÿ' => 'Ùº',
  76332. 'ï­ ' => 'Ùº',
  76333. 'ï­¡' => 'Ùº',
  76334. 'ï­¢' => 'Ù¿',
  76335. 'ï­£' => 'Ù¿',
  76336. 'ï­¤' => 'Ù¿',
  76337. 'ï­¥' => 'Ù¿',
  76338. 'ï­¦' => 'Ù¹',
  76339. 'ï­§' => 'Ù¹',
  76340. 'ï­¨' => 'Ù¹',
  76341. 'ï­©' => 'Ù¹',
  76342. 'ï­ª' => 'Ú¤',
  76343. 'ï­«' => 'Ú¤',
  76344. 'ï­¬' => 'Ú¤',
  76345. 'ï­­' => 'Ú¤',
  76346. 'ï­®' => 'Ú¦',
  76347. 'ï­¯' => 'Ú¦',
  76348. 'ï­°' => 'Ú¦',
  76349. 'ï­±' => 'Ú¦',
  76350. 'ï­²' => 'Ú„',
  76351. 'ï­³' => 'Ú„',
  76352. 'ï­´' => 'Ú„',
  76353. 'ï­µ' => 'Ú„',
  76354. 'ï­¶' => 'Úƒ',
  76355. 'ï­·' => 'Úƒ',
  76356. 'ï­¸' => 'Úƒ',
  76357. 'ï­¹' => 'Úƒ',
  76358. 'ï­º' => 'Ú†',
  76359. 'ï­»' => 'Ú†',
  76360. 'ï­¼' => 'Ú†',
  76361. 'ï­½' => 'Ú†',
  76362. 'ï­¾' => 'Ú‡',
  76363. 'ï­¿' => 'Ú‡',
  76364. 'ﮀ' => 'ڇ',
  76365. '�' => 'ڇ',
  76366. 'ﮂ' => '�',
  76367. 'ﮃ' => '�',
  76368. 'ﮄ' => 'ڌ',
  76369. 'ﮅ' => 'ڌ',
  76370. 'ﮆ' => 'ڎ',
  76371. 'ﮇ' => 'ڎ',
  76372. 'ﮈ' => 'ڈ',
  76373. 'ﮉ' => 'ڈ',
  76374. 'ﮊ' => 'ژ',
  76375. 'ﮋ' => 'ژ',
  76376. 'ﮌ' => 'ڑ',
  76377. '�' => 'ڑ',
  76378. 'ﮎ' => 'ک',
  76379. '�' => 'ک',
  76380. '�' => 'ک',
  76381. 'ﮑ' => 'ک',
  76382. 'ï®’' => 'Ú¯',
  76383. 'ﮓ' => 'گ',
  76384. 'ï®”' => 'Ú¯',
  76385. 'ﮕ' => 'گ',
  76386. 'ï®–' => 'Ú³',
  76387. 'ï®—' => 'Ú³',
  76388. 'ﮘ' => 'ڳ',
  76389. 'ï®™' => 'Ú³',
  76390. 'ﮚ' => 'ڱ',
  76391. 'ï®›' => 'Ú±',
  76392. 'ﮜ' => 'ڱ',
  76393. '�' => 'ڱ',
  76394. 'ﮞ' => 'ں',
  76395. 'ﮟ' => 'ں',
  76396. 'ï® ' => 'Ú»',
  76397. 'ﮡ' => 'ڻ',
  76398. 'ﮢ' => 'ڻ',
  76399. 'ﮣ' => 'ڻ',
  76400. 'ﮤ' => 'ۀ',
  76401. 'ﮥ' => 'ۀ',
  76402. 'ﮦ' => '�',
  76403. 'ﮧ' => '�',
  76404. 'ﮨ' => '�',
  76405. 'ﮩ' => '�',
  76406. 'ﮪ' => 'ھ',
  76407. 'ﮫ' => 'ھ',
  76408. 'ﮬ' => 'ھ',
  76409. 'ï®­' => 'Ú¾',
  76410. 'ï®®' => 'Û’',
  76411. 'ﮯ' => 'ے',
  76412. 'ï®°' => 'Û’Ù”',
  76413. 'ï®±' => 'Û’Ù”',
  76414. 'ﯓ' => 'ڭ',
  76415. 'ﯔ' => 'ڭ',
  76416. 'ﯕ' => 'ڭ',
  76417. 'ﯖ' => 'ڭ',
  76418. 'ﯗ' => 'ۇ',
  76419. 'ﯘ' => 'ۇ',
  76420. 'ﯙ' => 'ۆ',
  76421. 'ﯚ' => 'ۆ',
  76422. 'ﯛ' => 'ۈ',
  76423. 'ﯜ' => 'ۈ',
  76424. '�' => 'ۇٴ',
  76425. 'ﯞ' => 'ۋ',
  76426. 'ﯟ' => 'ۋ',
  76427. 'ﯠ' => 'ۅ',
  76428. 'ﯡ' => 'ۅ',
  76429. 'ﯢ' => 'ۉ',
  76430. 'ﯣ' => 'ۉ',
  76431. 'ﯤ' => '�',
  76432. 'ﯥ' => '�',
  76433. 'ﯦ' => '�',
  76434. 'ﯧ' => '�',
  76435. 'ﯨ' => 'ى',
  76436. 'ﯩ' => 'ى',
  76437. 'ﯪ' => 'ئا',
  76438. 'ﯫ' => 'ئا',
  76439. 'ﯬ' => 'ئە',
  76440. 'ﯭ' => 'ئە',
  76441. 'ﯮ' => 'ئو',
  76442. 'ﯯ' => 'ئو',
  76443. 'ﯰ' => 'ئۇ',
  76444. 'ﯱ' => 'ئۇ',
  76445. 'ﯲ' => 'ئۆ',
  76446. 'ﯳ' => 'ئۆ',
  76447. 'ﯴ' => 'ئۈ',
  76448. 'ﯵ' => 'ئۈ',
  76449. 'ﯶ' => 'ئ�',
  76450. 'ﯷ' => 'ئ�',
  76451. 'ﯸ' => 'ئ�',
  76452. 'ﯹ' => 'ئى',
  76453. 'ﯺ' => 'ئى',
  76454. 'ﯻ' => 'ئى',
  76455. 'ﯼ' => 'ی',
  76456. 'ﯽ' => 'ی',
  76457. 'ﯾ' => 'ی',
  76458. 'ﯿ' => 'ی',
  76459. 'ﰀ' => 'ئج',
  76460. '�' => 'ئح',
  76461. 'ï°‚' => 'ÙŠÙ”Ù…',
  76462. 'ï°ƒ' => 'ÙŠÙ”Ù‰',
  76463. 'ï°„' => 'ÙŠÙ”ÙŠ',
  76464. 'ﰅ' => 'بج',
  76465. 'ﰆ' => 'بح',
  76466. 'ﰇ' => 'بخ',
  76467. 'ﰈ' => 'بم',
  76468. 'ﰉ' => 'بى',
  76469. 'ﰊ' => 'بي',
  76470. 'ﰋ' => 'تج',
  76471. 'ﰌ' => 'تح',
  76472. '�' => 'تخ',
  76473. 'ﰎ' => 'تم',
  76474. '�' => 'تى',
  76475. '�' => 'تي',
  76476. 'ﰑ' => 'ثج',
  76477. 'ﰒ' => 'ثم',
  76478. 'ﰓ' => 'ثى',
  76479. 'ﰔ' => 'ثي',
  76480. 'ﰕ' => 'جح',
  76481. 'ﰖ' => 'جم',
  76482. 'ﰗ' => 'حج',
  76483. 'ﰘ' => 'حم',
  76484. 'ﰙ' => 'خج',
  76485. 'ﰚ' => 'خح',
  76486. 'ﰛ' => 'خم',
  76487. 'ﰜ' => 'سج',
  76488. '�' => 'سح',
  76489. 'ﰞ' => 'سخ',
  76490. 'ﰟ' => 'سم',
  76491. 'ﰠ' => 'صح',
  76492. 'ﰡ' => 'صم',
  76493. 'ﰢ' => 'ضج',
  76494. 'ﰣ' => 'ضح',
  76495. 'ﰤ' => 'ضخ',
  76496. 'ﰥ' => 'ضم',
  76497. 'ﰦ' => 'طح',
  76498. 'ﰧ' => 'طم',
  76499. 'ﰨ' => 'ظم',
  76500. 'ﰩ' => 'عج',
  76501. 'ﰪ' => 'عم',
  76502. 'ﰫ' => 'غج',
  76503. 'ﰬ' => 'غم',
  76504. 'ﰭ' => '�ج',
  76505. 'ﰮ' => '�ح',
  76506. 'ﰯ' => '�خ',
  76507. 'ﰰ' => '�م',
  76508. 'ﰱ' => '�ى',
  76509. 'ﰲ' => '�ي',
  76510. 'ﰳ' => 'قح',
  76511. 'ﰴ' => 'قم',
  76512. 'ﰵ' => 'قى',
  76513. 'ﰶ' => 'قي',
  76514. 'ﰷ' => 'كا',
  76515. 'ﰸ' => 'كج',
  76516. 'ﰹ' => 'كح',
  76517. 'ﰺ' => 'كخ',
  76518. 'ﰻ' => 'كل',
  76519. 'ﰼ' => 'كم',
  76520. 'ﰽ' => 'كى',
  76521. 'ﰾ' => 'كي',
  76522. 'ﰿ' => 'لج',
  76523. 'ﱀ' => 'لح',
  76524. '�' => 'لخ',
  76525. 'ﱂ' => 'لم',
  76526. 'ﱃ' => 'لى',
  76527. 'ﱄ' => 'لي',
  76528. 'ﱅ' => 'مج',
  76529. 'ﱆ' => 'مح',
  76530. 'ﱇ' => 'مخ',
  76531. 'ﱈ' => 'مم',
  76532. 'ﱉ' => 'مى',
  76533. 'ﱊ' => 'مي',
  76534. 'ﱋ' => 'نج',
  76535. 'ﱌ' => 'نح',
  76536. '�' => 'نخ',
  76537. 'ﱎ' => 'نم',
  76538. '�' => 'نى',
  76539. '�' => 'ني',
  76540. 'ﱑ' => 'هج',
  76541. 'ﱒ' => 'هم',
  76542. 'ﱓ' => 'هى',
  76543. 'ﱔ' => 'هي',
  76544. 'ﱕ' => 'يج',
  76545. 'ﱖ' => 'يح',
  76546. 'ﱗ' => 'يخ',
  76547. 'ﱘ' => 'يم',
  76548. 'ﱙ' => 'يى',
  76549. 'ﱚ' => 'يي',
  76550. 'ﱛ' => 'ذٰ',
  76551. 'ﱜ' => 'رٰ',
  76552. '�' => 'ىٰ',
  76553. 'ﱞ' => ' ٌّ',
  76554. 'ﱟ' => ' �ّ',
  76555. 'ï± ' => ' ÙŽÙ‘',
  76556. 'ﱡ' => ' �ّ',
  76557. 'ﱢ' => ' �ّ',
  76558. 'ﱣ' => ' ّٰ',
  76559. 'ﱤ' => 'ئر',
  76560. 'ﱥ' => 'ئز',
  76561. 'ﱦ' => 'ئم',
  76562. 'ﱧ' => 'ئن',
  76563. 'ﱨ' => 'ئى',
  76564. 'ﱩ' => 'ئي',
  76565. 'ﱪ' => 'بر',
  76566. 'ﱫ' => 'بز',
  76567. 'ﱬ' => 'بم',
  76568. 'ﱭ' => 'بن',
  76569. 'ﱮ' => 'بى',
  76570. 'ﱯ' => 'بي',
  76571. 'ﱰ' => 'تر',
  76572. 'ﱱ' => 'تز',
  76573. 'ﱲ' => 'تم',
  76574. 'ﱳ' => 'تن',
  76575. 'ﱴ' => 'تى',
  76576. 'ﱵ' => 'تي',
  76577. 'ﱶ' => 'ثر',
  76578. 'ﱷ' => 'ثز',
  76579. 'ﱸ' => 'ثم',
  76580. 'ﱹ' => 'ثن',
  76581. 'ﱺ' => 'ثى',
  76582. 'ﱻ' => 'ثي',
  76583. 'ﱼ' => '�ى',
  76584. 'ﱽ' => '�ي',
  76585. 'ﱾ' => 'قى',
  76586. 'ﱿ' => 'قي',
  76587. 'ﲀ' => 'كا',
  76588. '�' => 'كل',
  76589. 'ﲂ' => 'كم',
  76590. 'ﲃ' => 'كى',
  76591. 'ﲄ' => 'كي',
  76592. 'ﲅ' => 'لم',
  76593. 'ﲆ' => 'لى',
  76594. 'ﲇ' => 'لي',
  76595. 'ﲈ' => 'ما',
  76596. 'ﲉ' => 'مم',
  76597. 'ﲊ' => 'نر',
  76598. 'ﲋ' => 'نز',
  76599. 'ﲌ' => 'نم',
  76600. '�' => 'نن',
  76601. 'ﲎ' => 'نى',
  76602. '�' => 'ني',
  76603. '�' => 'ىٰ',
  76604. 'ﲑ' => 'ير',
  76605. 'ﲒ' => 'يز',
  76606. 'ﲓ' => 'يم',
  76607. 'ﲔ' => 'ين',
  76608. 'ﲕ' => 'يى',
  76609. 'ﲖ' => 'يي',
  76610. 'ﲗ' => 'ئج',
  76611. 'ﲘ' => 'ئح',
  76612. 'ﲙ' => 'ئخ',
  76613. 'ﲚ' => 'ئم',
  76614. 'ï²›' => 'ÙŠÙ”Ù‡',
  76615. 'ﲜ' => 'بج',
  76616. '�' => 'بح',
  76617. 'ﲞ' => 'بخ',
  76618. 'ﲟ' => 'بم',
  76619. 'ﲠ' => 'به',
  76620. 'ﲡ' => 'تج',
  76621. 'ﲢ' => 'تح',
  76622. 'ﲣ' => 'تخ',
  76623. 'ﲤ' => 'تم',
  76624. 'ﲥ' => 'ته',
  76625. 'ﲦ' => 'ثم',
  76626. 'ﲧ' => 'جح',
  76627. 'ﲨ' => 'جم',
  76628. 'ﲩ' => 'حج',
  76629. 'ﲪ' => 'حم',
  76630. 'ﲫ' => 'خج',
  76631. 'ﲬ' => 'خم',
  76632. 'ﲭ' => 'سج',
  76633. 'ﲮ' => 'سح',
  76634. 'ﲯ' => 'سخ',
  76635. 'ﲰ' => 'سم',
  76636. 'ﲱ' => 'صح',
  76637. 'ﲲ' => 'صخ',
  76638. 'ﲳ' => 'صم',
  76639. 'ﲴ' => 'ضج',
  76640. 'ﲵ' => 'ضح',
  76641. 'ﲶ' => 'ضخ',
  76642. 'ﲷ' => 'ضم',
  76643. 'ﲸ' => 'طح',
  76644. 'ﲹ' => 'ظم',
  76645. 'ﲺ' => 'عج',
  76646. 'ﲻ' => 'عم',
  76647. 'ﲼ' => 'غج',
  76648. 'ﲽ' => 'غم',
  76649. 'ﲾ' => '�ج',
  76650. 'ﲿ' => '�ح',
  76651. 'ﳀ' => '�خ',
  76652. '�' => '�م',
  76653. 'ﳂ' => 'قح',
  76654. 'ﳃ' => 'قم',
  76655. 'ﳄ' => 'كج',
  76656. 'ﳅ' => 'كح',
  76657. 'ﳆ' => 'كخ',
  76658. 'ﳇ' => 'كل',
  76659. 'ﳈ' => 'كم',
  76660. 'ﳉ' => 'لج',
  76661. 'ﳊ' => 'لح',
  76662. 'ﳋ' => 'لخ',
  76663. 'ﳌ' => 'لم',
  76664. '�' => 'له',
  76665. 'ﳎ' => 'مج',
  76666. '�' => 'مح',
  76667. '�' => 'مخ',
  76668. 'ﳑ' => 'مم',
  76669. 'ﳒ' => 'نج',
  76670. 'ﳓ' => 'نح',
  76671. 'ﳔ' => 'نخ',
  76672. 'ﳕ' => 'نم',
  76673. 'ﳖ' => 'نه',
  76674. 'ﳗ' => 'هج',
  76675. 'ﳘ' => 'هم',
  76676. 'ﳙ' => 'هٰ',
  76677. 'ﳚ' => 'يج',
  76678. 'ﳛ' => 'يح',
  76679. 'ﳜ' => 'يخ',
  76680. '�' => 'يم',
  76681. 'ﳞ' => 'يه',
  76682. 'ﳟ' => 'ئم',
  76683. 'ï³ ' => 'ÙŠÙ”Ù‡',
  76684. 'ﳡ' => 'بم',
  76685. 'ﳢ' => 'به',
  76686. 'ﳣ' => 'تم',
  76687. 'ﳤ' => 'ته',
  76688. 'ﳥ' => 'ثم',
  76689. 'ﳦ' => 'ثه',
  76690. 'ﳧ' => 'سم',
  76691. 'ﳨ' => 'سه',
  76692. 'ﳩ' => 'شم',
  76693. 'ﳪ' => 'شه',
  76694. 'ﳫ' => 'كل',
  76695. 'ﳬ' => 'كم',
  76696. 'ﳭ' => 'لم',
  76697. 'ﳮ' => 'نم',
  76698. 'ﳯ' => 'نه',
  76699. 'ﳰ' => 'يم',
  76700. 'ﳱ' => 'يه',
  76701. 'ï³²' => 'Ù€ÙŽÙ‘',
  76702. 'ﳳ' => 'ـ�ّ',
  76703. 'ﳴ' => 'ـ�ّ',
  76704. 'ﳵ' => 'طى',
  76705. 'ﳶ' => 'طي',
  76706. 'ﳷ' => 'عى',
  76707. 'ﳸ' => 'عي',
  76708. 'ﳹ' => 'غى',
  76709. 'ﳺ' => 'غي',
  76710. 'ﳻ' => 'سى',
  76711. 'ﳼ' => 'سي',
  76712. 'ﳽ' => 'شى',
  76713. 'ﳾ' => 'شي',
  76714. 'ﳿ' => 'حى',
  76715. 'ﴀ' => 'حي',
  76716. '�' => 'جى',
  76717. 'ﴂ' => 'جي',
  76718. 'ﴃ' => 'خى',
  76719. 'ﴄ' => 'خي',
  76720. 'ﴅ' => 'صى',
  76721. 'ﴆ' => 'صي',
  76722. 'ﴇ' => 'ضى',
  76723. 'ﴈ' => 'ضي',
  76724. 'ﴉ' => 'شج',
  76725. 'ﴊ' => 'شح',
  76726. 'ﴋ' => 'شخ',
  76727. 'ﴌ' => 'شم',
  76728. '�' => 'شر',
  76729. 'ﴎ' => 'سر',
  76730. '�' => 'صر',
  76731. '�' => 'ضر',
  76732. 'ﴑ' => 'طى',
  76733. 'ﴒ' => 'طي',
  76734. 'ﴓ' => 'عى',
  76735. 'ﴔ' => 'عي',
  76736. 'ﴕ' => 'غى',
  76737. 'ﴖ' => 'غي',
  76738. 'ﴗ' => 'سى',
  76739. 'ﴘ' => 'سي',
  76740. 'ﴙ' => 'شى',
  76741. 'ﴚ' => 'شي',
  76742. 'ﴛ' => 'حى',
  76743. 'ﴜ' => 'حي',
  76744. '�' => 'جى',
  76745. 'ﴞ' => 'جي',
  76746. 'ﴟ' => 'خى',
  76747. 'ﴠ' => 'خي',
  76748. 'ﴡ' => 'صى',
  76749. 'ﴢ' => 'صي',
  76750. 'ﴣ' => 'ضى',
  76751. 'ﴤ' => 'ضي',
  76752. 'ﴥ' => 'شج',
  76753. 'ﴦ' => 'شح',
  76754. 'ﴧ' => 'شخ',
  76755. 'ﴨ' => 'شم',
  76756. 'ﴩ' => 'شر',
  76757. 'ﴪ' => 'سر',
  76758. 'ﴫ' => 'صر',
  76759. 'ﴬ' => 'ضر',
  76760. 'ﴭ' => 'شج',
  76761. 'ﴮ' => 'شح',
  76762. 'ﴯ' => 'شخ',
  76763. 'ﴰ' => 'شم',
  76764. 'ﴱ' => 'سه',
  76765. 'ﴲ' => 'شه',
  76766. 'ﴳ' => 'طم',
  76767. 'ﴴ' => 'سج',
  76768. 'ﴵ' => 'سح',
  76769. 'ﴶ' => 'سخ',
  76770. 'ﴷ' => 'شج',
  76771. 'ﴸ' => 'شح',
  76772. 'ﴹ' => 'شخ',
  76773. 'ﴺ' => 'طم',
  76774. 'ﴻ' => 'ظم',
  76775. 'ﴼ' => 'اً',
  76776. 'ﴽ' => 'اً',
  76777. '�' => 'تجم',
  76778. 'ﵑ' => 'تحج',
  76779. 'ﵒ' => 'تحج',
  76780. 'ﵓ' => 'تحم',
  76781. 'ﵔ' => 'تخم',
  76782. 'ﵕ' => 'تمج',
  76783. 'ﵖ' => 'تمح',
  76784. 'ﵗ' => 'تمخ',
  76785. 'ﵘ' => 'جمح',
  76786. 'ﵙ' => 'جمح',
  76787. 'ﵚ' => 'حمي',
  76788. 'ﵛ' => 'حمى',
  76789. 'ﵜ' => 'سحج',
  76790. '�' => 'سجح',
  76791. 'ﵞ' => 'سجى',
  76792. 'ﵟ' => 'سمح',
  76793. 'ﵠ' => 'سمح',
  76794. 'ﵡ' => 'سمج',
  76795. 'ﵢ' => 'سمم',
  76796. 'ﵣ' => 'سمم',
  76797. 'ﵤ' => 'صحح',
  76798. 'ﵥ' => 'صحح',
  76799. 'ﵦ' => 'صمم',
  76800. 'ﵧ' => 'شحم',
  76801. 'ﵨ' => 'شحم',
  76802. 'ﵩ' => 'شجي',
  76803. 'ﵪ' => 'شمخ',
  76804. 'ﵫ' => 'شمخ',
  76805. 'ﵬ' => 'شمم',
  76806. 'ﵭ' => 'شمم',
  76807. 'ﵮ' => 'ضحى',
  76808. 'ﵯ' => 'ضخم',
  76809. 'ﵰ' => 'ضخم',
  76810. 'ﵱ' => 'طمح',
  76811. 'ﵲ' => 'طمح',
  76812. 'ﵳ' => 'طمم',
  76813. 'ﵴ' => 'طمي',
  76814. 'ﵵ' => 'عجم',
  76815. 'ﵶ' => 'عمم',
  76816. 'ﵷ' => 'عمم',
  76817. 'ﵸ' => 'عمى',
  76818. 'ﵹ' => 'غمم',
  76819. 'ﵺ' => 'غمي',
  76820. 'ﵻ' => 'غمى',
  76821. 'ﵼ' => '�خم',
  76822. 'ﵽ' => '�خم',
  76823. 'ﵾ' => 'قمح',
  76824. 'ﵿ' => 'قمم',
  76825. 'ﶀ' => 'لحم',
  76826. '�' => 'لحي',
  76827. 'ﶂ' => 'لحى',
  76828. 'ﶃ' => 'لجج',
  76829. 'ﶄ' => 'لجج',
  76830. 'ﶅ' => 'لخم',
  76831. 'ﶆ' => 'لخم',
  76832. 'ﶇ' => 'لمح',
  76833. 'ﶈ' => 'لمح',
  76834. 'ﶉ' => 'محج',
  76835. 'ﶊ' => 'محم',
  76836. 'ﶋ' => 'محي',
  76837. 'ﶌ' => 'مجح',
  76838. '�' => 'مجم',
  76839. 'ﶎ' => 'مخج',
  76840. '�' => 'مخم',
  76841. 'ﶒ' => 'مجخ',
  76842. 'ﶓ' => 'همج',
  76843. 'ﶔ' => 'همم',
  76844. 'ﶕ' => 'نحم',
  76845. 'ﶖ' => 'نحى',
  76846. 'ﶗ' => 'نجم',
  76847. 'ﶘ' => 'نجم',
  76848. 'ﶙ' => 'نجى',
  76849. 'ﶚ' => 'نمي',
  76850. 'ﶛ' => 'نمى',
  76851. 'ﶜ' => 'يمم',
  76852. '�' => 'يمم',
  76853. 'ﶞ' => 'بخي',
  76854. 'ﶟ' => 'تجي',
  76855. 'ﶠ' => 'تجى',
  76856. 'ﶡ' => 'تخي',
  76857. 'ﶢ' => 'تخى',
  76858. 'ﶣ' => 'تمي',
  76859. 'ﶤ' => 'تمى',
  76860. 'ﶥ' => 'جمي',
  76861. 'ﶦ' => 'جحى',
  76862. 'ﶧ' => 'جمى',
  76863. 'ﶨ' => 'سخى',
  76864. 'ﶩ' => 'صحي',
  76865. 'ﶪ' => 'شحي',
  76866. 'ﶫ' => 'ضحي',
  76867. 'ﶬ' => 'لجي',
  76868. 'ﶭ' => 'لمي',
  76869. 'ﶮ' => 'يحي',
  76870. 'ﶯ' => 'يجي',
  76871. 'ﶰ' => 'يمي',
  76872. 'ﶱ' => 'ممي',
  76873. 'ﶲ' => 'قمي',
  76874. 'ﶳ' => 'نحي',
  76875. 'ﶴ' => 'قمح',
  76876. 'ﶵ' => 'لحم',
  76877. 'ﶶ' => 'عمي',
  76878. 'ﶷ' => 'كمي',
  76879. 'ﶸ' => 'نجح',
  76880. 'ﶹ' => 'مخي',
  76881. 'ﶺ' => 'لجم',
  76882. 'ﶻ' => 'كمم',
  76883. 'ﶼ' => 'لجم',
  76884. 'ﶽ' => 'نجح',
  76885. 'ﶾ' => 'جحي',
  76886. 'ﶿ' => 'حجي',
  76887. 'ﷀ' => 'مجي',
  76888. '�' => '�مي',
  76889. 'ﷂ' => 'بحي',
  76890. 'ﷃ' => 'كمم',
  76891. 'ﷄ' => 'عجم',
  76892. 'ﷅ' => 'صمم',
  76893. 'ﷆ' => 'سخي',
  76894. 'ﷇ' => 'نجي',
  76895. 'ﷰ' => 'صلے',
  76896. 'ﷱ' => 'قلے',
  76897. 'ﷲ' => 'الله',
  76898. 'ﷳ' => 'اكبر',
  76899. 'ﷴ' => 'محمد',
  76900. 'ﷵ' => 'صلعم',
  76901. 'ﷶ' => 'رسول',
  76902. 'ﷷ' => 'عليه',
  76903. 'ﷸ' => 'وسلم',
  76904. 'ﷹ' => 'صلى',
  76905. 'ﷺ' => 'صلى الله عليه وسلم',
  76906. 'ﷻ' => 'جل جلاله',
  76907. '﷼' => 'ریال',
  76908. '�' => ',',
  76909. '︑' => '�',
  76910. '︒' => '。',
  76911. '︓' => ':',
  76912. '︔' => ';',
  76913. '︕' => '!',
  76914. '︖' => '?',
  76915. '︗' => '〖',
  76916. '︘' => '〗',
  76917. '︙' => '...',
  76918. '︰' => '..',
  76919. '︱' => '—',
  76920. '︲' => '–',
  76921. '︳' => '_',
  76922. '︴' => '_',
  76923. '︵' => '(',
  76924. '︶' => ')',
  76925. '︷' => '{',
  76926. '︸' => '}',
  76927. '︹' => '〔',
  76928. '︺' => '〕',
  76929. '︻' => '�',
  76930. '︼' => '】',
  76931. '︽' => '《',
  76932. '︾' => '》',
  76933. '︿' => '〈',
  76934. '﹀' => '〉',
  76935. '�' => '「',
  76936. '﹂' => '�',
  76937. '﹃' => '『',
  76938. '﹄' => '�',
  76939. '﹇' => '[',
  76940. '﹈' => ']',
  76941. '﹉' => ' ̅',
  76942. '﹊' => ' ̅',
  76943. '﹋' => ' ̅',
  76944. '﹌' => ' ̅',
  76945. '�' => '_',
  76946. '﹎' => '_',
  76947. '�' => '_',
  76948. '�' => ',',
  76949. '﹑' => '�',
  76950. 'ï¹’' => '.',
  76951. 'ï¹”' => ';',
  76952. '﹕' => ':',
  76953. 'ï¹–' => '?',
  76954. 'ï¹—' => '!',
  76955. '﹘' => '—',
  76956. 'ï¹™' => '(',
  76957. '﹚' => ')',
  76958. 'ï¹›' => '{',
  76959. '﹜' => '}',
  76960. '�' => '〔',
  76961. '﹞' => '〕',
  76962. '﹟' => '#',
  76963. 'ï¹ ' => '&',
  76964. '﹡' => '*',
  76965. 'ï¹¢' => '+',
  76966. 'ï¹£' => '-',
  76967. '﹤' => '<',
  76968. 'ï¹¥' => '>',
  76969. '﹦' => '=',
  76970. '﹨' => '\\',
  76971. '﹩' => '$',
  76972. '﹪' => '%',
  76973. '﹫' => '@',
  76974. 'ï¹°' => ' Ù‹',
  76975. 'ﹱ' => 'ـً',
  76976. 'ﹲ' => ' ٌ',
  76977. 'ï¹´' => ' Ù�',
  76978. 'ﹶ' => ' َ',
  76979. 'ï¹·' => 'Ù€ÙŽ',
  76980. 'ﹸ' => ' �',
  76981. 'ﹹ' => 'ـ�',
  76982. 'ﹺ' => ' �',
  76983. 'ﹻ' => 'ـ�',
  76984. 'ï¹¼' => ' Ù‘',
  76985. 'ﹽ' => 'ـّ',
  76986. 'ï¹¾' => ' Ù’',
  76987. 'ﹿ' => 'ـْ',
  76988. 'ﺀ' => 'ء',
  76989. '�' => 'آ',
  76990. 'ﺂ' => 'آ',
  76991. 'ﺃ' => 'أ',
  76992. 'ﺄ' => 'أ',
  76993. 'ﺅ' => 'ؤ',
  76994. 'ﺆ' => 'ؤ',
  76995. 'ﺇ' => 'إ',
  76996. 'ﺈ' => 'إ',
  76997. 'ﺉ' => 'ئ',
  76998. 'ﺊ' => 'ئ',
  76999. 'ﺋ' => 'ئ',
  77000. 'ﺌ' => 'ئ',
  77001. '�' => 'ا',
  77002. 'ﺎ' => 'ا',
  77003. '�' => 'ب',
  77004. '�' => 'ب',
  77005. 'ﺑ' => 'ب',
  77006. 'ﺒ' => 'ب',
  77007. 'ﺓ' => 'ة',
  77008. 'ﺔ' => 'ة',
  77009. 'ﺕ' => 'ت',
  77010. 'ﺖ' => 'ت',
  77011. 'ﺗ' => 'ت',
  77012. 'ﺘ' => 'ت',
  77013. 'ﺙ' => 'ث',
  77014. 'ﺚ' => 'ث',
  77015. 'ﺛ' => 'ث',
  77016. 'ﺜ' => 'ث',
  77017. '�' => 'ج',
  77018. 'ﺞ' => 'ج',
  77019. 'ﺟ' => 'ج',
  77020. 'ﺠ' => 'ج',
  77021. 'ﺡ' => 'ح',
  77022. 'ﺢ' => 'ح',
  77023. 'ﺣ' => 'ح',
  77024. 'ﺤ' => 'ح',
  77025. 'ﺥ' => 'خ',
  77026. 'ﺦ' => 'خ',
  77027. 'ﺧ' => 'خ',
  77028. 'ﺨ' => 'خ',
  77029. 'ﺩ' => 'د',
  77030. 'ﺪ' => 'د',
  77031. 'ﺫ' => 'ذ',
  77032. 'ﺬ' => 'ذ',
  77033. 'ﺭ' => 'ر',
  77034. 'ﺮ' => 'ر',
  77035. 'ﺯ' => 'ز',
  77036. 'ﺰ' => 'ز',
  77037. 'ﺱ' => 'س',
  77038. 'ﺲ' => 'س',
  77039. 'ﺳ' => 'س',
  77040. 'ﺴ' => 'س',
  77041. 'ﺵ' => 'ش',
  77042. 'ﺶ' => 'ش',
  77043. 'ﺷ' => 'ش',
  77044. 'ﺸ' => 'ش',
  77045. 'ﺹ' => 'ص',
  77046. 'ﺺ' => 'ص',
  77047. 'ﺻ' => 'ص',
  77048. 'ﺼ' => 'ص',
  77049. 'ﺽ' => 'ض',
  77050. 'ﺾ' => 'ض',
  77051. 'ﺿ' => 'ض',
  77052. 'ﻀ' => 'ض',
  77053. '�' => 'ط',
  77054. 'ﻂ' => 'ط',
  77055. 'ﻃ' => 'ط',
  77056. 'ﻄ' => 'ط',
  77057. 'ﻅ' => 'ظ',
  77058. 'ﻆ' => 'ظ',
  77059. 'ﻇ' => 'ظ',
  77060. 'ﻈ' => 'ظ',
  77061. 'ﻉ' => 'ع',
  77062. 'ﻊ' => 'ع',
  77063. 'ﻋ' => 'ع',
  77064. 'ﻌ' => 'ع',
  77065. '�' => 'غ',
  77066. 'ﻎ' => 'غ',
  77067. '�' => 'غ',
  77068. '�' => 'غ',
  77069. 'ﻑ' => '�',
  77070. 'ï»’' => 'Ù�',
  77071. 'ﻓ' => '�',
  77072. 'ï»”' => 'Ù�',
  77073. 'ﻕ' => 'ق',
  77074. 'ï»–' => 'Ù‚',
  77075. 'ï»—' => 'Ù‚',
  77076. 'ﻘ' => 'ق',
  77077. 'ï»™' => 'Ùƒ',
  77078. 'ﻚ' => 'ك',
  77079. 'ï»›' => 'Ùƒ',
  77080. 'ﻜ' => 'ك',
  77081. '�' => 'ل',
  77082. 'ﻞ' => 'ل',
  77083. 'ﻟ' => 'ل',
  77084. 'ï» ' => 'Ù„',
  77085. 'ﻡ' => 'م',
  77086. 'ﻢ' => 'م',
  77087. 'ﻣ' => 'م',
  77088. 'ﻤ' => 'م',
  77089. 'ﻥ' => 'ن',
  77090. 'ﻦ' => 'ن',
  77091. 'ﻧ' => 'ن',
  77092. 'ﻨ' => 'ن',
  77093. 'ﻩ' => 'ه',
  77094. 'ﻪ' => 'ه',
  77095. 'ﻫ' => 'ه',
  77096. 'ﻬ' => 'ه',
  77097. 'ï»­' => 'Ùˆ',
  77098. 'ï»®' => 'Ùˆ',
  77099. 'ﻯ' => 'ى',
  77100. 'ï»°' => 'Ù‰',
  77101. 'ï»±' => 'ÙŠ',
  77102. 'ﻲ' => 'ي',
  77103. 'ﻳ' => 'ي',
  77104. 'ï»´' => 'ÙŠ',
  77105. 'ﻵ' => 'لآ',
  77106. 'ﻶ' => 'لآ',
  77107. 'ﻷ' => 'لأ',
  77108. 'ﻸ' => 'لأ',
  77109. 'ﻹ' => 'لإ',
  77110. 'ﻺ' => 'لإ',
  77111. 'ﻻ' => 'لا',
  77112. 'ﻼ' => 'لا',
  77113. '�' => '!',
  77114. '"' => '"',
  77115. '#' => '#',
  77116. '$' => '$',
  77117. 'ï¼…' => '%',
  77118. '&' => '&',
  77119. ''' => '\'',
  77120. '(' => '(',
  77121. ')' => ')',
  77122. '*' => '*',
  77123. '+' => '+',
  77124. ',' => ',',
  77125. '�' => '-',
  77126. '.' => '.',
  77127. '�' => '/',
  77128. '�' => '0',
  77129. '1' => '1',
  77130. 'ï¼’' => '2',
  77131. '3' => '3',
  77132. 'ï¼”' => '4',
  77133. '5' => '5',
  77134. 'ï¼–' => '6',
  77135. 'ï¼—' => '7',
  77136. '8' => '8',
  77137. 'ï¼™' => '9',
  77138. ':' => ':',
  77139. 'ï¼›' => ';',
  77140. '<' => '<',
  77141. '�' => '=',
  77142. '>' => '>',
  77143. '?' => '?',
  77144. 'ï¼ ' => '@',
  77145. 'A' => 'A',
  77146. 'ï¼¢' => 'B',
  77147. 'ï¼£' => 'C',
  77148. 'D' => 'D',
  77149. 'ï¼¥' => 'E',
  77150. 'F' => 'F',
  77151. 'G' => 'G',
  77152. 'H' => 'H',
  77153. 'I' => 'I',
  77154. 'J' => 'J',
  77155. 'K' => 'K',
  77156. 'L' => 'L',
  77157. 'ï¼­' => 'M',
  77158. 'ï¼®' => 'N',
  77159. 'O' => 'O',
  77160. 'ï¼°' => 'P',
  77161. 'ï¼±' => 'Q',
  77162. 'ï¼²' => 'R',
  77163. 'ï¼³' => 'S',
  77164. 'ï¼´' => 'T',
  77165. 'ï¼µ' => 'U',
  77166. 'V' => 'V',
  77167. 'ï¼·' => 'W',
  77168. 'X' => 'X',
  77169. 'ï¼¹' => 'Y',
  77170. 'Z' => 'Z',
  77171. 'ï¼»' => '[',
  77172. 'ï¼¼' => '\\',
  77173. 'ï¼½' => ']',
  77174. 'ï¼¾' => '^',
  77175. '_' => '_',
  77176. 'ï½€' => '`',
  77177. '�' => 'a',
  77178. 'b' => 'b',
  77179. 'c' => 'c',
  77180. 'd' => 'd',
  77181. 'ï½…' => 'e',
  77182. 'f' => 'f',
  77183. 'g' => 'g',
  77184. 'h' => 'h',
  77185. 'i' => 'i',
  77186. 'j' => 'j',
  77187. 'k' => 'k',
  77188. 'l' => 'l',
  77189. '�' => 'm',
  77190. 'n' => 'n',
  77191. '�' => 'o',
  77192. '�' => 'p',
  77193. 'q' => 'q',
  77194. 'ï½’' => 'r',
  77195. 's' => 's',
  77196. 'ï½”' => 't',
  77197. 'u' => 'u',
  77198. 'ï½–' => 'v',
  77199. 'ï½—' => 'w',
  77200. 'x' => 'x',
  77201. 'ï½™' => 'y',
  77202. 'z' => 'z',
  77203. 'ï½›' => '{',
  77204. '|' => '|',
  77205. '�' => '}',
  77206. '~' => '~',
  77207. '⦅' => '⦅',
  77208. '⦆' => '⦆',
  77209. '。' => '。',
  77210. '「' => '「',
  77211. '」' => '�',
  77212. '、' => '�',
  77213. '・' => '・',
  77214. 'ヲ' => 'ヲ',
  77215. 'ァ' => 'ァ',
  77216. 'ィ' => 'ィ',
  77217. 'ゥ' => 'ゥ',
  77218. 'ェ' => 'ェ',
  77219. 'ォ' => 'ォ',
  77220. 'ャ' => 'ャ',
  77221. 'ュ' => 'ュ',
  77222. 'ョ' => 'ョ',
  77223. 'ッ' => 'ッ',
  77224. 'ー' => 'ー',
  77225. 'ï½±' => 'ã‚¢',
  77226. 'イ' => 'イ',
  77227. 'ウ' => 'ウ',
  77228. 'エ' => 'エ',
  77229. 'オ' => 'オ',
  77230. 'カ' => 'カ',
  77231. 'ï½·' => 'ã‚­',
  77232. 'ク' => 'ク',
  77233. 'ケ' => 'ケ',
  77234. 'コ' => 'コ',
  77235. 'サ' => 'サ',
  77236. 'ï½¼' => 'ã‚·',
  77237. 'ス' => 'ス',
  77238. 'ï½¾' => 'ã‚»',
  77239. 'ソ' => 'ソ',
  77240. 'ï¾€' => 'ã‚¿',
  77241. '�' => '�',
  77242. 'ツ' => 'ツ',
  77243. 'テ' => 'テ',
  77244. 'ト' => 'ト',
  77245. 'ナ' => 'ナ',
  77246. 'ニ' => 'ニ',
  77247. 'ヌ' => 'ヌ',
  77248. 'ネ' => '�',
  77249. 'ノ' => 'ノ',
  77250. 'ハ' => '�',
  77251. 'ヒ' => 'ヒ',
  77252. 'フ' => 'フ',
  77253. '�' => 'ヘ',
  77254. 'ホ' => 'ホ',
  77255. '�' => 'マ',
  77256. '�' => 'ミ',
  77257. 'ム' => 'ム',
  77258. 'メ' => 'メ',
  77259. 'モ' => 'モ',
  77260. 'ヤ' => 'ヤ',
  77261. 'ユ' => 'ユ',
  77262. 'ヨ' => 'ヨ',
  77263. 'ラ' => 'ラ',
  77264. 'リ' => 'リ',
  77265. 'ル' => 'ル',
  77266. 'レ' => 'レ',
  77267. 'ロ' => 'ロ',
  77268. 'ワ' => 'ワ',
  77269. '�' => 'ン',
  77270. '゙' => '゙',
  77271. '゚' => '゚',
  77272. 'ï¾ ' => 'á… ',
  77273. 'ᄀ' => 'ᄀ',
  77274. 'ᄁ' => '�',
  77275. 'ᆪ' => 'ᆪ',
  77276. 'ᄂ' => 'ᄂ',
  77277. 'ᆬ' => 'ᆬ',
  77278. 'ᆭ' => 'ᆭ',
  77279. 'ᄃ' => 'ᄃ',
  77280. 'ᄄ' => 'ᄄ',
  77281. 'ᄅ' => 'ᄅ',
  77282. 'ᆰ' => 'ᆰ',
  77283. 'ᆱ' => 'ᆱ',
  77284. 'ᆲ' => 'ᆲ',
  77285. 'ᆳ' => 'ᆳ',
  77286. 'ᆴ' => 'ᆴ',
  77287. 'ᆵ' => 'ᆵ',
  77288. 'ï¾°' => 'á„š',
  77289. 'ᄆ' => 'ᄆ',
  77290. 'ᄇ' => 'ᄇ',
  77291. 'ᄈ' => 'ᄈ',
  77292. 'ï¾´' => 'á„¡',
  77293. 'ᄉ' => 'ᄉ',
  77294. 'ᄊ' => 'ᄊ',
  77295. 'ï¾·' => 'á„‹',
  77296. 'ᄌ' => 'ᄌ',
  77297. 'ᄍ' => '�',
  77298. 'ᄎ' => 'ᄎ',
  77299. 'ᄏ' => '�',
  77300. 'ᄐ' => '�',
  77301. 'ï¾½' => 'á„‘',
  77302. 'ï¾¾' => 'á„’',
  77303. 'ï¿‚' => 'á…¡',
  77304. 'ᅢ' => 'ᅢ',
  77305. 'ï¿„' => 'á…£',
  77306. 'ï¿…' => 'á…¤',
  77307. 'ᅥ' => 'ᅥ',
  77308. 'ᅦ' => 'ᅦ',
  77309. 'ï¿Š' => 'á…§',
  77310. 'ï¿‹' => 'á…¨',
  77311. 'ᅩ' => 'ᅩ',
  77312. '�' => 'ᅪ',
  77313. 'ï¿Ž' => 'á…«',
  77314. '�' => 'ᅬ',
  77315. 'ï¿’' => 'á…­',
  77316. 'ï¿“' => 'á…®',
  77317. 'ï¿”' => 'á…¯',
  77318. 'ï¿•' => 'á…°',
  77319. 'ï¿–' => 'á…±',
  77320. 'ï¿—' => 'á…²',
  77321. 'ï¿š' => 'á…³',
  77322. 'ï¿›' => 'á…´',
  77323. 'ᅵ' => 'ᅵ',
  77324. '¢' => '¢',
  77325. '£' => '£',
  77326. '¬' => '¬',
  77327. 'ï¿£' => ' Ì„',
  77328. '¦' => '¦',
  77329. 'ï¿¥' => 'Â¥',
  77330. '₩' => '₩',
  77331. '│' => '│',
  77332. '←' => '�',
  77333. '↑' => '↑',
  77334. '→' => '→',
  77335. '↓' => '↓',
  77336. 'ï¿­' => 'â– ',
  77337. 'ï¿®' => 'â—‹',
  77338. '�' => 'A',
  77339. '�' => 'B',
  77340. '�' => 'C',
  77341. '�' => 'D',
  77342. '�' => 'E',
  77343. '�' => 'F',
  77344. '�' => 'G',
  77345. '�' => 'H',
  77346. '�' => 'I',
  77347. '�' => 'J',
  77348. '�' => 'K',
  77349. '�' => 'L',
  77350. '�' => 'M',
  77351. '�' => 'N',
  77352. '�' => 'O',
  77353. '�' => 'P',
  77354. '�' => 'Q',
  77355. '�' => 'R',
  77356. '�' => 'S',
  77357. '�' => 'T',
  77358. '�' => 'U',
  77359. '�' => 'V',
  77360. '�' => 'W',
  77361. '�' => 'X',
  77362. '�' => 'Y',
  77363. '�' => 'Z',
  77364. '�' => 'a',
  77365. '�' => 'b',
  77366. '�' => 'c',
  77367. '�' => 'd',
  77368. '�' => 'e',
  77369. '�' => 'f',
  77370. '�' => 'g',
  77371. '�' => 'h',
  77372. '�' => 'i',
  77373. '�' => 'j',
  77374. '�' => 'k',
  77375. '�' => 'l',
  77376. '�' => 'm',
  77377. '�' => 'n',
  77378. '�' => 'o',
  77379. '�' => 'p',
  77380. '�' => 'q',
  77381. '�' => 'r',
  77382. '�' => 's',
  77383. '�' => 't',
  77384. '�' => 'u',
  77385. '�' => 'v',
  77386. '�' => 'w',
  77387. '�' => 'x',
  77388. '�' => 'y',
  77389. '�' => 'z',
  77390. '�' => 'A',
  77391. '�' => 'B',
  77392. '�' => 'C',
  77393. '�' => 'D',
  77394. '�' => 'E',
  77395. '�' => 'F',
  77396. '�' => 'G',
  77397. '�' => 'H',
  77398. '�' => 'I',
  77399. '�' => 'J',
  77400. '�' => 'K',
  77401. '�' => 'L',
  77402. '�' => 'M',
  77403. '�' => 'N',
  77404. '�' => 'O',
  77405. '�' => 'P',
  77406. '�' => 'Q',
  77407. '�' => 'R',
  77408. '�' => 'S',
  77409. '�' => 'T',
  77410. '�' => 'U',
  77411. '�' => 'V',
  77412. '�' => 'W',
  77413. '�' => 'X',
  77414. '�' => 'Y',
  77415. '�' => 'Z',
  77416. '�' => 'a',
  77417. '�' => 'b',
  77418. '�' => 'c',
  77419. '�' => 'd',
  77420. '�' => 'e',
  77421. '�' => 'f',
  77422. '�' => 'g',
  77423. '�' => 'i',
  77424. '�' => 'j',
  77425. '�' => 'k',
  77426. '�' => 'l',
  77427. '�' => 'm',
  77428. '�' => 'n',
  77429. '�' => 'o',
  77430. '�' => 'p',
  77431. '�' => 'q',
  77432. '�' => 'r',
  77433. '�' => 's',
  77434. '�' => 't',
  77435. '�' => 'u',
  77436. '�' => 'v',
  77437. '�' => 'w',
  77438. '�' => 'x',
  77439. '�' => 'y',
  77440. '�' => 'z',
  77441. '�' => 'A',
  77442. '�' => 'B',
  77443. '�' => 'C',
  77444. '�' => 'D',
  77445. '�' => 'E',
  77446. '�' => 'F',
  77447. '�' => 'G',
  77448. '�' => 'H',
  77449. '�' => 'I',
  77450. '�' => 'J',
  77451. '�' => 'K',
  77452. '�' => 'L',
  77453. '�' => 'M',
  77454. '�' => 'N',
  77455. '�' => 'O',
  77456. '�' => 'P',
  77457. '�' => 'Q',
  77458. '�' => 'R',
  77459. '�' => 'S',
  77460. '�' => 'T',
  77461. '�' => 'U',
  77462. '�' => 'V',
  77463. '�' => 'W',
  77464. '�' => 'X',
  77465. '�' => 'Y',
  77466. '�' => 'Z',
  77467. '�' => 'a',
  77468. '�' => 'b',
  77469. '�' => 'c',
  77470. '�' => 'd',
  77471. '�' => 'e',
  77472. '�' => 'f',
  77473. '�' => 'g',
  77474. '�' => 'h',
  77475. '�' => 'i',
  77476. '�' => 'j',
  77477. '�' => 'k',
  77478. '�' => 'l',
  77479. '�' => 'm',
  77480. '�' => 'n',
  77481. '�' => 'o',
  77482. '�' => 'p',
  77483. '�' => 'q',
  77484. '�' => 'r',
  77485. '�' => 's',
  77486. '�' => 't',
  77487. '�' => 'u',
  77488. '�' => 'v',
  77489. '�' => 'w',
  77490. '�' => 'x',
  77491. '�' => 'y',
  77492. '�' => 'z',
  77493. '�' => 'A',
  77494. '�' => 'C',
  77495. '�' => 'D',
  77496. '�' => 'G',
  77497. '�' => 'J',
  77498. '�' => 'K',
  77499. '�' => 'N',
  77500. '�' => 'O',
  77501. '�' => 'P',
  77502. '�' => 'Q',
  77503. '�' => 'S',
  77504. '�' => 'T',
  77505. '�' => 'U',
  77506. '�' => 'V',
  77507. '�' => 'W',
  77508. '�' => 'X',
  77509. '�' => 'Y',
  77510. '�' => 'Z',
  77511. '�' => 'a',
  77512. '�' => 'b',
  77513. '�' => 'c',
  77514. '�' => 'd',
  77515. '�' => 'f',
  77516. '�' => 'h',
  77517. '�' => 'i',
  77518. '�' => 'j',
  77519. '�' => 'k',
  77520. '�' => 'l',
  77521. '�' => 'm',
  77522. '�' => 'n',
  77523. '�' => 'p',
  77524. '�' => 'q',
  77525. '�' => 'r',
  77526. '�' => 's',
  77527. '�' => 't',
  77528. '�' => 'u',
  77529. '�' => 'v',
  77530. '�' => 'w',
  77531. '�' => 'x',
  77532. '�' => 'y',
  77533. '�' => 'z',
  77534. '�' => 'A',
  77535. '�' => 'B',
  77536. '�' => 'C',
  77537. '�' => 'D',
  77538. '�' => 'E',
  77539. '�' => 'F',
  77540. '�' => 'G',
  77541. '�' => 'H',
  77542. '�' => 'I',
  77543. '�' => 'J',
  77544. '�' => 'K',
  77545. '�' => 'L',
  77546. '�' => 'M',
  77547. '�' => 'N',
  77548. '�' => 'O',
  77549. '�' => 'P',
  77550. '�' => 'Q',
  77551. '�' => 'R',
  77552. '�' => 'S',
  77553. '�' => 'T',
  77554. '�' => 'U',
  77555. '�' => 'V',
  77556. '�' => 'W',
  77557. '�' => 'X',
  77558. '�' => 'Y',
  77559. '�' => 'Z',
  77560. '�' => 'a',
  77561. '�' => 'b',
  77562. '�' => 'c',
  77563. '�' => 'd',
  77564. '�' => 'e',
  77565. '�' => 'f',
  77566. '�' => 'g',
  77567. '�' => 'h',
  77568. '�' => 'i',
  77569. '�' => 'j',
  77570. '�' => 'k',
  77571. '�' => 'l',
  77572. '�' => 'm',
  77573. '�' => 'n',
  77574. '�' => 'o',
  77575. '�' => 'p',
  77576. '�' => 'q',
  77577. '�' => 'r',
  77578. '�' => 's',
  77579. '�' => 't',
  77580. '�' => 'u',
  77581. '�' => 'v',
  77582. '�' => 'w',
  77583. '�' => 'x',
  77584. '�' => 'y',
  77585. '�' => 'z',
  77586. '�' => 'A',
  77587. '�' => 'B',
  77588. '�' => 'D',
  77589. '�' => 'E',
  77590. '�' => 'F',
  77591. '�' => 'G',
  77592. '�' => 'J',
  77593. '�' => 'K',
  77594. '�' => 'L',
  77595. '�' => 'M',
  77596. '�' => 'N',
  77597. '�' => 'O',
  77598. '�' => 'P',
  77599. '�' => 'Q',
  77600. '�' => 'S',
  77601. '�' => 'T',
  77602. '�' => 'U',
  77603. '�' => 'V',
  77604. '�' => 'W',
  77605. '�' => 'X',
  77606. '�' => 'Y',
  77607. '�' => 'a',
  77608. '�' => 'b',
  77609. '�' => 'c',
  77610. '�' => 'd',
  77611. '�' => 'e',
  77612. '�' => 'f',
  77613. '�' => 'g',
  77614. '�' => 'h',
  77615. '�' => 'i',
  77616. '�' => 'j',
  77617. '�' => 'k',
  77618. '�' => 'l',
  77619. '�' => 'm',
  77620. '�' => 'n',
  77621. '�' => 'o',
  77622. '�' => 'p',
  77623. '�' => 'q',
  77624. '�' => 'r',
  77625. '�' => 's',
  77626. '�' => 't',
  77627. '�' => 'u',
  77628. '�' => 'v',
  77629. '�' => 'w',
  77630. '�' => 'x',
  77631. '�' => 'y',
  77632. '�' => 'z',
  77633. '�' => 'A',
  77634. '�' => 'B',
  77635. '�' => 'D',
  77636. '�' => 'E',
  77637. '�' => 'F',
  77638. '�' => 'G',
  77639. '�' => 'I',
  77640. '�' => 'J',
  77641. '�' => 'K',
  77642. '�' => 'L',
  77643. '�' => 'M',
  77644. '�' => 'O',
  77645. '�' => 'S',
  77646. '�' => 'T',
  77647. '�' => 'U',
  77648. '�' => 'V',
  77649. '�' => 'W',
  77650. '�' => 'X',
  77651. '�' => 'Y',
  77652. '�' => 'a',
  77653. '�' => 'b',
  77654. '�' => 'c',
  77655. '�' => 'd',
  77656. '�' => 'e',
  77657. '�' => 'f',
  77658. '�' => 'g',
  77659. '�' => 'h',
  77660. '�' => 'i',
  77661. '�' => 'j',
  77662. '�' => 'k',
  77663. '�' => 'l',
  77664. '�' => 'm',
  77665. '�' => 'n',
  77666. '�' => 'o',
  77667. '�' => 'p',
  77668. '�' => 'q',
  77669. '�' => 'r',
  77670. '�' => 's',
  77671. '�' => 't',
  77672. '�' => 'u',
  77673. '�' => 'v',
  77674. '�' => 'w',
  77675. '�' => 'x',
  77676. '�' => 'y',
  77677. '�' => 'z',
  77678. '�' => 'A',
  77679. '�' => 'B',
  77680. '�' => 'C',
  77681. '�' => 'D',
  77682. '�' => 'E',
  77683. '�' => 'F',
  77684. '�' => 'G',
  77685. '�' => 'H',
  77686. '�' => 'I',
  77687. '�' => 'J',
  77688. '�' => 'K',
  77689. '�' => 'L',
  77690. '�' => 'M',
  77691. '�' => 'N',
  77692. '�' => 'O',
  77693. '�' => 'P',
  77694. '�' => 'Q',
  77695. '�' => 'R',
  77696. '�' => 'S',
  77697. '�' => 'T',
  77698. '�' => 'U',
  77699. '�' => 'V',
  77700. '�' => 'W',
  77701. '�' => 'X',
  77702. '�' => 'Y',
  77703. '�' => 'Z',
  77704. '�' => 'a',
  77705. '�' => 'b',
  77706. '�' => 'c',
  77707. '�' => 'd',
  77708. '�' => 'e',
  77709. '�' => 'f',
  77710. '�' => 'g',
  77711. '�' => 'h',
  77712. '�' => 'i',
  77713. '�' => 'j',
  77714. '�' => 'k',
  77715. '�' => 'l',
  77716. '�' => 'm',
  77717. '�' => 'n',
  77718. '�' => 'o',
  77719. '�' => 'p',
  77720. '�' => 'q',
  77721. '�' => 'r',
  77722. '�' => 's',
  77723. '�' => 't',
  77724. '�' => 'u',
  77725. '�' => 'v',
  77726. '�' => 'w',
  77727. '�' => 'x',
  77728. '�' => 'y',
  77729. '�' => 'z',
  77730. '�' => 'A',
  77731. '�' => 'B',
  77732. '�' => 'C',
  77733. '�' => 'D',
  77734. '�' => 'E',
  77735. '�' => 'F',
  77736. '�' => 'G',
  77737. '�' => 'H',
  77738. '�' => 'I',
  77739. '�' => 'J',
  77740. '�' => 'K',
  77741. '�' => 'L',
  77742. '�' => 'M',
  77743. '�' => 'N',
  77744. '�' => 'O',
  77745. '�' => 'P',
  77746. '�' => 'Q',
  77747. '�' => 'R',
  77748. '�' => 'S',
  77749. '�' => 'T',
  77750. '�' => 'U',
  77751. '�' => 'V',
  77752. '�' => 'W',
  77753. '�' => 'X',
  77754. '�' => 'Y',
  77755. '�' => 'Z',
  77756. '�' => 'a',
  77757. '�' => 'b',
  77758. '�' => 'c',
  77759. '�' => 'd',
  77760. '�' => 'e',
  77761. '�' => 'f',
  77762. '�' => 'g',
  77763. '�' => 'h',
  77764. '�' => 'i',
  77765. '�' => 'j',
  77766. '�' => 'k',
  77767. '�' => 'l',
  77768. '�' => 'm',
  77769. '�' => 'n',
  77770. '�' => 'o',
  77771. '�' => 'p',
  77772. '�' => 'q',
  77773. '�' => 'r',
  77774. '�' => 's',
  77775. '�' => 't',
  77776. '�' => 'u',
  77777. '�' => 'v',
  77778. '�' => 'w',
  77779. '�' => 'x',
  77780. '�' => 'y',
  77781. '�' => 'z',
  77782. '�' => 'A',
  77783. '�' => 'B',
  77784. '�' => 'C',
  77785. '�' => 'D',
  77786. '�' => 'E',
  77787. '�' => 'F',
  77788. '�' => 'G',
  77789. '�' => 'H',
  77790. '�' => 'I',
  77791. '�' => 'J',
  77792. '�' => 'K',
  77793. '�' => 'L',
  77794. '�' => 'M',
  77795. '�' => 'N',
  77796. '�' => 'O',
  77797. '�' => 'P',
  77798. '�' => 'Q',
  77799. '�' => 'R',
  77800. '�' => 'S',
  77801. '�' => 'T',
  77802. '�' => 'U',
  77803. '�' => 'V',
  77804. '�' => 'W',
  77805. '�' => 'X',
  77806. '�' => 'Y',
  77807. '�' => 'Z',
  77808. '�' => 'a',
  77809. '�' => 'b',
  77810. '�' => 'c',
  77811. '�' => 'd',
  77812. '�' => 'e',
  77813. '�' => 'f',
  77814. '�' => 'g',
  77815. '�' => 'h',
  77816. '�' => 'i',
  77817. '�' => 'j',
  77818. '�' => 'k',
  77819. '�' => 'l',
  77820. '�' => 'm',
  77821. '�' => 'n',
  77822. '�' => 'o',
  77823. '�' => 'p',
  77824. '�' => 'q',
  77825. '�' => 'r',
  77826. '�' => 's',
  77827. '�' => 't',
  77828. '�' => 'u',
  77829. '�' => 'v',
  77830. '�' => 'w',
  77831. '�' => 'x',
  77832. '�' => 'y',
  77833. '�' => 'z',
  77834. '�' => 'A',
  77835. '�' => 'B',
  77836. '�' => 'C',
  77837. '�' => 'D',
  77838. '�' => 'E',
  77839. '�' => 'F',
  77840. '�' => 'G',
  77841. '�' => 'H',
  77842. '�' => 'I',
  77843. '�' => 'J',
  77844. '�' => 'K',
  77845. '�' => 'L',
  77846. '�' => 'M',
  77847. '�' => 'N',
  77848. '�' => 'O',
  77849. '�' => 'P',
  77850. '�' => 'Q',
  77851. '�' => 'R',
  77852. '�' => 'S',
  77853. '�' => 'T',
  77854. '�' => 'U',
  77855. '�' => 'V',
  77856. '�' => 'W',
  77857. '�' => 'X',
  77858. '�' => 'Y',
  77859. '�' => 'Z',
  77860. '�' => 'a',
  77861. '�' => 'b',
  77862. '�' => 'c',
  77863. '�' => 'd',
  77864. '�' => 'e',
  77865. '�' => 'f',
  77866. '�' => 'g',
  77867. '�' => 'h',
  77868. '�' => 'i',
  77869. '�' => 'j',
  77870. '�' => 'k',
  77871. '�' => 'l',
  77872. '�' => 'm',
  77873. '�' => 'n',
  77874. '�' => 'o',
  77875. '�' => 'p',
  77876. '�' => 'q',
  77877. '�' => 'r',
  77878. '�' => 's',
  77879. '�' => 't',
  77880. '�' => 'u',
  77881. '�' => 'v',
  77882. '�' => 'w',
  77883. '�' => 'x',
  77884. '�' => 'y',
  77885. '�' => 'z',
  77886. '�' => 'A',
  77887. '�' => 'B',
  77888. '�' => 'C',
  77889. '�' => 'D',
  77890. '�' => 'E',
  77891. '�' => 'F',
  77892. '�' => 'G',
  77893. '�' => 'H',
  77894. '�' => 'I',
  77895. '�' => 'J',
  77896. '�' => 'K',
  77897. '�' => 'L',
  77898. '�' => 'M',
  77899. '�' => 'N',
  77900. '�' => 'O',
  77901. '�' => 'P',
  77902. '�' => 'Q',
  77903. '�' => 'R',
  77904. '�' => 'S',
  77905. '�' => 'T',
  77906. '�' => 'U',
  77907. '�' => 'V',
  77908. '�' => 'W',
  77909. '�' => 'X',
  77910. '�' => 'Y',
  77911. '�' => 'Z',
  77912. '�' => 'a',
  77913. '�' => 'b',
  77914. '�' => 'c',
  77915. '�' => 'd',
  77916. '�' => 'e',
  77917. '�' => 'f',
  77918. '�' => 'g',
  77919. '�' => 'h',
  77920. '�' => 'i',
  77921. '�' => 'j',
  77922. '�' => 'k',
  77923. '�' => 'l',
  77924. '�' => 'm',
  77925. '�' => 'n',
  77926. '�' => 'o',
  77927. '�' => 'p',
  77928. '�' => 'q',
  77929. '�' => 'r',
  77930. '�' => 's',
  77931. '�' => 't',
  77932. '�' => 'u',
  77933. '�' => 'v',
  77934. '�' => 'w',
  77935. '�' => 'x',
  77936. '�' => 'y',
  77937. '�' => 'z',
  77938. '�' => 'A',
  77939. '�' => 'B',
  77940. '�' => 'C',
  77941. '�' => 'D',
  77942. '�' => 'E',
  77943. '�' => 'F',
  77944. '�' => 'G',
  77945. '�' => 'H',
  77946. '�' => 'I',
  77947. '�' => 'J',
  77948. '�' => 'K',
  77949. '�' => 'L',
  77950. '�' => 'M',
  77951. '�' => 'N',
  77952. '�' => 'O',
  77953. '�' => 'P',
  77954. '�' => 'Q',
  77955. '�' => 'R',
  77956. '�' => 'S',
  77957. '�' => 'T',
  77958. '�' => 'U',
  77959. '�' => 'V',
  77960. '�' => 'W',
  77961. '�' => 'X',
  77962. '�' => 'Y',
  77963. '�' => 'Z',
  77964. '�' => 'a',
  77965. '�' => 'b',
  77966. '�' => 'c',
  77967. '�' => 'd',
  77968. '�' => 'e',
  77969. '�' => 'f',
  77970. '�' => 'g',
  77971. '�' => 'h',
  77972. '�' => 'i',
  77973. '�' => 'j',
  77974. '�' => 'k',
  77975. '�' => 'l',
  77976. '�' => 'm',
  77977. '�' => 'n',
  77978. '�' => 'o',
  77979. '�' => 'p',
  77980. '�' => 'q',
  77981. '�' => 'r',
  77982. '�' => 's',
  77983. '�' => 't',
  77984. '�' => 'u',
  77985. '�' => 'v',
  77986. '�' => 'w',
  77987. '�' => 'x',
  77988. '�' => 'y',
  77989. '�' => 'z',
  77990. '�' => 'ı',
  77991. '�' => 'ȷ',
  77992. '�' => 'Α',
  77993. '�' => 'Β',
  77994. '�' => 'Γ',
  77995. '�' => 'Δ',
  77996. '�' => 'Ε',
  77997. '�' => 'Ζ',
  77998. '�' => 'Η',
  77999. '�' => 'Θ',
  78000. '�' => 'Ι',
  78001. '�' => 'Κ',
  78002. '�' => 'Λ',
  78003. '�' => 'Μ',
  78004. '�' => '�',
  78005. '�' => 'Ξ',
  78006. '�' => 'Ο',
  78007. '�' => 'Π',
  78008. '�' => 'Ρ',
  78009. '�' => 'Θ',
  78010. '�' => 'Σ',
  78011. '�' => 'Τ',
  78012. '�' => 'Υ',
  78013. '�' => 'Φ',
  78014. '�' => 'Χ',
  78015. '�' => 'Ψ',
  78016. '�' => 'Ω',
  78017. '�' => '∇',
  78018. '�' => 'α',
  78019. '�' => 'β',
  78020. '�' => 'γ',
  78021. '�' => 'δ',
  78022. '�' => 'ε',
  78023. '�' => 'ζ',
  78024. '�' => 'η',
  78025. '�' => 'θ',
  78026. '�' => 'ι',
  78027. '�' => 'κ',
  78028. '�' => 'λ',
  78029. '�' => 'μ',
  78030. '�' => 'ν',
  78031. '�' => 'ξ',
  78032. '�' => 'ο',
  78033. '�' => 'π',
  78034. '�' => '�',
  78035. '�' => 'ς',
  78036. '�' => 'σ',
  78037. '�' => 'τ',
  78038. '�' => 'υ',
  78039. '�' => 'φ',
  78040. '�' => 'χ',
  78041. '�' => 'ψ',
  78042. '�' => 'ω',
  78043. '�' => '∂',
  78044. '�' => 'ε',
  78045. '�' => 'θ',
  78046. '�' => 'κ',
  78047. '�' => 'φ',
  78048. '�' => '�',
  78049. '�' => 'π',
  78050. '�' => 'Α',
  78051. '�' => 'Β',
  78052. '�' => 'Γ',
  78053. '�' => 'Δ',
  78054. '�' => 'Ε',
  78055. '�' => 'Ζ',
  78056. '�' => 'Η',
  78057. '�' => 'Θ',
  78058. '�' => 'Ι',
  78059. '�' => 'Κ',
  78060. '�' => 'Λ',
  78061. '�' => 'Μ',
  78062. '�' => '�',
  78063. '�' => 'Ξ',
  78064. '�' => 'Ο',
  78065. '�' => 'Π',
  78066. '�' => 'Ρ',
  78067. '�' => 'Θ',
  78068. '�' => 'Σ',
  78069. '�' => 'Τ',
  78070. '�' => 'Υ',
  78071. '�' => 'Φ',
  78072. '�' => 'Χ',
  78073. '�' => 'Ψ',
  78074. '�' => 'Ω',
  78075. '�' => '∇',
  78076. '�' => 'α',
  78077. '�' => 'β',
  78078. '�' => 'γ',
  78079. '�' => 'δ',
  78080. '�' => 'ε',
  78081. '�' => 'ζ',
  78082. '�' => 'η',
  78083. '�' => 'θ',
  78084. '�' => 'ι',
  78085. '�' => 'κ',
  78086. '�' => 'λ',
  78087. '�' => 'μ',
  78088. '�' => 'ν',
  78089. '�' => 'ξ',
  78090. '�' => 'ο',
  78091. '�' => 'π',
  78092. '�' => '�',
  78093. '�' => 'ς',
  78094. '�' => 'σ',
  78095. '�' => 'τ',
  78096. '�' => 'υ',
  78097. '�' => 'φ',
  78098. '�' => 'χ',
  78099. '�' => 'ψ',
  78100. '�' => 'ω',
  78101. '�' => '∂',
  78102. '�' => 'ε',
  78103. '�' => 'θ',
  78104. '�' => 'κ',
  78105. '�' => 'φ',
  78106. '�' => '�',
  78107. '�' => 'π',
  78108. '�' => 'Α',
  78109. '�' => 'Β',
  78110. '�' => 'Γ',
  78111. '�' => 'Δ',
  78112. '�' => 'Ε',
  78113. '�' => 'Ζ',
  78114. '�' => 'Η',
  78115. '�' => 'Θ',
  78116. '�' => 'Ι',
  78117. '�' => 'Κ',
  78118. '�' => 'Λ',
  78119. '�' => 'Μ',
  78120. '�' => '�',
  78121. '�' => 'Ξ',
  78122. '�' => 'Ο',
  78123. '�' => 'Π',
  78124. '�' => 'Ρ',
  78125. '�' => 'Θ',
  78126. '�' => 'Σ',
  78127. '�' => 'Τ',
  78128. '�' => 'Υ',
  78129. '�' => 'Φ',
  78130. '�' => 'Χ',
  78131. '�' => 'Ψ',
  78132. '�' => 'Ω',
  78133. '�' => '∇',
  78134. '�' => 'α',
  78135. '�' => 'β',
  78136. '�' => 'γ',
  78137. '�' => 'δ',
  78138. '�' => 'ε',
  78139. '�' => 'ζ',
  78140. '�' => 'η',
  78141. '�' => 'θ',
  78142. '�' => 'ι',
  78143. '�' => 'κ',
  78144. '�' => 'λ',
  78145. '�' => 'μ',
  78146. '�' => 'ν',
  78147. '�' => 'ξ',
  78148. '�' => 'ο',
  78149. '�' => 'π',
  78150. '�' => '�',
  78151. '�' => 'ς',
  78152. '�' => 'σ',
  78153. '�' => 'τ',
  78154. '�' => 'υ',
  78155. '�' => 'φ',
  78156. '�' => 'χ',
  78157. '�' => 'ψ',
  78158. '�' => 'ω',
  78159. '�' => '∂',
  78160. '�' => 'ε',
  78161. '�' => 'θ',
  78162. '�' => 'κ',
  78163. '�' => 'φ',
  78164. '�' => '�',
  78165. '�' => 'π',
  78166. '�' => 'Α',
  78167. '�' => 'Β',
  78168. '�' => 'Γ',
  78169. '�' => 'Δ',
  78170. '�' => 'Ε',
  78171. '�' => 'Ζ',
  78172. '�' => 'Η',
  78173. '�' => 'Θ',
  78174. '�' => 'Ι',
  78175. '�' => 'Κ',
  78176. '�' => 'Λ',
  78177. '�' => 'Μ',
  78178. '�' => '�',
  78179. '�' => 'Ξ',
  78180. '�' => 'Ο',
  78181. '�' => 'Π',
  78182. '�' => 'Ρ',
  78183. '�' => 'Θ',
  78184. '�' => 'Σ',
  78185. '�' => 'Τ',
  78186. '�' => 'Υ',
  78187. '�' => 'Φ',
  78188. '�' => 'Χ',
  78189. '�' => 'Ψ',
  78190. '�' => 'Ω',
  78191. '�' => '∇',
  78192. '�' => 'α',
  78193. '�' => 'β',
  78194. '�' => 'γ',
  78195. '�' => 'δ',
  78196. '�' => 'ε',
  78197. '�' => 'ζ',
  78198. '�' => 'η',
  78199. '�' => 'θ',
  78200. '�' => 'ι',
  78201. '�' => 'κ',
  78202. '�' => 'λ',
  78203. '�' => 'μ',
  78204. '�' => 'ν',
  78205. '�' => 'ξ',
  78206. '�' => 'ο',
  78207. '�' => 'π',
  78208. '�' => '�',
  78209. '�' => 'ς',
  78210. '�' => 'σ',
  78211. '�' => 'τ',
  78212. '�' => 'υ',
  78213. '�' => 'φ',
  78214. '�' => 'χ',
  78215. '�' => 'ψ',
  78216. '�' => 'ω',
  78217. '�' => '∂',
  78218. '�' => 'ε',
  78219. '�' => 'θ',
  78220. '�' => 'κ',
  78221. '�' => 'φ',
  78222. '�' => '�',
  78223. '�' => 'π',
  78224. '�' => 'Α',
  78225. '�' => 'Β',
  78226. '�' => 'Γ',
  78227. '�' => 'Δ',
  78228. '�' => 'Ε',
  78229. '�' => 'Ζ',
  78230. '�' => 'Η',
  78231. '�' => 'Θ',
  78232. '�' => 'Ι',
  78233. '�' => 'Κ',
  78234. '�' => 'Λ',
  78235. '�' => 'Μ',
  78236. '�' => '�',
  78237. '�' => 'Ξ',
  78238. '�' => 'Ο',
  78239. '�' => 'Π',
  78240. '�' => 'Ρ',
  78241. '�' => 'Θ',
  78242. '�' => 'Σ',
  78243. '�' => 'Τ',
  78244. '�' => 'Υ',
  78245. '�' => 'Φ',
  78246. '�' => 'Χ',
  78247. '�' => 'Ψ',
  78248. '�' => 'Ω',
  78249. '�' => '∇',
  78250. '�' => 'α',
  78251. '�' => 'β',
  78252. '�' => 'γ',
  78253. '�' => 'δ',
  78254. '�' => 'ε',
  78255. '�' => 'ζ',
  78256. '�' => 'η',
  78257. '�' => 'θ',
  78258. '�' => 'ι',
  78259. '�' => 'κ',
  78260. '�' => 'λ',
  78261. '�' => 'μ',
  78262. '�' => 'ν',
  78263. '�' => 'ξ',
  78264. '�' => 'ο',
  78265. '�' => 'π',
  78266. '�' => '�',
  78267. '�' => 'ς',
  78268. '�' => 'σ',
  78269. '�' => 'τ',
  78270. '�' => 'υ',
  78271. '�' => 'φ',
  78272. '�' => 'χ',
  78273. '�' => 'ψ',
  78274. '�' => 'ω',
  78275. '�' => '∂',
  78276. '�' => 'ε',
  78277. '�' => 'θ',
  78278. '�' => 'κ',
  78279. '�' => 'φ',
  78280. '�' => '�',
  78281. '�' => 'π',
  78282. '�' => 'Ϝ',
  78283. '�' => '�',
  78284. '�' => '0',
  78285. '�' => '1',
  78286. '�' => '2',
  78287. '�' => '3',
  78288. '�' => '4',
  78289. '�' => '5',
  78290. '�' => '6',
  78291. '�' => '7',
  78292. '�' => '8',
  78293. '�' => '9',
  78294. '�' => '0',
  78295. '�' => '1',
  78296. '�' => '2',
  78297. '�' => '3',
  78298. '�' => '4',
  78299. '�' => '5',
  78300. '�' => '6',
  78301. '�' => '7',
  78302. '�' => '8',
  78303. '�' => '9',
  78304. '�' => '0',
  78305. '�' => '1',
  78306. '�' => '2',
  78307. '�' => '3',
  78308. '�' => '4',
  78309. '�' => '5',
  78310. '�' => '6',
  78311. '�' => '7',
  78312. '�' => '8',
  78313. '�' => '9',
  78314. '�' => '0',
  78315. '�' => '1',
  78316. '�' => '2',
  78317. '�' => '3',
  78318. '�' => '4',
  78319. '�' => '5',
  78320. '�' => '6',
  78321. '�' => '7',
  78322. '�' => '8',
  78323. '�' => '9',
  78324. '�' => '0',
  78325. '�' => '1',
  78326. '�' => '2',
  78327. '�' => '3',
  78328. '�' => '4',
  78329. '�' => '5',
  78330. '�' => '6',
  78331. '�' => '7',
  78332. '�' => '8',
  78333. '�' => '9',
  78334. '𞸀' => 'ا',
  78335. '�' => 'ب',
  78336. '𞸂' => 'ج',
  78337. '𞸃' => 'د',
  78338. '𞸅' => 'و',
  78339. '𞸆' => 'ز',
  78340. '𞸇' => 'ح',
  78341. '𞸈' => 'ط',
  78342. '𞸉' => 'ي',
  78343. '𞸊' => 'ك',
  78344. '𞸋' => 'ل',
  78345. '𞸌' => 'م',
  78346. '�' => 'ن',
  78347. '𞸎' => 'س',
  78348. '�' => 'ع',
  78349. '�' => '�',
  78350. '𞸑' => 'ص',
  78351. '𞸒' => 'ق',
  78352. '𞸓' => 'ر',
  78353. '𞸔' => 'ش',
  78354. '𞸕' => 'ت',
  78355. '𞸖' => 'ث',
  78356. '𞸗' => 'خ',
  78357. '𞸘' => 'ذ',
  78358. '𞸙' => 'ض',
  78359. '𞸚' => 'ظ',
  78360. '𞸛' => 'غ',
  78361. '𞸜' => 'ٮ',
  78362. '�' => 'ں',
  78363. '𞸞' => 'ڡ',
  78364. '𞸟' => 'ٯ',
  78365. '𞸡' => 'ب',
  78366. '𞸢' => 'ج',
  78367. '𞸤' => 'ه',
  78368. '𞸧' => 'ح',
  78369. '𞸩' => 'ي',
  78370. '𞸪' => 'ك',
  78371. '𞸫' => 'ل',
  78372. '𞸬' => 'م',
  78373. '𞸭' => 'ن',
  78374. '𞸮' => 'س',
  78375. '𞸯' => 'ع',
  78376. '𞸰' => '�',
  78377. '𞸱' => 'ص',
  78378. '𞸲' => 'ق',
  78379. '𞸴' => 'ش',
  78380. '𞸵' => 'ت',
  78381. '𞸶' => 'ث',
  78382. '𞸷' => 'خ',
  78383. '𞸹' => 'ض',
  78384. '𞸻' => 'غ',
  78385. '𞹂' => 'ج',
  78386. '𞹇' => 'ح',
  78387. '𞹉' => 'ي',
  78388. '𞹋' => 'ل',
  78389. '�' => 'ن',
  78390. '𞹎' => 'س',
  78391. '�' => 'ع',
  78392. '𞹑' => 'ص',
  78393. 'ðž¹’' => 'Ù‚',
  78394. 'ðž¹”' => 'Ø´',
  78395. 'ðž¹—' => 'Ø®',
  78396. '𞹙' => 'ض',
  78397. '𞹛' => 'غ',
  78398. '�' => 'ں',
  78399. '𞹟' => 'ٯ',
  78400. '𞹡' => 'ب',
  78401. '𞹢' => 'ج',
  78402. '𞹤' => 'ه',
  78403. '𞹧' => 'ح',
  78404. '𞹨' => 'ط',
  78405. '𞹩' => 'ي',
  78406. '𞹪' => 'ك',
  78407. '𞹬' => 'م',
  78408. 'ðž¹­' => 'Ù†',
  78409. '𞹮' => 'س',
  78410. '𞹯' => 'ع',
  78411. 'ðž¹°' => 'Ù�',
  78412. '𞹱' => 'ص',
  78413. 'ðž¹²' => 'Ù‚',
  78414. 'ðž¹´' => 'Ø´',
  78415. '𞹵' => 'ت',
  78416. '𞹶' => 'ث',
  78417. 'ðž¹·' => 'Ø®',
  78418. '𞹹' => 'ض',
  78419. '𞹺' => 'ظ',
  78420. '𞹻' => 'غ',
  78421. 'ðž¹¼' => 'Ù®',
  78422. 'ðž¹¾' => 'Ú¡',
  78423. '𞺀' => 'ا',
  78424. '�' => 'ب',
  78425. '𞺂' => 'ج',
  78426. '𞺃' => 'د',
  78427. '𞺄' => 'ه',
  78428. '𞺅' => 'و',
  78429. '𞺆' => 'ز',
  78430. '𞺇' => 'ح',
  78431. '𞺈' => 'ط',
  78432. '𞺉' => 'ي',
  78433. '𞺋' => 'ل',
  78434. '𞺌' => 'م',
  78435. '�' => 'ن',
  78436. '𞺎' => 'س',
  78437. '�' => 'ع',
  78438. '�' => '�',
  78439. '𞺑' => 'ص',
  78440. '𞺒' => 'ق',
  78441. '𞺓' => 'ر',
  78442. '𞺔' => 'ش',
  78443. '𞺕' => 'ت',
  78444. '𞺖' => 'ث',
  78445. '𞺗' => 'خ',
  78446. '𞺘' => 'ذ',
  78447. '𞺙' => 'ض',
  78448. '𞺚' => 'ظ',
  78449. '𞺛' => 'غ',
  78450. '𞺡' => 'ب',
  78451. '𞺢' => 'ج',
  78452. '𞺣' => 'د',
  78453. '𞺥' => 'و',
  78454. '𞺦' => 'ز',
  78455. '𞺧' => 'ح',
  78456. '𞺨' => 'ط',
  78457. '𞺩' => 'ي',
  78458. '𞺫' => 'ل',
  78459. '𞺬' => 'م',
  78460. '𞺭' => 'ن',
  78461. '𞺮' => 'س',
  78462. '𞺯' => 'ع',
  78463. '𞺰' => '�',
  78464. '𞺱' => 'ص',
  78465. '𞺲' => 'ق',
  78466. '𞺳' => 'ر',
  78467. '𞺴' => 'ش',
  78468. '𞺵' => 'ت',
  78469. '𞺶' => 'ث',
  78470. '𞺷' => 'خ',
  78471. '𞺸' => 'ذ',
  78472. '𞺹' => 'ض',
  78473. '𞺺' => 'ظ',
  78474. '𞺻' => 'غ',
  78475. '🄀' => '0.',
  78476. '�' => '0,',
  78477. '🄂' => '1,',
  78478. '🄃' => '2,',
  78479. '🄄' => '3,',
  78480. '🄅' => '4,',
  78481. '🄆' => '5,',
  78482. '🄇' => '6,',
  78483. '🄈' => '7,',
  78484. '🄉' => '8,',
  78485. '🄊' => '9,',
  78486. '�' => '(A)',
  78487. '🄑' => '(B)',
  78488. '🄒' => '(C)',
  78489. '🄓' => '(D)',
  78490. '🄔' => '(E)',
  78491. '🄕' => '(F)',
  78492. '🄖' => '(G)',
  78493. '🄗' => '(H)',
  78494. '🄘' => '(I)',
  78495. '🄙' => '(J)',
  78496. '🄚' => '(K)',
  78497. '🄛' => '(L)',
  78498. '🄜' => '(M)',
  78499. '�' => '(N)',
  78500. '🄞' => '(O)',
  78501. '🄟' => '(P)',
  78502. '🄠' => '(Q)',
  78503. '🄡' => '(R)',
  78504. '🄢' => '(S)',
  78505. '🄣' => '(T)',
  78506. '🄤' => '(U)',
  78507. '🄥' => '(V)',
  78508. '🄦' => '(W)',
  78509. '🄧' => '(X)',
  78510. '🄨' => '(Y)',
  78511. '🄩' => '(Z)',
  78512. '🄪' => '〔S〕',
  78513. '🄫' => 'C',
  78514. '🄬' => 'R',
  78515. '🄭' => 'CD',
  78516. '🄮' => 'WZ',
  78517. '🄰' => 'A',
  78518. '🄱' => 'B',
  78519. '🄲' => 'C',
  78520. '🄳' => 'D',
  78521. '🄴' => 'E',
  78522. '🄵' => 'F',
  78523. '🄶' => 'G',
  78524. '🄷' => 'H',
  78525. '🄸' => 'I',
  78526. '🄹' => 'J',
  78527. '🄺' => 'K',
  78528. '🄻' => 'L',
  78529. '🄼' => 'M',
  78530. '🄽' => 'N',
  78531. '🄾' => 'O',
  78532. '🄿' => 'P',
  78533. '🅀' => 'Q',
  78534. '�' => 'R',
  78535. '🅂' => 'S',
  78536. '🅃' => 'T',
  78537. '🅄' => 'U',
  78538. '🅅' => 'V',
  78539. '🅆' => 'W',
  78540. '🅇' => 'X',
  78541. '🅈' => 'Y',
  78542. '🅉' => 'Z',
  78543. '🅊' => 'HV',
  78544. '🅋' => 'MV',
  78545. '🅌' => 'SD',
  78546. '�' => 'SS',
  78547. '🅎' => 'PPV',
  78548. '�' => 'WC',
  78549. '🅪' => 'MC',
  78550. '🅫' => 'MD',
  78551. '🅬' => 'MR',
  78552. '�' => 'DJ',
  78553. '🈀' => '��',
  78554. '�' => 'ココ',
  78555. '🈂' => 'サ',
  78556. '�' => '手',
  78557. '🈑' => '字',
  78558. '🈒' => '�',
  78559. '🈓' => 'デ',
  78560. '🈔' => '二',
  78561. '🈕' => '多',
  78562. '🈖' => '解',
  78563. '🈗' => '天',
  78564. '🈘' => '交',
  78565. '🈙' => '映',
  78566. '🈚' => '無',
  78567. '🈛' => '料',
  78568. '🈜' => '�',
  78569. '�' => '後',
  78570. '🈞' => '�',
  78571. '🈟' => '新',
  78572. '🈠' => '�',
  78573. '🈡' => '終',
  78574. '🈢' => '生',
  78575. '🈣' => '販',
  78576. '🈤' => '声',
  78577. '🈥' => '�',
  78578. '🈦' => '演',
  78579. '🈧' => '投',
  78580. '🈨' => '�',
  78581. '🈩' => '一',
  78582. '🈪' => '三',
  78583. '🈫' => '�',
  78584. '🈬' => '左',
  78585. '🈭' => '中',
  78586. '🈮' => '�',
  78587. '🈯' => '指',
  78588. '🈰' => '走',
  78589. '🈱' => '打',
  78590. '🈲' => '�',
  78591. '🈳' => '空',
  78592. '🈴' => '�',
  78593. '🈵' => '満',
  78594. '🈶' => '有',
  78595. '🈷' => '月',
  78596. '🈸' => '申',
  78597. '🈹' => '割',
  78598. '🈺' => '営',
  78599. '🈻' => '�',
  78600. '🉀' => '〔本〕',
  78601. '�' => '〔三〕',
  78602. '🉂' => '〔二〕',
  78603. '🉃' => '〔安〕',
  78604. '🉄' => '〔点〕',
  78605. '🉅' => '〔打〕',
  78606. '🉆' => '〔盗〕',
  78607. '🉇' => '〔�〕',
  78608. '🉈' => '〔敗〕',
  78609. '�' => '得',
  78610. '🉑' => '�',
  78611. '🯰' => '0',
  78612. '🯱' => '1',
  78613. '🯲' => '2',
  78614. '🯳' => '3',
  78615. '🯴' => '4',
  78616. '🯵' => '5',
  78617. '🯶' => '6',
  78618. '🯷' => '7',
  78619. '🯸' => '8',
  78620. '🯹' => '9',
  78621. );
  78622. <?php
  78623. use Symfony\Polyfill\Intl\Normalizer as p;
  78624. if (\PHP_VERSION_ID >= 80000) {
  78625. return require __DIR__.'/bootstrap80.php';
  78626. }
  78627. if (!function_exists('normalizer_is_normalized')) {
  78628. function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); }
  78629. }
  78630. if (!function_exists('normalizer_normalize')) {
  78631. function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); }
  78632. }
  78633. <?php
  78634. use Symfony\Polyfill\Intl\Normalizer as p;
  78635. if (!function_exists('normalizer_is_normalized')) {
  78636. function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); }
  78637. }
  78638. if (!function_exists('normalizer_normalize')) {
  78639. function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); }
  78640. }
  78641. Copyright (c) 2015-present Fabien Potencier
  78642. Permission is hereby granted, free of charge, to any person obtaining a copy
  78643. of this software and associated documentation files (the "Software"), to deal
  78644. in the Software without restriction, including without limitation the rights
  78645. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  78646. copies of the Software, and to permit persons to whom the Software is furnished
  78647. to do so, subject to the following conditions:
  78648. The above copyright notice and this permission notice shall be included in all
  78649. copies or substantial portions of the Software.
  78650. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  78651. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  78652. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  78653. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  78654. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  78655. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  78656. THE SOFTWARE.
  78657. <?php
  78658. namespace Symfony\Polyfill\Mbstring;
  78659. final class Mbstring
  78660. {
  78661. public const MB_CASE_FOLD = \PHP_INT_MAX;
  78662. private const SIMPLE_CASE_FOLD = [
  78663. ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
  78664. ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
  78665. ];
  78666. private static $encodingList = ['ASCII', 'UTF-8'];
  78667. private static $language = 'neutral';
  78668. private static $internalEncoding = 'UTF-8';
  78669. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  78670. {
  78671. if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) {
  78672. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  78673. } else {
  78674. $fromEncoding = self::getEncoding($fromEncoding);
  78675. }
  78676. $toEncoding = self::getEncoding($toEncoding);
  78677. if ('BASE64' === $fromEncoding) {
  78678. $s = base64_decode($s);
  78679. $fromEncoding = $toEncoding;
  78680. }
  78681. if ('BASE64' === $toEncoding) {
  78682. return base64_encode($s);
  78683. }
  78684. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  78685. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  78686. $fromEncoding = 'Windows-1252';
  78687. }
  78688. if ('UTF-8' !== $fromEncoding) {
  78689. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  78690. }
  78691. return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
  78692. }
  78693. if ('HTML-ENTITIES' === $fromEncoding) {
  78694. $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8');
  78695. $fromEncoding = 'UTF-8';
  78696. }
  78697. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  78698. }
  78699. public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
  78700. {
  78701. $ok = true;
  78702. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  78703. if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  78704. $ok = false;
  78705. }
  78706. });
  78707. return $ok ? $fromEncoding : false;
  78708. }
  78709. public static function mb_decode_mimeheader($s)
  78710. {
  78711. return iconv_mime_decode($s, 2, self::$internalEncoding);
  78712. }
  78713. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  78714. {
  78715. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
  78716. }
  78717. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  78718. {
  78719. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
  78720. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  78721. return null;
  78722. }
  78723. if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
  78724. return false;
  78725. }
  78726. if (null !== $encoding && !\is_scalar($encoding)) {
  78727. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  78728. return '';
  78729. }
  78730. $s = (string) $s;
  78731. if ('' === $s) {
  78732. return '';
  78733. }
  78734. $encoding = self::getEncoding($encoding);
  78735. if ('UTF-8' === $encoding) {
  78736. $encoding = null;
  78737. if (!preg_match('//u', $s)) {
  78738. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  78739. }
  78740. } else {
  78741. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  78742. }
  78743. $cnt = floor(\count($convmap) / 4) * 4;
  78744. for ($i = 0; $i < $cnt; $i += 4) {
  78745. $convmap[$i] += $convmap[$i + 2];
  78746. $convmap[$i + 1] += $convmap[$i + 2];
  78747. }
  78748. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  78749. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  78750. for ($i = 0; $i < $cnt; $i += 4) {
  78751. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  78752. return self::mb_chr($c - $convmap[$i + 2]);
  78753. }
  78754. }
  78755. return $m[0];
  78756. }, $s);
  78757. if (null === $encoding) {
  78758. return $s;
  78759. }
  78760. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  78761. }
  78762. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  78763. {
  78764. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
  78765. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  78766. return null;
  78767. }
  78768. if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
  78769. return false;
  78770. }
  78771. if (null !== $encoding && !\is_scalar($encoding)) {
  78772. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  78773. return null;
  78774. }
  78775. if (null !== $is_hex && !\is_scalar($is_hex)) {
  78776. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
  78777. return null;
  78778. }
  78779. $s = (string) $s;
  78780. if ('' === $s) {
  78781. return '';
  78782. }
  78783. $encoding = self::getEncoding($encoding);
  78784. if ('UTF-8' === $encoding) {
  78785. $encoding = null;
  78786. if (!preg_match('//u', $s)) {
  78787. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  78788. }
  78789. } else {
  78790. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  78791. }
  78792. static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  78793. $cnt = floor(\count($convmap) / 4) * 4;
  78794. $i = 0;
  78795. $len = \strlen($s);
  78796. $result = '';
  78797. while ($i < $len) {
  78798. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  78799. $uchr = substr($s, $i, $ulen);
  78800. $i += $ulen;
  78801. $c = self::mb_ord($uchr);
  78802. for ($j = 0; $j < $cnt; $j += 4) {
  78803. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  78804. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  78805. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  78806. continue 2;
  78807. }
  78808. }
  78809. $result .= $uchr;
  78810. }
  78811. if (null === $encoding) {
  78812. return $result;
  78813. }
  78814. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  78815. }
  78816. public static function mb_convert_case($s, $mode, $encoding = null)
  78817. {
  78818. $s = (string) $s;
  78819. if ('' === $s) {
  78820. return '';
  78821. }
  78822. $encoding = self::getEncoding($encoding);
  78823. if ('UTF-8' === $encoding) {
  78824. $encoding = null;
  78825. if (!preg_match('//u', $s)) {
  78826. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  78827. }
  78828. } else {
  78829. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  78830. }
  78831. if (\MB_CASE_TITLE == $mode) {
  78832. static $titleRegexp = null;
  78833. if (null === $titleRegexp) {
  78834. $titleRegexp = self::getData('titleCaseRegexp');
  78835. }
  78836. $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s);
  78837. } else {
  78838. if (\MB_CASE_UPPER == $mode) {
  78839. static $upper = null;
  78840. if (null === $upper) {
  78841. $upper = self::getData('upperCase');
  78842. }
  78843. $map = $upper;
  78844. } else {
  78845. if (self::MB_CASE_FOLD === $mode) {
  78846. static $caseFolding = null;
  78847. if (null === $caseFolding) {
  78848. $caseFolding = self::getData('caseFolding');
  78849. }
  78850. $s = strtr($s, $caseFolding);
  78851. }
  78852. static $lower = null;
  78853. if (null === $lower) {
  78854. $lower = self::getData('lowerCase');
  78855. }
  78856. $map = $lower;
  78857. }
  78858. static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  78859. $i = 0;
  78860. $len = \strlen($s);
  78861. while ($i < $len) {
  78862. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  78863. $uchr = substr($s, $i, $ulen);
  78864. $i += $ulen;
  78865. if (isset($map[$uchr])) {
  78866. $uchr = $map[$uchr];
  78867. $nlen = \strlen($uchr);
  78868. if ($nlen == $ulen) {
  78869. $nlen = $i;
  78870. do {
  78871. $s[--$nlen] = $uchr[--$ulen];
  78872. } while ($ulen);
  78873. } else {
  78874. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  78875. $len += $nlen - $ulen;
  78876. $i += $nlen - $ulen;
  78877. }
  78878. }
  78879. }
  78880. }
  78881. if (null === $encoding) {
  78882. return $s;
  78883. }
  78884. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  78885. }
  78886. public static function mb_internal_encoding($encoding = null)
  78887. {
  78888. if (null === $encoding) {
  78889. return self::$internalEncoding;
  78890. }
  78891. $normalizedEncoding = self::getEncoding($encoding);
  78892. if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
  78893. self::$internalEncoding = $normalizedEncoding;
  78894. return true;
  78895. }
  78896. if (80000 > \PHP_VERSION_ID) {
  78897. return false;
  78898. }
  78899. throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
  78900. }
  78901. public static function mb_language($lang = null)
  78902. {
  78903. if (null === $lang) {
  78904. return self::$language;
  78905. }
  78906. switch ($normalizedLang = strtolower($lang)) {
  78907. case 'uni':
  78908. case 'neutral':
  78909. self::$language = $normalizedLang;
  78910. return true;
  78911. }
  78912. if (80000 > \PHP_VERSION_ID) {
  78913. return false;
  78914. }
  78915. throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang));
  78916. }
  78917. public static function mb_list_encodings()
  78918. {
  78919. return ['UTF-8'];
  78920. }
  78921. public static function mb_encoding_aliases($encoding)
  78922. {
  78923. switch (strtoupper($encoding)) {
  78924. case 'UTF8':
  78925. case 'UTF-8':
  78926. return ['utf8'];
  78927. }
  78928. return false;
  78929. }
  78930. public static function mb_check_encoding($var = null, $encoding = null)
  78931. {
  78932. if (PHP_VERSION_ID < 70200 && \is_array($var)) {
  78933. trigger_error('mb_check_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING);
  78934. return null;
  78935. }
  78936. if (null === $encoding) {
  78937. if (null === $var) {
  78938. return false;
  78939. }
  78940. $encoding = self::$internalEncoding;
  78941. }
  78942. if (!\is_array($var)) {
  78943. return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var);
  78944. }
  78945. foreach ($var as $key => $value) {
  78946. if (!self::mb_check_encoding($key, $encoding)) {
  78947. return false;
  78948. }
  78949. if (!self::mb_check_encoding($value, $encoding)) {
  78950. return false;
  78951. }
  78952. }
  78953. return true;
  78954. }
  78955. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  78956. {
  78957. if (null === $encodingList) {
  78958. $encodingList = self::$encodingList;
  78959. } else {
  78960. if (!\is_array($encodingList)) {
  78961. $encodingList = array_map('trim', explode(',', $encodingList));
  78962. }
  78963. $encodingList = array_map('strtoupper', $encodingList);
  78964. }
  78965. foreach ($encodingList as $enc) {
  78966. switch ($enc) {
  78967. case 'ASCII':
  78968. if (!preg_match('/[\x80-\xFF]/', $str)) {
  78969. return $enc;
  78970. }
  78971. break;
  78972. case 'UTF8':
  78973. case 'UTF-8':
  78974. if (preg_match('//u', $str)) {
  78975. return 'UTF-8';
  78976. }
  78977. break;
  78978. default:
  78979. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  78980. return $enc;
  78981. }
  78982. }
  78983. }
  78984. return false;
  78985. }
  78986. public static function mb_detect_order($encodingList = null)
  78987. {
  78988. if (null === $encodingList) {
  78989. return self::$encodingList;
  78990. }
  78991. if (!\is_array($encodingList)) {
  78992. $encodingList = array_map('trim', explode(',', $encodingList));
  78993. }
  78994. $encodingList = array_map('strtoupper', $encodingList);
  78995. foreach ($encodingList as $enc) {
  78996. switch ($enc) {
  78997. default:
  78998. if (strncmp($enc, 'ISO-8859-', 9)) {
  78999. return false;
  79000. }
  79001. case 'ASCII':
  79002. case 'UTF8':
  79003. case 'UTF-8':
  79004. }
  79005. }
  79006. self::$encodingList = $encodingList;
  79007. return true;
  79008. }
  79009. public static function mb_strlen($s, $encoding = null)
  79010. {
  79011. $encoding = self::getEncoding($encoding);
  79012. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  79013. return \strlen($s);
  79014. }
  79015. return @iconv_strlen($s, $encoding);
  79016. }
  79017. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  79018. {
  79019. $encoding = self::getEncoding($encoding);
  79020. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  79021. return strpos($haystack, $needle, $offset);
  79022. }
  79023. $needle = (string) $needle;
  79024. if ('' === $needle) {
  79025. if (80000 > \PHP_VERSION_ID) {
  79026. trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING);
  79027. return false;
  79028. }
  79029. return 0;
  79030. }
  79031. return iconv_strpos($haystack, $needle, $offset, $encoding);
  79032. }
  79033. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  79034. {
  79035. $encoding = self::getEncoding($encoding);
  79036. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  79037. return strrpos($haystack, $needle, $offset);
  79038. }
  79039. if ($offset != (int) $offset) {
  79040. $offset = 0;
  79041. } elseif ($offset = (int) $offset) {
  79042. if ($offset < 0) {
  79043. if (0 > $offset += self::mb_strlen($needle)) {
  79044. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  79045. }
  79046. $offset = 0;
  79047. } else {
  79048. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  79049. }
  79050. }
  79051. $pos = '' !== $needle || 80000 > \PHP_VERSION_ID
  79052. ? iconv_strrpos($haystack, $needle, $encoding)
  79053. : self::mb_strlen($haystack, $encoding);
  79054. return false !== $pos ? $offset + $pos : false;
  79055. }
  79056. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  79057. {
  79058. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
  79059. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
  79060. return null;
  79061. }
  79062. if (1 > $split_length = (int) $split_length) {
  79063. if (80000 > \PHP_VERSION_ID) {
  79064. trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
  79065. return false;
  79066. }
  79067. throw new \ValueError('Argument #2 ($length) must be greater than 0');
  79068. }
  79069. if (null === $encoding) {
  79070. $encoding = mb_internal_encoding();
  79071. }
  79072. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  79073. $rx = '/(';
  79074. while (65535 < $split_length) {
  79075. $rx .= '.{65535}';
  79076. $split_length -= 65535;
  79077. }
  79078. $rx .= '.{'.$split_length.'})/us';
  79079. return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
  79080. }
  79081. $result = [];
  79082. $length = mb_strlen($string, $encoding);
  79083. for ($i = 0; $i < $length; $i += $split_length) {
  79084. $result[] = mb_substr($string, $i, $split_length, $encoding);
  79085. }
  79086. return $result;
  79087. }
  79088. public static function mb_strtolower($s, $encoding = null)
  79089. {
  79090. return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
  79091. }
  79092. public static function mb_strtoupper($s, $encoding = null)
  79093. {
  79094. return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
  79095. }
  79096. public static function mb_substitute_character($c = null)
  79097. {
  79098. if (null === $c) {
  79099. return 'none';
  79100. }
  79101. if (0 === strcasecmp($c, 'none')) {
  79102. return true;
  79103. }
  79104. if (80000 > \PHP_VERSION_ID) {
  79105. return false;
  79106. }
  79107. if (\is_int($c) || 'long' === $c || 'entity' === $c) {
  79108. return false;
  79109. }
  79110. throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint');
  79111. }
  79112. public static function mb_substr($s, $start, $length = null, $encoding = null)
  79113. {
  79114. $encoding = self::getEncoding($encoding);
  79115. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  79116. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  79117. }
  79118. if ($start < 0) {
  79119. $start = iconv_strlen($s, $encoding) + $start;
  79120. if ($start < 0) {
  79121. $start = 0;
  79122. }
  79123. }
  79124. if (null === $length) {
  79125. $length = 2147483647;
  79126. } elseif ($length < 0) {
  79127. $length = iconv_strlen($s, $encoding) + $length - $start;
  79128. if ($length < 0) {
  79129. return '';
  79130. }
  79131. }
  79132. return (string) iconv_substr($s, $start, $length, $encoding);
  79133. }
  79134. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  79135. {
  79136. [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [
  79137. self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding),
  79138. self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding),
  79139. ]);
  79140. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  79141. }
  79142. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  79143. {
  79144. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  79145. return self::getSubpart($pos, $part, $haystack, $encoding);
  79146. }
  79147. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  79148. {
  79149. $encoding = self::getEncoding($encoding);
  79150. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  79151. $pos = strrpos($haystack, $needle);
  79152. } else {
  79153. $needle = self::mb_substr($needle, 0, 1, $encoding);
  79154. $pos = iconv_strrpos($haystack, $needle, $encoding);
  79155. }
  79156. return self::getSubpart($pos, $part, $haystack, $encoding);
  79157. }
  79158. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  79159. {
  79160. $needle = self::mb_substr($needle, 0, 1, $encoding);
  79161. $pos = self::mb_strripos($haystack, $needle, $encoding);
  79162. return self::getSubpart($pos, $part, $haystack, $encoding);
  79163. }
  79164. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  79165. {
  79166. $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding);
  79167. $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding);
  79168. $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack);
  79169. $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle);
  79170. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  79171. }
  79172. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  79173. {
  79174. $pos = strpos($haystack, $needle);
  79175. if (false === $pos) {
  79176. return false;
  79177. }
  79178. if ($part) {
  79179. return substr($haystack, 0, $pos);
  79180. }
  79181. return substr($haystack, $pos);
  79182. }
  79183. public static function mb_get_info($type = 'all')
  79184. {
  79185. $info = [
  79186. 'internal_encoding' => self::$internalEncoding,
  79187. 'http_output' => 'pass',
  79188. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  79189. 'func_overload' => 0,
  79190. 'func_overload_list' => 'no overload',
  79191. 'mail_charset' => 'UTF-8',
  79192. 'mail_header_encoding' => 'BASE64',
  79193. 'mail_body_encoding' => 'BASE64',
  79194. 'illegal_chars' => 0,
  79195. 'encoding_translation' => 'Off',
  79196. 'language' => self::$language,
  79197. 'detect_order' => self::$encodingList,
  79198. 'substitute_character' => 'none',
  79199. 'strict_detection' => 'Off',
  79200. ];
  79201. if ('all' === $type) {
  79202. return $info;
  79203. }
  79204. if (isset($info[$type])) {
  79205. return $info[$type];
  79206. }
  79207. return false;
  79208. }
  79209. public static function mb_http_input($type = '')
  79210. {
  79211. return false;
  79212. }
  79213. public static function mb_http_output($encoding = null)
  79214. {
  79215. return null !== $encoding ? 'pass' === $encoding : 'pass';
  79216. }
  79217. public static function mb_strwidth($s, $encoding = null)
  79218. {
  79219. $encoding = self::getEncoding($encoding);
  79220. if ('UTF-8' !== $encoding) {
  79221. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  79222. }
  79223. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  79224. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  79225. }
  79226. public static function mb_substr_count($haystack, $needle, $encoding = null)
  79227. {
  79228. return substr_count($haystack, $needle);
  79229. }
  79230. public static function mb_output_handler($contents, $status)
  79231. {
  79232. return $contents;
  79233. }
  79234. public static function mb_chr($code, $encoding = null)
  79235. {
  79236. if (0x80 > $code %= 0x200000) {
  79237. $s = \chr($code);
  79238. } elseif (0x800 > $code) {
  79239. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  79240. } elseif (0x10000 > $code) {
  79241. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  79242. } else {
  79243. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  79244. }
  79245. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  79246. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  79247. }
  79248. return $s;
  79249. }
  79250. public static function mb_ord($s, $encoding = null)
  79251. {
  79252. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  79253. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  79254. }
  79255. if (1 === \strlen($s)) {
  79256. return \ord($s);
  79257. }
  79258. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  79259. if (0xF0 <= $code) {
  79260. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  79261. }
  79262. if (0xE0 <= $code) {
  79263. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  79264. }
  79265. if (0xC0 <= $code) {
  79266. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  79267. }
  79268. return $code;
  79269. }
  79270. public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, string $encoding = null): string
  79271. {
  79272. if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) {
  79273. throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH');
  79274. }
  79275. if (null === $encoding) {
  79276. $encoding = self::mb_internal_encoding();
  79277. }
  79278. try {
  79279. $validEncoding = @self::mb_check_encoding('', $encoding);
  79280. } catch (\ValueError $e) {
  79281. throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding));
  79282. }
  79283. if (!$validEncoding) {
  79284. throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding));
  79285. }
  79286. if (self::mb_strlen($pad_string, $encoding) <= 0) {
  79287. throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string');
  79288. }
  79289. $paddingRequired = $length - self::mb_strlen($string, $encoding);
  79290. if ($paddingRequired < 1) {
  79291. return $string;
  79292. }
  79293. switch ($pad_type) {
  79294. case \STR_PAD_LEFT:
  79295. return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string;
  79296. case \STR_PAD_RIGHT:
  79297. return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding);
  79298. default:
  79299. $leftPaddingLength = floor($paddingRequired / 2);
  79300. $rightPaddingLength = $paddingRequired - $leftPaddingLength;
  79301. return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding);
  79302. }
  79303. }
  79304. private static function getSubpart($pos, $part, $haystack, $encoding)
  79305. {
  79306. if (false === $pos) {
  79307. return false;
  79308. }
  79309. if ($part) {
  79310. return self::mb_substr($haystack, 0, $pos, $encoding);
  79311. }
  79312. return self::mb_substr($haystack, $pos, null, $encoding);
  79313. }
  79314. private static function html_encoding_callback(array $m)
  79315. {
  79316. $i = 1;
  79317. $entities = '';
  79318. $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
  79319. while (isset($m[$i])) {
  79320. if (0x80 > $m[$i]) {
  79321. $entities .= \chr($m[$i++]);
  79322. continue;
  79323. }
  79324. if (0xF0 <= $m[$i]) {
  79325. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  79326. } elseif (0xE0 <= $m[$i]) {
  79327. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  79328. } else {
  79329. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  79330. }
  79331. $entities .= '&#'.$c.';';
  79332. }
  79333. return $entities;
  79334. }
  79335. private static function title_case(array $s)
  79336. {
  79337. return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8');
  79338. }
  79339. private static function getData($file)
  79340. {
  79341. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  79342. return require $file;
  79343. }
  79344. return false;
  79345. }
  79346. private static function getEncoding($encoding)
  79347. {
  79348. if (null === $encoding) {
  79349. return self::$internalEncoding;
  79350. }
  79351. if ('UTF-8' === $encoding) {
  79352. return 'UTF-8';
  79353. }
  79354. $encoding = strtoupper($encoding);
  79355. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  79356. return 'CP850';
  79357. }
  79358. if ('UTF8' === $encoding) {
  79359. return 'UTF-8';
  79360. }
  79361. return $encoding;
  79362. }
  79363. }
  79364. <?php
  79365. return [
  79366. 'İ' => 'i̇',
  79367. 'µ' => 'μ',
  79368. 'Å¿' => 's',
  79369. 'ͅ' => 'ι',
  79370. 'ς' => 'σ',
  79371. '�' => 'β',
  79372. 'ϑ' => 'θ',
  79373. 'ϕ' => 'φ',
  79374. 'Ï–' => 'Ï€',
  79375. 'ϰ' => 'κ',
  79376. 'ϱ' => '�',
  79377. 'ϵ' => 'ε',
  79378. 'ẛ' => 'ṡ',
  79379. 'ι' => 'ι',
  79380. 'ß' => 'ss',
  79381. 'ʼn' => 'ʼn',
  79382. 'Ç°' => 'Ç°',
  79383. '�' => '�',
  79384. 'ΰ' => 'ΰ',
  79385. 'Ö‡' => 'Õ¥Ö‚',
  79386. 'ẖ' => 'ẖ',
  79387. 'ẗ' => 'ẗ',
  79388. 'ẘ' => 'ẘ',
  79389. 'ẙ' => 'ẙ',
  79390. 'ẚ' => 'aʾ',
  79391. 'ẞ' => 'ss',
  79392. '�' => '�',
  79393. 'á½’' => 'á½’',
  79394. 'á½”' => 'á½”',
  79395. 'á½–' => 'á½–',
  79396. 'ᾀ' => 'ἀι',
  79397. '�' => '�ι',
  79398. 'ᾂ' => 'ἂι',
  79399. 'ᾃ' => 'ἃι',
  79400. 'ᾄ' => 'ἄι',
  79401. 'ᾅ' => 'ἅι',
  79402. 'ᾆ' => 'ἆι',
  79403. 'ᾇ' => 'ἇι',
  79404. 'ᾈ' => 'ἀι',
  79405. 'ᾉ' => '�ι',
  79406. 'ᾊ' => 'ἂι',
  79407. 'ᾋ' => 'ἃι',
  79408. 'ᾌ' => 'ἄι',
  79409. '�' => 'ἅι',
  79410. 'ᾎ' => 'ἆι',
  79411. '�' => 'ἇι',
  79412. '�' => 'ἠι',
  79413. 'ᾑ' => 'ἡι',
  79414. 'ᾒ' => 'ἢι',
  79415. 'ᾓ' => 'ἣι',
  79416. 'ᾔ' => 'ἤι',
  79417. 'ᾕ' => 'ἥι',
  79418. 'ᾖ' => 'ἦι',
  79419. 'ᾗ' => 'ἧι',
  79420. 'ᾘ' => 'ἠι',
  79421. 'ᾙ' => 'ἡι',
  79422. 'ᾚ' => 'ἢι',
  79423. 'ᾛ' => 'ἣι',
  79424. 'ᾜ' => 'ἤι',
  79425. '�' => 'ἥι',
  79426. 'ᾞ' => 'ἦι',
  79427. 'ᾟ' => 'ἧι',
  79428. 'ᾠ' => 'ὠι',
  79429. 'ᾡ' => 'ὡι',
  79430. 'ᾢ' => 'ὢι',
  79431. 'ᾣ' => 'ὣι',
  79432. 'ᾤ' => 'ὤι',
  79433. 'ᾥ' => 'ὥι',
  79434. 'ᾦ' => 'ὦι',
  79435. 'ᾧ' => 'ὧι',
  79436. 'ᾨ' => 'ὠι',
  79437. 'ᾩ' => 'ὡι',
  79438. 'ᾪ' => 'ὢι',
  79439. 'ᾫ' => 'ὣι',
  79440. 'ᾬ' => 'ὤι',
  79441. 'ᾭ' => 'ὥι',
  79442. 'ᾮ' => 'ὦι',
  79443. 'ᾯ' => 'ὧι',
  79444. 'ᾲ' => 'ὰι',
  79445. 'ᾳ' => 'αι',
  79446. 'ᾴ' => 'άι',
  79447. 'ᾶ' => 'ᾶ',
  79448. 'ᾷ' => 'ᾶι',
  79449. 'ᾼ' => 'αι',
  79450. 'ῂ' => 'ὴι',
  79451. 'ῃ' => 'ηι',
  79452. 'ῄ' => 'ήι',
  79453. 'ῆ' => 'ῆ',
  79454. 'ῇ' => 'ῆι',
  79455. 'ῌ' => 'ηι',
  79456. 'á¿’' => 'á¿’',
  79457. 'á¿–' => 'á¿–',
  79458. 'á¿—' => 'á¿—',
  79459. 'á¿¢' => 'á¿¢',
  79460. 'ῤ' => 'ῤ',
  79461. 'ῦ' => 'ῦ',
  79462. 'ῧ' => 'ῧ',
  79463. 'ῲ' => 'ὼι',
  79464. 'ῳ' => 'ωι',
  79465. 'ῴ' => 'ώι',
  79466. 'ῶ' => 'ῶ',
  79467. 'ῷ' => 'ῶι',
  79468. 'ῼ' => 'ωι',
  79469. 'ff' => 'ff',
  79470. '�' => 'fi',
  79471. 'fl' => 'fl',
  79472. 'ffi' => 'ffi',
  79473. 'ffl' => 'ffl',
  79474. 'ſt' => 'st',
  79475. 'st' => 'st',
  79476. 'ﬓ' => 'մն',
  79477. 'ﬔ' => 'մե',
  79478. 'ﬕ' => 'մի',
  79479. 'ﬖ' => 'վն',
  79480. 'ﬗ' => 'մխ',
  79481. ];
  79482. <?php
  79483. return array (
  79484. 'A' => 'a',
  79485. 'B' => 'b',
  79486. 'C' => 'c',
  79487. 'D' => 'd',
  79488. 'E' => 'e',
  79489. 'F' => 'f',
  79490. 'G' => 'g',
  79491. 'H' => 'h',
  79492. 'I' => 'i',
  79493. 'J' => 'j',
  79494. 'K' => 'k',
  79495. 'L' => 'l',
  79496. 'M' => 'm',
  79497. 'N' => 'n',
  79498. 'O' => 'o',
  79499. 'P' => 'p',
  79500. 'Q' => 'q',
  79501. 'R' => 'r',
  79502. 'S' => 's',
  79503. 'T' => 't',
  79504. 'U' => 'u',
  79505. 'V' => 'v',
  79506. 'W' => 'w',
  79507. 'X' => 'x',
  79508. 'Y' => 'y',
  79509. 'Z' => 'z',
  79510. 'À' => 'à',
  79511. '�' => 'á',
  79512. 'Â' => 'â',
  79513. 'Ã' => 'ã',
  79514. 'Ä' => 'ä',
  79515. 'Ã…' => 'Ã¥',
  79516. 'Æ' => 'æ',
  79517. 'Ç' => 'ç',
  79518. 'È' => 'è',
  79519. 'É' => 'é',
  79520. 'Ê' => 'ê',
  79521. 'Ë' => 'ë',
  79522. 'Ì' => 'ì',
  79523. '�' => 'í',
  79524. 'Î' => 'î',
  79525. '�' => 'ï',
  79526. '�' => 'ð',
  79527. 'Ñ' => 'ñ',
  79528. 'Ò' => 'ò',
  79529. 'Ó' => 'ó',
  79530. 'Ô' => 'ô',
  79531. 'Õ' => 'õ',
  79532. 'Ö' => 'ö',
  79533. 'Ø' => 'ø',
  79534. 'Ù' => 'ù',
  79535. 'Ú' => 'ú',
  79536. 'Û' => 'û',
  79537. 'Ü' => 'ü',
  79538. '�' => 'ý',
  79539. 'Þ' => 'þ',
  79540. 'Ā' => '�',
  79541. 'Ă' => 'ă',
  79542. 'Ä„' => 'Ä…',
  79543. 'Ć' => 'ć',
  79544. 'Ĉ' => 'ĉ',
  79545. 'ÄŠ' => 'Ä‹',
  79546. 'Č' => '�',
  79547. 'Ď' => '�',
  79548. '�' => 'đ',
  79549. 'Ä’' => 'Ä“',
  79550. 'Ä”' => 'Ä•',
  79551. 'Ä–' => 'Ä—',
  79552. 'Ę' => 'ę',
  79553. 'Äš' => 'Ä›',
  79554. 'Ĝ' => '�',
  79555. 'Äž' => 'ÄŸ',
  79556. 'Ä ' => 'Ä¡',
  79557. 'Ä¢' => 'Ä£',
  79558. 'Ĥ' => 'ĥ',
  79559. 'Ħ' => 'ħ',
  79560. 'Ĩ' => 'ĩ',
  79561. 'Ī' => 'ī',
  79562. 'Ĭ' => 'ĭ',
  79563. 'Į' => 'į',
  79564. 'İ' => 'i̇',
  79565. 'IJ' => 'ij',
  79566. 'Ĵ' => 'ĵ',
  79567. 'Ķ' => 'ķ',
  79568. 'Ĺ' => 'ĺ',
  79569. 'Ļ' => 'ļ',
  79570. 'Ľ' => 'ľ',
  79571. 'Ä¿' => 'Å€',
  79572. '�' => 'ł',
  79573. 'Ń' => 'ń',
  79574. 'Ņ' => 'ņ',
  79575. 'Ň' => 'ň',
  79576. 'ÅŠ' => 'Å‹',
  79577. 'Ō' => '�',
  79578. 'Ŏ' => '�',
  79579. '�' => 'ő',
  79580. 'Å’' => 'Å“',
  79581. 'Å”' => 'Å•',
  79582. 'Å–' => 'Å—',
  79583. 'Ř' => 'ř',
  79584. 'Åš' => 'Å›',
  79585. 'Ŝ' => '�',
  79586. 'Åž' => 'ÅŸ',
  79587. 'Å ' => 'Å¡',
  79588. 'Å¢' => 'Å£',
  79589. 'Ť' => 'ť',
  79590. 'Ŧ' => 'ŧ',
  79591. 'Ũ' => 'ũ',
  79592. 'Ū' => 'ū',
  79593. 'Ŭ' => 'ŭ',
  79594. 'Ů' => 'ů',
  79595. 'Ű' => 'ű',
  79596. 'Ų' => 'ų',
  79597. 'Ŵ' => 'ŵ',
  79598. 'Ŷ' => 'ŷ',
  79599. 'Ÿ' => 'ÿ',
  79600. 'Ź' => 'ź',
  79601. 'Ż' => 'ż',
  79602. 'Ž' => 'ž',
  79603. '�' => 'ɓ',
  79604. 'Ƃ' => 'ƃ',
  79605. 'Æ„' => 'Æ…',
  79606. 'Ɔ' => 'ɔ',
  79607. 'Ƈ' => 'ƈ',
  79608. 'Ɖ' => 'ɖ',
  79609. 'ÆŠ' => 'É—',
  79610. 'Ƌ' => 'ƌ',
  79611. 'Ǝ' => '�',
  79612. '�' => 'ə',
  79613. '�' => 'ɛ',
  79614. 'Æ‘' => 'Æ’',
  79615. 'Æ“' => 'É ',
  79616. 'Æ”' => 'É£',
  79617. 'Æ–' => 'É©',
  79618. 'Ɨ' => 'ɨ',
  79619. 'Ƙ' => 'ƙ',
  79620. 'Ɯ' => 'ɯ',
  79621. '�' => 'ɲ',
  79622. 'Ɵ' => 'ɵ',
  79623. 'Æ ' => 'Æ¡',
  79624. 'Æ¢' => 'Æ£',
  79625. 'Ƥ' => 'ƥ',
  79626. 'Ʀ' => 'ʀ',
  79627. 'Ƨ' => 'ƨ',
  79628. 'Ʃ' => 'ʃ',
  79629. 'Ƭ' => 'ƭ',
  79630. 'Ʈ' => 'ʈ',
  79631. 'Ư' => 'ư',
  79632. 'Ʊ' => 'ʊ',
  79633. 'Ʋ' => 'ʋ',
  79634. 'Ƴ' => 'ƴ',
  79635. 'Ƶ' => 'ƶ',
  79636. 'Æ·' => 'Ê’',
  79637. 'Ƹ' => 'ƹ',
  79638. 'Ƽ' => 'ƽ',
  79639. 'DŽ' => 'dž',
  79640. 'Dž' => 'dž',
  79641. 'LJ' => 'lj',
  79642. 'Lj' => 'lj',
  79643. 'NJ' => 'nj',
  79644. 'Nj' => 'nj',
  79645. '�' => 'ǎ',
  79646. '�' => '�',
  79647. 'Ç‘' => 'Ç’',
  79648. 'Ç“' => 'Ç”',
  79649. 'Ç•' => 'Ç–',
  79650. 'Ǘ' => 'ǘ',
  79651. 'Ç™' => 'Çš',
  79652. 'Ǜ' => 'ǜ',
  79653. 'Çž' => 'ÇŸ',
  79654. 'Ç ' => 'Ç¡',
  79655. 'Ç¢' => 'Ç£',
  79656. 'Ǥ' => 'ǥ',
  79657. 'Ǧ' => 'ǧ',
  79658. 'Ǩ' => 'ǩ',
  79659. 'Ǫ' => 'ǫ',
  79660. 'Ǭ' => 'ǭ',
  79661. 'Ǯ' => 'ǯ',
  79662. 'DZ' => 'dz',
  79663. 'Dz' => 'dz',
  79664. 'Ǵ' => 'ǵ',
  79665. 'Ƕ' => 'ƕ',
  79666. 'Ç·' => 'Æ¿',
  79667. 'Ǹ' => 'ǹ',
  79668. 'Ǻ' => 'ǻ',
  79669. 'Ǽ' => 'ǽ',
  79670. 'Ǿ' => 'ǿ',
  79671. 'Ȁ' => '�',
  79672. 'Ȃ' => 'ȃ',
  79673. 'È„' => 'È…',
  79674. 'Ȇ' => 'ȇ',
  79675. 'Ȉ' => 'ȉ',
  79676. 'ÈŠ' => 'È‹',
  79677. 'Ȍ' => '�',
  79678. 'Ȏ' => '�',
  79679. '�' => 'ȑ',
  79680. 'È’' => 'È“',
  79681. 'È”' => 'È•',
  79682. 'È–' => 'È—',
  79683. 'Ș' => 'ș',
  79684. 'Èš' => 'È›',
  79685. 'Ȝ' => '�',
  79686. 'Èž' => 'ÈŸ',
  79687. 'È ' => 'Æž',
  79688. 'È¢' => 'È£',
  79689. 'Ȥ' => 'ȥ',
  79690. 'Ȧ' => 'ȧ',
  79691. 'Ȩ' => 'ȩ',
  79692. 'Ȫ' => 'ȫ',
  79693. 'Ȭ' => 'ȭ',
  79694. 'Ȯ' => 'ȯ',
  79695. 'Ȱ' => 'ȱ',
  79696. 'Ȳ' => 'ȳ',
  79697. 'Ⱥ' => 'ⱥ',
  79698. 'Ȼ' => 'ȼ',
  79699. 'Ƚ' => 'ƚ',
  79700. 'Ⱦ' => 'ⱦ',
  79701. '�' => 'ɂ',
  79702. 'Ƀ' => 'ƀ',
  79703. 'Ʉ' => 'ʉ',
  79704. 'Ʌ' => 'ʌ',
  79705. 'Ɇ' => 'ɇ',
  79706. 'Ɉ' => 'ɉ',
  79707. 'ÉŠ' => 'É‹',
  79708. 'Ɍ' => '�',
  79709. 'Ɏ' => '�',
  79710. 'Ͱ' => 'ͱ',
  79711. 'Ͳ' => 'ͳ',
  79712. 'Ͷ' => 'ͷ',
  79713. 'Ϳ' => 'ϳ',
  79714. 'Ά' => 'ά',
  79715. 'Έ' => 'έ',
  79716. 'Ή' => 'ή',
  79717. 'Ί' => 'ί',
  79718. 'Ό' => 'ό',
  79719. 'Ύ' => '�',
  79720. '�' => 'ώ',
  79721. 'Α' => 'α',
  79722. 'Β' => 'β',
  79723. 'Γ' => 'γ',
  79724. 'Δ' => 'δ',
  79725. 'Ε' => 'ε',
  79726. 'Ζ' => 'ζ',
  79727. 'Η' => 'η',
  79728. 'Θ' => 'θ',
  79729. 'Ι' => 'ι',
  79730. 'Κ' => 'κ',
  79731. 'Λ' => 'λ',
  79732. 'Μ' => 'μ',
  79733. '�' => 'ν',
  79734. 'Ξ' => 'ξ',
  79735. 'Ο' => 'ο',
  79736. 'Π' => 'π',
  79737. 'Ρ' => '�',
  79738. 'Σ' => 'σ',
  79739. 'Τ' => 'τ',
  79740. 'Î¥' => 'Ï…',
  79741. 'Φ' => 'φ',
  79742. 'Χ' => 'χ',
  79743. 'Ψ' => 'ψ',
  79744. 'Ω' => 'ω',
  79745. 'Ϊ' => 'ϊ',
  79746. 'Ϋ' => 'ϋ',
  79747. '�' => 'ϗ',
  79748. 'Ϙ' => 'ϙ',
  79749. 'Ïš' => 'Ï›',
  79750. 'Ϝ' => '�',
  79751. 'Ïž' => 'ÏŸ',
  79752. 'Ï ' => 'Ï¡',
  79753. 'Ï¢' => 'Ï£',
  79754. 'Ϥ' => 'ϥ',
  79755. 'Ϧ' => 'ϧ',
  79756. 'Ϩ' => 'ϩ',
  79757. 'Ϫ' => 'ϫ',
  79758. 'Ϭ' => 'ϭ',
  79759. 'Ϯ' => 'ϯ',
  79760. 'ϴ' => 'θ',
  79761. 'Ϸ' => 'ϸ',
  79762. 'Ϲ' => 'ϲ',
  79763. 'Ϻ' => 'ϻ',
  79764. 'Ͻ' => 'ͻ',
  79765. 'Ͼ' => 'ͼ',
  79766. 'Ͽ' => 'ͽ',
  79767. 'Ѐ' => '�',
  79768. '�' => 'ё',
  79769. 'Ђ' => 'ђ',
  79770. 'Ѓ' => 'ѓ',
  79771. 'Є' => 'є',
  79772. 'Ð…' => 'Ñ•',
  79773. 'І' => 'і',
  79774. 'Ї' => 'ї',
  79775. 'Ј' => 'ј',
  79776. 'Љ' => 'љ',
  79777. 'Њ' => 'њ',
  79778. 'Ћ' => 'ћ',
  79779. 'Ќ' => 'ќ',
  79780. '�' => '�',
  79781. 'ÐŽ' => 'Ñž',
  79782. '�' => 'џ',
  79783. '�' => 'а',
  79784. 'Б' => 'б',
  79785. 'В' => 'в',
  79786. 'Г' => 'г',
  79787. 'Д' => 'д',
  79788. 'Е' => 'е',
  79789. 'Ж' => 'ж',
  79790. 'З' => 'з',
  79791. 'И' => 'и',
  79792. 'Й' => 'й',
  79793. 'К' => 'к',
  79794. 'Л' => 'л',
  79795. 'М' => 'м',
  79796. '�' => 'н',
  79797. 'О' => 'о',
  79798. 'П' => 'п',
  79799. 'Р' => 'р',
  79800. 'С' => '�',
  79801. 'Т' => 'т',
  79802. 'У' => 'у',
  79803. 'Ф' => 'ф',
  79804. 'Ð¥' => 'Ñ…',
  79805. 'Ц' => 'ц',
  79806. 'Ч' => 'ч',
  79807. 'Ш' => 'ш',
  79808. 'Щ' => 'щ',
  79809. 'Ъ' => 'ъ',
  79810. 'Ы' => 'ы',
  79811. 'Ь' => 'ь',
  79812. 'Э' => '�',
  79813. 'Ю' => 'ю',
  79814. 'Я' => '�',
  79815. 'Ñ ' => 'Ñ¡',
  79816. 'Ñ¢' => 'Ñ£',
  79817. 'Ѥ' => 'ѥ',
  79818. 'Ѧ' => 'ѧ',
  79819. 'Ѩ' => 'ѩ',
  79820. 'Ѫ' => 'ѫ',
  79821. 'Ѭ' => 'ѭ',
  79822. 'Ѯ' => 'ѯ',
  79823. 'Ѱ' => 'ѱ',
  79824. 'Ѳ' => 'ѳ',
  79825. 'Ѵ' => 'ѵ',
  79826. 'Ѷ' => 'ѷ',
  79827. 'Ѹ' => 'ѹ',
  79828. 'Ѻ' => 'ѻ',
  79829. 'Ѽ' => 'ѽ',
  79830. 'Ѿ' => 'ѿ',
  79831. 'Ò€' => 'Ò�',
  79832. 'ÒŠ' => 'Ò‹',
  79833. 'Ҍ' => '�',
  79834. 'ÒŽ' => 'Ò�',
  79835. 'Ò�' => 'Ò‘',
  79836. 'Ò’' => 'Ò“',
  79837. 'Ò”' => 'Ò•',
  79838. 'Ò–' => 'Ò—',
  79839. 'Ò˜' => 'Ò™',
  79840. 'Òš' => 'Ò›',
  79841. 'Ҝ' => '�',
  79842. 'Òž' => 'ÒŸ',
  79843. 'Ò ' => 'Ò¡',
  79844. 'Ò¢' => 'Ò£',
  79845. 'Ò¤' => 'Ò¥',
  79846. 'Ò¦' => 'Ò§',
  79847. 'Ò¨' => 'Ò©',
  79848. 'Òª' => 'Ò«',
  79849. 'Ò¬' => 'Ò­',
  79850. 'Ò®' => 'Ò¯',
  79851. 'Ò°' => 'Ò±',
  79852. 'Ò²' => 'Ò³',
  79853. 'Ò´' => 'Òµ',
  79854. 'Ò¶' => 'Ò·',
  79855. 'Ò¸' => 'Ò¹',
  79856. 'Òº' => 'Ò»',
  79857. 'Ò¼' => 'Ò½',
  79858. 'Ò¾' => 'Ò¿',
  79859. 'Ó€' => 'Ó�',
  79860. 'Ó�' => 'Ó‚',
  79861. 'Óƒ' => 'Ó„',
  79862. 'Ó…' => 'Ó†',
  79863. 'Ó‡' => 'Óˆ',
  79864. 'Ó‰' => 'ÓŠ',
  79865. 'Ӌ' => 'ӌ',
  79866. 'Ó�' => 'ÓŽ',
  79867. 'Ó�' => 'Ó‘',
  79868. 'Ó’' => 'Ó“',
  79869. 'Ó”' => 'Ó•',
  79870. 'Ó–' => 'Ó—',
  79871. 'Ó˜' => 'Ó™',
  79872. 'Óš' => 'Ó›',
  79873. 'Ӝ' => '�',
  79874. 'Óž' => 'ÓŸ',
  79875. 'Ó ' => 'Ó¡',
  79876. 'Ó¢' => 'Ó£',
  79877. 'Ó¤' => 'Ó¥',
  79878. 'Ó¦' => 'Ó§',
  79879. 'Ó¨' => 'Ó©',
  79880. 'Óª' => 'Ó«',
  79881. 'Ó¬' => 'Ó­',
  79882. 'Ó®' => 'Ó¯',
  79883. 'Ó°' => 'Ó±',
  79884. 'Ó²' => 'Ó³',
  79885. 'Ó´' => 'Óµ',
  79886. 'Ó¶' => 'Ó·',
  79887. 'Ó¸' => 'Ó¹',
  79888. 'Óº' => 'Ó»',
  79889. 'Ó¼' => 'Ó½',
  79890. 'Ó¾' => 'Ó¿',
  79891. 'Ô€' => 'Ô�',
  79892. 'Ô‚' => 'Ôƒ',
  79893. 'Ô„' => 'Ô…',
  79894. 'Ô†' => 'Ô‡',
  79895. 'Ôˆ' => 'Ô‰',
  79896. 'ÔŠ' => 'Ô‹',
  79897. 'Ԍ' => '�',
  79898. 'ÔŽ' => 'Ô�',
  79899. 'Ô�' => 'Ô‘',
  79900. 'Ô’' => 'Ô“',
  79901. 'Ô”' => 'Ô•',
  79902. 'Ô–' => 'Ô—',
  79903. 'Ô˜' => 'Ô™',
  79904. 'Ôš' => 'Ô›',
  79905. 'Ԝ' => '�',
  79906. 'Ôž' => 'ÔŸ',
  79907. 'Ô ' => 'Ô¡',
  79908. 'Ô¢' => 'Ô£',
  79909. 'Ô¤' => 'Ô¥',
  79910. 'Ô¦' => 'Ô§',
  79911. 'Ô¨' => 'Ô©',
  79912. 'Ôª' => 'Ô«',
  79913. 'Ô¬' => 'Ô­',
  79914. 'Ô®' => 'Ô¯',
  79915. 'Ô±' => 'Õ¡',
  79916. 'Ô²' => 'Õ¢',
  79917. 'Ô³' => 'Õ£',
  79918. 'Ô´' => 'Õ¤',
  79919. 'Ôµ' => 'Õ¥',
  79920. 'Ô¶' => 'Õ¦',
  79921. 'Ô·' => 'Õ§',
  79922. 'Ô¸' => 'Õ¨',
  79923. 'Ô¹' => 'Õ©',
  79924. 'Ôº' => 'Õª',
  79925. 'Ô»' => 'Õ«',
  79926. 'Ô¼' => 'Õ¬',
  79927. 'Ô½' => 'Õ­',
  79928. 'Ô¾' => 'Õ®',
  79929. 'Ô¿' => 'Õ¯',
  79930. 'Õ€' => 'Õ°',
  79931. 'Õ�' => 'Õ±',
  79932. 'Õ‚' => 'Õ²',
  79933. 'Õƒ' => 'Õ³',
  79934. 'Õ„' => 'Õ´',
  79935. 'Õ…' => 'Õµ',
  79936. 'Õ†' => 'Õ¶',
  79937. 'Õ‡' => 'Õ·',
  79938. 'Õˆ' => 'Õ¸',
  79939. 'Õ‰' => 'Õ¹',
  79940. 'ÕŠ' => 'Õº',
  79941. 'Õ‹' => 'Õ»',
  79942. 'Ռ' => 'ռ',
  79943. 'Õ�' => 'Õ½',
  79944. 'ÕŽ' => 'Õ¾',
  79945. 'Õ�' => 'Õ¿',
  79946. 'Õ�' => 'Ö€',
  79947. 'Õ‘' => 'Ö�',
  79948. 'Õ’' => 'Ö‚',
  79949. 'Õ“' => 'Öƒ',
  79950. 'Õ”' => 'Ö„',
  79951. 'Õ•' => 'Ö…',
  79952. 'Õ–' => 'Ö†',
  79953. 'á‚ ' => 'â´€',
  79954. 'á‚¡' => 'â´�',
  79955. 'á‚¢' => 'â´‚',
  79956. 'á‚£' => 'â´ƒ',
  79957. 'Ⴄ' => 'ⴄ',
  79958. 'á‚¥' => 'â´…',
  79959. 'Ⴆ' => 'ⴆ',
  79960. 'Ⴇ' => 'ⴇ',
  79961. 'Ⴈ' => 'ⴈ',
  79962. 'á‚©' => 'â´‰',
  79963. 'Ⴊ' => 'ⴊ',
  79964. 'á‚«' => 'â´‹',
  79965. 'Ⴌ' => 'ⴌ',
  79966. 'á‚­' => 'â´�',
  79967. 'á‚®' => 'â´Ž',
  79968. 'Ⴏ' => '�',
  79969. 'á‚°' => 'â´�',
  79970. 'Ⴑ' => 'ⴑ',
  79971. 'Ⴒ' => 'ⴒ',
  79972. 'Ⴓ' => 'ⴓ',
  79973. 'á‚´' => 'â´”',
  79974. 'Ⴕ' => 'ⴕ',
  79975. 'Ⴖ' => 'ⴖ',
  79976. 'á‚·' => 'â´—',
  79977. 'Ⴘ' => 'ⴘ',
  79978. 'Ⴙ' => 'ⴙ',
  79979. 'Ⴚ' => 'ⴚ',
  79980. 'á‚»' => 'â´›',
  79981. 'Ⴜ' => 'ⴜ',
  79982. 'Ⴝ' => '�',
  79983. 'Ⴞ' => 'ⴞ',
  79984. 'á‚¿' => 'â´Ÿ',
  79985. 'Ⴠ' => 'ⴠ',
  79986. '�' => 'ⴡ',
  79987. 'Ⴢ' => 'ⴢ',
  79988. 'Ⴣ' => 'ⴣ',
  79989. 'Ⴤ' => 'ⴤ',
  79990. 'Ⴥ' => 'ⴥ',
  79991. 'Ⴧ' => 'ⴧ',
  79992. '�' => 'ⴭ',
  79993. 'Ꭰ' => 'ꭰ',
  79994. 'Ꭱ' => 'ꭱ',
  79995. 'Ꭲ' => 'ꭲ',
  79996. 'Ꭳ' => 'ꭳ',
  79997. 'Ꭴ' => 'ꭴ',
  79998. 'Ꭵ' => 'ꭵ',
  79999. 'Ꭶ' => 'ꭶ',
  80000. 'Ꭷ' => 'ꭷ',
  80001. 'Ꭸ' => 'ꭸ',
  80002. 'Ꭹ' => 'ꭹ',
  80003. 'Ꭺ' => 'ꭺ',
  80004. 'Ꭻ' => 'ꭻ',
  80005. 'Ꭼ' => 'ꭼ',
  80006. 'Ꭽ' => 'ꭽ',
  80007. 'Ꭾ' => 'ꭾ',
  80008. 'Ꭿ' => 'ꭿ',
  80009. 'Ꮀ' => 'ꮀ',
  80010. 'Ꮁ' => '�',
  80011. 'Ꮂ' => 'ꮂ',
  80012. 'Ꮃ' => 'ꮃ',
  80013. 'Ꮄ' => 'ꮄ',
  80014. 'Ꮅ' => 'ꮅ',
  80015. 'Ꮆ' => 'ꮆ',
  80016. 'Ꮇ' => 'ꮇ',
  80017. 'Ꮈ' => 'ꮈ',
  80018. 'Ꮉ' => 'ꮉ',
  80019. 'Ꮊ' => 'ꮊ',
  80020. 'Ꮋ' => 'ꮋ',
  80021. 'Ꮌ' => 'ꮌ',
  80022. 'Ꮍ' => '�',
  80023. 'Ꮎ' => 'ꮎ',
  80024. 'Ꮏ' => '�',
  80025. '�' => '�',
  80026. '�' => 'ꮑ',
  80027. '�' => 'ꮒ',
  80028. '�' => 'ꮓ',
  80029. '�' => 'ꮔ',
  80030. '�' => 'ꮕ',
  80031. '�' => 'ꮖ',
  80032. '�' => 'ꮗ',
  80033. '�' => 'ꮘ',
  80034. '�' => 'ꮙ',
  80035. '�' => 'ꮚ',
  80036. '�' => 'ꮛ',
  80037. '�' => 'ꮜ',
  80038. '�' => '�',
  80039. '�' => 'ꮞ',
  80040. '�' => 'ꮟ',
  80041. '�' => 'ꮠ',
  80042. '�' => 'ꮡ',
  80043. '�' => 'ꮢ',
  80044. '�' => 'ꮣ',
  80045. '�' => 'ꮤ',
  80046. '�' => 'ꮥ',
  80047. '�' => 'ꮦ',
  80048. '�' => 'ꮧ',
  80049. '�' => 'ꮨ',
  80050. '�' => 'ꮩ',
  80051. '�' => 'ꮪ',
  80052. '�' => 'ꮫ',
  80053. '�' => 'ꮬ',
  80054. '�' => 'ꮭ',
  80055. '�' => 'ꮮ',
  80056. '�' => 'ꮯ',
  80057. '�' => 'ꮰ',
  80058. '�' => 'ꮱ',
  80059. '�' => 'ꮲ',
  80060. '�' => 'ꮳ',
  80061. '�' => 'ꮴ',
  80062. '�' => 'ꮵ',
  80063. '�' => 'ꮶ',
  80064. '�' => 'ꮷ',
  80065. '�' => 'ꮸ',
  80066. '�' => 'ꮹ',
  80067. '�' => 'ꮺ',
  80068. '�' => 'ꮻ',
  80069. '�' => 'ꮼ',
  80070. '�' => 'ꮽ',
  80071. '�' => 'ꮾ',
  80072. '�' => 'ꮿ',
  80073. '�' => '�',
  80074. '�' => '�',
  80075. '�' => '�',
  80076. '�' => '�',
  80077. '�' => '�',
  80078. '�' => '�',
  80079. '�' => '�',
  80080. 'Ბ' => 'ბ',
  80081. 'Გ' => 'გ',
  80082. 'Დ' => 'დ',
  80083. 'Ე' => 'ე',
  80084. 'Ვ' => 'ვ',
  80085. 'Ზ' => 'ზ',
  80086. 'Თ' => 'თ',
  80087. 'Ი' => 'ი',
  80088. 'Კ' => 'კ',
  80089. 'Ლ' => 'ლ',
  80090. 'Მ' => 'მ',
  80091. 'Ნ' => 'ნ',
  80092. '�' => '�',
  80093. 'Პ' => 'პ',
  80094. 'Ჟ' => 'ჟ',
  80095. 'Რ' => 'რ',
  80096. 'Ს' => 'ს',
  80097. 'Ტ' => 'ტ',
  80098. 'Უ' => 'უ',
  80099. 'Ფ' => 'ფ',
  80100. 'Ქ' => 'ქ',
  80101. 'Ღ' => 'ღ',
  80102. 'Ყ' => 'ყ',
  80103. 'Შ' => 'შ',
  80104. 'Ჩ' => 'ჩ',
  80105. 'Ც' => 'ც',
  80106. 'Ძ' => 'ძ',
  80107. 'Წ' => 'წ',
  80108. 'Ჭ' => 'ჭ',
  80109. 'Ხ' => 'ხ',
  80110. 'Ჯ' => 'ჯ',
  80111. 'Ჰ' => 'ჰ',
  80112. 'Ჱ' => 'ჱ',
  80113. 'Ჲ' => 'ჲ',
  80114. 'Ჳ' => 'ჳ',
  80115. 'Ჴ' => 'ჴ',
  80116. 'Ჵ' => 'ჵ',
  80117. 'Ჶ' => 'ჶ',
  80118. 'Ჷ' => 'ჷ',
  80119. 'Ჸ' => 'ჸ',
  80120. 'Ჹ' => 'ჹ',
  80121. 'Ჺ' => 'ჺ',
  80122. 'Ჽ' => 'ჽ',
  80123. 'Ჾ' => 'ჾ',
  80124. 'Ჿ' => 'ჿ',
  80125. 'Ḁ' => '�',
  80126. 'Ḃ' => 'ḃ',
  80127. 'Ḅ' => 'ḅ',
  80128. 'Ḇ' => 'ḇ',
  80129. 'Ḉ' => 'ḉ',
  80130. 'Ḋ' => 'ḋ',
  80131. 'Ḍ' => '�',
  80132. 'Ḏ' => '�',
  80133. '�' => 'ḑ',
  80134. 'Ḓ' => 'ḓ',
  80135. 'Ḕ' => 'ḕ',
  80136. 'Ḗ' => 'ḗ',
  80137. 'Ḙ' => 'ḙ',
  80138. 'Ḛ' => 'ḛ',
  80139. 'Ḝ' => '�',
  80140. 'Ḟ' => 'ḟ',
  80141. 'Ḡ' => 'ḡ',
  80142. 'Ḣ' => 'ḣ',
  80143. 'Ḥ' => 'ḥ',
  80144. 'Ḧ' => 'ḧ',
  80145. 'Ḩ' => 'ḩ',
  80146. 'Ḫ' => 'ḫ',
  80147. 'Ḭ' => 'ḭ',
  80148. 'Ḯ' => 'ḯ',
  80149. 'Ḱ' => 'ḱ',
  80150. 'Ḳ' => 'ḳ',
  80151. 'Ḵ' => 'ḵ',
  80152. 'Ḷ' => 'ḷ',
  80153. 'Ḹ' => 'ḹ',
  80154. 'Ḻ' => 'ḻ',
  80155. 'Ḽ' => 'ḽ',
  80156. 'Ḿ' => 'ḿ',
  80157. 'Ṁ' => '�',
  80158. 'Ṃ' => 'ṃ',
  80159. 'Ṅ' => 'ṅ',
  80160. 'Ṇ' => 'ṇ',
  80161. 'Ṉ' => 'ṉ',
  80162. 'Ṋ' => 'ṋ',
  80163. 'Ṍ' => '�',
  80164. 'Ṏ' => '�',
  80165. '�' => 'ṑ',
  80166. 'Ṓ' => 'ṓ',
  80167. 'Ṕ' => 'ṕ',
  80168. 'á¹–' => 'á¹—',
  80169. 'Ṙ' => 'ṙ',
  80170. 'Ṛ' => 'ṛ',
  80171. 'Ṝ' => '�',
  80172. 'Ṟ' => 'ṟ',
  80173. 'Ṡ' => 'ṡ',
  80174. 'á¹¢' => 'á¹£',
  80175. 'Ṥ' => 'ṥ',
  80176. 'Ṧ' => 'ṧ',
  80177. 'Ṩ' => 'ṩ',
  80178. 'Ṫ' => 'ṫ',
  80179. 'Ṭ' => 'ṭ',
  80180. 'Ṯ' => 'ṯ',
  80181. 'á¹°' => 'á¹±',
  80182. 'á¹²' => 'á¹³',
  80183. 'á¹´' => 'á¹µ',
  80184. 'Ṷ' => 'ṷ',
  80185. 'Ṹ' => 'ṹ',
  80186. 'Ṻ' => 'ṻ',
  80187. 'á¹¼' => 'á¹½',
  80188. 'Ṿ' => 'ṿ',
  80189. 'Ẁ' => '�',
  80190. 'Ẃ' => 'ẃ',
  80191. 'Ẅ' => 'ẅ',
  80192. 'Ẇ' => 'ẇ',
  80193. 'Ẉ' => 'ẉ',
  80194. 'Ẋ' => 'ẋ',
  80195. 'Ẍ' => '�',
  80196. 'Ẏ' => '�',
  80197. '�' => 'ẑ',
  80198. 'Ẓ' => 'ẓ',
  80199. 'Ẕ' => 'ẕ',
  80200. 'ẞ' => 'ß',
  80201. 'Ạ' => 'ạ',
  80202. 'Ả' => 'ả',
  80203. 'Ấ' => 'ấ',
  80204. 'Ầ' => 'ầ',
  80205. 'Ẩ' => 'ẩ',
  80206. 'Ẫ' => 'ẫ',
  80207. 'Ậ' => 'ậ',
  80208. 'Ắ' => 'ắ',
  80209. 'Ằ' => 'ằ',
  80210. 'Ẳ' => 'ẳ',
  80211. 'Ẵ' => 'ẵ',
  80212. 'Ặ' => 'ặ',
  80213. 'Ẹ' => 'ẹ',
  80214. 'Ẻ' => 'ẻ',
  80215. 'Ẽ' => 'ẽ',
  80216. 'Ế' => 'ế',
  80217. 'Ề' => '�',
  80218. 'Ể' => 'ể',
  80219. 'Ễ' => 'ễ',
  80220. 'Ệ' => 'ệ',
  80221. 'Ỉ' => 'ỉ',
  80222. 'Ị' => 'ị',
  80223. 'Ọ' => '�',
  80224. 'Ỏ' => '�',
  80225. '�' => 'ố',
  80226. 'Ồ' => 'ồ',
  80227. 'Ổ' => 'ổ',
  80228. 'á»–' => 'á»—',
  80229. 'Ộ' => 'ộ',
  80230. 'Ớ' => 'ớ',
  80231. 'Ờ' => '�',
  80232. 'Ở' => 'ở',
  80233. 'Ỡ' => 'ỡ',
  80234. 'Ợ' => 'ợ',
  80235. 'Ụ' => 'ụ',
  80236. 'Ủ' => 'ủ',
  80237. 'Ứ' => 'ứ',
  80238. 'Ừ' => 'ừ',
  80239. 'Ử' => 'ử',
  80240. 'Ữ' => 'ữ',
  80241. 'á»°' => 'á»±',
  80242. 'Ỳ' => 'ỳ',
  80243. 'Ỵ' => 'ỵ',
  80244. 'Ỷ' => 'ỷ',
  80245. 'Ỹ' => 'ỹ',
  80246. 'Ỻ' => 'ỻ',
  80247. 'Ỽ' => 'ỽ',
  80248. 'Ỿ' => 'ỿ',
  80249. 'Ἀ' => 'ἀ',
  80250. 'Ἁ' => '�',
  80251. 'Ἂ' => 'ἂ',
  80252. 'Ἃ' => 'ἃ',
  80253. 'Ἄ' => 'ἄ',
  80254. '�' => 'ἅ',
  80255. 'Ἆ' => 'ἆ',
  80256. '�' => 'ἇ',
  80257. 'Ἐ' => '�',
  80258. 'Ἑ' => 'ἑ',
  80259. 'Ἒ' => 'ἒ',
  80260. 'Ἓ' => 'ἓ',
  80261. 'Ἔ' => 'ἔ',
  80262. '�' => 'ἕ',
  80263. 'Ἠ' => 'ἠ',
  80264. 'Ἡ' => 'ἡ',
  80265. 'Ἢ' => 'ἢ',
  80266. 'Ἣ' => 'ἣ',
  80267. 'Ἤ' => 'ἤ',
  80268. 'á¼­' => 'á¼¥',
  80269. 'Ἦ' => 'ἦ',
  80270. 'Ἧ' => 'ἧ',
  80271. 'Ἰ' => 'ἰ',
  80272. 'á¼¹' => 'á¼±',
  80273. 'Ἲ' => 'ἲ',
  80274. 'á¼»' => 'á¼³',
  80275. 'á¼¼' => 'á¼´',
  80276. 'á¼½' => 'á¼µ',
  80277. 'Ἶ' => 'ἶ',
  80278. 'Ἷ' => 'ἷ',
  80279. 'Ὀ' => 'ὀ',
  80280. 'Ὁ' => '�',
  80281. 'Ὂ' => 'ὂ',
  80282. 'Ὃ' => 'ὃ',
  80283. 'Ὄ' => 'ὄ',
  80284. '�' => 'ὅ',
  80285. 'Ὑ' => 'ὑ',
  80286. 'Ὓ' => 'ὓ',
  80287. '�' => 'ὕ',
  80288. 'Ὗ' => 'ὗ',
  80289. 'Ὠ' => 'ὠ',
  80290. 'Ὡ' => 'ὡ',
  80291. 'Ὢ' => 'ὢ',
  80292. 'Ὣ' => 'ὣ',
  80293. 'Ὤ' => 'ὤ',
  80294. 'á½­' => 'á½¥',
  80295. 'Ὦ' => 'ὦ',
  80296. 'Ὧ' => 'ὧ',
  80297. 'ᾈ' => 'ᾀ',
  80298. 'ᾉ' => '�',
  80299. 'ᾊ' => 'ᾂ',
  80300. 'ᾋ' => 'ᾃ',
  80301. 'ᾌ' => 'ᾄ',
  80302. '�' => 'ᾅ',
  80303. 'ᾎ' => 'ᾆ',
  80304. '�' => 'ᾇ',
  80305. 'ᾘ' => '�',
  80306. 'ᾙ' => 'ᾑ',
  80307. 'ᾚ' => 'ᾒ',
  80308. 'ᾛ' => 'ᾓ',
  80309. 'ᾜ' => 'ᾔ',
  80310. '�' => 'ᾕ',
  80311. 'ᾞ' => 'ᾖ',
  80312. 'ᾟ' => 'ᾗ',
  80313. 'ᾨ' => 'ᾠ',
  80314. 'ᾩ' => 'ᾡ',
  80315. 'ᾪ' => 'ᾢ',
  80316. 'ᾫ' => 'ᾣ',
  80317. 'ᾬ' => 'ᾤ',
  80318. 'á¾­' => 'á¾¥',
  80319. 'ᾮ' => 'ᾦ',
  80320. 'ᾯ' => 'ᾧ',
  80321. 'Ᾰ' => 'ᾰ',
  80322. 'á¾¹' => 'á¾±',
  80323. 'Ὰ' => 'ὰ',
  80324. 'á¾»' => 'á½±',
  80325. 'á¾¼' => 'á¾³',
  80326. 'Ὲ' => 'ὲ',
  80327. 'Έ' => 'έ',
  80328. 'á¿Š' => 'á½´',
  80329. 'á¿‹' => 'á½µ',
  80330. 'ῌ' => 'ῃ',
  80331. 'Ῐ' => '�',
  80332. 'á¿™' => 'á¿‘',
  80333. 'Ὶ' => 'ὶ',
  80334. 'á¿›' => 'á½·',
  80335. 'Ῠ' => 'ῠ',
  80336. 'á¿©' => 'á¿¡',
  80337. 'Ὺ' => 'ὺ',
  80338. 'á¿«' => 'á½»',
  80339. 'Ῥ' => 'ῥ',
  80340. 'Ὸ' => 'ὸ',
  80341. 'Ό' => 'ό',
  80342. 'Ὼ' => 'ὼ',
  80343. 'á¿»' => 'á½½',
  80344. 'ῼ' => 'ῳ',
  80345. 'Ω' => 'ω',
  80346. 'K' => 'k',
  80347. 'â„«' => 'Ã¥',
  80348. 'Ⅎ' => 'ⅎ',
  80349. 'â… ' => 'â…°',
  80350. 'â…¡' => 'â…±',
  80351. 'â…¢' => 'â…²',
  80352. 'â…£' => 'â…³',
  80353. 'â…¤' => 'â…´',
  80354. 'â…¥' => 'â…µ',
  80355. 'â…¦' => 'â…¶',
  80356. 'â…§' => 'â…·',
  80357. 'â…¨' => 'â…¸',
  80358. 'â…©' => 'â…¹',
  80359. 'â…ª' => 'â…º',
  80360. 'â…«' => 'â…»',
  80361. 'â…¬' => 'â…¼',
  80362. 'â…­' => 'â…½',
  80363. 'â…®' => 'â…¾',
  80364. 'â…¯' => 'â…¿',
  80365. 'Ↄ' => 'ↄ',
  80366. 'Ⓐ' => '�',
  80367. 'â’·' => 'â“‘',
  80368. 'â’¸' => 'â“’',
  80369. 'â’¹' => 'â““',
  80370. 'â’º' => 'â“”',
  80371. 'â’»' => 'â“•',
  80372. 'â’¼' => 'â“–',
  80373. 'â’½' => 'â“—',
  80374. 'Ⓘ' => 'ⓘ',
  80375. 'â’¿' => 'â“™',
  80376. 'â“€' => 'â“š',
  80377. '�' => 'ⓛ',
  80378. 'Ⓜ' => 'ⓜ',
  80379. 'Ⓝ' => '�',
  80380. 'â“„' => 'â“ž',
  80381. 'â“…' => 'â“Ÿ',
  80382. 'Ⓠ' => 'ⓠ',
  80383. 'Ⓡ' => 'ⓡ',
  80384. 'Ⓢ' => 'ⓢ',
  80385. 'Ⓣ' => 'ⓣ',
  80386. 'Ⓤ' => 'ⓤ',
  80387. 'â“‹' => 'â“¥',
  80388. 'Ⓦ' => 'ⓦ',
  80389. '�' => 'ⓧ',
  80390. 'Ⓨ' => 'ⓨ',
  80391. '�' => 'ⓩ',
  80392. 'â°€' => 'â°°',
  80393. 'â°�' => 'â°±',
  80394. 'â°‚' => 'â°²',
  80395. 'â°ƒ' => 'â°³',
  80396. 'â°„' => 'â°´',
  80397. 'â°…' => 'â°µ',
  80398. 'â°†' => 'â°¶',
  80399. 'â°‡' => 'â°·',
  80400. 'â°ˆ' => 'â°¸',
  80401. 'â°‰' => 'â°¹',
  80402. 'â°Š' => 'â°º',
  80403. 'â°‹' => 'â°»',
  80404. 'Ⰼ' => 'ⰼ',
  80405. 'â°�' => 'â°½',
  80406. 'â°Ž' => 'â°¾',
  80407. 'â°�' => 'â°¿',
  80408. 'â°�' => 'â±€',
  80409. 'Ⱁ' => '�',
  80410. 'Ⱂ' => 'ⱂ',
  80411. 'Ⱃ' => 'ⱃ',
  80412. 'Ⱄ' => 'ⱄ',
  80413. 'â°•' => 'â±…',
  80414. 'Ⱆ' => 'ⱆ',
  80415. 'Ⱇ' => 'ⱇ',
  80416. 'Ⱈ' => 'ⱈ',
  80417. 'Ⱉ' => 'ⱉ',
  80418. 'Ⱊ' => 'ⱊ',
  80419. 'Ⱋ' => 'ⱋ',
  80420. 'Ⱌ' => 'ⱌ',
  80421. '�' => '�',
  80422. 'Ⱎ' => 'ⱎ',
  80423. 'Ⱏ' => '�',
  80424. 'Ⱐ' => '�',
  80425. 'Ⱑ' => 'ⱑ',
  80426. 'â°¢' => 'â±’',
  80427. 'Ⱓ' => 'ⱓ',
  80428. 'â°¤' => 'â±”',
  80429. 'Ⱕ' => 'ⱕ',
  80430. 'â°¦' => 'â±–',
  80431. 'â°§' => 'â±—',
  80432. 'Ⱘ' => 'ⱘ',
  80433. 'â°©' => 'â±™',
  80434. 'Ⱚ' => 'ⱚ',
  80435. 'â°«' => 'â±›',
  80436. 'Ⱜ' => 'ⱜ',
  80437. 'Ⱝ' => '�',
  80438. 'Ⱞ' => 'ⱞ',
  80439. 'Ⱡ' => 'ⱡ',
  80440. 'â±¢' => 'É«',
  80441. 'â±£' => 'áµ½',
  80442. 'Ɽ' => 'ɽ',
  80443. 'Ⱨ' => 'ⱨ',
  80444. 'Ⱪ' => 'ⱪ',
  80445. 'Ⱬ' => 'ⱬ',
  80446. 'â±­' => 'É‘',
  80447. 'Ɱ' => 'ɱ',
  80448. 'Ɐ' => '�',
  80449. 'â±°' => 'É’',
  80450. 'â±²' => 'â±³',
  80451. 'Ⱶ' => 'ⱶ',
  80452. 'â±¾' => 'È¿',
  80453. 'Ɀ' => 'ɀ',
  80454. 'Ⲁ' => '�',
  80455. 'Ⲃ' => 'ⲃ',
  80456. 'Ⲅ' => 'ⲅ',
  80457. 'Ⲇ' => 'ⲇ',
  80458. 'Ⲉ' => 'ⲉ',
  80459. 'Ⲋ' => 'ⲋ',
  80460. 'Ⲍ' => '�',
  80461. 'Ⲏ' => '�',
  80462. '�' => 'ⲑ',
  80463. 'Ⲓ' => 'ⲓ',
  80464. 'Ⲕ' => 'ⲕ',
  80465. 'â²–' => 'â²—',
  80466. 'Ⲙ' => 'ⲙ',
  80467. 'Ⲛ' => 'ⲛ',
  80468. 'Ⲝ' => '�',
  80469. 'Ⲟ' => 'ⲟ',
  80470. 'Ⲡ' => 'ⲡ',
  80471. 'â²¢' => 'â²£',
  80472. 'Ⲥ' => 'ⲥ',
  80473. 'Ⲧ' => 'ⲧ',
  80474. 'Ⲩ' => 'ⲩ',
  80475. 'Ⲫ' => 'ⲫ',
  80476. 'Ⲭ' => 'ⲭ',
  80477. 'Ⲯ' => 'ⲯ',
  80478. 'â²°' => 'â²±',
  80479. 'â²²' => 'â²³',
  80480. 'â²´' => 'â²µ',
  80481. 'Ⲷ' => 'ⲷ',
  80482. 'Ⲹ' => 'ⲹ',
  80483. 'Ⲻ' => 'ⲻ',
  80484. 'â²¼' => 'â²½',
  80485. 'Ⲿ' => 'ⲿ',
  80486. 'Ⳁ' => '�',
  80487. 'Ⳃ' => 'ⳃ',
  80488. 'Ⳅ' => 'ⳅ',
  80489. 'Ⳇ' => 'ⳇ',
  80490. 'Ⳉ' => 'ⳉ',
  80491. 'Ⳋ' => 'ⳋ',
  80492. 'Ⳍ' => '�',
  80493. 'Ⳏ' => '�',
  80494. '�' => 'ⳑ',
  80495. 'Ⳓ' => 'ⳓ',
  80496. 'Ⳕ' => 'ⳕ',
  80497. 'â³–' => 'â³—',
  80498. 'Ⳙ' => 'ⳙ',
  80499. 'Ⳛ' => 'ⳛ',
  80500. 'Ⳝ' => '�',
  80501. 'Ⳟ' => 'ⳟ',
  80502. 'Ⳡ' => 'ⳡ',
  80503. 'â³¢' => 'â³£',
  80504. 'Ⳬ' => 'ⳬ',
  80505. 'â³­' => 'â³®',
  80506. 'â³²' => 'â³³',
  80507. 'Ꙁ' => '�',
  80508. 'Ꙃ' => 'ꙃ',
  80509. 'Ꙅ' => 'ꙅ',
  80510. 'Ꙇ' => 'ꙇ',
  80511. 'Ꙉ' => 'ꙉ',
  80512. 'Ꙋ' => 'ꙋ',
  80513. 'Ꙍ' => '�',
  80514. 'Ꙏ' => '�',
  80515. '�' => 'ꙑ',
  80516. 'Ꙓ' => 'ꙓ',
  80517. 'Ꙕ' => 'ꙕ',
  80518. 'ê™–' => 'ê™—',
  80519. 'Ꙙ' => 'ꙙ',
  80520. 'Ꙛ' => 'ꙛ',
  80521. 'Ꙝ' => '�',
  80522. 'Ꙟ' => 'ꙟ',
  80523. 'Ꙡ' => 'ꙡ',
  80524. 'Ꙣ' => 'ꙣ',
  80525. 'Ꙥ' => 'ꙥ',
  80526. 'Ꙧ' => 'ꙧ',
  80527. 'Ꙩ' => 'ꙩ',
  80528. 'Ꙫ' => 'ꙫ',
  80529. 'Ꙭ' => 'ꙭ',
  80530. 'Ꚁ' => '�',
  80531. 'Ꚃ' => 'ꚃ',
  80532. 'êš„' => 'êš…',
  80533. 'Ꚇ' => 'ꚇ',
  80534. 'Ꚉ' => 'ꚉ',
  80535. 'Ꚋ' => 'ꚋ',
  80536. 'Ꚍ' => '�',
  80537. 'Ꚏ' => '�',
  80538. '�' => 'ꚑ',
  80539. 'êš’' => 'êš“',
  80540. 'êš”' => 'êš•',
  80541. 'êš–' => 'êš—',
  80542. 'Ꚙ' => 'ꚙ',
  80543. 'êšš' => 'êš›',
  80544. 'Ꜣ' => 'ꜣ',
  80545. 'Ꜥ' => 'ꜥ',
  80546. 'Ꜧ' => 'ꜧ',
  80547. 'Ꜩ' => 'ꜩ',
  80548. 'Ꜫ' => 'ꜫ',
  80549. 'Ꜭ' => 'ꜭ',
  80550. 'Ꜯ' => 'ꜯ',
  80551. 'Ꜳ' => 'ꜳ',
  80552. 'Ꜵ' => 'ꜵ',
  80553. 'Ꜷ' => 'ꜷ',
  80554. 'Ꜹ' => 'ꜹ',
  80555. 'Ꜻ' => 'ꜻ',
  80556. 'Ꜽ' => 'ꜽ',
  80557. 'Ꜿ' => 'ꜿ',
  80558. '�' => '�',
  80559. '�' => '�',
  80560. '�' => '�',
  80561. '�' => '�',
  80562. '�' => '�',
  80563. '�' => '�',
  80564. '�' => '�',
  80565. '�' => '�',
  80566. '�' => '�',
  80567. '�' => '�',
  80568. '�' => '�',
  80569. '�' => '�',
  80570. '�' => '�',
  80571. '�' => '�',
  80572. '�' => '�',
  80573. '�' => '�',
  80574. '�' => '�',
  80575. '�' => '�',
  80576. '�' => '�',
  80577. '�' => '�',
  80578. '�' => '�',
  80579. '�' => '�',
  80580. '�' => '�',
  80581. '�' => '�',
  80582. '�' => '�',
  80583. '�' => '�',
  80584. '�' => 'ᵹ',
  80585. '�' => '�',
  80586. 'Ꞁ' => '�',
  80587. 'Ꞃ' => 'ꞃ',
  80588. 'êž„' => 'êž…',
  80589. 'Ꞇ' => 'ꞇ',
  80590. 'Ꞌ' => 'ꞌ',
  80591. '�' => 'ɥ',
  80592. '�' => 'ꞑ',
  80593. 'êž’' => 'êž“',
  80594. 'êž–' => 'êž—',
  80595. 'Ꞙ' => 'ꞙ',
  80596. 'êžš' => 'êž›',
  80597. 'Ꞝ' => '�',
  80598. 'Ꞟ' => 'ꞟ',
  80599. 'êž ' => 'êž¡',
  80600. 'Ꞣ' => 'ꞣ',
  80601. 'Ꞥ' => 'ꞥ',
  80602. 'Ꞧ' => 'ꞧ',
  80603. 'Ꞩ' => 'ꞩ',
  80604. 'Ɦ' => 'ɦ',
  80605. 'Ɜ' => 'ɜ',
  80606. 'Ɡ' => 'ɡ',
  80607. 'Ɬ' => 'ɬ',
  80608. 'Ɪ' => 'ɪ',
  80609. 'êž°' => 'Êž',
  80610. 'Ʇ' => 'ʇ',
  80611. 'Ʝ' => '�',
  80612. 'êž³' => 'ê­“',
  80613. 'êž´' => 'êžµ',
  80614. 'Ꞷ' => 'ꞷ',
  80615. 'Ꞹ' => 'ꞹ',
  80616. 'Ꞻ' => 'ꞻ',
  80617. 'êž¼' => 'êž½',
  80618. 'êž¾' => 'êž¿',
  80619. 'Ꟃ' => 'ꟃ',
  80620. 'Ꞔ' => 'ꞔ',
  80621. 'Ʂ' => 'ʂ',
  80622. 'Ᶎ' => 'ᶎ',
  80623. 'Ꟈ' => 'ꟈ',
  80624. 'Ꟊ' => 'ꟊ',
  80625. 'Ꟶ' => 'ꟶ',
  80626. 'A' => '�',
  80627. 'B' => 'b',
  80628. 'C' => 'c',
  80629. 'D' => 'd',
  80630. 'ï¼¥' => 'ï½…',
  80631. 'F' => 'f',
  80632. 'G' => 'g',
  80633. 'H' => 'h',
  80634. 'I' => 'i',
  80635. 'J' => 'j',
  80636. 'K' => 'k',
  80637. 'L' => 'l',
  80638. 'M' => '�',
  80639. 'N' => 'n',
  80640. 'O' => '�',
  80641. 'P' => '�',
  80642. 'Q' => 'q',
  80643. 'ï¼²' => 'ï½’',
  80644. 'S' => 's',
  80645. 'ï¼´' => 'ï½”',
  80646. 'U' => 'u',
  80647. 'V' => 'v',
  80648. 'ï¼·' => 'ï½—',
  80649. 'X' => 'x',
  80650. 'ï¼¹' => 'ï½™',
  80651. 'Z' => 'z',
  80652. '�' => '�',
  80653. '�' => '�',
  80654. '�' => '�',
  80655. '�' => '�',
  80656. '�' => '�',
  80657. '�' => '�',
  80658. '�' => '�',
  80659. '�' => '�',
  80660. '�' => '�',
  80661. '�' => '�',
  80662. '�' => '�',
  80663. '�' => '�',
  80664. '�' => '�',
  80665. '�' => '�',
  80666. '�' => '�',
  80667. '�' => '�',
  80668. '�' => '�',
  80669. '�' => '�',
  80670. '�' => '�',
  80671. '�' => '�',
  80672. '�' => '�',
  80673. '�' => '�',
  80674. '�' => '�',
  80675. '�' => '�',
  80676. '�' => '�',
  80677. '�' => '�',
  80678. '�' => '�',
  80679. '�' => '�',
  80680. '�' => '�',
  80681. '�' => '�',
  80682. '�' => '�',
  80683. '�' => '�',
  80684. '�' => '�',
  80685. '�' => '�',
  80686. '�' => '�',
  80687. '�' => '�',
  80688. '�' => '�',
  80689. '�' => '�',
  80690. '�' => '�',
  80691. '�' => '�',
  80692. '�' => '�',
  80693. '�' => '�',
  80694. '�' => '�',
  80695. '�' => '�',
  80696. '�' => '�',
  80697. '�' => '�',
  80698. '�' => '�',
  80699. '�' => '�',
  80700. '�' => '�',
  80701. '�' => '�',
  80702. '�' => '�',
  80703. '�' => '�',
  80704. '�' => '�',
  80705. '�' => '�',
  80706. '�' => '�',
  80707. '�' => '�',
  80708. '�' => '�',
  80709. '�' => '�',
  80710. '�' => '�',
  80711. '�' => '�',
  80712. '�' => '�',
  80713. '�' => '�',
  80714. '�' => '�',
  80715. '�' => '�',
  80716. '�' => '�',
  80717. '�' => '�',
  80718. '�' => '�',
  80719. '�' => '�',
  80720. '�' => '�',
  80721. '�' => '�',
  80722. '�' => '�',
  80723. '�' => '�',
  80724. '�' => '�',
  80725. '�' => '�',
  80726. '�' => '�',
  80727. '�' => '�',
  80728. '�' => '�',
  80729. '�' => '�',
  80730. '�' => '�',
  80731. '�' => '�',
  80732. '�' => '�',
  80733. '�' => '�',
  80734. '�' => '�',
  80735. '�' => '�',
  80736. '�' => '�',
  80737. '�' => '�',
  80738. '�' => '�',
  80739. '�' => '�',
  80740. '�' => '�',
  80741. '�' => '�',
  80742. '�' => '�',
  80743. '�' => '�',
  80744. '�' => '�',
  80745. '�' => '�',
  80746. '�' => '�',
  80747. '�' => '�',
  80748. '�' => '�',
  80749. '�' => '�',
  80750. '�' => '�',
  80751. '�' => '�',
  80752. '�' => '�',
  80753. '�' => '�',
  80754. '�' => '�',
  80755. '�' => '�',
  80756. '�' => '�',
  80757. '�' => '�',
  80758. '�' => '�',
  80759. '�' => '�',
  80760. '�' => '�',
  80761. '�' => '�',
  80762. '�' => '�',
  80763. '�' => '�',
  80764. '�' => '�',
  80765. '�' => '�',
  80766. '�' => '�',
  80767. '�' => '�',
  80768. '�' => '�',
  80769. '�' => '�',
  80770. '�' => '�',
  80771. '�' => '�',
  80772. '�' => '�',
  80773. '�' => '�',
  80774. '�' => '�',
  80775. '�' => '�',
  80776. '�' => '�',
  80777. '�' => '�',
  80778. '�' => '�',
  80779. 'ð‘¢ ' => 'ð‘£€',
  80780. '𑢡' => '�',
  80781. '𑢢' => '𑣂',
  80782. '𑢣' => '𑣃',
  80783. '𑢤' => '𑣄',
  80784. 'ð‘¢¥' => 'ð‘£…',
  80785. '𑢦' => '𑣆',
  80786. '𑢧' => '𑣇',
  80787. '𑢨' => '𑣈',
  80788. '𑢩' => '𑣉',
  80789. '𑢪' => '𑣊',
  80790. '𑢫' => '𑣋',
  80791. '𑢬' => '𑣌',
  80792. '𑢭' => '�',
  80793. '𑢮' => '𑣎',
  80794. '𑢯' => '�',
  80795. '𑢰' => '�',
  80796. '𑢱' => '𑣑',
  80797. 'ð‘¢²' => 'ð‘£’',
  80798. '𑢳' => '𑣓',
  80799. 'ð‘¢´' => 'ð‘£”',
  80800. '𑢵' => '𑣕',
  80801. '𑢶' => '𑣖',
  80802. 'ð‘¢·' => 'ð‘£—',
  80803. '𑢸' => '𑣘',
  80804. 'ð‘¢¹' => 'ð‘£™',
  80805. '𑢺' => '𑣚',
  80806. 'ð‘¢»' => 'ð‘£›',
  80807. '𑢼' => '𑣜',
  80808. '𑢽' => '�',
  80809. '𑢾' => '𑣞',
  80810. '𑢿' => '𑣟',
  80811. 'ð–¹€' => 'ð–¹ ',
  80812. '�' => '𖹡',
  80813. '𖹂' => '𖹢',
  80814. '𖹃' => '𖹣',
  80815. '𖹄' => '𖹤',
  80816. 'ð–¹…' => 'ð–¹¥',
  80817. '𖹆' => '𖹦',
  80818. '𖹇' => '𖹧',
  80819. '𖹈' => '𖹨',
  80820. '𖹉' => '𖹩',
  80821. '𖹊' => '𖹪',
  80822. '𖹋' => '𖹫',
  80823. '𖹌' => '𖹬',
  80824. '�' => '𖹭',
  80825. '𖹎' => '𖹮',
  80826. '�' => '𖹯',
  80827. '�' => '𖹰',
  80828. '𖹑' => '𖹱',
  80829. 'ð–¹’' => 'ð–¹²',
  80830. '𖹓' => '𖹳',
  80831. 'ð–¹”' => 'ð–¹´',
  80832. '𖹕' => '𖹵',
  80833. '𖹖' => '𖹶',
  80834. 'ð–¹—' => 'ð–¹·',
  80835. '𖹘' => '𖹸',
  80836. 'ð–¹™' => 'ð–¹¹',
  80837. '𖹚' => '𖹺',
  80838. 'ð–¹›' => 'ð–¹»',
  80839. '𖹜' => '𖹼',
  80840. '�' => '𖹽',
  80841. '𖹞' => '𖹾',
  80842. '𖹟' => '𖹿',
  80843. '𞤀' => '𞤢',
  80844. '�' => '𞤣',
  80845. '𞤂' => '𞤤',
  80846. '𞤃' => '𞤥',
  80847. '𞤄' => '𞤦',
  80848. '𞤅' => '𞤧',
  80849. '𞤆' => '𞤨',
  80850. '𞤇' => '𞤩',
  80851. '𞤈' => '𞤪',
  80852. '𞤉' => '𞤫',
  80853. '𞤊' => '𞤬',
  80854. '𞤋' => '𞤭',
  80855. '𞤌' => '𞤮',
  80856. '�' => '𞤯',
  80857. '𞤎' => '𞤰',
  80858. '�' => '𞤱',
  80859. '�' => '𞤲',
  80860. '𞤑' => '𞤳',
  80861. '𞤒' => '𞤴',
  80862. '𞤓' => '𞤵',
  80863. '𞤔' => '𞤶',
  80864. '𞤕' => '𞤷',
  80865. '𞤖' => '𞤸',
  80866. '𞤗' => '𞤹',
  80867. '𞤘' => '𞤺',
  80868. '𞤙' => '𞤻',
  80869. '𞤚' => '𞤼',
  80870. '𞤛' => '𞤽',
  80871. '𞤜' => '𞤾',
  80872. '�' => '𞤿',
  80873. '𞤞' => '𞥀',
  80874. '𞤟' => '�',
  80875. '𞤠' => '𞥂',
  80876. '𞤡' => '𞥃',
  80877. );
  80878. <?php
  80879. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  80880. <?php
  80881. return array (
  80882. 'a' => 'A',
  80883. 'b' => 'B',
  80884. 'c' => 'C',
  80885. 'd' => 'D',
  80886. 'e' => 'E',
  80887. 'f' => 'F',
  80888. 'g' => 'G',
  80889. 'h' => 'H',
  80890. 'i' => 'I',
  80891. 'j' => 'J',
  80892. 'k' => 'K',
  80893. 'l' => 'L',
  80894. 'm' => 'M',
  80895. 'n' => 'N',
  80896. 'o' => 'O',
  80897. 'p' => 'P',
  80898. 'q' => 'Q',
  80899. 'r' => 'R',
  80900. 's' => 'S',
  80901. 't' => 'T',
  80902. 'u' => 'U',
  80903. 'v' => 'V',
  80904. 'w' => 'W',
  80905. 'x' => 'X',
  80906. 'y' => 'Y',
  80907. 'z' => 'Z',
  80908. 'µ' => 'Μ',
  80909. 'à' => 'À',
  80910. 'á' => '�',
  80911. 'â' => 'Â',
  80912. 'ã' => 'Ã',
  80913. 'ä' => 'Ä',
  80914. 'Ã¥' => 'Ã…',
  80915. 'æ' => 'Æ',
  80916. 'ç' => 'Ç',
  80917. 'è' => 'È',
  80918. 'é' => 'É',
  80919. 'ê' => 'Ê',
  80920. 'ë' => 'Ë',
  80921. 'ì' => 'Ì',
  80922. 'í' => '�',
  80923. 'î' => 'Î',
  80924. 'ï' => '�',
  80925. 'ð' => '�',
  80926. 'ñ' => 'Ñ',
  80927. 'ò' => 'Ò',
  80928. 'ó' => 'Ó',
  80929. 'ô' => 'Ô',
  80930. 'õ' => 'Õ',
  80931. 'ö' => 'Ö',
  80932. 'ø' => 'Ø',
  80933. 'ù' => 'Ù',
  80934. 'ú' => 'Ú',
  80935. 'û' => 'Û',
  80936. 'ü' => 'Ü',
  80937. 'ý' => '�',
  80938. 'þ' => 'Þ',
  80939. 'ÿ' => 'Ÿ',
  80940. '�' => 'Ā',
  80941. 'ă' => 'Ă',
  80942. 'Ä…' => 'Ä„',
  80943. 'ć' => 'Ć',
  80944. 'ĉ' => 'Ĉ',
  80945. 'Ä‹' => 'ÄŠ',
  80946. '�' => 'Č',
  80947. '�' => 'Ď',
  80948. 'đ' => '�',
  80949. 'Ä“' => 'Ä’',
  80950. 'Ä•' => 'Ä”',
  80951. 'Ä—' => 'Ä–',
  80952. 'ę' => 'Ę',
  80953. 'Ä›' => 'Äš',
  80954. '�' => 'Ĝ',
  80955. 'ÄŸ' => 'Äž',
  80956. 'Ä¡' => 'Ä ',
  80957. 'Ä£' => 'Ä¢',
  80958. 'ĥ' => 'Ĥ',
  80959. 'ħ' => 'Ħ',
  80960. 'ĩ' => 'Ĩ',
  80961. 'ī' => 'Ī',
  80962. 'ĭ' => 'Ĭ',
  80963. 'į' => 'Į',
  80964. 'ı' => 'I',
  80965. 'ij' => 'IJ',
  80966. 'ĵ' => 'Ĵ',
  80967. 'ķ' => 'Ķ',
  80968. 'ĺ' => 'Ĺ',
  80969. 'ļ' => 'Ļ',
  80970. 'ľ' => 'Ľ',
  80971. 'Å€' => 'Ä¿',
  80972. 'ł' => '�',
  80973. 'ń' => 'Ń',
  80974. 'ņ' => 'Ņ',
  80975. 'ň' => 'Ň',
  80976. 'Å‹' => 'ÅŠ',
  80977. '�' => 'Ō',
  80978. '�' => 'Ŏ',
  80979. 'ő' => '�',
  80980. 'Å“' => 'Å’',
  80981. 'Å•' => 'Å”',
  80982. 'Å—' => 'Å–',
  80983. 'ř' => 'Ř',
  80984. 'Å›' => 'Åš',
  80985. '�' => 'Ŝ',
  80986. 'ÅŸ' => 'Åž',
  80987. 'Å¡' => 'Å ',
  80988. 'Å£' => 'Å¢',
  80989. 'ť' => 'Ť',
  80990. 'ŧ' => 'Ŧ',
  80991. 'ũ' => 'Ũ',
  80992. 'ū' => 'Ū',
  80993. 'ŭ' => 'Ŭ',
  80994. 'ů' => 'Ů',
  80995. 'ű' => 'Ű',
  80996. 'ų' => 'Ų',
  80997. 'ŵ' => 'Ŵ',
  80998. 'ŷ' => 'Ŷ',
  80999. 'ź' => 'Ź',
  81000. 'ż' => 'Ż',
  81001. 'ž' => 'Ž',
  81002. 'Å¿' => 'S',
  81003. 'ƀ' => 'Ƀ',
  81004. 'ƃ' => 'Ƃ',
  81005. 'Æ…' => 'Æ„',
  81006. 'ƈ' => 'Ƈ',
  81007. 'ƌ' => 'Ƌ',
  81008. 'Æ’' => 'Æ‘',
  81009. 'ƕ' => 'Ƕ',
  81010. 'ƙ' => 'Ƙ',
  81011. 'ƚ' => 'Ƚ',
  81012. 'Æž' => 'È ',
  81013. 'Æ¡' => 'Æ ',
  81014. 'Æ£' => 'Æ¢',
  81015. 'ƥ' => 'Ƥ',
  81016. 'ƨ' => 'Ƨ',
  81017. 'ƭ' => 'Ƭ',
  81018. 'ư' => 'Ư',
  81019. 'ƴ' => 'Ƴ',
  81020. 'ƶ' => 'Ƶ',
  81021. 'ƹ' => 'Ƹ',
  81022. 'ƽ' => 'Ƽ',
  81023. 'Æ¿' => 'Ç·',
  81024. 'Ç…' => 'Ç„',
  81025. 'dž' => 'DŽ',
  81026. 'Lj' => 'LJ',
  81027. 'lj' => 'LJ',
  81028. 'Ç‹' => 'ÇŠ',
  81029. 'nj' => 'NJ',
  81030. 'ǎ' => '�',
  81031. '�' => '�',
  81032. 'Ç’' => 'Ç‘',
  81033. 'Ç”' => 'Ç“',
  81034. 'Ç–' => 'Ç•',
  81035. 'ǘ' => 'Ǘ',
  81036. 'Çš' => 'Ç™',
  81037. 'ǜ' => 'Ǜ',
  81038. '�' => 'Ǝ',
  81039. 'ÇŸ' => 'Çž',
  81040. 'Ç¡' => 'Ç ',
  81041. 'Ç£' => 'Ç¢',
  81042. 'ǥ' => 'Ǥ',
  81043. 'ǧ' => 'Ǧ',
  81044. 'ǩ' => 'Ǩ',
  81045. 'ǫ' => 'Ǫ',
  81046. 'ǭ' => 'Ǭ',
  81047. 'ǯ' => 'Ǯ',
  81048. 'Dz' => 'DZ',
  81049. 'dz' => 'DZ',
  81050. 'ǵ' => 'Ǵ',
  81051. 'ǹ' => 'Ǹ',
  81052. 'ǻ' => 'Ǻ',
  81053. 'ǽ' => 'Ǽ',
  81054. 'ǿ' => 'Ǿ',
  81055. '�' => 'Ȁ',
  81056. 'ȃ' => 'Ȃ',
  81057. 'È…' => 'È„',
  81058. 'ȇ' => 'Ȇ',
  81059. 'ȉ' => 'Ȉ',
  81060. 'È‹' => 'ÈŠ',
  81061. '�' => 'Ȍ',
  81062. '�' => 'Ȏ',
  81063. 'ȑ' => '�',
  81064. 'È“' => 'È’',
  81065. 'È•' => 'È”',
  81066. 'È—' => 'È–',
  81067. 'ș' => 'Ș',
  81068. 'È›' => 'Èš',
  81069. '�' => 'Ȝ',
  81070. 'ÈŸ' => 'Èž',
  81071. 'È£' => 'È¢',
  81072. 'ȥ' => 'Ȥ',
  81073. 'ȧ' => 'Ȧ',
  81074. 'ȩ' => 'Ȩ',
  81075. 'ȫ' => 'Ȫ',
  81076. 'ȭ' => 'Ȭ',
  81077. 'ȯ' => 'Ȯ',
  81078. 'ȱ' => 'Ȱ',
  81079. 'ȳ' => 'Ȳ',
  81080. 'ȼ' => 'Ȼ',
  81081. 'È¿' => 'â±¾',
  81082. 'ɀ' => 'Ɀ',
  81083. 'ɂ' => '�',
  81084. 'ɇ' => 'Ɇ',
  81085. 'ɉ' => 'Ɉ',
  81086. 'É‹' => 'ÉŠ',
  81087. '�' => 'Ɍ',
  81088. '�' => 'Ɏ',
  81089. '�' => 'Ɐ',
  81090. 'É‘' => 'â±­',
  81091. 'É’' => 'â±°',
  81092. 'ɓ' => '�',
  81093. 'ɔ' => 'Ɔ',
  81094. 'ɖ' => 'Ɖ',
  81095. 'É—' => 'ÆŠ',
  81096. 'ə' => '�',
  81097. 'ɛ' => '�',
  81098. 'ɜ' => 'Ɜ',
  81099. 'É ' => 'Æ“',
  81100. 'ɡ' => 'Ɡ',
  81101. 'É£' => 'Æ”',
  81102. 'ɥ' => '�',
  81103. 'ɦ' => 'Ɦ',
  81104. 'ɨ' => 'Ɨ',
  81105. 'É©' => 'Æ–',
  81106. 'ɪ' => 'Ɪ',
  81107. 'É«' => 'â±¢',
  81108. 'ɬ' => 'Ɬ',
  81109. 'ɯ' => 'Ɯ',
  81110. 'ɱ' => 'Ɱ',
  81111. 'ɲ' => '�',
  81112. 'ɵ' => 'Ɵ',
  81113. 'ɽ' => 'Ɽ',
  81114. 'ʀ' => 'Ʀ',
  81115. 'ʂ' => 'Ʂ',
  81116. 'ʃ' => 'Ʃ',
  81117. 'ʇ' => 'Ʇ',
  81118. 'ʈ' => 'Ʈ',
  81119. 'ʉ' => 'Ʉ',
  81120. 'ʊ' => 'Ʊ',
  81121. 'ʋ' => 'Ʋ',
  81122. 'ʌ' => 'Ʌ',
  81123. 'Ê’' => 'Æ·',
  81124. '�' => 'Ʝ',
  81125. 'Êž' => 'êž°',
  81126. 'ͅ' => 'Ι',
  81127. 'ͱ' => 'Ͱ',
  81128. 'ͳ' => 'Ͳ',
  81129. 'ͷ' => 'Ͷ',
  81130. 'ͻ' => 'Ͻ',
  81131. 'ͼ' => 'Ͼ',
  81132. 'ͽ' => 'Ͽ',
  81133. 'ά' => 'Ά',
  81134. 'έ' => 'Έ',
  81135. 'ή' => 'Ή',
  81136. 'ί' => 'Ί',
  81137. 'α' => 'Α',
  81138. 'β' => 'Β',
  81139. 'γ' => 'Γ',
  81140. 'δ' => 'Δ',
  81141. 'ε' => 'Ε',
  81142. 'ζ' => 'Ζ',
  81143. 'η' => 'Η',
  81144. 'θ' => 'Θ',
  81145. 'ι' => 'Ι',
  81146. 'κ' => 'Κ',
  81147. 'λ' => 'Λ',
  81148. 'μ' => 'Μ',
  81149. 'ν' => '�',
  81150. 'ξ' => 'Ξ',
  81151. 'ο' => 'Ο',
  81152. 'π' => 'Π',
  81153. '�' => 'Ρ',
  81154. 'ς' => 'Σ',
  81155. 'σ' => 'Σ',
  81156. 'τ' => 'Τ',
  81157. 'Ï…' => 'Î¥',
  81158. 'φ' => 'Φ',
  81159. 'χ' => 'Χ',
  81160. 'ψ' => 'Ψ',
  81161. 'ω' => 'Ω',
  81162. 'ϊ' => 'Ϊ',
  81163. 'ϋ' => 'Ϋ',
  81164. 'ό' => 'Ό',
  81165. '�' => 'Ύ',
  81166. 'ώ' => '�',
  81167. '�' => 'Β',
  81168. 'ϑ' => 'Θ',
  81169. 'ϕ' => 'Φ',
  81170. 'ϖ' => 'Π',
  81171. 'ϗ' => '�',
  81172. 'ϙ' => 'Ϙ',
  81173. 'Ï›' => 'Ïš',
  81174. '�' => 'Ϝ',
  81175. 'ÏŸ' => 'Ïž',
  81176. 'Ï¡' => 'Ï ',
  81177. 'Ï£' => 'Ï¢',
  81178. 'ϥ' => 'Ϥ',
  81179. 'ϧ' => 'Ϧ',
  81180. 'ϩ' => 'Ϩ',
  81181. 'ϫ' => 'Ϫ',
  81182. 'ϭ' => 'Ϭ',
  81183. 'ϯ' => 'Ϯ',
  81184. 'ϰ' => 'Κ',
  81185. 'ϱ' => 'Ρ',
  81186. 'ϲ' => 'Ϲ',
  81187. 'ϳ' => 'Ϳ',
  81188. 'ϵ' => 'Ε',
  81189. 'ϸ' => 'Ϸ',
  81190. 'ϻ' => 'Ϻ',
  81191. 'а' => '�',
  81192. 'б' => 'Б',
  81193. 'в' => 'В',
  81194. 'г' => 'Г',
  81195. 'д' => 'Д',
  81196. 'е' => 'Е',
  81197. 'ж' => 'Ж',
  81198. 'з' => 'З',
  81199. 'и' => 'И',
  81200. 'й' => 'Й',
  81201. 'к' => 'К',
  81202. 'л' => 'Л',
  81203. 'м' => 'М',
  81204. 'н' => '�',
  81205. 'о' => 'О',
  81206. 'п' => 'П',
  81207. 'р' => 'Р',
  81208. '�' => 'С',
  81209. 'т' => 'Т',
  81210. 'у' => 'У',
  81211. 'ф' => 'Ф',
  81212. 'Ñ…' => 'Ð¥',
  81213. 'ц' => 'Ц',
  81214. 'ч' => 'Ч',
  81215. 'ш' => 'Ш',
  81216. 'щ' => 'Щ',
  81217. 'ъ' => 'Ъ',
  81218. 'ы' => 'Ы',
  81219. 'ь' => 'Ь',
  81220. '�' => 'Э',
  81221. 'ю' => 'Ю',
  81222. '�' => 'Я',
  81223. '�' => 'Ѐ',
  81224. 'ё' => '�',
  81225. 'ђ' => 'Ђ',
  81226. 'ѓ' => 'Ѓ',
  81227. 'є' => 'Є',
  81228. 'Ñ•' => 'Ð…',
  81229. 'і' => 'І',
  81230. 'ї' => 'Ї',
  81231. 'ј' => 'Ј',
  81232. 'љ' => 'Љ',
  81233. 'њ' => 'Њ',
  81234. 'ћ' => 'Ћ',
  81235. 'ќ' => 'Ќ',
  81236. '�' => '�',
  81237. 'Ñž' => 'ÐŽ',
  81238. 'џ' => '�',
  81239. 'Ñ¡' => 'Ñ ',
  81240. 'Ñ£' => 'Ñ¢',
  81241. 'ѥ' => 'Ѥ',
  81242. 'ѧ' => 'Ѧ',
  81243. 'ѩ' => 'Ѩ',
  81244. 'ѫ' => 'Ѫ',
  81245. 'ѭ' => 'Ѭ',
  81246. 'ѯ' => 'Ѯ',
  81247. 'ѱ' => 'Ѱ',
  81248. 'ѳ' => 'Ѳ',
  81249. 'ѵ' => 'Ѵ',
  81250. 'ѷ' => 'Ѷ',
  81251. 'ѹ' => 'Ѹ',
  81252. 'ѻ' => 'Ѻ',
  81253. 'ѽ' => 'Ѽ',
  81254. 'ѿ' => 'Ѿ',
  81255. 'Ò�' => 'Ò€',
  81256. 'Ò‹' => 'ÒŠ',
  81257. '�' => 'Ҍ',
  81258. 'Ò�' => 'ÒŽ',
  81259. 'Ò‘' => 'Ò�',
  81260. 'Ò“' => 'Ò’',
  81261. 'Ò•' => 'Ò”',
  81262. 'Ò—' => 'Ò–',
  81263. 'Ò™' => 'Ò˜',
  81264. 'Ò›' => 'Òš',
  81265. '�' => 'Ҝ',
  81266. 'ÒŸ' => 'Òž',
  81267. 'Ò¡' => 'Ò ',
  81268. 'Ò£' => 'Ò¢',
  81269. 'Ò¥' => 'Ò¤',
  81270. 'Ò§' => 'Ò¦',
  81271. 'Ò©' => 'Ò¨',
  81272. 'Ò«' => 'Òª',
  81273. 'Ò­' => 'Ò¬',
  81274. 'Ò¯' => 'Ò®',
  81275. 'Ò±' => 'Ò°',
  81276. 'Ò³' => 'Ò²',
  81277. 'Òµ' => 'Ò´',
  81278. 'Ò·' => 'Ò¶',
  81279. 'Ò¹' => 'Ò¸',
  81280. 'Ò»' => 'Òº',
  81281. 'Ò½' => 'Ò¼',
  81282. 'Ò¿' => 'Ò¾',
  81283. 'Ó‚' => 'Ó�',
  81284. 'Ó„' => 'Óƒ',
  81285. 'Ó†' => 'Ó…',
  81286. 'Óˆ' => 'Ó‡',
  81287. 'ÓŠ' => 'Ó‰',
  81288. 'ӌ' => 'Ӌ',
  81289. 'ÓŽ' => 'Ó�',
  81290. 'Ó�' => 'Ó€',
  81291. 'Ó‘' => 'Ó�',
  81292. 'Ó“' => 'Ó’',
  81293. 'Ó•' => 'Ó”',
  81294. 'Ó—' => 'Ó–',
  81295. 'Ó™' => 'Ó˜',
  81296. 'Ó›' => 'Óš',
  81297. '�' => 'Ӝ',
  81298. 'ÓŸ' => 'Óž',
  81299. 'Ó¡' => 'Ó ',
  81300. 'Ó£' => 'Ó¢',
  81301. 'Ó¥' => 'Ó¤',
  81302. 'Ó§' => 'Ó¦',
  81303. 'Ó©' => 'Ó¨',
  81304. 'Ó«' => 'Óª',
  81305. 'Ó­' => 'Ó¬',
  81306. 'Ó¯' => 'Ó®',
  81307. 'Ó±' => 'Ó°',
  81308. 'Ó³' => 'Ó²',
  81309. 'Óµ' => 'Ó´',
  81310. 'Ó·' => 'Ó¶',
  81311. 'Ó¹' => 'Ó¸',
  81312. 'Ó»' => 'Óº',
  81313. 'Ó½' => 'Ó¼',
  81314. 'Ó¿' => 'Ó¾',
  81315. 'Ô�' => 'Ô€',
  81316. 'Ôƒ' => 'Ô‚',
  81317. 'Ô…' => 'Ô„',
  81318. 'Ô‡' => 'Ô†',
  81319. 'Ô‰' => 'Ôˆ',
  81320. 'Ô‹' => 'ÔŠ',
  81321. '�' => 'Ԍ',
  81322. 'Ô�' => 'ÔŽ',
  81323. 'Ô‘' => 'Ô�',
  81324. 'Ô“' => 'Ô’',
  81325. 'Ô•' => 'Ô”',
  81326. 'Ô—' => 'Ô–',
  81327. 'Ô™' => 'Ô˜',
  81328. 'Ô›' => 'Ôš',
  81329. '�' => 'Ԝ',
  81330. 'ÔŸ' => 'Ôž',
  81331. 'Ô¡' => 'Ô ',
  81332. 'Ô£' => 'Ô¢',
  81333. 'Ô¥' => 'Ô¤',
  81334. 'Ô§' => 'Ô¦',
  81335. 'Ô©' => 'Ô¨',
  81336. 'Ô«' => 'Ôª',
  81337. 'Ô­' => 'Ô¬',
  81338. 'Ô¯' => 'Ô®',
  81339. 'Õ¡' => 'Ô±',
  81340. 'Õ¢' => 'Ô²',
  81341. 'Õ£' => 'Ô³',
  81342. 'Õ¤' => 'Ô´',
  81343. 'Õ¥' => 'Ôµ',
  81344. 'Õ¦' => 'Ô¶',
  81345. 'Õ§' => 'Ô·',
  81346. 'Õ¨' => 'Ô¸',
  81347. 'Õ©' => 'Ô¹',
  81348. 'Õª' => 'Ôº',
  81349. 'Õ«' => 'Ô»',
  81350. 'Õ¬' => 'Ô¼',
  81351. 'Õ­' => 'Ô½',
  81352. 'Õ®' => 'Ô¾',
  81353. 'Õ¯' => 'Ô¿',
  81354. 'Õ°' => 'Õ€',
  81355. 'Õ±' => 'Õ�',
  81356. 'Õ²' => 'Õ‚',
  81357. 'Õ³' => 'Õƒ',
  81358. 'Õ´' => 'Õ„',
  81359. 'Õµ' => 'Õ…',
  81360. 'Õ¶' => 'Õ†',
  81361. 'Õ·' => 'Õ‡',
  81362. 'Õ¸' => 'Õˆ',
  81363. 'Õ¹' => 'Õ‰',
  81364. 'Õº' => 'ÕŠ',
  81365. 'Õ»' => 'Õ‹',
  81366. 'ռ' => 'Ռ',
  81367. 'Õ½' => 'Õ�',
  81368. 'Õ¾' => 'ÕŽ',
  81369. 'Õ¿' => 'Õ�',
  81370. 'Ö€' => 'Õ�',
  81371. 'Ö�' => 'Õ‘',
  81372. 'Ö‚' => 'Õ’',
  81373. 'Öƒ' => 'Õ“',
  81374. 'Ö„' => 'Õ”',
  81375. 'Ö…' => 'Õ•',
  81376. 'Ö†' => 'Õ–',
  81377. '�' => '�',
  81378. 'ბ' => 'Ბ',
  81379. 'გ' => 'Გ',
  81380. 'დ' => 'Დ',
  81381. 'ე' => 'Ე',
  81382. 'ვ' => 'Ვ',
  81383. 'ზ' => 'Ზ',
  81384. 'თ' => 'Თ',
  81385. 'ი' => 'Ი',
  81386. 'კ' => 'Კ',
  81387. 'ლ' => 'Ლ',
  81388. 'მ' => 'Მ',
  81389. 'ნ' => 'Ნ',
  81390. '�' => '�',
  81391. 'პ' => 'Პ',
  81392. 'ჟ' => 'Ჟ',
  81393. 'რ' => 'Რ',
  81394. 'ს' => 'Ს',
  81395. 'ტ' => 'Ტ',
  81396. 'უ' => 'Უ',
  81397. 'ფ' => 'Ფ',
  81398. 'ქ' => 'Ქ',
  81399. 'ღ' => 'Ღ',
  81400. 'ყ' => 'Ყ',
  81401. 'შ' => 'Შ',
  81402. 'ჩ' => 'Ჩ',
  81403. 'ც' => 'Ც',
  81404. 'ძ' => 'Ძ',
  81405. 'წ' => 'Წ',
  81406. 'ჭ' => 'Ჭ',
  81407. 'ხ' => 'Ხ',
  81408. 'ჯ' => 'Ჯ',
  81409. 'ჰ' => 'Ჰ',
  81410. 'ჱ' => 'Ჱ',
  81411. 'ჲ' => 'Ჲ',
  81412. 'ჳ' => 'Ჳ',
  81413. 'ჴ' => 'Ჴ',
  81414. 'ჵ' => 'Ჵ',
  81415. 'ჶ' => 'Ჶ',
  81416. 'ჷ' => 'Ჷ',
  81417. 'ჸ' => 'Ჸ',
  81418. 'ჹ' => 'Ჹ',
  81419. 'ჺ' => 'Ჺ',
  81420. 'ჽ' => 'Ჽ',
  81421. 'ჾ' => 'Ჾ',
  81422. 'ჿ' => 'Ჿ',
  81423. '�' => '�',
  81424. '�' => '�',
  81425. '�' => '�',
  81426. '�' => '�',
  81427. '�' => '�',
  81428. '�' => '�',
  81429. 'á²€' => 'Ð’',
  81430. '�' => 'Д',
  81431. 'ᲂ' => 'О',
  81432. 'ᲃ' => 'С',
  81433. 'ᲄ' => 'Т',
  81434. 'ᲅ' => 'Т',
  81435. 'ᲆ' => 'Ъ',
  81436. 'ᲇ' => 'Ѣ',
  81437. 'ᲈ' => 'Ꙋ',
  81438. 'ᵹ' => '�',
  81439. 'áµ½' => 'â±£',
  81440. 'ᶎ' => 'Ᶎ',
  81441. '�' => 'Ḁ',
  81442. 'ḃ' => 'Ḃ',
  81443. 'ḅ' => 'Ḅ',
  81444. 'ḇ' => 'Ḇ',
  81445. 'ḉ' => 'Ḉ',
  81446. 'ḋ' => 'Ḋ',
  81447. '�' => 'Ḍ',
  81448. '�' => 'Ḏ',
  81449. 'ḑ' => '�',
  81450. 'ḓ' => 'Ḓ',
  81451. 'ḕ' => 'Ḕ',
  81452. 'ḗ' => 'Ḗ',
  81453. 'ḙ' => 'Ḙ',
  81454. 'ḛ' => 'Ḛ',
  81455. '�' => 'Ḝ',
  81456. 'ḟ' => 'Ḟ',
  81457. 'ḡ' => 'Ḡ',
  81458. 'ḣ' => 'Ḣ',
  81459. 'ḥ' => 'Ḥ',
  81460. 'ḧ' => 'Ḧ',
  81461. 'ḩ' => 'Ḩ',
  81462. 'ḫ' => 'Ḫ',
  81463. 'ḭ' => 'Ḭ',
  81464. 'ḯ' => 'Ḯ',
  81465. 'ḱ' => 'Ḱ',
  81466. 'ḳ' => 'Ḳ',
  81467. 'ḵ' => 'Ḵ',
  81468. 'ḷ' => 'Ḷ',
  81469. 'ḹ' => 'Ḹ',
  81470. 'ḻ' => 'Ḻ',
  81471. 'ḽ' => 'Ḽ',
  81472. 'ḿ' => 'Ḿ',
  81473. '�' => 'Ṁ',
  81474. 'ṃ' => 'Ṃ',
  81475. 'ṅ' => 'Ṅ',
  81476. 'ṇ' => 'Ṇ',
  81477. 'ṉ' => 'Ṉ',
  81478. 'ṋ' => 'Ṋ',
  81479. '�' => 'Ṍ',
  81480. '�' => 'Ṏ',
  81481. 'ṑ' => '�',
  81482. 'ṓ' => 'Ṓ',
  81483. 'ṕ' => 'Ṕ',
  81484. 'á¹—' => 'á¹–',
  81485. 'ṙ' => 'Ṙ',
  81486. 'ṛ' => 'Ṛ',
  81487. '�' => 'Ṝ',
  81488. 'ṟ' => 'Ṟ',
  81489. 'ṡ' => 'Ṡ',
  81490. 'á¹£' => 'á¹¢',
  81491. 'ṥ' => 'Ṥ',
  81492. 'ṧ' => 'Ṧ',
  81493. 'ṩ' => 'Ṩ',
  81494. 'ṫ' => 'Ṫ',
  81495. 'ṭ' => 'Ṭ',
  81496. 'ṯ' => 'Ṯ',
  81497. 'á¹±' => 'á¹°',
  81498. 'á¹³' => 'á¹²',
  81499. 'á¹µ' => 'á¹´',
  81500. 'ṷ' => 'Ṷ',
  81501. 'ṹ' => 'Ṹ',
  81502. 'ṻ' => 'Ṻ',
  81503. 'á¹½' => 'á¹¼',
  81504. 'ṿ' => 'Ṿ',
  81505. '�' => 'Ẁ',
  81506. 'ẃ' => 'Ẃ',
  81507. 'ẅ' => 'Ẅ',
  81508. 'ẇ' => 'Ẇ',
  81509. 'ẉ' => 'Ẉ',
  81510. 'ẋ' => 'Ẋ',
  81511. '�' => 'Ẍ',
  81512. '�' => 'Ẏ',
  81513. 'ẑ' => '�',
  81514. 'ẓ' => 'Ẓ',
  81515. 'ẕ' => 'Ẕ',
  81516. 'ẛ' => 'Ṡ',
  81517. 'ạ' => 'Ạ',
  81518. 'ả' => 'Ả',
  81519. 'ấ' => 'Ấ',
  81520. 'ầ' => 'Ầ',
  81521. 'ẩ' => 'Ẩ',
  81522. 'ẫ' => 'Ẫ',
  81523. 'ậ' => 'Ậ',
  81524. 'ắ' => 'Ắ',
  81525. 'ằ' => 'Ằ',
  81526. 'ẳ' => 'Ẳ',
  81527. 'ẵ' => 'Ẵ',
  81528. 'ặ' => 'Ặ',
  81529. 'ẹ' => 'Ẹ',
  81530. 'ẻ' => 'Ẻ',
  81531. 'ẽ' => 'Ẽ',
  81532. 'ế' => 'Ế',
  81533. '�' => 'Ề',
  81534. 'ể' => 'Ể',
  81535. 'ễ' => 'Ễ',
  81536. 'ệ' => 'Ệ',
  81537. 'ỉ' => 'Ỉ',
  81538. 'ị' => 'Ị',
  81539. '�' => 'Ọ',
  81540. '�' => 'Ỏ',
  81541. 'ố' => '�',
  81542. 'ồ' => 'Ồ',
  81543. 'ổ' => 'Ổ',
  81544. 'á»—' => 'á»–',
  81545. 'ộ' => 'Ộ',
  81546. 'ớ' => 'Ớ',
  81547. '�' => 'Ờ',
  81548. 'ở' => 'Ở',
  81549. 'ỡ' => 'Ỡ',
  81550. 'ợ' => 'Ợ',
  81551. 'ụ' => 'Ụ',
  81552. 'ủ' => 'Ủ',
  81553. 'ứ' => 'Ứ',
  81554. 'ừ' => 'Ừ',
  81555. 'ử' => 'Ử',
  81556. 'ữ' => 'Ữ',
  81557. 'á»±' => 'á»°',
  81558. 'ỳ' => 'Ỳ',
  81559. 'ỵ' => 'Ỵ',
  81560. 'ỷ' => 'Ỷ',
  81561. 'ỹ' => 'Ỹ',
  81562. 'ỻ' => 'Ỻ',
  81563. 'ỽ' => 'Ỽ',
  81564. 'ỿ' => 'Ỿ',
  81565. 'ἀ' => 'Ἀ',
  81566. '�' => 'Ἁ',
  81567. 'ἂ' => 'Ἂ',
  81568. 'ἃ' => 'Ἃ',
  81569. 'ἄ' => 'Ἄ',
  81570. 'ἅ' => '�',
  81571. 'ἆ' => 'Ἆ',
  81572. 'ἇ' => '�',
  81573. '�' => 'Ἐ',
  81574. 'ἑ' => 'Ἑ',
  81575. 'ἒ' => 'Ἒ',
  81576. 'ἓ' => 'Ἓ',
  81577. 'ἔ' => 'Ἔ',
  81578. 'ἕ' => '�',
  81579. 'ἠ' => 'Ἠ',
  81580. 'ἡ' => 'Ἡ',
  81581. 'ἢ' => 'Ἢ',
  81582. 'ἣ' => 'Ἣ',
  81583. 'ἤ' => 'Ἤ',
  81584. 'á¼¥' => 'á¼­',
  81585. 'ἦ' => 'Ἦ',
  81586. 'ἧ' => 'Ἧ',
  81587. 'ἰ' => 'Ἰ',
  81588. 'á¼±' => 'á¼¹',
  81589. 'ἲ' => 'Ἲ',
  81590. 'á¼³' => 'á¼»',
  81591. 'á¼´' => 'á¼¼',
  81592. 'á¼µ' => 'á¼½',
  81593. 'ἶ' => 'Ἶ',
  81594. 'ἷ' => 'Ἷ',
  81595. 'ὀ' => 'Ὀ',
  81596. '�' => 'Ὁ',
  81597. 'ὂ' => 'Ὂ',
  81598. 'ὃ' => 'Ὃ',
  81599. 'ὄ' => 'Ὄ',
  81600. 'ὅ' => '�',
  81601. 'ὑ' => 'Ὑ',
  81602. 'ὓ' => 'Ὓ',
  81603. 'ὕ' => '�',
  81604. 'ὗ' => 'Ὗ',
  81605. 'ὠ' => 'Ὠ',
  81606. 'ὡ' => 'Ὡ',
  81607. 'ὢ' => 'Ὢ',
  81608. 'ὣ' => 'Ὣ',
  81609. 'ὤ' => 'Ὤ',
  81610. 'á½¥' => 'á½­',
  81611. 'ὦ' => 'Ὦ',
  81612. 'ὧ' => 'Ὧ',
  81613. 'ὰ' => 'Ὰ',
  81614. 'á½±' => 'á¾»',
  81615. 'ὲ' => 'Ὲ',
  81616. 'έ' => 'Έ',
  81617. 'á½´' => 'á¿Š',
  81618. 'á½µ' => 'á¿‹',
  81619. 'ὶ' => 'Ὶ',
  81620. 'á½·' => 'á¿›',
  81621. 'ὸ' => 'Ὸ',
  81622. 'ό' => 'Ό',
  81623. 'ὺ' => 'Ὺ',
  81624. 'á½»' => 'á¿«',
  81625. 'ὼ' => 'Ὼ',
  81626. 'á½½' => 'á¿»',
  81627. 'ᾀ' => 'ἈΙ',
  81628. '�' => 'ἉΙ',
  81629. 'ᾂ' => 'ἊΙ',
  81630. 'ᾃ' => 'ἋΙ',
  81631. 'ᾄ' => 'ἌΙ',
  81632. 'ᾅ' => '�Ι',
  81633. 'ᾆ' => 'ἎΙ',
  81634. 'ᾇ' => '�Ι',
  81635. '�' => 'ἨΙ',
  81636. 'ᾑ' => 'ἩΙ',
  81637. 'ᾒ' => 'ἪΙ',
  81638. 'ᾓ' => 'ἫΙ',
  81639. 'ᾔ' => 'ἬΙ',
  81640. 'ᾕ' => 'ἭΙ',
  81641. 'ᾖ' => 'ἮΙ',
  81642. 'ᾗ' => 'ἯΙ',
  81643. 'ᾠ' => 'ὨΙ',
  81644. 'ᾡ' => 'ὩΙ',
  81645. 'ᾢ' => 'ὪΙ',
  81646. 'ᾣ' => 'ὫΙ',
  81647. 'ᾤ' => 'ὬΙ',
  81648. 'ᾥ' => 'ὭΙ',
  81649. 'ᾦ' => 'ὮΙ',
  81650. 'ᾧ' => 'ὯΙ',
  81651. 'ᾰ' => 'Ᾰ',
  81652. 'á¾±' => 'á¾¹',
  81653. 'ᾳ' => 'ΑΙ',
  81654. 'ι' => 'Ι',
  81655. 'ῃ' => 'ΗΙ',
  81656. '�' => 'Ῐ',
  81657. 'á¿‘' => 'á¿™',
  81658. 'ῠ' => 'Ῠ',
  81659. 'á¿¡' => 'á¿©',
  81660. 'ῥ' => 'Ῥ',
  81661. 'ῳ' => 'ΩΙ',
  81662. 'ⅎ' => 'Ⅎ',
  81663. 'â…°' => 'â… ',
  81664. 'â…±' => 'â…¡',
  81665. 'â…²' => 'â…¢',
  81666. 'â…³' => 'â…£',
  81667. 'â…´' => 'â…¤',
  81668. 'â…µ' => 'â…¥',
  81669. 'â…¶' => 'â…¦',
  81670. 'â…·' => 'â…§',
  81671. 'â…¸' => 'â…¨',
  81672. 'â…¹' => 'â…©',
  81673. 'â…º' => 'â…ª',
  81674. 'â…»' => 'â…«',
  81675. 'â…¼' => 'â…¬',
  81676. 'â…½' => 'â…­',
  81677. 'â…¾' => 'â…®',
  81678. 'â…¿' => 'â…¯',
  81679. 'ↄ' => 'Ↄ',
  81680. '�' => 'Ⓐ',
  81681. 'â“‘' => 'â’·',
  81682. 'â“’' => 'â’¸',
  81683. 'â““' => 'â’¹',
  81684. 'â“”' => 'â’º',
  81685. 'â“•' => 'â’»',
  81686. 'â“–' => 'â’¼',
  81687. 'â“—' => 'â’½',
  81688. 'ⓘ' => 'Ⓘ',
  81689. 'â“™' => 'â’¿',
  81690. 'â“š' => 'â“€',
  81691. 'ⓛ' => '�',
  81692. 'ⓜ' => 'Ⓜ',
  81693. '�' => 'Ⓝ',
  81694. 'â“ž' => 'â“„',
  81695. 'â“Ÿ' => 'â“…',
  81696. 'ⓠ' => 'Ⓠ',
  81697. 'ⓡ' => 'Ⓡ',
  81698. 'ⓢ' => 'Ⓢ',
  81699. 'ⓣ' => 'Ⓣ',
  81700. 'ⓤ' => 'Ⓤ',
  81701. 'â“¥' => 'â“‹',
  81702. 'ⓦ' => 'Ⓦ',
  81703. 'ⓧ' => '�',
  81704. 'ⓨ' => 'Ⓨ',
  81705. 'ⓩ' => '�',
  81706. 'â°°' => 'â°€',
  81707. 'â°±' => 'â°�',
  81708. 'â°²' => 'â°‚',
  81709. 'â°³' => 'â°ƒ',
  81710. 'â°´' => 'â°„',
  81711. 'â°µ' => 'â°…',
  81712. 'â°¶' => 'â°†',
  81713. 'â°·' => 'â°‡',
  81714. 'â°¸' => 'â°ˆ',
  81715. 'â°¹' => 'â°‰',
  81716. 'â°º' => 'â°Š',
  81717. 'â°»' => 'â°‹',
  81718. 'ⰼ' => 'Ⰼ',
  81719. 'â°½' => 'â°�',
  81720. 'â°¾' => 'â°Ž',
  81721. 'â°¿' => 'â°�',
  81722. 'â±€' => 'â°�',
  81723. '�' => 'Ⱁ',
  81724. 'ⱂ' => 'Ⱂ',
  81725. 'ⱃ' => 'Ⱃ',
  81726. 'ⱄ' => 'Ⱄ',
  81727. 'â±…' => 'â°•',
  81728. 'ⱆ' => 'Ⱆ',
  81729. 'ⱇ' => 'Ⱇ',
  81730. 'ⱈ' => 'Ⱈ',
  81731. 'ⱉ' => 'Ⱉ',
  81732. 'ⱊ' => 'Ⱊ',
  81733. 'ⱋ' => 'Ⱋ',
  81734. 'ⱌ' => 'Ⱌ',
  81735. '�' => '�',
  81736. 'ⱎ' => 'Ⱎ',
  81737. '�' => 'Ⱏ',
  81738. '�' => 'Ⱐ',
  81739. 'ⱑ' => 'Ⱑ',
  81740. 'â±’' => 'â°¢',
  81741. 'ⱓ' => 'Ⱓ',
  81742. 'â±”' => 'â°¤',
  81743. 'ⱕ' => 'Ⱕ',
  81744. 'â±–' => 'â°¦',
  81745. 'â±—' => 'â°§',
  81746. 'ⱘ' => 'Ⱘ',
  81747. 'â±™' => 'â°©',
  81748. 'ⱚ' => 'Ⱚ',
  81749. 'â±›' => 'â°«',
  81750. 'ⱜ' => 'Ⱜ',
  81751. '�' => 'Ⱝ',
  81752. 'ⱞ' => 'Ⱞ',
  81753. 'ⱡ' => 'Ⱡ',
  81754. 'ⱥ' => 'Ⱥ',
  81755. 'ⱦ' => 'Ⱦ',
  81756. 'ⱨ' => 'Ⱨ',
  81757. 'ⱪ' => 'Ⱪ',
  81758. 'ⱬ' => 'Ⱬ',
  81759. 'â±³' => 'â±²',
  81760. 'ⱶ' => 'Ⱶ',
  81761. '�' => 'Ⲁ',
  81762. 'ⲃ' => 'Ⲃ',
  81763. 'ⲅ' => 'Ⲅ',
  81764. 'ⲇ' => 'Ⲇ',
  81765. 'ⲉ' => 'Ⲉ',
  81766. 'ⲋ' => 'Ⲋ',
  81767. '�' => 'Ⲍ',
  81768. '�' => 'Ⲏ',
  81769. 'ⲑ' => '�',
  81770. 'ⲓ' => 'Ⲓ',
  81771. 'ⲕ' => 'Ⲕ',
  81772. 'â²—' => 'â²–',
  81773. 'ⲙ' => 'Ⲙ',
  81774. 'ⲛ' => 'Ⲛ',
  81775. '�' => 'Ⲝ',
  81776. 'ⲟ' => 'Ⲟ',
  81777. 'ⲡ' => 'Ⲡ',
  81778. 'â²£' => 'â²¢',
  81779. 'ⲥ' => 'Ⲥ',
  81780. 'ⲧ' => 'Ⲧ',
  81781. 'ⲩ' => 'Ⲩ',
  81782. 'ⲫ' => 'Ⲫ',
  81783. 'ⲭ' => 'Ⲭ',
  81784. 'ⲯ' => 'Ⲯ',
  81785. 'â²±' => 'â²°',
  81786. 'â²³' => 'â²²',
  81787. 'â²µ' => 'â²´',
  81788. 'ⲷ' => 'Ⲷ',
  81789. 'ⲹ' => 'Ⲹ',
  81790. 'ⲻ' => 'Ⲻ',
  81791. 'â²½' => 'â²¼',
  81792. 'ⲿ' => 'Ⲿ',
  81793. '�' => 'Ⳁ',
  81794. 'ⳃ' => 'Ⳃ',
  81795. 'ⳅ' => 'Ⳅ',
  81796. 'ⳇ' => 'Ⳇ',
  81797. 'ⳉ' => 'Ⳉ',
  81798. 'ⳋ' => 'Ⳋ',
  81799. '�' => 'Ⳍ',
  81800. '�' => 'Ⳏ',
  81801. 'ⳑ' => '�',
  81802. 'ⳓ' => 'Ⳓ',
  81803. 'ⳕ' => 'Ⳕ',
  81804. 'â³—' => 'â³–',
  81805. 'ⳙ' => 'Ⳙ',
  81806. 'ⳛ' => 'Ⳛ',
  81807. '�' => 'Ⳝ',
  81808. 'ⳟ' => 'Ⳟ',
  81809. 'ⳡ' => 'Ⳡ',
  81810. 'â³£' => 'â³¢',
  81811. 'ⳬ' => 'Ⳬ',
  81812. 'â³®' => 'â³­',
  81813. 'â³³' => 'â³²',
  81814. 'â´€' => 'á‚ ',
  81815. 'â´�' => 'á‚¡',
  81816. 'â´‚' => 'á‚¢',
  81817. 'â´ƒ' => 'á‚£',
  81818. 'ⴄ' => 'Ⴄ',
  81819. 'â´…' => 'á‚¥',
  81820. 'ⴆ' => 'Ⴆ',
  81821. 'ⴇ' => 'Ⴇ',
  81822. 'ⴈ' => 'Ⴈ',
  81823. 'â´‰' => 'á‚©',
  81824. 'ⴊ' => 'Ⴊ',
  81825. 'â´‹' => 'á‚«',
  81826. 'ⴌ' => 'Ⴌ',
  81827. 'â´�' => 'á‚­',
  81828. 'â´Ž' => 'á‚®',
  81829. '�' => 'Ⴏ',
  81830. 'â´�' => 'á‚°',
  81831. 'ⴑ' => 'Ⴑ',
  81832. 'ⴒ' => 'Ⴒ',
  81833. 'ⴓ' => 'Ⴓ',
  81834. 'â´”' => 'á‚´',
  81835. 'ⴕ' => 'Ⴕ',
  81836. 'ⴖ' => 'Ⴖ',
  81837. 'â´—' => 'á‚·',
  81838. 'ⴘ' => 'Ⴘ',
  81839. 'ⴙ' => 'Ⴙ',
  81840. 'ⴚ' => 'Ⴚ',
  81841. 'â´›' => 'á‚»',
  81842. 'ⴜ' => 'Ⴜ',
  81843. '�' => 'Ⴝ',
  81844. 'ⴞ' => 'Ⴞ',
  81845. 'â´Ÿ' => 'á‚¿',
  81846. 'ⴠ' => 'Ⴠ',
  81847. 'ⴡ' => '�',
  81848. 'ⴢ' => 'Ⴢ',
  81849. 'ⴣ' => 'Ⴣ',
  81850. 'ⴤ' => 'Ⴤ',
  81851. 'ⴥ' => 'Ⴥ',
  81852. 'ⴧ' => 'Ⴧ',
  81853. 'ⴭ' => '�',
  81854. '�' => 'Ꙁ',
  81855. 'ꙃ' => 'Ꙃ',
  81856. 'ꙅ' => 'Ꙅ',
  81857. 'ꙇ' => 'Ꙇ',
  81858. 'ꙉ' => 'Ꙉ',
  81859. 'ꙋ' => 'Ꙋ',
  81860. '�' => 'Ꙍ',
  81861. '�' => 'Ꙏ',
  81862. 'ꙑ' => '�',
  81863. 'ꙓ' => 'Ꙓ',
  81864. 'ꙕ' => 'Ꙕ',
  81865. 'ê™—' => 'ê™–',
  81866. 'ꙙ' => 'Ꙙ',
  81867. 'ꙛ' => 'Ꙛ',
  81868. '�' => 'Ꙝ',
  81869. 'ꙟ' => 'Ꙟ',
  81870. 'ꙡ' => 'Ꙡ',
  81871. 'ꙣ' => 'Ꙣ',
  81872. 'ꙥ' => 'Ꙥ',
  81873. 'ꙧ' => 'Ꙧ',
  81874. 'ꙩ' => 'Ꙩ',
  81875. 'ꙫ' => 'Ꙫ',
  81876. 'ꙭ' => 'Ꙭ',
  81877. '�' => 'Ꚁ',
  81878. 'ꚃ' => 'Ꚃ',
  81879. 'êš…' => 'êš„',
  81880. 'ꚇ' => 'Ꚇ',
  81881. 'ꚉ' => 'Ꚉ',
  81882. 'ꚋ' => 'Ꚋ',
  81883. '�' => 'Ꚍ',
  81884. '�' => 'Ꚏ',
  81885. 'ꚑ' => '�',
  81886. 'êš“' => 'êš’',
  81887. 'êš•' => 'êš”',
  81888. 'êš—' => 'êš–',
  81889. 'ꚙ' => 'Ꚙ',
  81890. 'êš›' => 'êšš',
  81891. 'ꜣ' => 'Ꜣ',
  81892. 'ꜥ' => 'Ꜥ',
  81893. 'ꜧ' => 'Ꜧ',
  81894. 'ꜩ' => 'Ꜩ',
  81895. 'ꜫ' => 'Ꜫ',
  81896. 'ꜭ' => 'Ꜭ',
  81897. 'ꜯ' => 'Ꜯ',
  81898. 'ꜳ' => 'Ꜳ',
  81899. 'ꜵ' => 'Ꜵ',
  81900. 'ꜷ' => 'Ꜷ',
  81901. 'ꜹ' => 'Ꜹ',
  81902. 'ꜻ' => 'Ꜻ',
  81903. 'ꜽ' => 'Ꜽ',
  81904. 'ꜿ' => 'Ꜿ',
  81905. '�' => '�',
  81906. '�' => '�',
  81907. '�' => '�',
  81908. '�' => '�',
  81909. '�' => '�',
  81910. '�' => '�',
  81911. '�' => '�',
  81912. '�' => '�',
  81913. '�' => '�',
  81914. '�' => '�',
  81915. '�' => '�',
  81916. '�' => '�',
  81917. '�' => '�',
  81918. '�' => '�',
  81919. '�' => '�',
  81920. '�' => '�',
  81921. '�' => '�',
  81922. '�' => '�',
  81923. '�' => '�',
  81924. '�' => '�',
  81925. '�' => '�',
  81926. '�' => '�',
  81927. '�' => '�',
  81928. '�' => '�',
  81929. '�' => '�',
  81930. '�' => '�',
  81931. '�' => '�',
  81932. '�' => 'Ꞁ',
  81933. 'ꞃ' => 'Ꞃ',
  81934. 'êž…' => 'êž„',
  81935. 'ꞇ' => 'Ꞇ',
  81936. 'ꞌ' => 'Ꞌ',
  81937. 'ꞑ' => '�',
  81938. 'êž“' => 'êž’',
  81939. 'ꞔ' => 'Ꞔ',
  81940. 'êž—' => 'êž–',
  81941. 'ꞙ' => 'Ꞙ',
  81942. 'êž›' => 'êžš',
  81943. '�' => 'Ꞝ',
  81944. 'ꞟ' => 'Ꞟ',
  81945. 'êž¡' => 'êž ',
  81946. 'ꞣ' => 'Ꞣ',
  81947. 'ꞥ' => 'Ꞥ',
  81948. 'ꞧ' => 'Ꞧ',
  81949. 'ꞩ' => 'Ꞩ',
  81950. 'êžµ' => 'êž´',
  81951. 'ꞷ' => 'Ꞷ',
  81952. 'ꞹ' => 'Ꞹ',
  81953. 'ꞻ' => 'Ꞻ',
  81954. 'êž½' => 'êž¼',
  81955. 'êž¿' => 'êž¾',
  81956. 'ꟃ' => 'Ꟃ',
  81957. 'ꟈ' => 'Ꟈ',
  81958. 'ꟊ' => 'Ꟊ',
  81959. 'ꟶ' => 'Ꟶ',
  81960. 'ê­“' => 'êž³',
  81961. 'ꭰ' => 'Ꭰ',
  81962. 'ꭱ' => 'Ꭱ',
  81963. 'ꭲ' => 'Ꭲ',
  81964. 'ꭳ' => 'Ꭳ',
  81965. 'ꭴ' => 'Ꭴ',
  81966. 'ꭵ' => 'Ꭵ',
  81967. 'ꭶ' => 'Ꭶ',
  81968. 'ꭷ' => 'Ꭷ',
  81969. 'ꭸ' => 'Ꭸ',
  81970. 'ꭹ' => 'Ꭹ',
  81971. 'ꭺ' => 'Ꭺ',
  81972. 'ꭻ' => 'Ꭻ',
  81973. 'ꭼ' => 'Ꭼ',
  81974. 'ꭽ' => 'Ꭽ',
  81975. 'ꭾ' => 'Ꭾ',
  81976. 'ꭿ' => 'Ꭿ',
  81977. 'ꮀ' => 'Ꮀ',
  81978. '�' => 'Ꮁ',
  81979. 'ꮂ' => 'Ꮂ',
  81980. 'ꮃ' => 'Ꮃ',
  81981. 'ꮄ' => 'Ꮄ',
  81982. 'ꮅ' => 'Ꮅ',
  81983. 'ꮆ' => 'Ꮆ',
  81984. 'ꮇ' => 'Ꮇ',
  81985. 'ꮈ' => 'Ꮈ',
  81986. 'ꮉ' => 'Ꮉ',
  81987. 'ꮊ' => 'Ꮊ',
  81988. 'ꮋ' => 'Ꮋ',
  81989. 'ꮌ' => 'Ꮌ',
  81990. '�' => 'Ꮍ',
  81991. 'ꮎ' => 'Ꮎ',
  81992. '�' => 'Ꮏ',
  81993. '�' => '�',
  81994. 'ꮑ' => '�',
  81995. 'ꮒ' => '�',
  81996. 'ꮓ' => '�',
  81997. 'ꮔ' => '�',
  81998. 'ꮕ' => '�',
  81999. 'ꮖ' => '�',
  82000. 'ꮗ' => '�',
  82001. 'ꮘ' => '�',
  82002. 'ꮙ' => '�',
  82003. 'ꮚ' => '�',
  82004. 'ꮛ' => '�',
  82005. 'ꮜ' => '�',
  82006. '�' => '�',
  82007. 'ꮞ' => '�',
  82008. 'ꮟ' => '�',
  82009. 'ꮠ' => '�',
  82010. 'ꮡ' => '�',
  82011. 'ꮢ' => '�',
  82012. 'ꮣ' => '�',
  82013. 'ꮤ' => '�',
  82014. 'ꮥ' => '�',
  82015. 'ꮦ' => '�',
  82016. 'ꮧ' => '�',
  82017. 'ꮨ' => '�',
  82018. 'ꮩ' => '�',
  82019. 'ꮪ' => '�',
  82020. 'ꮫ' => '�',
  82021. 'ꮬ' => '�',
  82022. 'ꮭ' => '�',
  82023. 'ꮮ' => '�',
  82024. 'ꮯ' => '�',
  82025. 'ꮰ' => '�',
  82026. 'ꮱ' => '�',
  82027. 'ꮲ' => '�',
  82028. 'ꮳ' => '�',
  82029. 'ꮴ' => '�',
  82030. 'ꮵ' => '�',
  82031. 'ꮶ' => '�',
  82032. 'ꮷ' => '�',
  82033. 'ꮸ' => '�',
  82034. 'ꮹ' => '�',
  82035. 'ꮺ' => '�',
  82036. 'ꮻ' => '�',
  82037. 'ꮼ' => '�',
  82038. 'ꮽ' => '�',
  82039. 'ꮾ' => '�',
  82040. 'ꮿ' => '�',
  82041. '�' => 'A',
  82042. 'b' => 'B',
  82043. 'c' => 'C',
  82044. 'd' => 'D',
  82045. 'ï½…' => 'ï¼¥',
  82046. 'f' => 'F',
  82047. 'g' => 'G',
  82048. 'h' => 'H',
  82049. 'i' => 'I',
  82050. 'j' => 'J',
  82051. 'k' => 'K',
  82052. 'l' => 'L',
  82053. '�' => 'M',
  82054. 'n' => 'N',
  82055. '�' => 'O',
  82056. '�' => 'P',
  82057. 'q' => 'Q',
  82058. 'ï½’' => 'ï¼²',
  82059. 's' => 'S',
  82060. 'ï½”' => 'ï¼´',
  82061. 'u' => 'U',
  82062. 'v' => 'V',
  82063. 'ï½—' => 'ï¼·',
  82064. 'x' => 'X',
  82065. 'ï½™' => 'ï¼¹',
  82066. 'z' => 'Z',
  82067. '�' => '�',
  82068. '�' => '�',
  82069. '�' => '�',
  82070. '�' => '�',
  82071. '�' => '�',
  82072. '�' => '�',
  82073. '�' => '�',
  82074. '�' => '�',
  82075. '�' => '�',
  82076. '�' => '�',
  82077. '�' => '�',
  82078. '�' => '�',
  82079. '�' => '�',
  82080. '�' => '�',
  82081. '�' => '�',
  82082. '�' => '�',
  82083. '�' => '�',
  82084. '�' => '�',
  82085. '�' => '�',
  82086. '�' => '�',
  82087. '�' => '�',
  82088. '�' => '�',
  82089. '�' => '�',
  82090. '�' => '�',
  82091. '�' => '�',
  82092. '�' => '�',
  82093. '�' => '�',
  82094. '�' => '�',
  82095. '�' => '�',
  82096. '�' => '�',
  82097. '�' => '�',
  82098. '�' => '�',
  82099. '�' => '�',
  82100. '�' => '�',
  82101. '�' => '�',
  82102. '�' => '�',
  82103. '�' => '�',
  82104. '�' => '�',
  82105. '�' => '�',
  82106. '�' => '�',
  82107. '�' => '�',
  82108. '�' => '�',
  82109. '�' => '�',
  82110. '�' => '�',
  82111. '�' => '�',
  82112. '�' => '�',
  82113. '�' => '�',
  82114. '�' => '�',
  82115. '�' => '�',
  82116. '�' => '�',
  82117. '�' => '�',
  82118. '�' => '�',
  82119. '�' => '�',
  82120. '�' => '�',
  82121. '�' => '�',
  82122. '�' => '�',
  82123. '�' => '�',
  82124. '�' => '�',
  82125. '�' => '�',
  82126. '�' => '�',
  82127. '�' => '�',
  82128. '�' => '�',
  82129. '�' => '�',
  82130. '�' => '�',
  82131. '�' => '�',
  82132. '�' => '�',
  82133. '�' => '�',
  82134. '�' => '�',
  82135. '�' => '�',
  82136. '�' => '�',
  82137. '�' => '�',
  82138. '�' => '�',
  82139. '�' => '�',
  82140. '�' => '�',
  82141. '�' => '�',
  82142. '�' => '�',
  82143. '�' => '�',
  82144. '�' => '�',
  82145. '�' => '�',
  82146. '�' => '�',
  82147. '�' => '�',
  82148. '�' => '�',
  82149. '�' => '�',
  82150. '�' => '�',
  82151. '�' => '�',
  82152. '�' => '�',
  82153. '�' => '�',
  82154. '�' => '�',
  82155. '�' => '�',
  82156. '�' => '�',
  82157. '�' => '�',
  82158. '�' => '�',
  82159. '�' => '�',
  82160. '�' => '�',
  82161. '�' => '�',
  82162. '�' => '�',
  82163. '�' => '�',
  82164. '�' => '�',
  82165. '�' => '�',
  82166. '�' => '�',
  82167. '�' => '�',
  82168. '�' => '�',
  82169. '�' => '�',
  82170. '�' => '�',
  82171. '�' => '�',
  82172. '�' => '�',
  82173. '�' => '�',
  82174. '�' => '�',
  82175. '�' => '�',
  82176. '�' => '�',
  82177. '�' => '�',
  82178. '�' => '�',
  82179. '�' => '�',
  82180. '�' => '�',
  82181. '�' => '�',
  82182. '�' => '�',
  82183. '�' => '�',
  82184. '�' => '�',
  82185. '�' => '�',
  82186. '�' => '�',
  82187. '�' => '�',
  82188. '�' => '�',
  82189. '�' => '�',
  82190. '�' => '�',
  82191. '�' => '�',
  82192. '�' => '�',
  82193. '�' => '�',
  82194. 'ð‘£€' => 'ð‘¢ ',
  82195. '�' => '𑢡',
  82196. '𑣂' => '𑢢',
  82197. '𑣃' => '𑢣',
  82198. '𑣄' => '𑢤',
  82199. 'ð‘£…' => 'ð‘¢¥',
  82200. '𑣆' => '𑢦',
  82201. '𑣇' => '𑢧',
  82202. '𑣈' => '𑢨',
  82203. '𑣉' => '𑢩',
  82204. '𑣊' => '𑢪',
  82205. '𑣋' => '𑢫',
  82206. '𑣌' => '𑢬',
  82207. '�' => '𑢭',
  82208. '𑣎' => '𑢮',
  82209. '�' => '𑢯',
  82210. '�' => '𑢰',
  82211. '𑣑' => '𑢱',
  82212. 'ð‘£’' => 'ð‘¢²',
  82213. '𑣓' => '𑢳',
  82214. 'ð‘£”' => 'ð‘¢´',
  82215. '𑣕' => '𑢵',
  82216. '𑣖' => '𑢶',
  82217. 'ð‘£—' => 'ð‘¢·',
  82218. '𑣘' => '𑢸',
  82219. 'ð‘£™' => 'ð‘¢¹',
  82220. '𑣚' => '𑢺',
  82221. 'ð‘£›' => 'ð‘¢»',
  82222. '𑣜' => '𑢼',
  82223. '�' => '𑢽',
  82224. '𑣞' => '𑢾',
  82225. '𑣟' => '𑢿',
  82226. 'ð–¹ ' => 'ð–¹€',
  82227. '𖹡' => '�',
  82228. '𖹢' => '𖹂',
  82229. '𖹣' => '𖹃',
  82230. '𖹤' => '𖹄',
  82231. 'ð–¹¥' => 'ð–¹…',
  82232. '𖹦' => '𖹆',
  82233. '𖹧' => '𖹇',
  82234. '𖹨' => '𖹈',
  82235. '𖹩' => '𖹉',
  82236. '𖹪' => '𖹊',
  82237. '𖹫' => '𖹋',
  82238. '𖹬' => '𖹌',
  82239. '𖹭' => '�',
  82240. '𖹮' => '𖹎',
  82241. '𖹯' => '�',
  82242. '𖹰' => '�',
  82243. '𖹱' => '𖹑',
  82244. 'ð–¹²' => 'ð–¹’',
  82245. '𖹳' => '𖹓',
  82246. 'ð–¹´' => 'ð–¹”',
  82247. '𖹵' => '𖹕',
  82248. '𖹶' => '𖹖',
  82249. 'ð–¹·' => 'ð–¹—',
  82250. '𖹸' => '𖹘',
  82251. 'ð–¹¹' => 'ð–¹™',
  82252. '𖹺' => '𖹚',
  82253. 'ð–¹»' => 'ð–¹›',
  82254. '𖹼' => '𖹜',
  82255. '𖹽' => '�',
  82256. '𖹾' => '𖹞',
  82257. '𖹿' => '𖹟',
  82258. '𞤢' => '𞤀',
  82259. '𞤣' => '�',
  82260. '𞤤' => '𞤂',
  82261. '𞤥' => '𞤃',
  82262. '𞤦' => '𞤄',
  82263. '𞤧' => '𞤅',
  82264. '𞤨' => '𞤆',
  82265. '𞤩' => '𞤇',
  82266. '𞤪' => '𞤈',
  82267. '𞤫' => '𞤉',
  82268. '𞤬' => '𞤊',
  82269. '𞤭' => '𞤋',
  82270. '𞤮' => '𞤌',
  82271. '𞤯' => '�',
  82272. '𞤰' => '𞤎',
  82273. '𞤱' => '�',
  82274. '𞤲' => '�',
  82275. '𞤳' => '𞤑',
  82276. '𞤴' => '𞤒',
  82277. '𞤵' => '𞤓',
  82278. '𞤶' => '𞤔',
  82279. '𞤷' => '𞤕',
  82280. '𞤸' => '𞤖',
  82281. '𞤹' => '𞤗',
  82282. '𞤺' => '𞤘',
  82283. '𞤻' => '𞤙',
  82284. '𞤼' => '𞤚',
  82285. '𞤽' => '𞤛',
  82286. '𞤾' => '𞤜',
  82287. '𞤿' => '�',
  82288. '𞥀' => '𞤞',
  82289. '�' => '𞤟',
  82290. '𞥂' => '𞤠',
  82291. '𞥃' => '𞤡',
  82292. 'ß' => 'SS',
  82293. 'ff' => 'FF',
  82294. '�' => 'FI',
  82295. 'fl' => 'FL',
  82296. 'ffi' => 'FFI',
  82297. 'ffl' => 'FFL',
  82298. 'ſt' => 'ST',
  82299. 'st' => 'ST',
  82300. 'Ö‡' => 'ÔµÕ’',
  82301. 'ﬓ' => 'ՄՆ',
  82302. 'ﬔ' => 'ՄԵ',
  82303. 'ﬕ' => 'ՄԻ',
  82304. 'ﬖ' => 'ՎՆ',
  82305. 'ﬗ' => 'ՄԽ',
  82306. 'ʼn' => 'ʼN',
  82307. '�' => 'Ϊ�',
  82308. 'ΰ' => 'Ϋ�',
  82309. 'ǰ' => 'J̌',
  82310. 'ẖ' => 'H̱',
  82311. 'ẗ' => 'T̈',
  82312. 'ẘ' => 'W̊',
  82313. 'ẙ' => 'Y̊',
  82314. 'ẚ' => 'Aʾ',
  82315. '�' => 'Υ̓',
  82316. 'ὒ' => 'Υ̓̀',
  82317. 'ὔ' => 'Υ̓�',
  82318. 'ὖ' => 'Υ̓͂',
  82319. 'ᾶ' => 'Α͂',
  82320. 'ῆ' => 'Η͂',
  82321. 'ῒ' => 'Ϊ̀',
  82322. 'ΐ' => 'Ϊ�',
  82323. 'ῖ' => 'Ι͂',
  82324. 'ῗ' => 'Ϊ͂',
  82325. 'ῢ' => 'Ϋ̀',
  82326. 'ΰ' => 'Ϋ�',
  82327. 'ῤ' => 'Ρ̓',
  82328. 'ῦ' => 'Υ͂',
  82329. 'ῧ' => 'Ϋ͂',
  82330. 'ῶ' => 'Ω͂',
  82331. 'ᾈ' => 'ἈΙ',
  82332. 'ᾉ' => 'ἉΙ',
  82333. 'ᾊ' => 'ἊΙ',
  82334. 'ᾋ' => 'ἋΙ',
  82335. 'ᾌ' => 'ἌΙ',
  82336. '�' => '�Ι',
  82337. 'ᾎ' => 'ἎΙ',
  82338. '�' => '�Ι',
  82339. 'ᾘ' => 'ἨΙ',
  82340. 'ᾙ' => 'ἩΙ',
  82341. 'ᾚ' => 'ἪΙ',
  82342. 'ᾛ' => 'ἫΙ',
  82343. 'ᾜ' => 'ἬΙ',
  82344. '�' => 'ἭΙ',
  82345. 'ᾞ' => 'ἮΙ',
  82346. 'ᾟ' => 'ἯΙ',
  82347. 'ᾨ' => 'ὨΙ',
  82348. 'ᾩ' => 'ὩΙ',
  82349. 'ᾪ' => 'ὪΙ',
  82350. 'ᾫ' => 'ὫΙ',
  82351. 'ᾬ' => 'ὬΙ',
  82352. 'ᾭ' => 'ὭΙ',
  82353. 'ᾮ' => 'ὮΙ',
  82354. 'ᾯ' => 'ὯΙ',
  82355. 'ᾼ' => 'ΑΙ',
  82356. 'ῌ' => 'ΗΙ',
  82357. 'ῼ' => 'ΩΙ',
  82358. 'ᾲ' => 'ᾺΙ',
  82359. 'ᾴ' => 'ΆΙ',
  82360. 'ῂ' => 'ῊΙ',
  82361. 'ῄ' => 'ΉΙ',
  82362. 'ῲ' => 'ῺΙ',
  82363. 'ῴ' => '�Ι',
  82364. 'ᾷ' => 'Α͂Ι',
  82365. 'ῇ' => 'Η͂Ι',
  82366. 'ῷ' => 'Ω͂Ι',
  82367. );
  82368. <?php
  82369. use Symfony\Polyfill\Mbstring as p;
  82370. if (\PHP_VERSION_ID >= 80000) {
  82371. return require __DIR__.'/bootstrap80.php';
  82372. }
  82373. if (!function_exists('mb_convert_encoding')) {
  82374. function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
  82375. }
  82376. if (!function_exists('mb_decode_mimeheader')) {
  82377. function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
  82378. }
  82379. if (!function_exists('mb_encode_mimeheader')) {
  82380. function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
  82381. }
  82382. if (!function_exists('mb_decode_numericentity')) {
  82383. function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
  82384. }
  82385. if (!function_exists('mb_encode_numericentity')) {
  82386. function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
  82387. }
  82388. if (!function_exists('mb_convert_case')) {
  82389. function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
  82390. }
  82391. if (!function_exists('mb_internal_encoding')) {
  82392. function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
  82393. }
  82394. if (!function_exists('mb_language')) {
  82395. function mb_language($language = null) { return p\Mbstring::mb_language($language); }
  82396. }
  82397. if (!function_exists('mb_list_encodings')) {
  82398. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  82399. }
  82400. if (!function_exists('mb_encoding_aliases')) {
  82401. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  82402. }
  82403. if (!function_exists('mb_check_encoding')) {
  82404. function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
  82405. }
  82406. if (!function_exists('mb_detect_encoding')) {
  82407. function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
  82408. }
  82409. if (!function_exists('mb_detect_order')) {
  82410. function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
  82411. }
  82412. if (!function_exists('mb_parse_str')) {
  82413. function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; }
  82414. }
  82415. if (!function_exists('mb_strlen')) {
  82416. function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
  82417. }
  82418. if (!function_exists('mb_strpos')) {
  82419. function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
  82420. }
  82421. if (!function_exists('mb_strtolower')) {
  82422. function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
  82423. }
  82424. if (!function_exists('mb_strtoupper')) {
  82425. function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
  82426. }
  82427. if (!function_exists('mb_substitute_character')) {
  82428. function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
  82429. }
  82430. if (!function_exists('mb_substr')) {
  82431. function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
  82432. }
  82433. if (!function_exists('mb_stripos')) {
  82434. function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
  82435. }
  82436. if (!function_exists('mb_stristr')) {
  82437. function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
  82438. }
  82439. if (!function_exists('mb_strrchr')) {
  82440. function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
  82441. }
  82442. if (!function_exists('mb_strrichr')) {
  82443. function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
  82444. }
  82445. if (!function_exists('mb_strripos')) {
  82446. function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
  82447. }
  82448. if (!function_exists('mb_strrpos')) {
  82449. function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
  82450. }
  82451. if (!function_exists('mb_strstr')) {
  82452. function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
  82453. }
  82454. if (!function_exists('mb_get_info')) {
  82455. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  82456. }
  82457. if (!function_exists('mb_http_output')) {
  82458. function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
  82459. }
  82460. if (!function_exists('mb_strwidth')) {
  82461. function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
  82462. }
  82463. if (!function_exists('mb_substr_count')) {
  82464. function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
  82465. }
  82466. if (!function_exists('mb_output_handler')) {
  82467. function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
  82468. }
  82469. if (!function_exists('mb_http_input')) {
  82470. function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
  82471. }
  82472. if (!function_exists('mb_convert_variables')) {
  82473. function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
  82474. }
  82475. if (!function_exists('mb_ord')) {
  82476. function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
  82477. }
  82478. if (!function_exists('mb_chr')) {
  82479. function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
  82480. }
  82481. if (!function_exists('mb_scrub')) {
  82482. function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
  82483. }
  82484. if (!function_exists('mb_str_split')) {
  82485. function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
  82486. }
  82487. if (!function_exists('mb_str_pad')) {
  82488. function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
  82489. }
  82490. if (extension_loaded('mbstring')) {
  82491. return;
  82492. }
  82493. if (!defined('MB_CASE_UPPER')) {
  82494. define('MB_CASE_UPPER', 0);
  82495. }
  82496. if (!defined('MB_CASE_LOWER')) {
  82497. define('MB_CASE_LOWER', 1);
  82498. }
  82499. if (!defined('MB_CASE_TITLE')) {
  82500. define('MB_CASE_TITLE', 2);
  82501. }
  82502. <?php
  82503. use Symfony\Polyfill\Mbstring as p;
  82504. if (!function_exists('mb_convert_encoding')) {
  82505. function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); }
  82506. }
  82507. if (!function_exists('mb_decode_mimeheader')) {
  82508. function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); }
  82509. }
  82510. if (!function_exists('mb_encode_mimeheader')) {
  82511. function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); }
  82512. }
  82513. if (!function_exists('mb_decode_numericentity')) {
  82514. function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
  82515. }
  82516. if (!function_exists('mb_encode_numericentity')) {
  82517. function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); }
  82518. }
  82519. if (!function_exists('mb_convert_case')) {
  82520. function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
  82521. }
  82522. if (!function_exists('mb_internal_encoding')) {
  82523. function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
  82524. }
  82525. if (!function_exists('mb_language')) {
  82526. function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); }
  82527. }
  82528. if (!function_exists('mb_list_encodings')) {
  82529. function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
  82530. }
  82531. if (!function_exists('mb_encoding_aliases')) {
  82532. function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
  82533. }
  82534. if (!function_exists('mb_check_encoding')) {
  82535. function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
  82536. }
  82537. if (!function_exists('mb_detect_encoding')) {
  82538. function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); }
  82539. }
  82540. if (!function_exists('mb_detect_order')) {
  82541. function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
  82542. }
  82543. if (!function_exists('mb_parse_str')) {
  82544. function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; }
  82545. }
  82546. if (!function_exists('mb_strlen')) {
  82547. function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); }
  82548. }
  82549. if (!function_exists('mb_strpos')) {
  82550. function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  82551. }
  82552. if (!function_exists('mb_strtolower')) {
  82553. function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
  82554. }
  82555. if (!function_exists('mb_strtoupper')) {
  82556. function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
  82557. }
  82558. if (!function_exists('mb_substitute_character')) {
  82559. function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
  82560. }
  82561. if (!function_exists('mb_substr')) {
  82562. function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); }
  82563. }
  82564. if (!function_exists('mb_stripos')) {
  82565. function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  82566. }
  82567. if (!function_exists('mb_stristr')) {
  82568. function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  82569. }
  82570. if (!function_exists('mb_strrchr')) {
  82571. function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  82572. }
  82573. if (!function_exists('mb_strrichr')) {
  82574. function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  82575. }
  82576. if (!function_exists('mb_strripos')) {
  82577. function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  82578. }
  82579. if (!function_exists('mb_strrpos')) {
  82580. function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  82581. }
  82582. if (!function_exists('mb_strstr')) {
  82583. function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  82584. }
  82585. if (!function_exists('mb_get_info')) {
  82586. function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); }
  82587. }
  82588. if (!function_exists('mb_http_output')) {
  82589. function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
  82590. }
  82591. if (!function_exists('mb_strwidth')) {
  82592. function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
  82593. }
  82594. if (!function_exists('mb_substr_count')) {
  82595. function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
  82596. }
  82597. if (!function_exists('mb_output_handler')) {
  82598. function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
  82599. }
  82600. if (!function_exists('mb_http_input')) {
  82601. function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
  82602. }
  82603. if (!function_exists('mb_convert_variables')) {
  82604. function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); }
  82605. }
  82606. if (!function_exists('mb_ord')) {
  82607. function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); }
  82608. }
  82609. if (!function_exists('mb_chr')) {
  82610. function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
  82611. }
  82612. if (!function_exists('mb_scrub')) {
  82613. function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
  82614. }
  82615. if (!function_exists('mb_str_split')) {
  82616. function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
  82617. }
  82618. if (!function_exists('mb_str_pad')) {
  82619. function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
  82620. }
  82621. if (extension_loaded('mbstring')) {
  82622. return;
  82623. }
  82624. if (!defined('MB_CASE_UPPER')) {
  82625. define('MB_CASE_UPPER', 0);
  82626. }
  82627. if (!defined('MB_CASE_LOWER')) {
  82628. define('MB_CASE_LOWER', 1);
  82629. }
  82630. if (!defined('MB_CASE_TITLE')) {
  82631. define('MB_CASE_TITLE', 2);
  82632. }
  82633. Copyright (c) 2018-present Fabien Potencier
  82634. Permission is hereby granted, free of charge, to any person obtaining a copy
  82635. of this software and associated documentation files (the "Software"), to deal
  82636. in the Software without restriction, including without limitation the rights
  82637. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  82638. copies of the Software, and to permit persons to whom the Software is furnished
  82639. to do so, subject to the following conditions:
  82640. The above copyright notice and this permission notice shall be included in all
  82641. copies or substantial portions of the Software.
  82642. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  82643. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  82644. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  82645. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  82646. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  82647. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  82648. THE SOFTWARE.
  82649. <?php
  82650. namespace Symfony\Polyfill\Php73;
  82651. final class Php73
  82652. {
  82653. public static $startAt = 1533462603;
  82654. public static function hrtime($asNum = false)
  82655. {
  82656. $ns = microtime(false);
  82657. $s = substr($ns, 11) - self::$startAt;
  82658. $ns = 1E9 * (float) $ns;
  82659. if ($asNum) {
  82660. $ns += $s * 1E9;
  82661. return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
  82662. }
  82663. return [$s, (int) $ns];
  82664. }
  82665. }
  82666. <?php
  82667. if (\PHP_VERSION_ID < 70300) {
  82668. class JsonException extends Exception
  82669. {
  82670. }
  82671. }
  82672. <?php
  82673. use Symfony\Polyfill\Php73 as p;
  82674. if (\PHP_VERSION_ID >= 70300) {
  82675. return;
  82676. }
  82677. if (!function_exists('is_countable')) {
  82678. function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
  82679. }
  82680. if (!function_exists('hrtime')) {
  82681. require_once __DIR__.'/Php73.php';
  82682. p\Php73::$startAt = (int) microtime(true);
  82683. function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
  82684. }
  82685. if (!function_exists('array_key_first')) {
  82686. function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
  82687. }
  82688. if (!function_exists('array_key_last')) {
  82689. function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
  82690. }
  82691. Copyright (c) 2020-present Fabien Potencier
  82692. Permission is hereby granted, free of charge, to any person obtaining a copy
  82693. of this software and associated documentation files (the "Software"), to deal
  82694. in the Software without restriction, including without limitation the rights
  82695. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  82696. copies of the Software, and to permit persons to whom the Software is furnished
  82697. to do so, subject to the following conditions:
  82698. The above copyright notice and this permission notice shall be included in all
  82699. copies or substantial portions of the Software.
  82700. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  82701. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  82702. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  82703. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  82704. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  82705. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  82706. THE SOFTWARE.
  82707. <?php
  82708. namespace Symfony\Polyfill\Php80;
  82709. final class Php80
  82710. {
  82711. public static function fdiv(float $dividend, float $divisor): float
  82712. {
  82713. return @($dividend / $divisor);
  82714. }
  82715. public static function get_debug_type($value): string
  82716. {
  82717. switch (true) {
  82718. case null === $value: return 'null';
  82719. case \is_bool($value): return 'bool';
  82720. case \is_string($value): return 'string';
  82721. case \is_array($value): return 'array';
  82722. case \is_int($value): return 'int';
  82723. case \is_float($value): return 'float';
  82724. case \is_object($value): break;
  82725. case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
  82726. default:
  82727. if (null === $type = @get_resource_type($value)) {
  82728. return 'unknown';
  82729. }
  82730. if ('Unknown' === $type) {
  82731. $type = 'closed';
  82732. }
  82733. return "resource ($type)";
  82734. }
  82735. $class = \get_class($value);
  82736. if (false === strpos($class, '@')) {
  82737. return $class;
  82738. }
  82739. return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
  82740. }
  82741. public static function get_resource_id($res): int
  82742. {
  82743. if (!\is_resource($res) && null === @get_resource_type($res)) {
  82744. throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
  82745. }
  82746. return (int) $res;
  82747. }
  82748. public static function preg_last_error_msg(): string
  82749. {
  82750. switch (preg_last_error()) {
  82751. case \PREG_INTERNAL_ERROR:
  82752. return 'Internal error';
  82753. case \PREG_BAD_UTF8_ERROR:
  82754. return 'Malformed UTF-8 characters, possibly incorrectly encoded';
  82755. case \PREG_BAD_UTF8_OFFSET_ERROR:
  82756. return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
  82757. case \PREG_BACKTRACK_LIMIT_ERROR:
  82758. return 'Backtrack limit exhausted';
  82759. case \PREG_RECURSION_LIMIT_ERROR:
  82760. return 'Recursion limit exhausted';
  82761. case \PREG_JIT_STACKLIMIT_ERROR:
  82762. return 'JIT stack limit exhausted';
  82763. case \PREG_NO_ERROR:
  82764. return 'No error';
  82765. default:
  82766. return 'Unknown error';
  82767. }
  82768. }
  82769. public static function str_contains(string $haystack, string $needle): bool
  82770. {
  82771. return '' === $needle || false !== strpos($haystack, $needle);
  82772. }
  82773. public static function str_starts_with(string $haystack, string $needle): bool
  82774. {
  82775. return 0 === strncmp($haystack, $needle, \strlen($needle));
  82776. }
  82777. public static function str_ends_with(string $haystack, string $needle): bool
  82778. {
  82779. if ('' === $needle || $needle === $haystack) {
  82780. return true;
  82781. }
  82782. if ('' === $haystack) {
  82783. return false;
  82784. }
  82785. $needleLength = \strlen($needle);
  82786. return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
  82787. }
  82788. }
  82789. <?php
  82790. namespace Symfony\Polyfill\Php80;
  82791. class PhpToken implements \Stringable
  82792. {
  82793. public $id;
  82794. public $text;
  82795. public $line;
  82796. public $pos;
  82797. public function __construct(int $id, string $text, int $line = -1, int $position = -1)
  82798. {
  82799. $this->id = $id;
  82800. $this->text = $text;
  82801. $this->line = $line;
  82802. $this->pos = $position;
  82803. }
  82804. public function getTokenName(): ?string
  82805. {
  82806. if ('UNKNOWN' === $name = token_name($this->id)) {
  82807. $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
  82808. }
  82809. return $name;
  82810. }
  82811. public function is($kind): bool
  82812. {
  82813. foreach ((array) $kind as $value) {
  82814. if (\in_array($value, [$this->id, $this->text], true)) {
  82815. return true;
  82816. }
  82817. }
  82818. return false;
  82819. }
  82820. public function isIgnorable(): bool
  82821. {
  82822. return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
  82823. }
  82824. public function __toString(): string
  82825. {
  82826. return (string) $this->text;
  82827. }
  82828. public static function tokenize(string $code, int $flags = 0): array
  82829. {
  82830. $line = 1;
  82831. $position = 0;
  82832. $tokens = token_get_all($code, $flags);
  82833. foreach ($tokens as $index => $token) {
  82834. if (\is_string($token)) {
  82835. $id = \ord($token);
  82836. $text = $token;
  82837. } else {
  82838. [$id, $text, $line] = $token;
  82839. }
  82840. $tokens[$index] = new static($id, $text, $line, $position);
  82841. $position += \strlen($text);
  82842. }
  82843. return $tokens;
  82844. }
  82845. }
  82846. <?php
  82847. #[Attribute(Attribute::TARGET_CLASS)]
  82848. final class Attribute
  82849. {
  82850. public const TARGET_CLASS = 1;
  82851. public const TARGET_FUNCTION = 2;
  82852. public const TARGET_METHOD = 4;
  82853. public const TARGET_PROPERTY = 8;
  82854. public const TARGET_CLASS_CONSTANT = 16;
  82855. public const TARGET_PARAMETER = 32;
  82856. public const TARGET_ALL = 63;
  82857. public const IS_REPEATABLE = 64;
  82858. public $flags;
  82859. public function __construct(int $flags = self::TARGET_ALL)
  82860. {
  82861. $this->flags = $flags;
  82862. }
  82863. }
  82864. <?php
  82865. if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) {
  82866. class PhpToken extends Symfony\Polyfill\Php80\PhpToken
  82867. {
  82868. }
  82869. }
  82870. <?php
  82871. if (\PHP_VERSION_ID < 80000) {
  82872. interface Stringable
  82873. {
  82874. public function __toString();
  82875. }
  82876. }
  82877. <?php
  82878. if (\PHP_VERSION_ID < 80000) {
  82879. class UnhandledMatchError extends Error
  82880. {
  82881. }
  82882. }
  82883. <?php
  82884. if (\PHP_VERSION_ID < 80000) {
  82885. class ValueError extends Error
  82886. {
  82887. }
  82888. }
  82889. <?php
  82890. use Symfony\Polyfill\Php80 as p;
  82891. if (\PHP_VERSION_ID >= 80000) {
  82892. return;
  82893. }
  82894. if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
  82895. define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
  82896. }
  82897. if (!function_exists('fdiv')) {
  82898. function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
  82899. }
  82900. if (!function_exists('preg_last_error_msg')) {
  82901. function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
  82902. }
  82903. if (!function_exists('str_contains')) {
  82904. function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
  82905. }
  82906. if (!function_exists('str_starts_with')) {
  82907. function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
  82908. }
  82909. if (!function_exists('str_ends_with')) {
  82910. function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
  82911. }
  82912. if (!function_exists('get_debug_type')) {
  82913. function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
  82914. }
  82915. if (!function_exists('get_resource_id')) {
  82916. function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
  82917. }
  82918. Copyright (c) 2021-present Fabien Potencier
  82919. Permission is hereby granted, free of charge, to any person obtaining a copy
  82920. of this software and associated documentation files (the "Software"), to deal
  82921. in the Software without restriction, including without limitation the rights
  82922. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  82923. copies of the Software, and to permit persons to whom the Software is furnished
  82924. to do so, subject to the following conditions:
  82925. The above copyright notice and this permission notice shall be included in all
  82926. copies or substantial portions of the Software.
  82927. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  82928. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  82929. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  82930. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  82931. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  82932. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  82933. THE SOFTWARE.
  82934. <?php
  82935. namespace Symfony\Polyfill\Php81;
  82936. final class Php81
  82937. {
  82938. public static function array_is_list(array $array): bool
  82939. {
  82940. if ([] === $array || $array === array_values($array)) {
  82941. return true;
  82942. }
  82943. $nextKey = -1;
  82944. foreach ($array as $k => $v) {
  82945. if ($k !== ++$nextKey) {
  82946. return false;
  82947. }
  82948. }
  82949. return true;
  82950. }
  82951. }
  82952. <?php
  82953. if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) {
  82954. class CURLStringFile extends CURLFile
  82955. {
  82956. private $data;
  82957. public function __construct(string $data, string $postname, string $mime = 'application/octet-stream')
  82958. {
  82959. $this->data = $data;
  82960. parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname);
  82961. }
  82962. public function __set(string $name, $value): void
  82963. {
  82964. if ('data' !== $name) {
  82965. $this->$name = $value;
  82966. return;
  82967. }
  82968. if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) {
  82969. throw new \TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string');
  82970. }
  82971. $this->name = 'data://application/octet-stream;base64,'.base64_encode($value);
  82972. }
  82973. public function __isset(string $name): bool
  82974. {
  82975. return isset($this->$name);
  82976. }
  82977. public function &__get(string $name)
  82978. {
  82979. return $this->$name;
  82980. }
  82981. }
  82982. }
  82983. <?php
  82984. if (\PHP_VERSION_ID < 80100) {
  82985. #[Attribute(Attribute::TARGET_METHOD)]
  82986. final class ReturnTypeWillChange
  82987. {
  82988. public function __construct()
  82989. {
  82990. }
  82991. }
  82992. }
  82993. <?php
  82994. use Symfony\Polyfill\Php81 as p;
  82995. if (\PHP_VERSION_ID >= 80100) {
  82996. return;
  82997. }
  82998. if (defined('MYSQLI_REFRESH_SLAVE') && !defined('MYSQLI_REFRESH_REPLICA')) {
  82999. define('MYSQLI_REFRESH_REPLICA', 64);
  83000. }
  83001. if (!function_exists('array_is_list')) {
  83002. function array_is_list(array $array): bool { return p\Php81::array_is_list($array); }
  83003. }
  83004. if (!function_exists('enum_exists')) {
  83005. function enum_exists(string $enum, bool $autoload = true): bool { return $autoload && class_exists($enum) && false; }
  83006. }
  83007. <?php
  83008. namespace Symfony\Component\Process\Exception;
  83009. interface ExceptionInterface extends \Throwable
  83010. {
  83011. }
  83012. <?php
  83013. namespace Symfony\Component\Process\Exception;
  83014. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  83015. {
  83016. }
  83017. <?php
  83018. namespace Symfony\Component\Process\Exception;
  83019. class LogicException extends \LogicException implements ExceptionInterface
  83020. {
  83021. }
  83022. <?php
  83023. namespace Symfony\Component\Process\Exception;
  83024. use Symfony\Component\Process\Process;
  83025. class ProcessFailedException extends RuntimeException
  83026. {
  83027. private $process;
  83028. public function __construct(Process $process)
  83029. {
  83030. if ($process->isSuccessful()) {
  83031. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  83032. }
  83033. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  83034. $process->getCommandLine(),
  83035. $process->getExitCode(),
  83036. $process->getExitCodeText(),
  83037. $process->getWorkingDirectory()
  83038. );
  83039. if (!$process->isOutputDisabled()) {
  83040. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  83041. $process->getOutput(),
  83042. $process->getErrorOutput()
  83043. );
  83044. }
  83045. parent::__construct($error);
  83046. $this->process = $process;
  83047. }
  83048. public function getProcess()
  83049. {
  83050. return $this->process;
  83051. }
  83052. }
  83053. <?php
  83054. namespace Symfony\Component\Process\Exception;
  83055. use Symfony\Component\Process\Process;
  83056. final class ProcessSignaledException extends RuntimeException
  83057. {
  83058. private $process;
  83059. public function __construct(Process $process)
  83060. {
  83061. $this->process = $process;
  83062. parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
  83063. }
  83064. public function getProcess(): Process
  83065. {
  83066. return $this->process;
  83067. }
  83068. public function getSignal(): int
  83069. {
  83070. return $this->getProcess()->getTermSignal();
  83071. }
  83072. }
  83073. <?php
  83074. namespace Symfony\Component\Process\Exception;
  83075. use Symfony\Component\Process\Process;
  83076. class ProcessTimedOutException extends RuntimeException
  83077. {
  83078. public const TYPE_GENERAL = 1;
  83079. public const TYPE_IDLE = 2;
  83080. private $process;
  83081. private $timeoutType;
  83082. public function __construct(Process $process, int $timeoutType)
  83083. {
  83084. $this->process = $process;
  83085. $this->timeoutType = $timeoutType;
  83086. parent::__construct(sprintf(
  83087. 'The process "%s" exceeded the timeout of %s seconds.',
  83088. $process->getCommandLine(),
  83089. $this->getExceededTimeout()
  83090. ));
  83091. }
  83092. public function getProcess()
  83093. {
  83094. return $this->process;
  83095. }
  83096. public function isGeneralTimeout()
  83097. {
  83098. return self::TYPE_GENERAL === $this->timeoutType;
  83099. }
  83100. public function isIdleTimeout()
  83101. {
  83102. return self::TYPE_IDLE === $this->timeoutType;
  83103. }
  83104. public function getExceededTimeout()
  83105. {
  83106. switch ($this->timeoutType) {
  83107. case self::TYPE_GENERAL:
  83108. return $this->process->getTimeout();
  83109. case self::TYPE_IDLE:
  83110. return $this->process->getIdleTimeout();
  83111. default:
  83112. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  83113. }
  83114. }
  83115. }
  83116. <?php
  83117. namespace Symfony\Component\Process\Exception;
  83118. class RuntimeException extends \RuntimeException implements ExceptionInterface
  83119. {
  83120. }
  83121. <?php
  83122. namespace Symfony\Component\Process;
  83123. class ExecutableFinder
  83124. {
  83125. private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
  83126. public function setSuffixes(array $suffixes)
  83127. {
  83128. $this->suffixes = $suffixes;
  83129. }
  83130. public function addSuffix(string $suffix)
  83131. {
  83132. $this->suffixes[] = $suffix;
  83133. }
  83134. public function find(string $name, ?string $default = null, array $extraDirs = [])
  83135. {
  83136. if (\ini_get('open_basedir')) {
  83137. $searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);
  83138. $dirs = [];
  83139. foreach ($searchPath as $path) {
  83140. if (@is_dir($path)) {
  83141. $dirs[] = $path;
  83142. } else {
  83143. if (basename($path) == $name && @is_executable($path)) {
  83144. return $path;
  83145. }
  83146. }
  83147. }
  83148. } else {
  83149. $dirs = array_merge(
  83150. explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  83151. $extraDirs
  83152. );
  83153. }
  83154. $suffixes = [''];
  83155. if ('\\' === \DIRECTORY_SEPARATOR) {
  83156. $pathExt = getenv('PATHEXT');
  83157. $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  83158. }
  83159. foreach ($suffixes as $suffix) {
  83160. foreach ($dirs as $dir) {
  83161. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  83162. return $file;
  83163. }
  83164. }
  83165. }
  83166. return $default;
  83167. }
  83168. }
  83169. <?php
  83170. namespace Symfony\Component\Process;
  83171. use Symfony\Component\Process\Exception\RuntimeException;
  83172. class InputStream implements \IteratorAggregate
  83173. {
  83174. private $onEmpty = null;
  83175. private $input = [];
  83176. private $open = true;
  83177. public function onEmpty(?callable $onEmpty = null)
  83178. {
  83179. $this->onEmpty = $onEmpty;
  83180. }
  83181. public function write($input)
  83182. {
  83183. if (null === $input) {
  83184. return;
  83185. }
  83186. if ($this->isClosed()) {
  83187. throw new RuntimeException(sprintf('"%s" is closed.', static::class));
  83188. }
  83189. $this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
  83190. }
  83191. public function close()
  83192. {
  83193. $this->open = false;
  83194. }
  83195. public function isClosed()
  83196. {
  83197. return !$this->open;
  83198. }
  83199. #[\ReturnTypeWillChange]
  83200. public function getIterator()
  83201. {
  83202. $this->open = true;
  83203. while ($this->open || $this->input) {
  83204. if (!$this->input) {
  83205. yield '';
  83206. continue;
  83207. }
  83208. $current = array_shift($this->input);
  83209. if ($current instanceof \Iterator) {
  83210. yield from $current;
  83211. } else {
  83212. yield $current;
  83213. }
  83214. if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) {
  83215. $this->write($onEmpty($this));
  83216. }
  83217. }
  83218. }
  83219. }
  83220. Copyright (c) 2004-present Fabien Potencier
  83221. Permission is hereby granted, free of charge, to any person obtaining a copy
  83222. of this software and associated documentation files (the "Software"), to deal
  83223. in the Software without restriction, including without limitation the rights
  83224. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  83225. copies of the Software, and to permit persons to whom the Software is furnished
  83226. to do so, subject to the following conditions:
  83227. The above copyright notice and this permission notice shall be included in all
  83228. copies or substantial portions of the Software.
  83229. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  83230. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  83231. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  83232. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  83233. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  83234. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  83235. THE SOFTWARE.
  83236. <?php
  83237. namespace Symfony\Component\Process;
  83238. class PhpExecutableFinder
  83239. {
  83240. private $executableFinder;
  83241. public function __construct()
  83242. {
  83243. $this->executableFinder = new ExecutableFinder();
  83244. }
  83245. public function find(bool $includeArgs = true)
  83246. {
  83247. if ($php = getenv('PHP_BINARY')) {
  83248. if (!is_executable($php)) {
  83249. $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --';
  83250. if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
  83251. if (!is_executable($php)) {
  83252. return false;
  83253. }
  83254. } else {
  83255. return false;
  83256. }
  83257. }
  83258. if (@is_dir($php)) {
  83259. return false;
  83260. }
  83261. return $php;
  83262. }
  83263. $args = $this->findArguments();
  83264. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  83265. if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) {
  83266. return \PHP_BINARY.$args;
  83267. }
  83268. if ($php = getenv('PHP_PATH')) {
  83269. if (!@is_executable($php) || @is_dir($php)) {
  83270. return false;
  83271. }
  83272. return $php;
  83273. }
  83274. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  83275. if (@is_executable($php) && !@is_dir($php)) {
  83276. return $php;
  83277. }
  83278. }
  83279. if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php')) && !@is_dir($php)) {
  83280. return $php;
  83281. }
  83282. $dirs = [\PHP_BINDIR];
  83283. if ('\\' === \DIRECTORY_SEPARATOR) {
  83284. $dirs[] = 'C:\xampp\php\\';
  83285. }
  83286. return $this->executableFinder->find('php', false, $dirs);
  83287. }
  83288. public function findArguments()
  83289. {
  83290. $arguments = [];
  83291. if ('phpdbg' === \PHP_SAPI) {
  83292. $arguments[] = '-qrr';
  83293. }
  83294. return $arguments;
  83295. }
  83296. }
  83297. <?php
  83298. namespace Symfony\Component\Process;
  83299. use Symfony\Component\Process\Exception\LogicException;
  83300. use Symfony\Component\Process\Exception\RuntimeException;
  83301. class PhpProcess extends Process
  83302. {
  83303. public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
  83304. {
  83305. if (null === $php) {
  83306. $executableFinder = new PhpExecutableFinder();
  83307. $php = $executableFinder->find(false);
  83308. $php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
  83309. }
  83310. if ('phpdbg' === \PHP_SAPI) {
  83311. $file = tempnam(sys_get_temp_dir(), 'dbg');
  83312. file_put_contents($file, $script);
  83313. register_shutdown_function('unlink', $file);
  83314. $php[] = $file;
  83315. $script = null;
  83316. }
  83317. parent::__construct($php, $cwd, $env, $script, $timeout);
  83318. }
  83319. public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
  83320. {
  83321. throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
  83322. }
  83323. public function start(?callable $callback = null, array $env = [])
  83324. {
  83325. if (null === $this->getCommandLine()) {
  83326. throw new RuntimeException('Unable to find the PHP executable.');
  83327. }
  83328. parent::start($callback, $env);
  83329. }
  83330. }
  83331. <?php
  83332. namespace Symfony\Component\Process\Pipes;
  83333. use Symfony\Component\Process\Exception\InvalidArgumentException;
  83334. abstract class AbstractPipes implements PipesInterface
  83335. {
  83336. public $pipes = [];
  83337. private $inputBuffer = '';
  83338. private $input;
  83339. private $blocked = true;
  83340. private $lastError;
  83341. public function __construct($input)
  83342. {
  83343. if (\is_resource($input) || $input instanceof \Iterator) {
  83344. $this->input = $input;
  83345. } elseif (\is_string($input)) {
  83346. $this->inputBuffer = $input;
  83347. } else {
  83348. $this->inputBuffer = (string) $input;
  83349. }
  83350. }
  83351. public function close()
  83352. {
  83353. foreach ($this->pipes as $pipe) {
  83354. if (\is_resource($pipe)) {
  83355. fclose($pipe);
  83356. }
  83357. }
  83358. $this->pipes = [];
  83359. }
  83360. protected function hasSystemCallBeenInterrupted(): bool
  83361. {
  83362. $lastError = $this->lastError;
  83363. $this->lastError = null;
  83364. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  83365. }
  83366. protected function unblock()
  83367. {
  83368. if (!$this->blocked) {
  83369. return;
  83370. }
  83371. foreach ($this->pipes as $pipe) {
  83372. stream_set_blocking($pipe, 0);
  83373. }
  83374. if (\is_resource($this->input)) {
  83375. stream_set_blocking($this->input, 0);
  83376. }
  83377. $this->blocked = false;
  83378. }
  83379. protected function write(): ?array
  83380. {
  83381. if (!isset($this->pipes[0])) {
  83382. return null;
  83383. }
  83384. $input = $this->input;
  83385. if ($input instanceof \Iterator) {
  83386. if (!$input->valid()) {
  83387. $input = null;
  83388. } elseif (\is_resource($input = $input->current())) {
  83389. stream_set_blocking($input, 0);
  83390. } elseif (!isset($this->inputBuffer[0])) {
  83391. if (!\is_string($input)) {
  83392. if (!\is_scalar($input)) {
  83393. throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
  83394. }
  83395. $input = (string) $input;
  83396. }
  83397. $this->inputBuffer = $input;
  83398. $this->input->next();
  83399. $input = null;
  83400. } else {
  83401. $input = null;
  83402. }
  83403. }
  83404. $r = $e = [];
  83405. $w = [$this->pipes[0]];
  83406. if (false === @stream_select($r, $w, $e, 0, 0)) {
  83407. return null;
  83408. }
  83409. foreach ($w as $stdin) {
  83410. if (isset($this->inputBuffer[0])) {
  83411. $written = fwrite($stdin, $this->inputBuffer);
  83412. $this->inputBuffer = substr($this->inputBuffer, $written);
  83413. if (isset($this->inputBuffer[0])) {
  83414. return [$this->pipes[0]];
  83415. }
  83416. }
  83417. if ($input) {
  83418. while (true) {
  83419. $data = fread($input, self::CHUNK_SIZE);
  83420. if (!isset($data[0])) {
  83421. break;
  83422. }
  83423. $written = fwrite($stdin, $data);
  83424. $data = substr($data, $written);
  83425. if (isset($data[0])) {
  83426. $this->inputBuffer = $data;
  83427. return [$this->pipes[0]];
  83428. }
  83429. }
  83430. if (feof($input)) {
  83431. if ($this->input instanceof \Iterator) {
  83432. $this->input->next();
  83433. } else {
  83434. $this->input = null;
  83435. }
  83436. }
  83437. }
  83438. }
  83439. if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
  83440. $this->input = null;
  83441. fclose($this->pipes[0]);
  83442. unset($this->pipes[0]);
  83443. } elseif (!$w) {
  83444. return [$this->pipes[0]];
  83445. }
  83446. return null;
  83447. }
  83448. public function handleError(int $type, string $msg)
  83449. {
  83450. $this->lastError = $msg;
  83451. }
  83452. }
  83453. <?php
  83454. namespace Symfony\Component\Process\Pipes;
  83455. interface PipesInterface
  83456. {
  83457. public const CHUNK_SIZE = 16384;
  83458. public function getDescriptors(): array;
  83459. public function getFiles(): array;
  83460. public function readAndWrite(bool $blocking, bool $close = false): array;
  83461. public function areOpen(): bool;
  83462. public function haveReadSupport(): bool;
  83463. public function close();
  83464. }
  83465. <?php
  83466. namespace Symfony\Component\Process\Pipes;
  83467. use Symfony\Component\Process\Process;
  83468. class UnixPipes extends AbstractPipes
  83469. {
  83470. private $ttyMode;
  83471. private $ptyMode;
  83472. private $haveReadSupport;
  83473. public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport)
  83474. {
  83475. $this->ttyMode = $ttyMode;
  83476. $this->ptyMode = $ptyMode;
  83477. $this->haveReadSupport = $haveReadSupport;
  83478. parent::__construct($input);
  83479. }
  83480. public function __sleep(): array
  83481. {
  83482. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  83483. }
  83484. public function __wakeup()
  83485. {
  83486. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  83487. }
  83488. public function __destruct()
  83489. {
  83490. $this->close();
  83491. }
  83492. public function getDescriptors(): array
  83493. {
  83494. if (!$this->haveReadSupport) {
  83495. $nullstream = fopen('/dev/null', 'c');
  83496. return [
  83497. ['pipe', 'r'],
  83498. $nullstream,
  83499. $nullstream,
  83500. ];
  83501. }
  83502. if ($this->ttyMode) {
  83503. return [
  83504. ['file', '/dev/tty', 'r'],
  83505. ['file', '/dev/tty', 'w'],
  83506. ['file', '/dev/tty', 'w'],
  83507. ];
  83508. }
  83509. if ($this->ptyMode && Process::isPtySupported()) {
  83510. return [
  83511. ['pty'],
  83512. ['pty'],
  83513. ['pty'],
  83514. ];
  83515. }
  83516. return [
  83517. ['pipe', 'r'],
  83518. ['pipe', 'w'],
  83519. ['pipe', 'w'],
  83520. ];
  83521. }
  83522. public function getFiles(): array
  83523. {
  83524. return [];
  83525. }
  83526. public function readAndWrite(bool $blocking, bool $close = false): array
  83527. {
  83528. $this->unblock();
  83529. $w = $this->write();
  83530. $read = $e = [];
  83531. $r = $this->pipes;
  83532. unset($r[0]);
  83533. set_error_handler([$this, 'handleError']);
  83534. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  83535. restore_error_handler();
  83536. if (!$this->hasSystemCallBeenInterrupted()) {
  83537. $this->pipes = [];
  83538. }
  83539. return $read;
  83540. }
  83541. restore_error_handler();
  83542. foreach ($r as $pipe) {
  83543. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  83544. do {
  83545. $data = @fread($pipe, self::CHUNK_SIZE);
  83546. $read[$type] .= $data;
  83547. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  83548. if (!isset($read[$type][0])) {
  83549. unset($read[$type]);
  83550. }
  83551. if ($close && feof($pipe)) {
  83552. fclose($pipe);
  83553. unset($this->pipes[$type]);
  83554. }
  83555. }
  83556. return $read;
  83557. }
  83558. public function haveReadSupport(): bool
  83559. {
  83560. return $this->haveReadSupport;
  83561. }
  83562. public function areOpen(): bool
  83563. {
  83564. return (bool) $this->pipes;
  83565. }
  83566. }
  83567. <?php
  83568. namespace Symfony\Component\Process\Pipes;
  83569. use Symfony\Component\Process\Exception\RuntimeException;
  83570. use Symfony\Component\Process\Process;
  83571. class WindowsPipes extends AbstractPipes
  83572. {
  83573. private $files = [];
  83574. private $fileHandles = [];
  83575. private $lockHandles = [];
  83576. private $readBytes = [
  83577. Process::STDOUT => 0,
  83578. Process::STDERR => 0,
  83579. ];
  83580. private $haveReadSupport;
  83581. public function __construct($input, bool $haveReadSupport)
  83582. {
  83583. $this->haveReadSupport = $haveReadSupport;
  83584. if ($this->haveReadSupport) {
  83585. $pipes = [
  83586. Process::STDOUT => Process::OUT,
  83587. Process::STDERR => Process::ERR,
  83588. ];
  83589. $tmpDir = sys_get_temp_dir();
  83590. $lastError = 'unknown reason';
  83591. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  83592. for ($i = 0;; ++$i) {
  83593. foreach ($pipes as $pipe => $name) {
  83594. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  83595. if (!$h = fopen($file.'.lock', 'w')) {
  83596. if (file_exists($file.'.lock')) {
  83597. continue 2;
  83598. }
  83599. restore_error_handler();
  83600. throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
  83601. }
  83602. if (!flock($h, \LOCK_EX | \LOCK_NB)) {
  83603. continue 2;
  83604. }
  83605. if (isset($this->lockHandles[$pipe])) {
  83606. flock($this->lockHandles[$pipe], \LOCK_UN);
  83607. fclose($this->lockHandles[$pipe]);
  83608. }
  83609. $this->lockHandles[$pipe] = $h;
  83610. if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
  83611. flock($this->lockHandles[$pipe], \LOCK_UN);
  83612. fclose($this->lockHandles[$pipe]);
  83613. unset($this->lockHandles[$pipe]);
  83614. continue 2;
  83615. }
  83616. $this->fileHandles[$pipe] = $h;
  83617. $this->files[$pipe] = $file;
  83618. }
  83619. break;
  83620. }
  83621. restore_error_handler();
  83622. }
  83623. parent::__construct($input);
  83624. }
  83625. public function __sleep(): array
  83626. {
  83627. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  83628. }
  83629. public function __wakeup()
  83630. {
  83631. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  83632. }
  83633. public function __destruct()
  83634. {
  83635. $this->close();
  83636. }
  83637. public function getDescriptors(): array
  83638. {
  83639. if (!$this->haveReadSupport) {
  83640. $nullstream = fopen('NUL', 'c');
  83641. return [
  83642. ['pipe', 'r'],
  83643. $nullstream,
  83644. $nullstream,
  83645. ];
  83646. }
  83647. return [
  83648. ['pipe', 'r'],
  83649. ['file', 'NUL', 'w'],
  83650. ['file', 'NUL', 'w'],
  83651. ];
  83652. }
  83653. public function getFiles(): array
  83654. {
  83655. return $this->files;
  83656. }
  83657. public function readAndWrite(bool $blocking, bool $close = false): array
  83658. {
  83659. $this->unblock();
  83660. $w = $this->write();
  83661. $read = $r = $e = [];
  83662. if ($blocking) {
  83663. if ($w) {
  83664. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  83665. } elseif ($this->fileHandles) {
  83666. usleep((int) (Process::TIMEOUT_PRECISION * 1E6));
  83667. }
  83668. }
  83669. foreach ($this->fileHandles as $type => $fileHandle) {
  83670. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  83671. if (isset($data[0])) {
  83672. $this->readBytes[$type] += \strlen($data);
  83673. $read[$type] = $data;
  83674. }
  83675. if ($close) {
  83676. ftruncate($fileHandle, 0);
  83677. fclose($fileHandle);
  83678. flock($this->lockHandles[$type], \LOCK_UN);
  83679. fclose($this->lockHandles[$type]);
  83680. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  83681. }
  83682. }
  83683. return $read;
  83684. }
  83685. public function haveReadSupport(): bool
  83686. {
  83687. return $this->haveReadSupport;
  83688. }
  83689. public function areOpen(): bool
  83690. {
  83691. return $this->pipes && $this->fileHandles;
  83692. }
  83693. public function close()
  83694. {
  83695. parent::close();
  83696. foreach ($this->fileHandles as $type => $handle) {
  83697. ftruncate($handle, 0);
  83698. fclose($handle);
  83699. flock($this->lockHandles[$type], \LOCK_UN);
  83700. fclose($this->lockHandles[$type]);
  83701. }
  83702. $this->fileHandles = $this->lockHandles = [];
  83703. }
  83704. }
  83705. <?php
  83706. namespace Symfony\Component\Process;
  83707. use Symfony\Component\Process\Exception\InvalidArgumentException;
  83708. use Symfony\Component\Process\Exception\LogicException;
  83709. use Symfony\Component\Process\Exception\ProcessFailedException;
  83710. use Symfony\Component\Process\Exception\ProcessSignaledException;
  83711. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  83712. use Symfony\Component\Process\Exception\RuntimeException;
  83713. use Symfony\Component\Process\Pipes\PipesInterface;
  83714. use Symfony\Component\Process\Pipes\UnixPipes;
  83715. use Symfony\Component\Process\Pipes\WindowsPipes;
  83716. class Process implements \IteratorAggregate
  83717. {
  83718. public const ERR = 'err';
  83719. public const OUT = 'out';
  83720. public const STATUS_READY = 'ready';
  83721. public const STATUS_STARTED = 'started';
  83722. public const STATUS_TERMINATED = 'terminated';
  83723. public const STDIN = 0;
  83724. public const STDOUT = 1;
  83725. public const STDERR = 2;
  83726. public const TIMEOUT_PRECISION = 0.2;
  83727. public const ITER_NON_BLOCKING = 1;
  83728. public const ITER_KEEP_OUTPUT = 2;
  83729. public const ITER_SKIP_OUT = 4;
  83730. public const ITER_SKIP_ERR = 8;
  83731. private $callback;
  83732. private $hasCallback = false;
  83733. private $commandline;
  83734. private $cwd;
  83735. private $env = [];
  83736. private $input;
  83737. private $starttime;
  83738. private $lastOutputTime;
  83739. private $timeout;
  83740. private $idleTimeout;
  83741. private $exitcode;
  83742. private $fallbackStatus = [];
  83743. private $processInformation;
  83744. private $outputDisabled = false;
  83745. private $stdout;
  83746. private $stderr;
  83747. private $process;
  83748. private $status = self::STATUS_READY;
  83749. private $incrementalOutputOffset = 0;
  83750. private $incrementalErrorOutputOffset = 0;
  83751. private $tty = false;
  83752. private $pty;
  83753. private $options = ['suppress_errors' => true, 'bypass_shell' => true];
  83754. private $useFileHandles = false;
  83755. private $processPipes;
  83756. private $latestSignal;
  83757. private static $sigchild;
  83758. public static $exitCodes = [
  83759. 0 => 'OK',
  83760. 1 => 'General error',
  83761. 2 => 'Misuse of shell builtins',
  83762. 126 => 'Invoked command cannot execute',
  83763. 127 => 'Command not found',
  83764. 128 => 'Invalid exit argument',
  83765. 129 => 'Hangup',
  83766. 130 => 'Interrupt',
  83767. 131 => 'Quit and dump core',
  83768. 132 => 'Illegal instruction',
  83769. 133 => 'Trace/breakpoint trap',
  83770. 134 => 'Process aborted',
  83771. 135 => 'Bus error: "access to undefined portion of memory object"',
  83772. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  83773. 137 => 'Kill (terminate immediately)',
  83774. 138 => 'User-defined 1',
  83775. 139 => 'Segmentation violation',
  83776. 140 => 'User-defined 2',
  83777. 141 => 'Write to pipe with no one reading',
  83778. 142 => 'Signal raised by alarm',
  83779. 143 => 'Termination (request to terminate)',
  83780. 145 => 'Child process terminated, stopped (or continued*)',
  83781. 146 => 'Continue if stopped',
  83782. 147 => 'Stop executing temporarily',
  83783. 148 => 'Terminal stop signal',
  83784. 149 => 'Background process attempting to read from tty ("in")',
  83785. 150 => 'Background process attempting to write to tty ("out")',
  83786. 151 => 'Urgent data available on socket',
  83787. 152 => 'CPU time limit exceeded',
  83788. 153 => 'File size limit exceeded',
  83789. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  83790. 155 => 'Profiling timer expired',
  83791. 157 => 'Pollable event',
  83792. 159 => 'Bad syscall',
  83793. ];
  83794. public function __construct(array $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
  83795. {
  83796. if (!\function_exists('proc_open')) {
  83797. throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
  83798. }
  83799. $this->commandline = $command;
  83800. $this->cwd = $cwd;
  83801. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  83802. $this->cwd = getcwd();
  83803. }
  83804. if (null !== $env) {
  83805. $this->setEnv($env);
  83806. }
  83807. $this->setInput($input);
  83808. $this->setTimeout($timeout);
  83809. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  83810. $this->pty = false;
  83811. }
  83812. public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
  83813. {
  83814. $process = new static([], $cwd, $env, $input, $timeout);
  83815. $process->commandline = $command;
  83816. return $process;
  83817. }
  83818. public function __sleep()
  83819. {
  83820. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  83821. }
  83822. public function __wakeup()
  83823. {
  83824. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  83825. }
  83826. public function __destruct()
  83827. {
  83828. if ($this->options['create_new_console'] ?? false) {
  83829. $this->processPipes->close();
  83830. } else {
  83831. $this->stop(0);
  83832. }
  83833. }
  83834. public function __clone()
  83835. {
  83836. $this->resetProcessData();
  83837. }
  83838. public function run(?callable $callback = null, array $env = []): int
  83839. {
  83840. $this->start($callback, $env);
  83841. return $this->wait();
  83842. }
  83843. public function mustRun(?callable $callback = null, array $env = []): self
  83844. {
  83845. if (0 !== $this->run($callback, $env)) {
  83846. throw new ProcessFailedException($this);
  83847. }
  83848. return $this;
  83849. }
  83850. public function start(?callable $callback = null, array $env = [])
  83851. {
  83852. if ($this->isRunning()) {
  83853. throw new RuntimeException('Process is already running.');
  83854. }
  83855. $this->resetProcessData();
  83856. $this->starttime = $this->lastOutputTime = microtime(true);
  83857. $this->callback = $this->buildCallback($callback);
  83858. $this->hasCallback = null !== $callback;
  83859. $descriptors = $this->getDescriptors();
  83860. if ($this->env) {
  83861. $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->env, $env, 'strcasecmp') : $this->env;
  83862. }
  83863. $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->getDefaultEnv(), $env, 'strcasecmp') : $this->getDefaultEnv();
  83864. if (\is_array($commandline = $this->commandline)) {
  83865. $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline));
  83866. if ('\\' !== \DIRECTORY_SEPARATOR) {
  83867. $commandline = 'exec '.$commandline;
  83868. }
  83869. } else {
  83870. $commandline = $this->replacePlaceholders($commandline, $env);
  83871. }
  83872. if ('\\' === \DIRECTORY_SEPARATOR) {
  83873. $commandline = $this->prepareWindowsCommandLine($commandline, $env);
  83874. } elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
  83875. $descriptors[3] = ['pipe', 'w'];
  83876. $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  83877. $commandline .= 'pid=$!; echo $pid >&3; wait $pid 2>/dev/null; code=$?; echo $code >&3; exit $code';
  83878. $ptsWorkaround = fopen(__FILE__, 'r');
  83879. }
  83880. $envPairs = [];
  83881. foreach ($env as $k => $v) {
  83882. if (false !== $v && false === \in_array($k, ['argc', 'argv', 'ARGC', 'ARGV'], true)) {
  83883. $envPairs[] = $k.'='.$v;
  83884. }
  83885. }
  83886. if (!is_dir($this->cwd)) {
  83887. throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
  83888. }
  83889. $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
  83890. if (!\is_resource($this->process)) {
  83891. throw new RuntimeException('Unable to launch a new process.');
  83892. }
  83893. $this->status = self::STATUS_STARTED;
  83894. if (isset($descriptors[3])) {
  83895. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  83896. }
  83897. if ($this->tty) {
  83898. return;
  83899. }
  83900. $this->updateStatus(false);
  83901. $this->checkTimeout();
  83902. }
  83903. public function restart(?callable $callback = null, array $env = []): self
  83904. {
  83905. if ($this->isRunning()) {
  83906. throw new RuntimeException('Process is already running.');
  83907. }
  83908. $process = clone $this;
  83909. $process->start($callback, $env);
  83910. return $process;
  83911. }
  83912. public function wait(?callable $callback = null)
  83913. {
  83914. $this->requireProcessIsStarted(__FUNCTION__);
  83915. $this->updateStatus(false);
  83916. if (null !== $callback) {
  83917. if (!$this->processPipes->haveReadSupport()) {
  83918. $this->stop(0);
  83919. throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait".');
  83920. }
  83921. $this->callback = $this->buildCallback($callback);
  83922. }
  83923. do {
  83924. $this->checkTimeout();
  83925. $running = $this->isRunning() && ('\\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen());
  83926. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  83927. } while ($running);
  83928. while ($this->isRunning()) {
  83929. $this->checkTimeout();
  83930. usleep(1000);
  83931. }
  83932. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  83933. throw new ProcessSignaledException($this);
  83934. }
  83935. return $this->exitcode;
  83936. }
  83937. public function waitUntil(callable $callback): bool
  83938. {
  83939. $this->requireProcessIsStarted(__FUNCTION__);
  83940. $this->updateStatus(false);
  83941. if (!$this->processPipes->haveReadSupport()) {
  83942. $this->stop(0);
  83943. throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
  83944. }
  83945. $callback = $this->buildCallback($callback);
  83946. $ready = false;
  83947. while (true) {
  83948. $this->checkTimeout();
  83949. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  83950. $output = $this->processPipes->readAndWrite($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  83951. foreach ($output as $type => $data) {
  83952. if (3 !== $type) {
  83953. $ready = $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data) || $ready;
  83954. } elseif (!isset($this->fallbackStatus['signaled'])) {
  83955. $this->fallbackStatus['exitcode'] = (int) $data;
  83956. }
  83957. }
  83958. if ($ready) {
  83959. return true;
  83960. }
  83961. if (!$running) {
  83962. return false;
  83963. }
  83964. usleep(1000);
  83965. }
  83966. }
  83967. public function getPid()
  83968. {
  83969. return $this->isRunning() ? $this->processInformation['pid'] : null;
  83970. }
  83971. public function signal(int $signal)
  83972. {
  83973. $this->doSignal($signal, true);
  83974. return $this;
  83975. }
  83976. public function disableOutput()
  83977. {
  83978. if ($this->isRunning()) {
  83979. throw new RuntimeException('Disabling output while the process is running is not possible.');
  83980. }
  83981. if (null !== $this->idleTimeout) {
  83982. throw new LogicException('Output cannot be disabled while an idle timeout is set.');
  83983. }
  83984. $this->outputDisabled = true;
  83985. return $this;
  83986. }
  83987. public function enableOutput()
  83988. {
  83989. if ($this->isRunning()) {
  83990. throw new RuntimeException('Enabling output while the process is running is not possible.');
  83991. }
  83992. $this->outputDisabled = false;
  83993. return $this;
  83994. }
  83995. public function isOutputDisabled()
  83996. {
  83997. return $this->outputDisabled;
  83998. }
  83999. public function getOutput()
  84000. {
  84001. $this->readPipesForOutput(__FUNCTION__);
  84002. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  84003. return '';
  84004. }
  84005. return $ret;
  84006. }
  84007. public function getIncrementalOutput()
  84008. {
  84009. $this->readPipesForOutput(__FUNCTION__);
  84010. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  84011. $this->incrementalOutputOffset = ftell($this->stdout);
  84012. if (false === $latest) {
  84013. return '';
  84014. }
  84015. return $latest;
  84016. }
  84017. #[\ReturnTypeWillChange]
  84018. public function getIterator(int $flags = 0)
  84019. {
  84020. $this->readPipesForOutput(__FUNCTION__, false);
  84021. $clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);
  84022. $blocking = !(self::ITER_NON_BLOCKING & $flags);
  84023. $yieldOut = !(self::ITER_SKIP_OUT & $flags);
  84024. $yieldErr = !(self::ITER_SKIP_ERR & $flags);
  84025. while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) {
  84026. if ($yieldOut) {
  84027. $out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  84028. if (isset($out[0])) {
  84029. if ($clearOutput) {
  84030. $this->clearOutput();
  84031. } else {
  84032. $this->incrementalOutputOffset = ftell($this->stdout);
  84033. }
  84034. yield self::OUT => $out;
  84035. }
  84036. }
  84037. if ($yieldErr) {
  84038. $err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  84039. if (isset($err[0])) {
  84040. if ($clearOutput) {
  84041. $this->clearErrorOutput();
  84042. } else {
  84043. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  84044. }
  84045. yield self::ERR => $err;
  84046. }
  84047. }
  84048. if (!$blocking && !isset($out[0]) && !isset($err[0])) {
  84049. yield self::OUT => '';
  84050. }
  84051. $this->checkTimeout();
  84052. $this->readPipesForOutput(__FUNCTION__, $blocking);
  84053. }
  84054. }
  84055. public function clearOutput()
  84056. {
  84057. ftruncate($this->stdout, 0);
  84058. fseek($this->stdout, 0);
  84059. $this->incrementalOutputOffset = 0;
  84060. return $this;
  84061. }
  84062. public function getErrorOutput()
  84063. {
  84064. $this->readPipesForOutput(__FUNCTION__);
  84065. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  84066. return '';
  84067. }
  84068. return $ret;
  84069. }
  84070. public function getIncrementalErrorOutput()
  84071. {
  84072. $this->readPipesForOutput(__FUNCTION__);
  84073. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  84074. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  84075. if (false === $latest) {
  84076. return '';
  84077. }
  84078. return $latest;
  84079. }
  84080. public function clearErrorOutput()
  84081. {
  84082. ftruncate($this->stderr, 0);
  84083. fseek($this->stderr, 0);
  84084. $this->incrementalErrorOutputOffset = 0;
  84085. return $this;
  84086. }
  84087. public function getExitCode()
  84088. {
  84089. $this->updateStatus(false);
  84090. return $this->exitcode;
  84091. }
  84092. public function getExitCodeText()
  84093. {
  84094. if (null === $exitcode = $this->getExitCode()) {
  84095. return null;
  84096. }
  84097. return self::$exitCodes[$exitcode] ?? 'Unknown error';
  84098. }
  84099. public function isSuccessful()
  84100. {
  84101. return 0 === $this->getExitCode();
  84102. }
  84103. public function hasBeenSignaled()
  84104. {
  84105. $this->requireProcessIsTerminated(__FUNCTION__);
  84106. return $this->processInformation['signaled'];
  84107. }
  84108. public function getTermSignal()
  84109. {
  84110. $this->requireProcessIsTerminated(__FUNCTION__);
  84111. if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
  84112. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.');
  84113. }
  84114. return $this->processInformation['termsig'];
  84115. }
  84116. public function hasBeenStopped()
  84117. {
  84118. $this->requireProcessIsTerminated(__FUNCTION__);
  84119. return $this->processInformation['stopped'];
  84120. }
  84121. public function getStopSignal()
  84122. {
  84123. $this->requireProcessIsTerminated(__FUNCTION__);
  84124. return $this->processInformation['stopsig'];
  84125. }
  84126. public function isRunning()
  84127. {
  84128. if (self::STATUS_STARTED !== $this->status) {
  84129. return false;
  84130. }
  84131. $this->updateStatus(false);
  84132. return $this->processInformation['running'];
  84133. }
  84134. public function isStarted()
  84135. {
  84136. return self::STATUS_READY != $this->status;
  84137. }
  84138. public function isTerminated()
  84139. {
  84140. $this->updateStatus(false);
  84141. return self::STATUS_TERMINATED == $this->status;
  84142. }
  84143. public function getStatus()
  84144. {
  84145. $this->updateStatus(false);
  84146. return $this->status;
  84147. }
  84148. public function stop(float $timeout = 10, ?int $signal = null)
  84149. {
  84150. $timeoutMicro = microtime(true) + $timeout;
  84151. if ($this->isRunning()) {
  84152. $this->doSignal(15, false);
  84153. do {
  84154. usleep(1000);
  84155. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  84156. if ($this->isRunning()) {
  84157. $this->doSignal($signal ?: 9, false);
  84158. }
  84159. }
  84160. if ($this->isRunning()) {
  84161. if (isset($this->fallbackStatus['pid'])) {
  84162. unset($this->fallbackStatus['pid']);
  84163. return $this->stop(0, $signal);
  84164. }
  84165. $this->close();
  84166. }
  84167. return $this->exitcode;
  84168. }
  84169. public function addOutput(string $line)
  84170. {
  84171. $this->lastOutputTime = microtime(true);
  84172. fseek($this->stdout, 0, \SEEK_END);
  84173. fwrite($this->stdout, $line);
  84174. fseek($this->stdout, $this->incrementalOutputOffset);
  84175. }
  84176. public function addErrorOutput(string $line)
  84177. {
  84178. $this->lastOutputTime = microtime(true);
  84179. fseek($this->stderr, 0, \SEEK_END);
  84180. fwrite($this->stderr, $line);
  84181. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  84182. }
  84183. public function getLastOutputTime(): ?float
  84184. {
  84185. return $this->lastOutputTime;
  84186. }
  84187. public function getCommandLine()
  84188. {
  84189. return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline;
  84190. }
  84191. public function getTimeout()
  84192. {
  84193. return $this->timeout;
  84194. }
  84195. public function getIdleTimeout()
  84196. {
  84197. return $this->idleTimeout;
  84198. }
  84199. public function setTimeout(?float $timeout)
  84200. {
  84201. $this->timeout = $this->validateTimeout($timeout);
  84202. return $this;
  84203. }
  84204. public function setIdleTimeout(?float $timeout)
  84205. {
  84206. if (null !== $timeout && $this->outputDisabled) {
  84207. throw new LogicException('Idle timeout cannot be set while the output is disabled.');
  84208. }
  84209. $this->idleTimeout = $this->validateTimeout($timeout);
  84210. return $this;
  84211. }
  84212. public function setTty(bool $tty)
  84213. {
  84214. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  84215. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  84216. }
  84217. if ($tty && !self::isTtySupported()) {
  84218. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  84219. }
  84220. $this->tty = $tty;
  84221. return $this;
  84222. }
  84223. public function isTty()
  84224. {
  84225. return $this->tty;
  84226. }
  84227. public function setPty(bool $bool)
  84228. {
  84229. $this->pty = $bool;
  84230. return $this;
  84231. }
  84232. public function isPty()
  84233. {
  84234. return $this->pty;
  84235. }
  84236. public function getWorkingDirectory()
  84237. {
  84238. if (null === $this->cwd) {
  84239. return getcwd() ?: null;
  84240. }
  84241. return $this->cwd;
  84242. }
  84243. public function setWorkingDirectory(string $cwd)
  84244. {
  84245. $this->cwd = $cwd;
  84246. return $this;
  84247. }
  84248. public function getEnv()
  84249. {
  84250. return $this->env;
  84251. }
  84252. public function setEnv(array $env)
  84253. {
  84254. $this->env = $env;
  84255. return $this;
  84256. }
  84257. public function getInput()
  84258. {
  84259. return $this->input;
  84260. }
  84261. public function setInput($input)
  84262. {
  84263. if ($this->isRunning()) {
  84264. throw new LogicException('Input cannot be set while the process is running.');
  84265. }
  84266. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  84267. return $this;
  84268. }
  84269. public function checkTimeout()
  84270. {
  84271. if (self::STATUS_STARTED !== $this->status) {
  84272. return;
  84273. }
  84274. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  84275. $this->stop(0);
  84276. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  84277. }
  84278. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  84279. $this->stop(0);
  84280. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  84281. }
  84282. }
  84283. public function getStartTime(): float
  84284. {
  84285. if (!$this->isStarted()) {
  84286. throw new LogicException('Start time is only available after process start.');
  84287. }
  84288. return $this->starttime;
  84289. }
  84290. public function setOptions(array $options)
  84291. {
  84292. if ($this->isRunning()) {
  84293. throw new RuntimeException('Setting options while the process is running is not possible.');
  84294. }
  84295. $defaultOptions = $this->options;
  84296. $existingOptions = ['blocking_pipes', 'create_process_group', 'create_new_console'];
  84297. foreach ($options as $key => $value) {
  84298. if (!\in_array($key, $existingOptions)) {
  84299. $this->options = $defaultOptions;
  84300. throw new LogicException(sprintf('Invalid option "%s" passed to "%s()". Supported options are "%s".', $key, __METHOD__, implode('", "', $existingOptions)));
  84301. }
  84302. $this->options[$key] = $value;
  84303. }
  84304. }
  84305. public static function isTtySupported(): bool
  84306. {
  84307. static $isTtySupported;
  84308. if (null === $isTtySupported) {
  84309. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
  84310. }
  84311. return $isTtySupported;
  84312. }
  84313. public static function isPtySupported()
  84314. {
  84315. static $result;
  84316. if (null !== $result) {
  84317. return $result;
  84318. }
  84319. if ('\\' === \DIRECTORY_SEPARATOR) {
  84320. return $result = false;
  84321. }
  84322. return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes);
  84323. }
  84324. private function getDescriptors(): array
  84325. {
  84326. if ($this->input instanceof \Iterator) {
  84327. $this->input->rewind();
  84328. }
  84329. if ('\\' === \DIRECTORY_SEPARATOR) {
  84330. $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
  84331. } else {
  84332. $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
  84333. }
  84334. return $this->processPipes->getDescriptors();
  84335. }
  84336. protected function buildCallback(?callable $callback = null)
  84337. {
  84338. if ($this->outputDisabled) {
  84339. return function ($type, $data) use ($callback): bool {
  84340. return null !== $callback && $callback($type, $data);
  84341. };
  84342. }
  84343. $out = self::OUT;
  84344. return function ($type, $data) use ($callback, $out): bool {
  84345. if ($out == $type) {
  84346. $this->addOutput($data);
  84347. } else {
  84348. $this->addErrorOutput($data);
  84349. }
  84350. return null !== $callback && $callback($type, $data);
  84351. };
  84352. }
  84353. protected function updateStatus(bool $blocking)
  84354. {
  84355. if (self::STATUS_STARTED !== $this->status) {
  84356. return;
  84357. }
  84358. $this->processInformation = proc_get_status($this->process);
  84359. $running = $this->processInformation['running'];
  84360. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  84361. if ($this->fallbackStatus && $this->isSigchildEnabled()) {
  84362. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  84363. }
  84364. if (!$running) {
  84365. $this->close();
  84366. }
  84367. }
  84368. protected function isSigchildEnabled()
  84369. {
  84370. if (null !== self::$sigchild) {
  84371. return self::$sigchild;
  84372. }
  84373. if (!\function_exists('phpinfo')) {
  84374. return self::$sigchild = false;
  84375. }
  84376. ob_start();
  84377. phpinfo(\INFO_GENERAL);
  84378. return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
  84379. }
  84380. private function readPipesForOutput(string $caller, bool $blocking = false)
  84381. {
  84382. if ($this->outputDisabled) {
  84383. throw new LogicException('Output has been disabled.');
  84384. }
  84385. $this->requireProcessIsStarted($caller);
  84386. $this->updateStatus($blocking);
  84387. }
  84388. private function validateTimeout(?float $timeout): ?float
  84389. {
  84390. $timeout = (float) $timeout;
  84391. if (0.0 === $timeout) {
  84392. $timeout = null;
  84393. } elseif ($timeout < 0) {
  84394. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  84395. }
  84396. return $timeout;
  84397. }
  84398. private function readPipes(bool $blocking, bool $close)
  84399. {
  84400. $result = $this->processPipes->readAndWrite($blocking, $close);
  84401. $callback = $this->callback;
  84402. foreach ($result as $type => $data) {
  84403. if (3 !== $type) {
  84404. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  84405. } elseif (!isset($this->fallbackStatus['signaled'])) {
  84406. $this->fallbackStatus['exitcode'] = (int) $data;
  84407. }
  84408. }
  84409. }
  84410. private function close(): int
  84411. {
  84412. $this->processPipes->close();
  84413. if (\is_resource($this->process)) {
  84414. proc_close($this->process);
  84415. }
  84416. $this->exitcode = $this->processInformation['exitcode'];
  84417. $this->status = self::STATUS_TERMINATED;
  84418. if (-1 === $this->exitcode) {
  84419. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  84420. $this->exitcode = 128 + $this->processInformation['termsig'];
  84421. } elseif ($this->isSigchildEnabled()) {
  84422. $this->processInformation['signaled'] = true;
  84423. $this->processInformation['termsig'] = -1;
  84424. }
  84425. }
  84426. $this->callback = null;
  84427. return $this->exitcode;
  84428. }
  84429. private function resetProcessData()
  84430. {
  84431. $this->starttime = null;
  84432. $this->callback = null;
  84433. $this->exitcode = null;
  84434. $this->fallbackStatus = [];
  84435. $this->processInformation = null;
  84436. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
  84437. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
  84438. $this->process = null;
  84439. $this->latestSignal = null;
  84440. $this->status = self::STATUS_READY;
  84441. $this->incrementalOutputOffset = 0;
  84442. $this->incrementalErrorOutputOffset = 0;
  84443. }
  84444. private function doSignal(int $signal, bool $throwException): bool
  84445. {
  84446. if (null === $pid = $this->getPid()) {
  84447. if ($throwException) {
  84448. throw new LogicException('Cannot send signal on a non running process.');
  84449. }
  84450. return false;
  84451. }
  84452. if ('\\' === \DIRECTORY_SEPARATOR) {
  84453. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  84454. if ($exitCode && $this->isRunning()) {
  84455. if ($throwException) {
  84456. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  84457. }
  84458. return false;
  84459. }
  84460. } else {
  84461. if (!$this->isSigchildEnabled()) {
  84462. $ok = @proc_terminate($this->process, $signal);
  84463. } elseif (\function_exists('posix_kill')) {
  84464. $ok = @posix_kill($pid, $signal);
  84465. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
  84466. $ok = false === fgets($pipes[2]);
  84467. }
  84468. if (!$ok) {
  84469. if ($throwException) {
  84470. throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
  84471. }
  84472. return false;
  84473. }
  84474. }
  84475. $this->latestSignal = $signal;
  84476. $this->fallbackStatus['signaled'] = true;
  84477. $this->fallbackStatus['exitcode'] = -1;
  84478. $this->fallbackStatus['termsig'] = $this->latestSignal;
  84479. return true;
  84480. }
  84481. private function prepareWindowsCommandLine(string $cmd, array &$env): string
  84482. {
  84483. $uid = uniqid('', true);
  84484. $varCount = 0;
  84485. $varCache = [];
  84486. $cmd = preg_replace_callback(
  84487. '/"(?:(
  84488. [^"%!^]*+
  84489. (?:
  84490. (?: !LF! | "(?:\^[%!^])?+" )
  84491. [^"%!^]*+
  84492. )++
  84493. ) | [^"]*+ )"/x',
  84494. function ($m) use (&$env, &$varCache, &$varCount, $uid) {
  84495. if (!isset($m[1])) {
  84496. return $m[0];
  84497. }
  84498. if (isset($varCache[$m[0]])) {
  84499. return $varCache[$m[0]];
  84500. }
  84501. if (str_contains($value = $m[1], "\0")) {
  84502. $value = str_replace("\0", '?', $value);
  84503. }
  84504. if (false === strpbrk($value, "\"%!\n")) {
  84505. return '"'.$value.'"';
  84506. }
  84507. $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value);
  84508. $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
  84509. $var = $uid.++$varCount;
  84510. $env[$var] = $value;
  84511. return $varCache[$m[0]] = '!'.$var.'!';
  84512. },
  84513. $cmd
  84514. );
  84515. $cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
  84516. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  84517. $cmd .= ' '.$offset.'>"'.$filename.'"';
  84518. }
  84519. return $cmd;
  84520. }
  84521. private function requireProcessIsStarted(string $functionName)
  84522. {
  84523. if (!$this->isStarted()) {
  84524. throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
  84525. }
  84526. }
  84527. private function requireProcessIsTerminated(string $functionName)
  84528. {
  84529. if (!$this->isTerminated()) {
  84530. throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));
  84531. }
  84532. }
  84533. private function escapeArgument(?string $argument): string
  84534. {
  84535. if ('' === $argument || null === $argument) {
  84536. return '""';
  84537. }
  84538. if ('\\' !== \DIRECTORY_SEPARATOR) {
  84539. return "'".str_replace("'", "'\\''", $argument)."'";
  84540. }
  84541. if (str_contains($argument, "\0")) {
  84542. $argument = str_replace("\0", '?', $argument);
  84543. }
  84544. if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
  84545. return $argument;
  84546. }
  84547. $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);
  84548. return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
  84549. }
  84550. private function replacePlaceholders(string $commandline, array $env)
  84551. {
  84552. return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
  84553. if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
  84554. throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline);
  84555. }
  84556. return $this->escapeArgument($env[$matches[1]]);
  84557. }, $commandline);
  84558. }
  84559. private function getDefaultEnv(): array
  84560. {
  84561. $env = getenv();
  84562. $env = ('\\' === \DIRECTORY_SEPARATOR ? array_intersect_ukey($env, $_SERVER, 'strcasecmp') : array_intersect_key($env, $_SERVER)) ?: $env;
  84563. return $_ENV + ('\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($env, $_ENV, 'strcasecmp') : $env);
  84564. }
  84565. }
  84566. <?php
  84567. namespace Symfony\Component\Process;
  84568. use Symfony\Component\Process\Exception\InvalidArgumentException;
  84569. class ProcessUtils
  84570. {
  84571. private function __construct()
  84572. {
  84573. }
  84574. public static function validateInput(string $caller, $input)
  84575. {
  84576. if (null !== $input) {
  84577. if (\is_resource($input)) {
  84578. return $input;
  84579. }
  84580. if (\is_string($input)) {
  84581. return $input;
  84582. }
  84583. if (\is_scalar($input)) {
  84584. return (string) $input;
  84585. }
  84586. if ($input instanceof Process) {
  84587. return $input->getIterator($input::ITER_SKIP_ERR);
  84588. }
  84589. if ($input instanceof \Iterator) {
  84590. return $input;
  84591. }
  84592. if ($input instanceof \Traversable) {
  84593. return new \IteratorIterator($input);
  84594. }
  84595. throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
  84596. }
  84597. return $input;
  84598. }
  84599. }
  84600. <?php
  84601. namespace Symfony\Contracts\Service\Attribute;
  84602. #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
  84603. final class Required
  84604. {
  84605. }
  84606. <?php
  84607. namespace Symfony\Contracts\Service\Attribute;
  84608. use Symfony\Contracts\Service\ServiceSubscriberTrait;
  84609. #[\Attribute(\Attribute::TARGET_METHOD)]
  84610. final class SubscribedService
  84611. {
  84612. public function __construct(
  84613. public ?string $key = null
  84614. ) {
  84615. }
  84616. }
  84617. Copyright (c) 2018-2022 Fabien Potencier
  84618. Permission is hereby granted, free of charge, to any person obtaining a copy
  84619. of this software and associated documentation files (the "Software"), to deal
  84620. in the Software without restriction, including without limitation the rights
  84621. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  84622. copies of the Software, and to permit persons to whom the Software is furnished
  84623. to do so, subject to the following conditions:
  84624. The above copyright notice and this permission notice shall be included in all
  84625. copies or substantial portions of the Software.
  84626. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  84627. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  84628. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  84629. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  84630. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  84631. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  84632. THE SOFTWARE.
  84633. <?php
  84634. namespace Symfony\Contracts\Service;
  84635. interface ResetInterface
  84636. {
  84637. public function reset();
  84638. }
  84639. <?php
  84640. namespace Symfony\Contracts\Service;
  84641. use Psr\Container\ContainerExceptionInterface;
  84642. use Psr\Container\NotFoundExceptionInterface;
  84643. class_exists(ContainerExceptionInterface::class);
  84644. class_exists(NotFoundExceptionInterface::class);
  84645. trait ServiceLocatorTrait
  84646. {
  84647. private $factories;
  84648. private $loading = [];
  84649. private $providedTypes;
  84650. public function __construct(array $factories)
  84651. {
  84652. $this->factories = $factories;
  84653. }
  84654. public function has(string $id)
  84655. {
  84656. return isset($this->factories[$id]);
  84657. }
  84658. public function get(string $id)
  84659. {
  84660. if (!isset($this->factories[$id])) {
  84661. throw $this->createNotFoundException($id);
  84662. }
  84663. if (isset($this->loading[$id])) {
  84664. $ids = array_values($this->loading);
  84665. $ids = \array_slice($this->loading, array_search($id, $ids));
  84666. $ids[] = $id;
  84667. throw $this->createCircularReferenceException($id, $ids);
  84668. }
  84669. $this->loading[$id] = $id;
  84670. try {
  84671. return $this->factories[$id]($this);
  84672. } finally {
  84673. unset($this->loading[$id]);
  84674. }
  84675. }
  84676. public function getProvidedServices(): array
  84677. {
  84678. if (null === $this->providedTypes) {
  84679. $this->providedTypes = [];
  84680. foreach ($this->factories as $name => $factory) {
  84681. if (!\is_callable($factory)) {
  84682. $this->providedTypes[$name] = '?';
  84683. } else {
  84684. $type = (new \ReflectionFunction($factory))->getReturnType();
  84685. $this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
  84686. }
  84687. }
  84688. }
  84689. return $this->providedTypes;
  84690. }
  84691. private function createNotFoundException(string $id): NotFoundExceptionInterface
  84692. {
  84693. if (!$alternatives = array_keys($this->factories)) {
  84694. $message = 'is empty...';
  84695. } else {
  84696. $last = array_pop($alternatives);
  84697. if ($alternatives) {
  84698. $message = sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
  84699. } else {
  84700. $message = sprintf('only knows about the "%s" service.', $last);
  84701. }
  84702. }
  84703. if ($this->loading) {
  84704. $message = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
  84705. } else {
  84706. $message = sprintf('Service "%s" not found: the current service locator %s', $id, $message);
  84707. }
  84708. return new class($message) extends \InvalidArgumentException implements NotFoundExceptionInterface {
  84709. };
  84710. }
  84711. private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface
  84712. {
  84713. return new class(sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
  84714. };
  84715. }
  84716. }
  84717. <?php
  84718. namespace Symfony\Contracts\Service;
  84719. use Psr\Container\ContainerInterface;
  84720. interface ServiceProviderInterface extends ContainerInterface
  84721. {
  84722. public function getProvidedServices(): array;
  84723. }
  84724. <?php
  84725. namespace Symfony\Contracts\Service;
  84726. interface ServiceSubscriberInterface
  84727. {
  84728. public static function getSubscribedServices();
  84729. }
  84730. <?php
  84731. namespace Symfony\Contracts\Service;
  84732. use Psr\Container\ContainerInterface;
  84733. use Symfony\Contracts\Service\Attribute\SubscribedService;
  84734. trait ServiceSubscriberTrait
  84735. {
  84736. protected $container;
  84737. public static function getSubscribedServices(): array
  84738. {
  84739. $services = method_exists(get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : [];
  84740. $attributeOptIn = false;
  84741. if (\PHP_VERSION_ID >= 80000) {
  84742. foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
  84743. if (self::class !== $method->getDeclaringClass()->name) {
  84744. continue;
  84745. }
  84746. if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) {
  84747. continue;
  84748. }
  84749. if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
  84750. throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
  84751. }
  84752. if (!$returnType = $method->getReturnType()) {
  84753. throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
  84754. }
  84755. $serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
  84756. if ($returnType->allowsNull()) {
  84757. $serviceId = '?'.$serviceId;
  84758. }
  84759. $services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId;
  84760. $attributeOptIn = true;
  84761. }
  84762. }
  84763. if (!$attributeOptIn) {
  84764. foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
  84765. if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
  84766. continue;
  84767. }
  84768. if (self::class !== $method->getDeclaringClass()->name) {
  84769. continue;
  84770. }
  84771. if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) {
  84772. continue;
  84773. }
  84774. if ($returnType->isBuiltin()) {
  84775. continue;
  84776. }
  84777. if (\PHP_VERSION_ID >= 80000) {
  84778. trigger_deprecation('symfony/service-contracts', '2.5', 'Using "%s" in "%s" without using the "%s" attribute on any method is deprecated.', ServiceSubscriberTrait::class, self::class, SubscribedService::class);
  84779. }
  84780. $services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType);
  84781. }
  84782. }
  84783. return $services;
  84784. }
  84785. public function setContainer(ContainerInterface $container)
  84786. {
  84787. $this->container = $container;
  84788. if (method_exists(get_parent_class(self::class) ?: '', __FUNCTION__)) {
  84789. return parent::setContainer($container);
  84790. }
  84791. return null;
  84792. }
  84793. }
  84794. <?php
  84795. namespace Symfony\Contracts\Service\Test;
  84796. use PHPUnit\Framework\TestCase;
  84797. use Psr\Container\ContainerInterface;
  84798. use Symfony\Contracts\Service\ServiceLocatorTrait;
  84799. abstract class ServiceLocatorTest extends TestCase
  84800. {
  84801. protected function getServiceLocator(array $factories)
  84802. {
  84803. return new class($factories) implements ContainerInterface {
  84804. use ServiceLocatorTrait;
  84805. };
  84806. }
  84807. public function testHas()
  84808. {
  84809. $locator = $this->getServiceLocator([
  84810. 'foo' => function () { return 'bar'; },
  84811. 'bar' => function () { return 'baz'; },
  84812. function () { return 'dummy'; },
  84813. ]);
  84814. $this->assertTrue($locator->has('foo'));
  84815. $this->assertTrue($locator->has('bar'));
  84816. $this->assertFalse($locator->has('dummy'));
  84817. }
  84818. public function testGet()
  84819. {
  84820. $locator = $this->getServiceLocator([
  84821. 'foo' => function () { return 'bar'; },
  84822. 'bar' => function () { return 'baz'; },
  84823. ]);
  84824. $this->assertSame('bar', $locator->get('foo'));
  84825. $this->assertSame('baz', $locator->get('bar'));
  84826. }
  84827. public function testGetDoesNotMemoize()
  84828. {
  84829. $i = 0;
  84830. $locator = $this->getServiceLocator([
  84831. 'foo' => function () use (&$i) {
  84832. ++$i;
  84833. return 'bar';
  84834. },
  84835. ]);
  84836. $this->assertSame('bar', $locator->get('foo'));
  84837. $this->assertSame('bar', $locator->get('foo'));
  84838. $this->assertSame(2, $i);
  84839. }
  84840. public function testThrowsOnUndefinedInternalService()
  84841. {
  84842. if (!$this->getExpectedException()) {
  84843. $this->expectException(\Psr\Container\NotFoundExceptionInterface::class);
  84844. $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
  84845. }
  84846. $locator = $this->getServiceLocator([
  84847. 'foo' => function () use (&$locator) { return $locator->get('bar'); },
  84848. ]);
  84849. $locator->get('foo');
  84850. }
  84851. public function testThrowsOnCircularReference()
  84852. {
  84853. $this->expectException(\Psr\Container\ContainerExceptionInterface::class);
  84854. $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
  84855. $locator = $this->getServiceLocator([
  84856. 'foo' => function () use (&$locator) { return $locator->get('bar'); },
  84857. 'bar' => function () use (&$locator) { return $locator->get('baz'); },
  84858. 'baz' => function () use (&$locator) { return $locator->get('bar'); },
  84859. ]);
  84860. $locator->get('foo');
  84861. }
  84862. }
  84863. <?php
  84864. namespace Symfony\Component\String;
  84865. use Symfony\Component\String\Exception\ExceptionInterface;
  84866. use Symfony\Component\String\Exception\InvalidArgumentException;
  84867. use Symfony\Component\String\Exception\RuntimeException;
  84868. abstract class AbstractString implements \Stringable, \JsonSerializable
  84869. {
  84870. public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER;
  84871. public const PREG_SET_ORDER = \PREG_SET_ORDER;
  84872. public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE;
  84873. public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL;
  84874. public const PREG_SPLIT = 0;
  84875. public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY;
  84876. public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE;
  84877. public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE;
  84878. protected $string = '';
  84879. protected $ignoreCase = false;
  84880. abstract public function __construct(string $string = '');
  84881. public static function unwrap(array $values): array
  84882. {
  84883. foreach ($values as $k => $v) {
  84884. if ($v instanceof self) {
  84885. $values[$k] = $v->__toString();
  84886. } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) {
  84887. $values[$k] = $v;
  84888. }
  84889. }
  84890. return $values;
  84891. }
  84892. public static function wrap(array $values): array
  84893. {
  84894. $i = 0;
  84895. $keys = null;
  84896. foreach ($values as $k => $v) {
  84897. if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) {
  84898. $keys = $keys ?? array_keys($values);
  84899. $keys[$i] = $j;
  84900. }
  84901. if (\is_string($v)) {
  84902. $values[$k] = new static($v);
  84903. } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) {
  84904. $values[$k] = $v;
  84905. }
  84906. ++$i;
  84907. }
  84908. return null !== $keys ? array_combine($keys, $values) : $values;
  84909. }
  84910. public function after($needle, bool $includeNeedle = false, int $offset = 0): self
  84911. {
  84912. $str = clone $this;
  84913. $i = \PHP_INT_MAX;
  84914. foreach ((array) $needle as $n) {
  84915. $n = (string) $n;
  84916. $j = $this->indexOf($n, $offset);
  84917. if (null !== $j && $j < $i) {
  84918. $i = $j;
  84919. $str->string = $n;
  84920. }
  84921. }
  84922. if (\PHP_INT_MAX === $i) {
  84923. return $str;
  84924. }
  84925. if (!$includeNeedle) {
  84926. $i += $str->length();
  84927. }
  84928. return $this->slice($i);
  84929. }
  84930. public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self
  84931. {
  84932. $str = clone $this;
  84933. $i = null;
  84934. foreach ((array) $needle as $n) {
  84935. $n = (string) $n;
  84936. $j = $this->indexOfLast($n, $offset);
  84937. if (null !== $j && $j >= $i) {
  84938. $i = $offset = $j;
  84939. $str->string = $n;
  84940. }
  84941. }
  84942. if (null === $i) {
  84943. return $str;
  84944. }
  84945. if (!$includeNeedle) {
  84946. $i += $str->length();
  84947. }
  84948. return $this->slice($i);
  84949. }
  84950. abstract public function append(string ...$suffix): self;
  84951. public function before($needle, bool $includeNeedle = false, int $offset = 0): self
  84952. {
  84953. $str = clone $this;
  84954. $i = \PHP_INT_MAX;
  84955. foreach ((array) $needle as $n) {
  84956. $n = (string) $n;
  84957. $j = $this->indexOf($n, $offset);
  84958. if (null !== $j && $j < $i) {
  84959. $i = $j;
  84960. $str->string = $n;
  84961. }
  84962. }
  84963. if (\PHP_INT_MAX === $i) {
  84964. return $str;
  84965. }
  84966. if ($includeNeedle) {
  84967. $i += $str->length();
  84968. }
  84969. return $this->slice(0, $i);
  84970. }
  84971. public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self
  84972. {
  84973. $str = clone $this;
  84974. $i = null;
  84975. foreach ((array) $needle as $n) {
  84976. $n = (string) $n;
  84977. $j = $this->indexOfLast($n, $offset);
  84978. if (null !== $j && $j >= $i) {
  84979. $i = $offset = $j;
  84980. $str->string = $n;
  84981. }
  84982. }
  84983. if (null === $i) {
  84984. return $str;
  84985. }
  84986. if ($includeNeedle) {
  84987. $i += $str->length();
  84988. }
  84989. return $this->slice(0, $i);
  84990. }
  84991. public function bytesAt(int $offset): array
  84992. {
  84993. $str = $this->slice($offset, 1);
  84994. return '' === $str->string ? [] : array_values(unpack('C*', $str->string));
  84995. }
  84996. abstract public function camel(): self;
  84997. abstract public function chunk(int $length = 1): array;
  84998. public function collapseWhitespace(): self
  84999. {
  85000. $str = clone $this;
  85001. $str->string = trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $str->string), " \n\r\t\x0C");
  85002. return $str;
  85003. }
  85004. public function containsAny($needle): bool
  85005. {
  85006. return null !== $this->indexOf($needle);
  85007. }
  85008. public function endsWith($suffix): bool
  85009. {
  85010. if (!\is_array($suffix) && !$suffix instanceof \Traversable) {
  85011. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  85012. }
  85013. foreach ($suffix as $s) {
  85014. if ($this->endsWith((string) $s)) {
  85015. return true;
  85016. }
  85017. }
  85018. return false;
  85019. }
  85020. public function ensureEnd(string $suffix): self
  85021. {
  85022. if (!$this->endsWith($suffix)) {
  85023. return $this->append($suffix);
  85024. }
  85025. $suffix = preg_quote($suffix);
  85026. $regex = '{('.$suffix.')(?:'.$suffix.')++$}D';
  85027. return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1');
  85028. }
  85029. public function ensureStart(string $prefix): self
  85030. {
  85031. $prefix = new static($prefix);
  85032. if (!$this->startsWith($prefix)) {
  85033. return $this->prepend($prefix);
  85034. }
  85035. $str = clone $this;
  85036. $i = $prefixLen = $prefix->length();
  85037. while ($this->indexOf($prefix, $i) === $i) {
  85038. $str = $str->slice($prefixLen);
  85039. $i += $prefixLen;
  85040. }
  85041. return $str;
  85042. }
  85043. public function equalsTo($string): bool
  85044. {
  85045. if (!\is_array($string) && !$string instanceof \Traversable) {
  85046. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  85047. }
  85048. foreach ($string as $s) {
  85049. if ($this->equalsTo((string) $s)) {
  85050. return true;
  85051. }
  85052. }
  85053. return false;
  85054. }
  85055. abstract public function folded(): self;
  85056. public function ignoreCase(): self
  85057. {
  85058. $str = clone $this;
  85059. $str->ignoreCase = true;
  85060. return $str;
  85061. }
  85062. public function indexOf($needle, int $offset = 0): ?int
  85063. {
  85064. if (!\is_array($needle) && !$needle instanceof \Traversable) {
  85065. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  85066. }
  85067. $i = \PHP_INT_MAX;
  85068. foreach ($needle as $n) {
  85069. $j = $this->indexOf((string) $n, $offset);
  85070. if (null !== $j && $j < $i) {
  85071. $i = $j;
  85072. }
  85073. }
  85074. return \PHP_INT_MAX === $i ? null : $i;
  85075. }
  85076. public function indexOfLast($needle, int $offset = 0): ?int
  85077. {
  85078. if (!\is_array($needle) && !$needle instanceof \Traversable) {
  85079. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  85080. }
  85081. $i = null;
  85082. foreach ($needle as $n) {
  85083. $j = $this->indexOfLast((string) $n, $offset);
  85084. if (null !== $j && $j >= $i) {
  85085. $i = $offset = $j;
  85086. }
  85087. }
  85088. return $i;
  85089. }
  85090. public function isEmpty(): bool
  85091. {
  85092. return '' === $this->string;
  85093. }
  85094. abstract public function join(array $strings, ?string $lastGlue = null): self;
  85095. public function jsonSerialize(): string
  85096. {
  85097. return $this->string;
  85098. }
  85099. abstract public function length(): int;
  85100. abstract public function lower(): self;
  85101. abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
  85102. abstract public function padBoth(int $length, string $padStr = ' '): self;
  85103. abstract public function padEnd(int $length, string $padStr = ' '): self;
  85104. abstract public function padStart(int $length, string $padStr = ' '): self;
  85105. abstract public function prepend(string ...$prefix): self;
  85106. public function repeat(int $multiplier): self
  85107. {
  85108. if (0 > $multiplier) {
  85109. throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier));
  85110. }
  85111. $str = clone $this;
  85112. $str->string = str_repeat($str->string, $multiplier);
  85113. return $str;
  85114. }
  85115. abstract public function replace(string $from, string $to): self;
  85116. abstract public function replaceMatches(string $fromRegexp, $to): self;
  85117. abstract public function reverse(): self;
  85118. abstract public function slice(int $start = 0, ?int $length = null): self;
  85119. abstract public function snake(): self;
  85120. abstract public function splice(string $replacement, int $start = 0, ?int $length = null): self;
  85121. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  85122. {
  85123. if (null === $flags) {
  85124. throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.');
  85125. }
  85126. if ($this->ignoreCase) {
  85127. $delimiter .= 'i';
  85128. }
  85129. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  85130. try {
  85131. if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) {
  85132. $lastError = preg_last_error();
  85133. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  85134. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  85135. throw new RuntimeException('Splitting failed with '.$k.'.');
  85136. }
  85137. }
  85138. throw new RuntimeException('Splitting failed with unknown error code.');
  85139. }
  85140. } finally {
  85141. restore_error_handler();
  85142. }
  85143. $str = clone $this;
  85144. if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) {
  85145. foreach ($chunks as &$chunk) {
  85146. $str->string = $chunk[0];
  85147. $chunk[0] = clone $str;
  85148. }
  85149. } else {
  85150. foreach ($chunks as &$chunk) {
  85151. $str->string = $chunk;
  85152. $chunk = clone $str;
  85153. }
  85154. }
  85155. return $chunks;
  85156. }
  85157. public function startsWith($prefix): bool
  85158. {
  85159. if (!\is_array($prefix) && !$prefix instanceof \Traversable) {
  85160. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  85161. }
  85162. foreach ($prefix as $prefix) {
  85163. if ($this->startsWith((string) $prefix)) {
  85164. return true;
  85165. }
  85166. }
  85167. return false;
  85168. }
  85169. abstract public function title(bool $allWords = false): self;
  85170. public function toByteString(?string $toEncoding = null): ByteString
  85171. {
  85172. $b = new ByteString();
  85173. $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding;
  85174. if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') {
  85175. $b->string = $this->string;
  85176. return $b;
  85177. }
  85178. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  85179. try {
  85180. try {
  85181. $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8');
  85182. } catch (InvalidArgumentException|\ValueError $e) {
  85183. if (!\function_exists('iconv')) {
  85184. if ($e instanceof \ValueError) {
  85185. throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
  85186. }
  85187. throw $e;
  85188. }
  85189. $b->string = iconv('UTF-8', $toEncoding, $this->string);
  85190. }
  85191. } finally {
  85192. restore_error_handler();
  85193. }
  85194. return $b;
  85195. }
  85196. public function toCodePointString(): CodePointString
  85197. {
  85198. return new CodePointString($this->string);
  85199. }
  85200. public function toString(): string
  85201. {
  85202. return $this->string;
  85203. }
  85204. public function toUnicodeString(): UnicodeString
  85205. {
  85206. return new UnicodeString($this->string);
  85207. }
  85208. abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  85209. abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  85210. public function trimPrefix($prefix): self
  85211. {
  85212. if (\is_array($prefix) || $prefix instanceof \Traversable) {
  85213. foreach ($prefix as $s) {
  85214. $t = $this->trimPrefix($s);
  85215. if ($t->string !== $this->string) {
  85216. return $t;
  85217. }
  85218. }
  85219. return clone $this;
  85220. }
  85221. $str = clone $this;
  85222. if ($prefix instanceof self) {
  85223. $prefix = $prefix->string;
  85224. } else {
  85225. $prefix = (string) $prefix;
  85226. }
  85227. if ('' !== $prefix && \strlen($this->string) >= \strlen($prefix) && 0 === substr_compare($this->string, $prefix, 0, \strlen($prefix), $this->ignoreCase)) {
  85228. $str->string = substr($this->string, \strlen($prefix));
  85229. }
  85230. return $str;
  85231. }
  85232. abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  85233. public function trimSuffix($suffix): self
  85234. {
  85235. if (\is_array($suffix) || $suffix instanceof \Traversable) {
  85236. foreach ($suffix as $s) {
  85237. $t = $this->trimSuffix($s);
  85238. if ($t->string !== $this->string) {
  85239. return $t;
  85240. }
  85241. }
  85242. return clone $this;
  85243. }
  85244. $str = clone $this;
  85245. if ($suffix instanceof self) {
  85246. $suffix = $suffix->string;
  85247. } else {
  85248. $suffix = (string) $suffix;
  85249. }
  85250. if ('' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase)) {
  85251. $str->string = substr($this->string, 0, -\strlen($suffix));
  85252. }
  85253. return $str;
  85254. }
  85255. public function truncate(int $length, string $ellipsis = '', bool $cut = true): self
  85256. {
  85257. $stringLength = $this->length();
  85258. if ($stringLength <= $length) {
  85259. return clone $this;
  85260. }
  85261. $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0;
  85262. if ($length < $ellipsisLength) {
  85263. $ellipsisLength = 0;
  85264. }
  85265. if (!$cut) {
  85266. if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) {
  85267. return clone $this;
  85268. }
  85269. $length += $ellipsisLength;
  85270. }
  85271. $str = $this->slice(0, $length - $ellipsisLength);
  85272. return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str;
  85273. }
  85274. abstract public function upper(): self;
  85275. abstract public function width(bool $ignoreAnsiDecoration = true): int;
  85276. public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self
  85277. {
  85278. $lines = '' !== $break ? $this->split($break) : [clone $this];
  85279. $chars = [];
  85280. $mask = '';
  85281. if (1 === \count($lines) && '' === $lines[0]->string) {
  85282. return $lines[0];
  85283. }
  85284. foreach ($lines as $i => $line) {
  85285. if ($i) {
  85286. $chars[] = $break;
  85287. $mask .= '#';
  85288. }
  85289. foreach ($line->chunk() as $char) {
  85290. $chars[] = $char->string;
  85291. $mask .= ' ' === $char->string ? ' ' : '?';
  85292. }
  85293. }
  85294. $string = '';
  85295. $j = 0;
  85296. $b = $i = -1;
  85297. $mask = wordwrap($mask, $width, '#', $cut);
  85298. while (false !== $b = strpos($mask, '#', $b + 1)) {
  85299. for (++$i; $i < $b; ++$i) {
  85300. $string .= $chars[$j];
  85301. unset($chars[$j++]);
  85302. }
  85303. if ($break === $chars[$j] || ' ' === $chars[$j]) {
  85304. unset($chars[$j++]);
  85305. }
  85306. $string .= $break;
  85307. }
  85308. $str = clone $this;
  85309. $str->string = $string.implode('', $chars);
  85310. return $str;
  85311. }
  85312. public function __sleep(): array
  85313. {
  85314. return ['string'];
  85315. }
  85316. public function __clone()
  85317. {
  85318. $this->ignoreCase = false;
  85319. }
  85320. public function __toString(): string
  85321. {
  85322. return $this->string;
  85323. }
  85324. }
  85325. <?php
  85326. namespace Symfony\Component\String;
  85327. use Symfony\Component\String\Exception\ExceptionInterface;
  85328. use Symfony\Component\String\Exception\InvalidArgumentException;
  85329. use Symfony\Component\String\Exception\RuntimeException;
  85330. abstract class AbstractUnicodeString extends AbstractString
  85331. {
  85332. public const NFC = \Normalizer::NFC;
  85333. public const NFD = \Normalizer::NFD;
  85334. public const NFKC = \Normalizer::NFKC;
  85335. public const NFKD = \Normalizer::NFKD;
  85336. private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  85337. private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', '�', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'ʼn', 'ǰ', '�', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', '�', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', '�', 'ᾎ', '�', '�', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', '�', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
  85338. private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', 'ṡ', 'ι', 'ss', 'ʼn', 'ǰ', '�', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', '�', 'ὒ', 'ὔ', 'ὖ', 'ἀι', '�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', '�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
  85339. private const UPPER_FROM = ['ß', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', '�', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];
  85340. private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ�', 'Ϋ�', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓�', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ�', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ�', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂'];
  85341. private const TRANSLIT_FROM = ['Æ', '�', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', '�', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', '�', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', '�', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', '�', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', '�', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', '�', 'Ɏ', '�', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', '�', '�', 'ʑ', 'ʙ', 'ʛ', 'ʜ', '�', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', '�', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', '�', '�', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', '�', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', '�', 'ᶎ', '�', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', '�', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '�', '�', '�', '�', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '�', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '�', '„', '‟', '′', '″', '�', '〞', '«', '»', '‹', '›', '�', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '�', '�', '�', '�', '�', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '�', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆'];
  85342. private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))'];
  85343. private static $transliterators = [];
  85344. private static $tableZero;
  85345. private static $tableWide;
  85346. public static function fromCodePoints(int ...$codes): self
  85347. {
  85348. $string = '';
  85349. foreach ($codes as $code) {
  85350. if (0x80 > $code %= 0x200000) {
  85351. $string .= \chr($code);
  85352. } elseif (0x800 > $code) {
  85353. $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  85354. } elseif (0x10000 > $code) {
  85355. $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  85356. } else {
  85357. $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  85358. }
  85359. }
  85360. return new static($string);
  85361. }
  85362. public function ascii(array $rules = []): self
  85363. {
  85364. $str = clone $this;
  85365. $s = $str->string;
  85366. $str->string = '';
  85367. array_unshift($rules, 'nfd');
  85368. $rules[] = 'latin-ascii';
  85369. if (\function_exists('transliterator_transliterate')) {
  85370. $rules[] = 'any-latin/bgn';
  85371. }
  85372. $rules[] = 'nfkd';
  85373. $rules[] = '[:nonspacing mark:] remove';
  85374. while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) {
  85375. if (0 < --$i) {
  85376. $str->string .= substr($s, 0, $i);
  85377. $s = substr($s, $i);
  85378. }
  85379. if (!$rule = array_shift($rules)) {
  85380. $rules = [];
  85381. }
  85382. if ($rule instanceof \Transliterator) {
  85383. $s = $rule->transliterate($s);
  85384. } elseif ($rule instanceof \Closure) {
  85385. $s = $rule($s);
  85386. } elseif ($rule) {
  85387. if ('nfd' === $rule = strtolower($rule)) {
  85388. normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD);
  85389. } elseif ('nfkd' === $rule) {
  85390. normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD);
  85391. } elseif ('[:nonspacing mark:] remove' === $rule) {
  85392. $s = preg_replace('/\p{Mn}++/u', '', $s);
  85393. } elseif ('latin-ascii' === $rule) {
  85394. $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s);
  85395. } elseif ('de-ascii' === $rule) {
  85396. $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s);
  85397. $s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s);
  85398. } elseif (\function_exists('transliterator_transliterate')) {
  85399. if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) {
  85400. if ('any-latin/bgn' === $rule) {
  85401. $rule = 'any-latin';
  85402. $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule);
  85403. }
  85404. if (null === $transliterator) {
  85405. throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule));
  85406. }
  85407. self::$transliterators['any-latin/bgn'] = $transliterator;
  85408. }
  85409. $s = $transliterator->transliterate($s);
  85410. }
  85411. } elseif (!\function_exists('iconv')) {
  85412. $s = preg_replace('/[^\x00-\x7F]/u', '?', $s);
  85413. } else {
  85414. $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
  85415. $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]);
  85416. if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) {
  85417. throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class));
  85418. }
  85419. return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?');
  85420. }, $s);
  85421. }
  85422. }
  85423. $str->string .= $s;
  85424. return $str;
  85425. }
  85426. public function camel(): parent
  85427. {
  85428. $str = clone $this;
  85429. $str->string = str_replace(' ', '', preg_replace_callback('/\b.(?![A-Z]{2,})/u', static function ($m) use (&$i) {
  85430. return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
  85431. }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string)));
  85432. return $str;
  85433. }
  85434. public function codePointsAt(int $offset): array
  85435. {
  85436. $str = $this->slice($offset, 1);
  85437. if ('' === $str->string) {
  85438. return [];
  85439. }
  85440. $codePoints = [];
  85441. foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
  85442. $codePoints[] = mb_ord($c, 'UTF-8');
  85443. }
  85444. return $codePoints;
  85445. }
  85446. public function folded(bool $compat = true): parent
  85447. {
  85448. $str = clone $this;
  85449. if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) {
  85450. $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC);
  85451. $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8');
  85452. } else {
  85453. $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF);
  85454. }
  85455. return $str;
  85456. }
  85457. public function join(array $strings, ?string $lastGlue = null): parent
  85458. {
  85459. $str = clone $this;
  85460. $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
  85461. $str->string = implode($this->string, $strings).$tail;
  85462. if (!preg_match('//u', $str->string)) {
  85463. throw new InvalidArgumentException('Invalid UTF-8 string.');
  85464. }
  85465. return $str;
  85466. }
  85467. public function lower(): parent
  85468. {
  85469. $str = clone $this;
  85470. $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8');
  85471. return $str;
  85472. }
  85473. public function match(string $regexp, int $flags = 0, int $offset = 0): array
  85474. {
  85475. $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
  85476. if ($this->ignoreCase) {
  85477. $regexp .= 'i';
  85478. }
  85479. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  85480. try {
  85481. if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
  85482. $lastError = preg_last_error();
  85483. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  85484. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  85485. throw new RuntimeException('Matching failed with '.$k.'.');
  85486. }
  85487. }
  85488. throw new RuntimeException('Matching failed with unknown error code.');
  85489. }
  85490. } finally {
  85491. restore_error_handler();
  85492. }
  85493. return $matches;
  85494. }
  85495. public function normalize(int $form = self::NFC): self
  85496. {
  85497. if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) {
  85498. throw new InvalidArgumentException('Unsupported normalization form.');
  85499. }
  85500. $str = clone $this;
  85501. normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
  85502. return $str;
  85503. }
  85504. public function padBoth(int $length, string $padStr = ' '): parent
  85505. {
  85506. if ('' === $padStr || !preg_match('//u', $padStr)) {
  85507. throw new InvalidArgumentException('Invalid UTF-8 string.');
  85508. }
  85509. $pad = clone $this;
  85510. $pad->string = $padStr;
  85511. return $this->pad($length, $pad, \STR_PAD_BOTH);
  85512. }
  85513. public function padEnd(int $length, string $padStr = ' '): parent
  85514. {
  85515. if ('' === $padStr || !preg_match('//u', $padStr)) {
  85516. throw new InvalidArgumentException('Invalid UTF-8 string.');
  85517. }
  85518. $pad = clone $this;
  85519. $pad->string = $padStr;
  85520. return $this->pad($length, $pad, \STR_PAD_RIGHT);
  85521. }
  85522. public function padStart(int $length, string $padStr = ' '): parent
  85523. {
  85524. if ('' === $padStr || !preg_match('//u', $padStr)) {
  85525. throw new InvalidArgumentException('Invalid UTF-8 string.');
  85526. }
  85527. $pad = clone $this;
  85528. $pad->string = $padStr;
  85529. return $this->pad($length, $pad, \STR_PAD_LEFT);
  85530. }
  85531. public function replaceMatches(string $fromRegexp, $to): parent
  85532. {
  85533. if ($this->ignoreCase) {
  85534. $fromRegexp .= 'i';
  85535. }
  85536. if (\is_array($to) || $to instanceof \Closure) {
  85537. if (!\is_callable($to)) {
  85538. throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
  85539. }
  85540. $replace = 'preg_replace_callback';
  85541. $to = static function (array $m) use ($to): string {
  85542. $to = $to($m);
  85543. if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) {
  85544. throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.');
  85545. }
  85546. return $to;
  85547. };
  85548. } elseif ('' !== $to && !preg_match('//u', $to)) {
  85549. throw new InvalidArgumentException('Invalid UTF-8 string.');
  85550. } else {
  85551. $replace = 'preg_replace';
  85552. }
  85553. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  85554. try {
  85555. if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
  85556. $lastError = preg_last_error();
  85557. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  85558. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  85559. throw new RuntimeException('Matching failed with '.$k.'.');
  85560. }
  85561. }
  85562. throw new RuntimeException('Matching failed with unknown error code.');
  85563. }
  85564. } finally {
  85565. restore_error_handler();
  85566. }
  85567. $str = clone $this;
  85568. $str->string = $string;
  85569. return $str;
  85570. }
  85571. public function reverse(): parent
  85572. {
  85573. $str = clone $this;
  85574. $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY)));
  85575. return $str;
  85576. }
  85577. public function snake(): parent
  85578. {
  85579. $str = $this->camel();
  85580. $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8');
  85581. return $str;
  85582. }
  85583. public function title(bool $allWords = false): parent
  85584. {
  85585. $str = clone $this;
  85586. $limit = $allWords ? -1 : 1;
  85587. $str->string = preg_replace_callback('/\b./u', static function (array $m): string {
  85588. return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
  85589. }, $str->string, $limit);
  85590. return $str;
  85591. }
  85592. public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  85593. {
  85594. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  85595. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  85596. }
  85597. $chars = preg_quote($chars);
  85598. $str = clone $this;
  85599. $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string);
  85600. return $str;
  85601. }
  85602. public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  85603. {
  85604. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  85605. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  85606. }
  85607. $chars = preg_quote($chars);
  85608. $str = clone $this;
  85609. $str->string = preg_replace("{[$chars]++$}uD", '', $str->string);
  85610. return $str;
  85611. }
  85612. public function trimPrefix($prefix): parent
  85613. {
  85614. if (!$this->ignoreCase) {
  85615. return parent::trimPrefix($prefix);
  85616. }
  85617. $str = clone $this;
  85618. if ($prefix instanceof \Traversable) {
  85619. $prefix = iterator_to_array($prefix, false);
  85620. } elseif ($prefix instanceof parent) {
  85621. $prefix = $prefix->string;
  85622. }
  85623. $prefix = implode('|', array_map('preg_quote', (array) $prefix));
  85624. $str->string = preg_replace("{^(?:$prefix)}iuD", '', $this->string);
  85625. return $str;
  85626. }
  85627. public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  85628. {
  85629. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  85630. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  85631. }
  85632. $chars = preg_quote($chars);
  85633. $str = clone $this;
  85634. $str->string = preg_replace("{^[$chars]++}uD", '', $str->string);
  85635. return $str;
  85636. }
  85637. public function trimSuffix($suffix): parent
  85638. {
  85639. if (!$this->ignoreCase) {
  85640. return parent::trimSuffix($suffix);
  85641. }
  85642. $str = clone $this;
  85643. if ($suffix instanceof \Traversable) {
  85644. $suffix = iterator_to_array($suffix, false);
  85645. } elseif ($suffix instanceof parent) {
  85646. $suffix = $suffix->string;
  85647. }
  85648. $suffix = implode('|', array_map('preg_quote', (array) $suffix));
  85649. $str->string = preg_replace("{(?:$suffix)$}iuD", '', $this->string);
  85650. return $str;
  85651. }
  85652. public function upper(): parent
  85653. {
  85654. $str = clone $this;
  85655. $str->string = mb_strtoupper($str->string, 'UTF-8');
  85656. if (\PHP_VERSION_ID < 70300) {
  85657. $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string);
  85658. }
  85659. return $str;
  85660. }
  85661. public function width(bool $ignoreAnsiDecoration = true): int
  85662. {
  85663. $width = 0;
  85664. $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string);
  85665. if (false !== strpos($s, "\r")) {
  85666. $s = str_replace(["\r\n", "\r"], "\n", $s);
  85667. }
  85668. if (!$ignoreAnsiDecoration) {
  85669. $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s);
  85670. }
  85671. foreach (explode("\n", $s) as $s) {
  85672. if ($ignoreAnsiDecoration) {
  85673. $s = preg_replace('/(?:\x1B(?:
  85674. \[ [\x30-\x3F]*+ [\x20-\x2F]*+ [\x40-\x7E]
  85675. | [P\]X^_] .*? \x1B\\\\
  85676. | [\x41-\x7E]
  85677. )|[\p{Cc}\x7F]++)/xu', '', $s);
  85678. }
  85679. $lineWidth = $this->wcswidth($s);
  85680. if ($lineWidth > $width) {
  85681. $width = $lineWidth;
  85682. }
  85683. }
  85684. return $width;
  85685. }
  85686. private function pad(int $len, self $pad, int $type): parent
  85687. {
  85688. $sLen = $this->length();
  85689. if ($len <= $sLen) {
  85690. return clone $this;
  85691. }
  85692. $padLen = $pad->length();
  85693. $freeLen = $len - $sLen;
  85694. $len = $freeLen % $padLen;
  85695. switch ($type) {
  85696. case \STR_PAD_RIGHT:
  85697. return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  85698. case \STR_PAD_LEFT:
  85699. return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  85700. case \STR_PAD_BOTH:
  85701. $freeLen /= 2;
  85702. $rightLen = ceil($freeLen);
  85703. $len = $rightLen % $padLen;
  85704. $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  85705. $leftLen = floor($freeLen);
  85706. $len = $leftLen % $padLen;
  85707. return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  85708. default:
  85709. throw new InvalidArgumentException('Invalid padding type.');
  85710. }
  85711. }
  85712. private function wcswidth(string $string): int
  85713. {
  85714. $width = 0;
  85715. foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
  85716. $codePoint = mb_ord($c, 'UTF-8');
  85717. if (0 === $codePoint
  85718. || 0x034F === $codePoint
  85719. || (0x200B <= $codePoint && 0x200F >= $codePoint)
  85720. || 0x2028 === $codePoint
  85721. || 0x2029 === $codePoint
  85722. || (0x202A <= $codePoint && 0x202E >= $codePoint)
  85723. || (0x2060 <= $codePoint && 0x2063 >= $codePoint)
  85724. ) {
  85725. continue;
  85726. }
  85727. if (32 > $codePoint
  85728. || (0x07F <= $codePoint && 0x0A0 > $codePoint)
  85729. ) {
  85730. return -1;
  85731. }
  85732. if (null === self::$tableZero) {
  85733. self::$tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php';
  85734. }
  85735. if ($codePoint >= self::$tableZero[0][0] && $codePoint <= self::$tableZero[$ubound = \count(self::$tableZero) - 1][1]) {
  85736. $lbound = 0;
  85737. while ($ubound >= $lbound) {
  85738. $mid = floor(($lbound + $ubound) / 2);
  85739. if ($codePoint > self::$tableZero[$mid][1]) {
  85740. $lbound = $mid + 1;
  85741. } elseif ($codePoint < self::$tableZero[$mid][0]) {
  85742. $ubound = $mid - 1;
  85743. } else {
  85744. continue 2;
  85745. }
  85746. }
  85747. }
  85748. if (null === self::$tableWide) {
  85749. self::$tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php';
  85750. }
  85751. if ($codePoint >= self::$tableWide[0][0] && $codePoint <= self::$tableWide[$ubound = \count(self::$tableWide) - 1][1]) {
  85752. $lbound = 0;
  85753. while ($ubound >= $lbound) {
  85754. $mid = floor(($lbound + $ubound) / 2);
  85755. if ($codePoint > self::$tableWide[$mid][1]) {
  85756. $lbound = $mid + 1;
  85757. } elseif ($codePoint < self::$tableWide[$mid][0]) {
  85758. $ubound = $mid - 1;
  85759. } else {
  85760. $width += 2;
  85761. continue 2;
  85762. }
  85763. }
  85764. }
  85765. ++$width;
  85766. }
  85767. return $width;
  85768. }
  85769. }
  85770. <?php
  85771. namespace Symfony\Component\String;
  85772. use Symfony\Component\String\Exception\ExceptionInterface;
  85773. use Symfony\Component\String\Exception\InvalidArgumentException;
  85774. use Symfony\Component\String\Exception\RuntimeException;
  85775. class ByteString extends AbstractString
  85776. {
  85777. private const ALPHABET_ALPHANUMERIC = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
  85778. public function __construct(string $string = '')
  85779. {
  85780. $this->string = $string;
  85781. }
  85782. public static function fromRandom(int $length = 16, ?string $alphabet = null): self
  85783. {
  85784. if ($length <= 0) {
  85785. throw new InvalidArgumentException(sprintf('A strictly positive length is expected, "%d" given.', $length));
  85786. }
  85787. $alphabet = $alphabet ?? self::ALPHABET_ALPHANUMERIC;
  85788. $alphabetSize = \strlen($alphabet);
  85789. $bits = (int) ceil(log($alphabetSize, 2.0));
  85790. if ($bits <= 0 || $bits > 56) {
  85791. throw new InvalidArgumentException('The length of the alphabet must in the [2^1, 2^56] range.');
  85792. }
  85793. $ret = '';
  85794. while ($length > 0) {
  85795. $urandomLength = (int) ceil(2 * $length * $bits / 8.0);
  85796. $data = random_bytes($urandomLength);
  85797. $unpackedData = 0;
  85798. $unpackedBits = 0;
  85799. for ($i = 0; $i < $urandomLength && $length > 0; ++$i) {
  85800. $unpackedData = ($unpackedData << 8) | \ord($data[$i]);
  85801. $unpackedBits += 8;
  85802. for (; $unpackedBits >= $bits && $length > 0; $unpackedBits -= $bits) {
  85803. $index = ($unpackedData & ((1 << $bits) - 1));
  85804. $unpackedData >>= $bits;
  85805. if ($index < $alphabetSize) {
  85806. $ret .= $alphabet[$index];
  85807. --$length;
  85808. }
  85809. }
  85810. }
  85811. }
  85812. return new static($ret);
  85813. }
  85814. public function bytesAt(int $offset): array
  85815. {
  85816. $str = $this->string[$offset] ?? '';
  85817. return '' === $str ? [] : [\ord($str)];
  85818. }
  85819. public function append(string ...$suffix): parent
  85820. {
  85821. $str = clone $this;
  85822. $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
  85823. return $str;
  85824. }
  85825. public function camel(): parent
  85826. {
  85827. $str = clone $this;
  85828. $parts = explode(' ', trim(ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->string))));
  85829. $parts[0] = 1 !== \strlen($parts[0]) && ctype_upper($parts[0]) ? $parts[0] : lcfirst($parts[0]);
  85830. $str->string = implode('', $parts);
  85831. return $str;
  85832. }
  85833. public function chunk(int $length = 1): array
  85834. {
  85835. if (1 > $length) {
  85836. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  85837. }
  85838. if ('' === $this->string) {
  85839. return [];
  85840. }
  85841. $str = clone $this;
  85842. $chunks = [];
  85843. foreach (str_split($this->string, $length) as $chunk) {
  85844. $str->string = $chunk;
  85845. $chunks[] = clone $str;
  85846. }
  85847. return $chunks;
  85848. }
  85849. public function endsWith($suffix): bool
  85850. {
  85851. if ($suffix instanceof parent) {
  85852. $suffix = $suffix->string;
  85853. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  85854. return parent::endsWith($suffix);
  85855. } else {
  85856. $suffix = (string) $suffix;
  85857. }
  85858. return '' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase);
  85859. }
  85860. public function equalsTo($string): bool
  85861. {
  85862. if ($string instanceof parent) {
  85863. $string = $string->string;
  85864. } elseif (\is_array($string) || $string instanceof \Traversable) {
  85865. return parent::equalsTo($string);
  85866. } else {
  85867. $string = (string) $string;
  85868. }
  85869. if ('' !== $string && $this->ignoreCase) {
  85870. return 0 === strcasecmp($string, $this->string);
  85871. }
  85872. return $string === $this->string;
  85873. }
  85874. public function folded(): parent
  85875. {
  85876. $str = clone $this;
  85877. $str->string = strtolower($str->string);
  85878. return $str;
  85879. }
  85880. public function indexOf($needle, int $offset = 0): ?int
  85881. {
  85882. if ($needle instanceof parent) {
  85883. $needle = $needle->string;
  85884. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  85885. return parent::indexOf($needle, $offset);
  85886. } else {
  85887. $needle = (string) $needle;
  85888. }
  85889. if ('' === $needle) {
  85890. return null;
  85891. }
  85892. $i = $this->ignoreCase ? stripos($this->string, $needle, $offset) : strpos($this->string, $needle, $offset);
  85893. return false === $i ? null : $i;
  85894. }
  85895. public function indexOfLast($needle, int $offset = 0): ?int
  85896. {
  85897. if ($needle instanceof parent) {
  85898. $needle = $needle->string;
  85899. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  85900. return parent::indexOfLast($needle, $offset);
  85901. } else {
  85902. $needle = (string) $needle;
  85903. }
  85904. if ('' === $needle) {
  85905. return null;
  85906. }
  85907. $i = $this->ignoreCase ? strripos($this->string, $needle, $offset) : strrpos($this->string, $needle, $offset);
  85908. return false === $i ? null : $i;
  85909. }
  85910. public function isUtf8(): bool
  85911. {
  85912. return '' === $this->string || preg_match('//u', $this->string);
  85913. }
  85914. public function join(array $strings, ?string $lastGlue = null): parent
  85915. {
  85916. $str = clone $this;
  85917. $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
  85918. $str->string = implode($this->string, $strings).$tail;
  85919. return $str;
  85920. }
  85921. public function length(): int
  85922. {
  85923. return \strlen($this->string);
  85924. }
  85925. public function lower(): parent
  85926. {
  85927. $str = clone $this;
  85928. $str->string = strtolower($str->string);
  85929. return $str;
  85930. }
  85931. public function match(string $regexp, int $flags = 0, int $offset = 0): array
  85932. {
  85933. $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
  85934. if ($this->ignoreCase) {
  85935. $regexp .= 'i';
  85936. }
  85937. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  85938. try {
  85939. if (false === $match($regexp, $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
  85940. $lastError = preg_last_error();
  85941. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  85942. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  85943. throw new RuntimeException('Matching failed with '.$k.'.');
  85944. }
  85945. }
  85946. throw new RuntimeException('Matching failed with unknown error code.');
  85947. }
  85948. } finally {
  85949. restore_error_handler();
  85950. }
  85951. return $matches;
  85952. }
  85953. public function padBoth(int $length, string $padStr = ' '): parent
  85954. {
  85955. $str = clone $this;
  85956. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_BOTH);
  85957. return $str;
  85958. }
  85959. public function padEnd(int $length, string $padStr = ' '): parent
  85960. {
  85961. $str = clone $this;
  85962. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_RIGHT);
  85963. return $str;
  85964. }
  85965. public function padStart(int $length, string $padStr = ' '): parent
  85966. {
  85967. $str = clone $this;
  85968. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_LEFT);
  85969. return $str;
  85970. }
  85971. public function prepend(string ...$prefix): parent
  85972. {
  85973. $str = clone $this;
  85974. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$str->string;
  85975. return $str;
  85976. }
  85977. public function replace(string $from, string $to): parent
  85978. {
  85979. $str = clone $this;
  85980. if ('' !== $from) {
  85981. $str->string = $this->ignoreCase ? str_ireplace($from, $to, $this->string) : str_replace($from, $to, $this->string);
  85982. }
  85983. return $str;
  85984. }
  85985. public function replaceMatches(string $fromRegexp, $to): parent
  85986. {
  85987. if ($this->ignoreCase) {
  85988. $fromRegexp .= 'i';
  85989. }
  85990. if (\is_array($to)) {
  85991. if (!\is_callable($to)) {
  85992. throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
  85993. }
  85994. $replace = 'preg_replace_callback';
  85995. } else {
  85996. $replace = $to instanceof \Closure ? 'preg_replace_callback' : 'preg_replace';
  85997. }
  85998. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  85999. try {
  86000. if (null === $string = $replace($fromRegexp, $to, $this->string)) {
  86001. $lastError = preg_last_error();
  86002. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  86003. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  86004. throw new RuntimeException('Matching failed with '.$k.'.');
  86005. }
  86006. }
  86007. throw new RuntimeException('Matching failed with unknown error code.');
  86008. }
  86009. } finally {
  86010. restore_error_handler();
  86011. }
  86012. $str = clone $this;
  86013. $str->string = $string;
  86014. return $str;
  86015. }
  86016. public function reverse(): parent
  86017. {
  86018. $str = clone $this;
  86019. $str->string = strrev($str->string);
  86020. return $str;
  86021. }
  86022. public function slice(int $start = 0, ?int $length = null): parent
  86023. {
  86024. $str = clone $this;
  86025. $str->string = (string) substr($this->string, $start, $length ?? \PHP_INT_MAX);
  86026. return $str;
  86027. }
  86028. public function snake(): parent
  86029. {
  86030. $str = $this->camel();
  86031. $str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
  86032. return $str;
  86033. }
  86034. public function splice(string $replacement, int $start = 0, ?int $length = null): parent
  86035. {
  86036. $str = clone $this;
  86037. $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
  86038. return $str;
  86039. }
  86040. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  86041. {
  86042. if (1 > $limit = $limit ?? \PHP_INT_MAX) {
  86043. throw new InvalidArgumentException('Split limit must be a positive integer.');
  86044. }
  86045. if ('' === $delimiter) {
  86046. throw new InvalidArgumentException('Split delimiter is empty.');
  86047. }
  86048. if (null !== $flags) {
  86049. return parent::split($delimiter, $limit, $flags);
  86050. }
  86051. $str = clone $this;
  86052. $chunks = $this->ignoreCase
  86053. ? preg_split('{'.preg_quote($delimiter).'}iD', $this->string, $limit)
  86054. : explode($delimiter, $this->string, $limit);
  86055. foreach ($chunks as &$chunk) {
  86056. $str->string = $chunk;
  86057. $chunk = clone $str;
  86058. }
  86059. return $chunks;
  86060. }
  86061. public function startsWith($prefix): bool
  86062. {
  86063. if ($prefix instanceof parent) {
  86064. $prefix = $prefix->string;
  86065. } elseif (!\is_string($prefix)) {
  86066. return parent::startsWith($prefix);
  86067. }
  86068. return '' !== $prefix && 0 === ($this->ignoreCase ? strncasecmp($this->string, $prefix, \strlen($prefix)) : strncmp($this->string, $prefix, \strlen($prefix)));
  86069. }
  86070. public function title(bool $allWords = false): parent
  86071. {
  86072. $str = clone $this;
  86073. $str->string = $allWords ? ucwords($str->string) : ucfirst($str->string);
  86074. return $str;
  86075. }
  86076. public function toUnicodeString(?string $fromEncoding = null): UnicodeString
  86077. {
  86078. return new UnicodeString($this->toCodePointString($fromEncoding)->string);
  86079. }
  86080. public function toCodePointString(?string $fromEncoding = null): CodePointString
  86081. {
  86082. $u = new CodePointString();
  86083. if (\in_array($fromEncoding, [null, 'utf8', 'utf-8', 'UTF8', 'UTF-8'], true) && preg_match('//u', $this->string)) {
  86084. $u->string = $this->string;
  86085. return $u;
  86086. }
  86087. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  86088. try {
  86089. try {
  86090. $validEncoding = false !== mb_detect_encoding($this->string, $fromEncoding ?? 'Windows-1252', true);
  86091. } catch (InvalidArgumentException $e) {
  86092. if (!\function_exists('iconv')) {
  86093. throw $e;
  86094. }
  86095. $u->string = iconv($fromEncoding ?? 'Windows-1252', 'UTF-8', $this->string);
  86096. return $u;
  86097. }
  86098. } finally {
  86099. restore_error_handler();
  86100. }
  86101. if (!$validEncoding) {
  86102. throw new InvalidArgumentException(sprintf('Invalid "%s" string.', $fromEncoding ?? 'Windows-1252'));
  86103. }
  86104. $u->string = mb_convert_encoding($this->string, 'UTF-8', $fromEncoding ?? 'Windows-1252');
  86105. return $u;
  86106. }
  86107. public function trim(string $chars = " \t\n\r\0\x0B\x0C"): parent
  86108. {
  86109. $str = clone $this;
  86110. $str->string = trim($str->string, $chars);
  86111. return $str;
  86112. }
  86113. public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C"): parent
  86114. {
  86115. $str = clone $this;
  86116. $str->string = rtrim($str->string, $chars);
  86117. return $str;
  86118. }
  86119. public function trimStart(string $chars = " \t\n\r\0\x0B\x0C"): parent
  86120. {
  86121. $str = clone $this;
  86122. $str->string = ltrim($str->string, $chars);
  86123. return $str;
  86124. }
  86125. public function upper(): parent
  86126. {
  86127. $str = clone $this;
  86128. $str->string = strtoupper($str->string);
  86129. return $str;
  86130. }
  86131. public function width(bool $ignoreAnsiDecoration = true): int
  86132. {
  86133. $string = preg_match('//u', $this->string) ? $this->string : preg_replace('/[\x80-\xFF]/', '?', $this->string);
  86134. return (new CodePointString($string))->width($ignoreAnsiDecoration);
  86135. }
  86136. }
  86137. <?php
  86138. namespace Symfony\Component\String;
  86139. use Symfony\Component\String\Exception\ExceptionInterface;
  86140. use Symfony\Component\String\Exception\InvalidArgumentException;
  86141. class CodePointString extends AbstractUnicodeString
  86142. {
  86143. public function __construct(string $string = '')
  86144. {
  86145. if ('' !== $string && !preg_match('//u', $string)) {
  86146. throw new InvalidArgumentException('Invalid UTF-8 string.');
  86147. }
  86148. $this->string = $string;
  86149. }
  86150. public function append(string ...$suffix): AbstractString
  86151. {
  86152. $str = clone $this;
  86153. $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
  86154. if (!preg_match('//u', $str->string)) {
  86155. throw new InvalidArgumentException('Invalid UTF-8 string.');
  86156. }
  86157. return $str;
  86158. }
  86159. public function chunk(int $length = 1): array
  86160. {
  86161. if (1 > $length) {
  86162. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  86163. }
  86164. if ('' === $this->string) {
  86165. return [];
  86166. }
  86167. $rx = '/(';
  86168. while (65535 < $length) {
  86169. $rx .= '.{65535}';
  86170. $length -= 65535;
  86171. }
  86172. $rx .= '.{'.$length.'})/us';
  86173. $str = clone $this;
  86174. $chunks = [];
  86175. foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
  86176. $str->string = $chunk;
  86177. $chunks[] = clone $str;
  86178. }
  86179. return $chunks;
  86180. }
  86181. public function codePointsAt(int $offset): array
  86182. {
  86183. $str = $offset ? $this->slice($offset, 1) : $this;
  86184. return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')];
  86185. }
  86186. public function endsWith($suffix): bool
  86187. {
  86188. if ($suffix instanceof AbstractString) {
  86189. $suffix = $suffix->string;
  86190. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  86191. return parent::endsWith($suffix);
  86192. } else {
  86193. $suffix = (string) $suffix;
  86194. }
  86195. if ('' === $suffix || !preg_match('//u', $suffix)) {
  86196. return false;
  86197. }
  86198. if ($this->ignoreCase) {
  86199. return preg_match('{'.preg_quote($suffix).'$}iuD', $this->string);
  86200. }
  86201. return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix));
  86202. }
  86203. public function equalsTo($string): bool
  86204. {
  86205. if ($string instanceof AbstractString) {
  86206. $string = $string->string;
  86207. } elseif (\is_array($string) || $string instanceof \Traversable) {
  86208. return parent::equalsTo($string);
  86209. } else {
  86210. $string = (string) $string;
  86211. }
  86212. if ('' !== $string && $this->ignoreCase) {
  86213. return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
  86214. }
  86215. return $string === $this->string;
  86216. }
  86217. public function indexOf($needle, int $offset = 0): ?int
  86218. {
  86219. if ($needle instanceof AbstractString) {
  86220. $needle = $needle->string;
  86221. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  86222. return parent::indexOf($needle, $offset);
  86223. } else {
  86224. $needle = (string) $needle;
  86225. }
  86226. if ('' === $needle) {
  86227. return null;
  86228. }
  86229. $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8');
  86230. return false === $i ? null : $i;
  86231. }
  86232. public function indexOfLast($needle, int $offset = 0): ?int
  86233. {
  86234. if ($needle instanceof AbstractString) {
  86235. $needle = $needle->string;
  86236. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  86237. return parent::indexOfLast($needle, $offset);
  86238. } else {
  86239. $needle = (string) $needle;
  86240. }
  86241. if ('' === $needle) {
  86242. return null;
  86243. }
  86244. $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8');
  86245. return false === $i ? null : $i;
  86246. }
  86247. public function length(): int
  86248. {
  86249. return mb_strlen($this->string, 'UTF-8');
  86250. }
  86251. public function prepend(string ...$prefix): AbstractString
  86252. {
  86253. $str = clone $this;
  86254. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
  86255. if (!preg_match('//u', $str->string)) {
  86256. throw new InvalidArgumentException('Invalid UTF-8 string.');
  86257. }
  86258. return $str;
  86259. }
  86260. public function replace(string $from, string $to): AbstractString
  86261. {
  86262. $str = clone $this;
  86263. if ('' === $from || !preg_match('//u', $from)) {
  86264. return $str;
  86265. }
  86266. if ('' !== $to && !preg_match('//u', $to)) {
  86267. throw new InvalidArgumentException('Invalid UTF-8 string.');
  86268. }
  86269. if ($this->ignoreCase) {
  86270. $str->string = implode($to, preg_split('{'.preg_quote($from).'}iuD', $this->string));
  86271. } else {
  86272. $str->string = str_replace($from, $to, $this->string);
  86273. }
  86274. return $str;
  86275. }
  86276. public function slice(int $start = 0, ?int $length = null): AbstractString
  86277. {
  86278. $str = clone $this;
  86279. $str->string = mb_substr($this->string, $start, $length, 'UTF-8');
  86280. return $str;
  86281. }
  86282. public function splice(string $replacement, int $start = 0, ?int $length = null): AbstractString
  86283. {
  86284. if (!preg_match('//u', $replacement)) {
  86285. throw new InvalidArgumentException('Invalid UTF-8 string.');
  86286. }
  86287. $str = clone $this;
  86288. $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0;
  86289. $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length;
  86290. $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
  86291. return $str;
  86292. }
  86293. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  86294. {
  86295. if (1 > $limit = $limit ?? \PHP_INT_MAX) {
  86296. throw new InvalidArgumentException('Split limit must be a positive integer.');
  86297. }
  86298. if ('' === $delimiter) {
  86299. throw new InvalidArgumentException('Split delimiter is empty.');
  86300. }
  86301. if (null !== $flags) {
  86302. return parent::split($delimiter.'u', $limit, $flags);
  86303. }
  86304. if (!preg_match('//u', $delimiter)) {
  86305. throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
  86306. }
  86307. $str = clone $this;
  86308. $chunks = $this->ignoreCase
  86309. ? preg_split('{'.preg_quote($delimiter).'}iuD', $this->string, $limit)
  86310. : explode($delimiter, $this->string, $limit);
  86311. foreach ($chunks as &$chunk) {
  86312. $str->string = $chunk;
  86313. $chunk = clone $str;
  86314. }
  86315. return $chunks;
  86316. }
  86317. public function startsWith($prefix): bool
  86318. {
  86319. if ($prefix instanceof AbstractString) {
  86320. $prefix = $prefix->string;
  86321. } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
  86322. return parent::startsWith($prefix);
  86323. } else {
  86324. $prefix = (string) $prefix;
  86325. }
  86326. if ('' === $prefix || !preg_match('//u', $prefix)) {
  86327. return false;
  86328. }
  86329. if ($this->ignoreCase) {
  86330. return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8');
  86331. }
  86332. return 0 === strncmp($this->string, $prefix, \strlen($prefix));
  86333. }
  86334. }
  86335. <?php
  86336. namespace Symfony\Component\String\Exception;
  86337. interface ExceptionInterface extends \Throwable
  86338. {
  86339. }
  86340. <?php
  86341. namespace Symfony\Component\String\Exception;
  86342. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  86343. {
  86344. }
  86345. <?php
  86346. namespace Symfony\Component\String\Exception;
  86347. class RuntimeException extends \RuntimeException implements ExceptionInterface
  86348. {
  86349. }
  86350. <?php
  86351. namespace Symfony\Component\String\Inflector;
  86352. final class EnglishInflector implements InflectorInterface
  86353. {
  86354. private const PLURAL_MAP = [
  86355. ['a', 1, true, true, ['on', 'um']],
  86356. ['ea', 2, true, true, 'a'],
  86357. ['secivres', 8, true, true, 'service'],
  86358. ['eci', 3, false, true, 'ouse'],
  86359. ['esee', 4, false, true, 'oose'],
  86360. ['i', 1, true, true, 'us'],
  86361. ['nem', 3, true, true, 'man'],
  86362. ['nerdlihc', 8, true, true, 'child'],
  86363. ['nexo', 4, false, false, 'ox'],
  86364. ['seci', 4, false, true, ['ex', 'ix', 'ice']],
  86365. ['sedoc', 5, false, true, 'code'],
  86366. ['seifles', 7, true, true, 'selfie'],
  86367. ['seibmoz', 7, true, true, 'zombie'],
  86368. ['seivom', 6, true, true, 'movie'],
  86369. ['seman', 5, true, false, 'name'],
  86370. ['sesutcep', 8, true, true, 'pectus'],
  86371. ['teef', 4, true, true, 'foot'],
  86372. ['eseeg', 5, true, true, 'goose'],
  86373. ['hteet', 5, true, true, 'tooth'],
  86374. ['swen', 4, true, true, 'news'],
  86375. ['seires', 6, true, true, 'series'],
  86376. ['sei', 3, false, true, 'y'],
  86377. ['sess', 4, true, false, 'ss'],
  86378. ['sesutats', 8, true, true, 'status'],
  86379. ['ses', 3, true, true, ['s', 'se', 'sis']],
  86380. ['sevit', 5, true, true, 'tive'],
  86381. ['sevird', 6, false, true, 'drive'],
  86382. ['sevi', 4, false, true, 'ife'],
  86383. ['sevom', 5, true, true, 'move'],
  86384. ['sev', 3, true, true, ['f', 've', 'ff']],
  86385. ['sexa', 4, false, false, ['ax', 'axe', 'axis']],
  86386. ['sex', 3, true, false, 'x'],
  86387. ['sezz', 4, true, false, 'z'],
  86388. ['suae', 4, false, true, 'eau'],
  86389. ['see', 3, true, true, 'ee'],
  86390. ['segd', 4, true, true, 'dge'],
  86391. ['se', 2, true, true, ['', 'e']],
  86392. ['sutats', 6, true, true, 'status'],
  86393. ['s', 1, true, true, ''],
  86394. ['xuae', 4, false, true, 'eau'],
  86395. ['elpoep', 6, true, true, 'person'],
  86396. ];
  86397. private const SINGULAR_MAP = [
  86398. ['sixa', 4, false, false, 'axes'],
  86399. ['airetirc', 8, false, false, 'criterion'],
  86400. ['aluben', 6, false, false, 'nebulae'],
  86401. ['dlihc', 5, true, true, 'children'],
  86402. ['eci', 3, false, true, 'ices'],
  86403. ['ecivres', 7, true, true, 'services'],
  86404. ['efi', 3, false, true, 'ives'],
  86405. ['eifles', 6, true, true, 'selfies'],
  86406. ['eivom', 5, true, true, 'movies'],
  86407. ['esuol', 5, false, true, 'lice'],
  86408. ['esuom', 5, false, true, 'mice'],
  86409. ['esoo', 4, false, true, 'eese'],
  86410. ['es', 2, true, true, 'ses'],
  86411. ['esoog', 5, true, true, 'geese'],
  86412. ['ev', 2, true, true, 'ves'],
  86413. ['evird', 5, false, true, 'drives'],
  86414. ['evit', 4, true, true, 'tives'],
  86415. ['evom', 4, true, true, 'moves'],
  86416. ['ffats', 5, true, true, 'staves'],
  86417. ['ff', 2, true, true, 'ffs'],
  86418. ['f', 1, true, true, ['fs', 'ves']],
  86419. ['hc', 2, true, true, 'ches'],
  86420. ['hs', 2, true, true, 'shes'],
  86421. ['htoot', 5, true, true, 'teeth'],
  86422. ['mu', 2, true, true, 'a'],
  86423. ['nam', 3, true, true, 'men'],
  86424. ['nosrep', 6, true, true, ['persons', 'people']],
  86425. ['noi', 3, true, true, 'ions'],
  86426. ['nop', 3, true, true, 'pons'],
  86427. ['nos', 3, true, true, 'sons'],
  86428. ['noc', 3, true, true, 'cons'],
  86429. ['no', 2, true, true, 'a'],
  86430. ['ohce', 4, true, true, 'echoes'],
  86431. ['oreh', 4, true, true, 'heroes'],
  86432. ['salta', 5, true, true, 'atlases'],
  86433. ['siri', 4, true, true, 'irises'],
  86434. ['sis', 3, true, true, 'ses'],
  86435. ['ss', 2, true, false, 'sses'],
  86436. ['suballys', 8, true, true, 'syllabi'],
  86437. ['sub', 3, true, true, 'buses'],
  86438. ['suc', 3, true, true, 'cuses'],
  86439. ['sutats', 6, true, true, ['status', 'statuses']],
  86440. ['sutcep', 6, true, true, 'pectuses'],
  86441. ['su', 2, true, true, 'i'],
  86442. ['swen', 4, true, true, 'news'],
  86443. ['toof', 4, true, true, 'feet'],
  86444. ['uae', 3, false, true, ['eaus', 'eaux']],
  86445. ['xo', 2, false, false, 'oxen'],
  86446. ['xaoh', 4, true, false, 'hoaxes'],
  86447. ['xedni', 5, false, true, ['indicies', 'indexes']],
  86448. ['xo', 2, false, true, 'oxes'],
  86449. ['x', 1, true, false, ['cies', 'xes']],
  86450. ['xi', 2, false, true, 'ices'],
  86451. ['y', 1, false, true, 'ies'],
  86452. ['ziuq', 4, true, false, 'quizzes'],
  86453. ['z', 1, true, true, 'zes'],
  86454. ];
  86455. private const UNINFLECTED = [
  86456. '',
  86457. 'atad',
  86458. 'reed',
  86459. 'tnempiuqe',
  86460. 'kcabdeef',
  86461. 'hsif',
  86462. 'htlaeh',
  86463. 'yrotsih',
  86464. 'ofni',
  86465. 'noitamrofni',
  86466. 'yenom',
  86467. 'esoom',
  86468. 'seires',
  86469. 'peehs',
  86470. 'seiceps',
  86471. 'ciffart',
  86472. 'tfarcria',
  86473. ];
  86474. public function singularize(string $plural): array
  86475. {
  86476. $pluralRev = strrev($plural);
  86477. $lowerPluralRev = strtolower($pluralRev);
  86478. $pluralLength = \strlen($lowerPluralRev);
  86479. if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
  86480. return [$plural];
  86481. }
  86482. foreach (self::PLURAL_MAP as $map) {
  86483. $suffix = $map[0];
  86484. $suffixLength = $map[1];
  86485. $j = 0;
  86486. while ($suffix[$j] === $lowerPluralRev[$j]) {
  86487. ++$j;
  86488. if ($j === $suffixLength) {
  86489. if ($j < $pluralLength) {
  86490. $nextIsVowel = false !== strpos('aeiou', $lowerPluralRev[$j]);
  86491. if (!$map[2] && $nextIsVowel) {
  86492. break;
  86493. }
  86494. if (!$map[3] && !$nextIsVowel) {
  86495. break;
  86496. }
  86497. }
  86498. $newBase = substr($plural, 0, $pluralLength - $suffixLength);
  86499. $newSuffix = $map[4];
  86500. $firstUpper = ctype_upper($pluralRev[$j - 1]);
  86501. if (\is_array($newSuffix)) {
  86502. $singulars = [];
  86503. foreach ($newSuffix as $newSuffixEntry) {
  86504. $singulars[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
  86505. }
  86506. return $singulars;
  86507. }
  86508. return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
  86509. }
  86510. if ($j === $pluralLength) {
  86511. break;
  86512. }
  86513. }
  86514. }
  86515. return [$plural];
  86516. }
  86517. public function pluralize(string $singular): array
  86518. {
  86519. $singularRev = strrev($singular);
  86520. $lowerSingularRev = strtolower($singularRev);
  86521. $singularLength = \strlen($lowerSingularRev);
  86522. if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
  86523. return [$singular];
  86524. }
  86525. foreach (self::SINGULAR_MAP as $map) {
  86526. $suffix = $map[0];
  86527. $suffixLength = $map[1];
  86528. $j = 0;
  86529. while ($suffix[$j] === $lowerSingularRev[$j]) {
  86530. ++$j;
  86531. if ($j === $suffixLength) {
  86532. if ($j < $singularLength) {
  86533. $nextIsVowel = false !== strpos('aeiou', $lowerSingularRev[$j]);
  86534. if (!$map[2] && $nextIsVowel) {
  86535. break;
  86536. }
  86537. if (!$map[3] && !$nextIsVowel) {
  86538. break;
  86539. }
  86540. }
  86541. $newBase = substr($singular, 0, $singularLength - $suffixLength);
  86542. $newSuffix = $map[4];
  86543. $firstUpper = ctype_upper($singularRev[$j - 1]);
  86544. if (\is_array($newSuffix)) {
  86545. $plurals = [];
  86546. foreach ($newSuffix as $newSuffixEntry) {
  86547. $plurals[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
  86548. }
  86549. return $plurals;
  86550. }
  86551. return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
  86552. }
  86553. if ($j === $singularLength) {
  86554. break;
  86555. }
  86556. }
  86557. }
  86558. return [$singular.'s'];
  86559. }
  86560. }
  86561. <?php
  86562. namespace Symfony\Component\String\Inflector;
  86563. final class FrenchInflector implements InflectorInterface
  86564. {
  86565. private const PLURALIZE_REGEXP = [
  86566. ['/(s|x|z)$/i', '\1'],
  86567. ['/(eau)$/i', '\1x'],
  86568. ['/^(landau)$/i', '\1s'],
  86569. ['/(au)$/i', '\1x'],
  86570. ['/^(pneu|bleu|émeu)$/i', '\1s'],
  86571. ['/(eu)$/i', '\1x'],
  86572. ['/^(bal|carnaval|caracal|chacal|choral|corral|étal|festival|récital|val)$/i', '\1s'],
  86573. ['/al$/i', '\1aux'],
  86574. ['/^(aspir|b|cor|ém|ferm|soupir|trav|vant|vitr)ail$/i', '\1aux'],
  86575. ['/^(bij|caill|ch|gen|hib|jouj|p)ou$/i', '\1oux'],
  86576. ['/^(cinquante|soixante|mille)$/i', '\1'],
  86577. ['/^(mon|ma)(sieur|dame|demoiselle|seigneur)$/', 'mes\2s'],
  86578. ['/^(Mon|Ma)(sieur|dame|demoiselle|seigneur)$/', 'Mes\2s'],
  86579. ];
  86580. private const SINGULARIZE_REGEXP = [
  86581. ['/((aspir|b|cor|ém|ferm|soupir|trav|vant|vitr))aux$/i', '\1ail'],
  86582. ['/(eau)x$/i', '\1'],
  86583. ['/(amir|anim|arsen|boc|can|capit|capor|chev|crist|génér|hopit|hôpit|idé|journ|littor|loc|m|mét|minér|princip|radic|termin)aux$/i', '\1al'],
  86584. ['/(au)x$/i', '\1'],
  86585. ['/(eu)x$/i', '\1'],
  86586. ['/(bij|caill|ch|gen|hib|jouj|p)oux$/i', '\1ou'],
  86587. ['/^mes(dame|demoiselle)s$/', 'ma\1'],
  86588. ['/^Mes(dame|demoiselle)s$/', 'Ma\1'],
  86589. ['/^mes(sieur|seigneur)s$/', 'mon\1'],
  86590. ['/^Mes(sieur|seigneur)s$/', 'Mon\1'],
  86591. ['/s$/i', ''],
  86592. ];
  86593. private const UNINFLECTED = '/^(abcès|accès|abus|albatros|anchois|anglais|autobus|bois|brebis|carquois|cas|chas|colis|concours|corps|cours|cyprès|décès|devis|discours|dos|embarras|engrais|entrelacs|excès|fils|fois|gâchis|gars|glas|héros|intrus|jars|jus|kermès|lacis|legs|lilas|marais|mars|matelas|mépris|mets|mois|mors|obus|os|palais|paradis|parcours|pardessus|pays|plusieurs|poids|pois|pouls|printemps|processus|progrès|puits|pus|rabais|radis|recors|recours|refus|relais|remords|remous|rictus|rhinocéros|repas|rubis|sans|sas|secours|sens|souris|succès|talus|tapis|tas|taudis|temps|tiers|univers|velours|verglas|vernis|virus)$/i';
  86594. public function singularize(string $plural): array
  86595. {
  86596. if ($this->isInflectedWord($plural)) {
  86597. return [$plural];
  86598. }
  86599. foreach (self::SINGULARIZE_REGEXP as $rule) {
  86600. [$regexp, $replace] = $rule;
  86601. if (1 === preg_match($regexp, $plural)) {
  86602. return [preg_replace($regexp, $replace, $plural)];
  86603. }
  86604. }
  86605. return [$plural];
  86606. }
  86607. public function pluralize(string $singular): array
  86608. {
  86609. if ($this->isInflectedWord($singular)) {
  86610. return [$singular];
  86611. }
  86612. foreach (self::PLURALIZE_REGEXP as $rule) {
  86613. [$regexp, $replace] = $rule;
  86614. if (1 === preg_match($regexp, $singular)) {
  86615. return [preg_replace($regexp, $replace, $singular)];
  86616. }
  86617. }
  86618. return [$singular.'s'];
  86619. }
  86620. private function isInflectedWord(string $word): bool
  86621. {
  86622. return 1 === preg_match(self::UNINFLECTED, $word);
  86623. }
  86624. }
  86625. <?php
  86626. namespace Symfony\Component\String\Inflector;
  86627. interface InflectorInterface
  86628. {
  86629. public function singularize(string $plural): array;
  86630. public function pluralize(string $singular): array;
  86631. }
  86632. Copyright (c) 2019-present Fabien Potencier
  86633. Permission is hereby granted, free of charge, to any person obtaining a copy
  86634. of this software and associated documentation files (the "Software"), to deal
  86635. in the Software without restriction, including without limitation the rights
  86636. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  86637. copies of the Software, and to permit persons to whom the Software is furnished
  86638. to do so, subject to the following conditions:
  86639. The above copyright notice and this permission notice shall be included in all
  86640. copies or substantial portions of the Software.
  86641. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  86642. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  86643. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  86644. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  86645. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  86646. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  86647. THE SOFTWARE.
  86648. <?php
  86649. namespace Symfony\Component\String;
  86650. class LazyString implements \Stringable, \JsonSerializable
  86651. {
  86652. private $value;
  86653. public static function fromCallable($callback, ...$arguments): self
  86654. {
  86655. if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) {
  86656. throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type($callback)));
  86657. }
  86658. $lazyString = new static();
  86659. $lazyString->value = static function () use (&$callback, &$arguments, &$value): string {
  86660. if (null !== $arguments) {
  86661. if (!\is_callable($callback)) {
  86662. $callback[0] = $callback[0]();
  86663. $callback[1] = $callback[1] ?? '__invoke';
  86664. }
  86665. $value = $callback(...$arguments);
  86666. $callback = self::getPrettyName($callback);
  86667. $arguments = null;
  86668. }
  86669. return $value ?? '';
  86670. };
  86671. return $lazyString;
  86672. }
  86673. public static function fromStringable($value): self
  86674. {
  86675. if (!self::isStringable($value)) {
  86676. throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value)));
  86677. }
  86678. if (\is_object($value)) {
  86679. return static::fromCallable([$value, '__toString']);
  86680. }
  86681. $lazyString = new static();
  86682. $lazyString->value = (string) $value;
  86683. return $lazyString;
  86684. }
  86685. final public static function isStringable($value): bool
  86686. {
  86687. return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : \is_scalar($value));
  86688. }
  86689. final public static function resolve($value): string
  86690. {
  86691. return $value;
  86692. }
  86693. public function __toString()
  86694. {
  86695. if (\is_string($this->value)) {
  86696. return $this->value;
  86697. }
  86698. try {
  86699. return $this->value = ($this->value)();
  86700. } catch (\Throwable $e) {
  86701. if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) {
  86702. $type = explode(', ', $e->getMessage());
  86703. $type = substr(array_pop($type), 0, -\strlen(' returned'));
  86704. $r = new \ReflectionFunction($this->value);
  86705. $callback = $r->getStaticVariables()['callback'];
  86706. $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type));
  86707. }
  86708. if (\PHP_VERSION_ID < 70400) {
  86709. return trigger_error($e, \E_USER_ERROR);
  86710. }
  86711. throw $e;
  86712. }
  86713. }
  86714. public function __sleep(): array
  86715. {
  86716. $this->__toString();
  86717. return ['value'];
  86718. }
  86719. public function jsonSerialize(): string
  86720. {
  86721. return $this->__toString();
  86722. }
  86723. private function __construct()
  86724. {
  86725. }
  86726. private static function getPrettyName(callable $callback): string
  86727. {
  86728. if (\is_string($callback)) {
  86729. return $callback;
  86730. }
  86731. if (\is_array($callback)) {
  86732. $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0];
  86733. $method = $callback[1];
  86734. } elseif ($callback instanceof \Closure) {
  86735. $r = new \ReflectionFunction($callback);
  86736. if (false !== strpos($r->name, '{closure}') || !$class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
  86737. return $r->name;
  86738. }
  86739. $class = $class->name;
  86740. $method = $r->name;
  86741. } else {
  86742. $class = get_debug_type($callback);
  86743. $method = '__invoke';
  86744. }
  86745. return $class.'::'.$method;
  86746. }
  86747. }
  86748. <?php
  86749. return [
  86750. [
  86751. 4352,
  86752. 4447,
  86753. ],
  86754. [
  86755. 8986,
  86756. 8987,
  86757. ],
  86758. [
  86759. 9001,
  86760. 9001,
  86761. ],
  86762. [
  86763. 9002,
  86764. 9002,
  86765. ],
  86766. [
  86767. 9193,
  86768. 9196,
  86769. ],
  86770. [
  86771. 9200,
  86772. 9200,
  86773. ],
  86774. [
  86775. 9203,
  86776. 9203,
  86777. ],
  86778. [
  86779. 9725,
  86780. 9726,
  86781. ],
  86782. [
  86783. 9748,
  86784. 9749,
  86785. ],
  86786. [
  86787. 9800,
  86788. 9811,
  86789. ],
  86790. [
  86791. 9855,
  86792. 9855,
  86793. ],
  86794. [
  86795. 9875,
  86796. 9875,
  86797. ],
  86798. [
  86799. 9889,
  86800. 9889,
  86801. ],
  86802. [
  86803. 9898,
  86804. 9899,
  86805. ],
  86806. [
  86807. 9917,
  86808. 9918,
  86809. ],
  86810. [
  86811. 9924,
  86812. 9925,
  86813. ],
  86814. [
  86815. 9934,
  86816. 9934,
  86817. ],
  86818. [
  86819. 9940,
  86820. 9940,
  86821. ],
  86822. [
  86823. 9962,
  86824. 9962,
  86825. ],
  86826. [
  86827. 9970,
  86828. 9971,
  86829. ],
  86830. [
  86831. 9973,
  86832. 9973,
  86833. ],
  86834. [
  86835. 9978,
  86836. 9978,
  86837. ],
  86838. [
  86839. 9981,
  86840. 9981,
  86841. ],
  86842. [
  86843. 9989,
  86844. 9989,
  86845. ],
  86846. [
  86847. 9994,
  86848. 9995,
  86849. ],
  86850. [
  86851. 10024,
  86852. 10024,
  86853. ],
  86854. [
  86855. 10060,
  86856. 10060,
  86857. ],
  86858. [
  86859. 10062,
  86860. 10062,
  86861. ],
  86862. [
  86863. 10067,
  86864. 10069,
  86865. ],
  86866. [
  86867. 10071,
  86868. 10071,
  86869. ],
  86870. [
  86871. 10133,
  86872. 10135,
  86873. ],
  86874. [
  86875. 10160,
  86876. 10160,
  86877. ],
  86878. [
  86879. 10175,
  86880. 10175,
  86881. ],
  86882. [
  86883. 11035,
  86884. 11036,
  86885. ],
  86886. [
  86887. 11088,
  86888. 11088,
  86889. ],
  86890. [
  86891. 11093,
  86892. 11093,
  86893. ],
  86894. [
  86895. 11904,
  86896. 11929,
  86897. ],
  86898. [
  86899. 11931,
  86900. 12019,
  86901. ],
  86902. [
  86903. 12032,
  86904. 12245,
  86905. ],
  86906. [
  86907. 12272,
  86908. 12287,
  86909. ],
  86910. [
  86911. 12288,
  86912. 12288,
  86913. ],
  86914. [
  86915. 12289,
  86916. 12291,
  86917. ],
  86918. [
  86919. 12292,
  86920. 12292,
  86921. ],
  86922. [
  86923. 12293,
  86924. 12293,
  86925. ],
  86926. [
  86927. 12294,
  86928. 12294,
  86929. ],
  86930. [
  86931. 12295,
  86932. 12295,
  86933. ],
  86934. [
  86935. 12296,
  86936. 12296,
  86937. ],
  86938. [
  86939. 12297,
  86940. 12297,
  86941. ],
  86942. [
  86943. 12298,
  86944. 12298,
  86945. ],
  86946. [
  86947. 12299,
  86948. 12299,
  86949. ],
  86950. [
  86951. 12300,
  86952. 12300,
  86953. ],
  86954. [
  86955. 12301,
  86956. 12301,
  86957. ],
  86958. [
  86959. 12302,
  86960. 12302,
  86961. ],
  86962. [
  86963. 12303,
  86964. 12303,
  86965. ],
  86966. [
  86967. 12304,
  86968. 12304,
  86969. ],
  86970. [
  86971. 12305,
  86972. 12305,
  86973. ],
  86974. [
  86975. 12306,
  86976. 12307,
  86977. ],
  86978. [
  86979. 12308,
  86980. 12308,
  86981. ],
  86982. [
  86983. 12309,
  86984. 12309,
  86985. ],
  86986. [
  86987. 12310,
  86988. 12310,
  86989. ],
  86990. [
  86991. 12311,
  86992. 12311,
  86993. ],
  86994. [
  86995. 12312,
  86996. 12312,
  86997. ],
  86998. [
  86999. 12313,
  87000. 12313,
  87001. ],
  87002. [
  87003. 12314,
  87004. 12314,
  87005. ],
  87006. [
  87007. 12315,
  87008. 12315,
  87009. ],
  87010. [
  87011. 12316,
  87012. 12316,
  87013. ],
  87014. [
  87015. 12317,
  87016. 12317,
  87017. ],
  87018. [
  87019. 12318,
  87020. 12319,
  87021. ],
  87022. [
  87023. 12320,
  87024. 12320,
  87025. ],
  87026. [
  87027. 12321,
  87028. 12329,
  87029. ],
  87030. [
  87031. 12330,
  87032. 12333,
  87033. ],
  87034. [
  87035. 12334,
  87036. 12335,
  87037. ],
  87038. [
  87039. 12336,
  87040. 12336,
  87041. ],
  87042. [
  87043. 12337,
  87044. 12341,
  87045. ],
  87046. [
  87047. 12342,
  87048. 12343,
  87049. ],
  87050. [
  87051. 12344,
  87052. 12346,
  87053. ],
  87054. [
  87055. 12347,
  87056. 12347,
  87057. ],
  87058. [
  87059. 12348,
  87060. 12348,
  87061. ],
  87062. [
  87063. 12349,
  87064. 12349,
  87065. ],
  87066. [
  87067. 12350,
  87068. 12350,
  87069. ],
  87070. [
  87071. 12353,
  87072. 12438,
  87073. ],
  87074. [
  87075. 12441,
  87076. 12442,
  87077. ],
  87078. [
  87079. 12443,
  87080. 12444,
  87081. ],
  87082. [
  87083. 12445,
  87084. 12446,
  87085. ],
  87086. [
  87087. 12447,
  87088. 12447,
  87089. ],
  87090. [
  87091. 12448,
  87092. 12448,
  87093. ],
  87094. [
  87095. 12449,
  87096. 12538,
  87097. ],
  87098. [
  87099. 12539,
  87100. 12539,
  87101. ],
  87102. [
  87103. 12540,
  87104. 12542,
  87105. ],
  87106. [
  87107. 12543,
  87108. 12543,
  87109. ],
  87110. [
  87111. 12549,
  87112. 12591,
  87113. ],
  87114. [
  87115. 12593,
  87116. 12686,
  87117. ],
  87118. [
  87119. 12688,
  87120. 12689,
  87121. ],
  87122. [
  87123. 12690,
  87124. 12693,
  87125. ],
  87126. [
  87127. 12694,
  87128. 12703,
  87129. ],
  87130. [
  87131. 12704,
  87132. 12735,
  87133. ],
  87134. [
  87135. 12736,
  87136. 12771,
  87137. ],
  87138. [
  87139. 12783,
  87140. 12783,
  87141. ],
  87142. [
  87143. 12784,
  87144. 12799,
  87145. ],
  87146. [
  87147. 12800,
  87148. 12830,
  87149. ],
  87150. [
  87151. 12832,
  87152. 12841,
  87153. ],
  87154. [
  87155. 12842,
  87156. 12871,
  87157. ],
  87158. [
  87159. 12880,
  87160. 12880,
  87161. ],
  87162. [
  87163. 12881,
  87164. 12895,
  87165. ],
  87166. [
  87167. 12896,
  87168. 12927,
  87169. ],
  87170. [
  87171. 12928,
  87172. 12937,
  87173. ],
  87174. [
  87175. 12938,
  87176. 12976,
  87177. ],
  87178. [
  87179. 12977,
  87180. 12991,
  87181. ],
  87182. [
  87183. 12992,
  87184. 13055,
  87185. ],
  87186. [
  87187. 13056,
  87188. 13311,
  87189. ],
  87190. [
  87191. 13312,
  87192. 19903,
  87193. ],
  87194. [
  87195. 19968,
  87196. 40959,
  87197. ],
  87198. [
  87199. 40960,
  87200. 40980,
  87201. ],
  87202. [
  87203. 40981,
  87204. 40981,
  87205. ],
  87206. [
  87207. 40982,
  87208. 42124,
  87209. ],
  87210. [
  87211. 42128,
  87212. 42182,
  87213. ],
  87214. [
  87215. 43360,
  87216. 43388,
  87217. ],
  87218. [
  87219. 44032,
  87220. 55203,
  87221. ],
  87222. [
  87223. 63744,
  87224. 64109,
  87225. ],
  87226. [
  87227. 64110,
  87228. 64111,
  87229. ],
  87230. [
  87231. 64112,
  87232. 64217,
  87233. ],
  87234. [
  87235. 64218,
  87236. 64255,
  87237. ],
  87238. [
  87239. 65040,
  87240. 65046,
  87241. ],
  87242. [
  87243. 65047,
  87244. 65047,
  87245. ],
  87246. [
  87247. 65048,
  87248. 65048,
  87249. ],
  87250. [
  87251. 65049,
  87252. 65049,
  87253. ],
  87254. [
  87255. 65072,
  87256. 65072,
  87257. ],
  87258. [
  87259. 65073,
  87260. 65074,
  87261. ],
  87262. [
  87263. 65075,
  87264. 65076,
  87265. ],
  87266. [
  87267. 65077,
  87268. 65077,
  87269. ],
  87270. [
  87271. 65078,
  87272. 65078,
  87273. ],
  87274. [
  87275. 65079,
  87276. 65079,
  87277. ],
  87278. [
  87279. 65080,
  87280. 65080,
  87281. ],
  87282. [
  87283. 65081,
  87284. 65081,
  87285. ],
  87286. [
  87287. 65082,
  87288. 65082,
  87289. ],
  87290. [
  87291. 65083,
  87292. 65083,
  87293. ],
  87294. [
  87295. 65084,
  87296. 65084,
  87297. ],
  87298. [
  87299. 65085,
  87300. 65085,
  87301. ],
  87302. [
  87303. 65086,
  87304. 65086,
  87305. ],
  87306. [
  87307. 65087,
  87308. 65087,
  87309. ],
  87310. [
  87311. 65088,
  87312. 65088,
  87313. ],
  87314. [
  87315. 65089,
  87316. 65089,
  87317. ],
  87318. [
  87319. 65090,
  87320. 65090,
  87321. ],
  87322. [
  87323. 65091,
  87324. 65091,
  87325. ],
  87326. [
  87327. 65092,
  87328. 65092,
  87329. ],
  87330. [
  87331. 65093,
  87332. 65094,
  87333. ],
  87334. [
  87335. 65095,
  87336. 65095,
  87337. ],
  87338. [
  87339. 65096,
  87340. 65096,
  87341. ],
  87342. [
  87343. 65097,
  87344. 65100,
  87345. ],
  87346. [
  87347. 65101,
  87348. 65103,
  87349. ],
  87350. [
  87351. 65104,
  87352. 65106,
  87353. ],
  87354. [
  87355. 65108,
  87356. 65111,
  87357. ],
  87358. [
  87359. 65112,
  87360. 65112,
  87361. ],
  87362. [
  87363. 65113,
  87364. 65113,
  87365. ],
  87366. [
  87367. 65114,
  87368. 65114,
  87369. ],
  87370. [
  87371. 65115,
  87372. 65115,
  87373. ],
  87374. [
  87375. 65116,
  87376. 65116,
  87377. ],
  87378. [
  87379. 65117,
  87380. 65117,
  87381. ],
  87382. [
  87383. 65118,
  87384. 65118,
  87385. ],
  87386. [
  87387. 65119,
  87388. 65121,
  87389. ],
  87390. [
  87391. 65122,
  87392. 65122,
  87393. ],
  87394. [
  87395. 65123,
  87396. 65123,
  87397. ],
  87398. [
  87399. 65124,
  87400. 65126,
  87401. ],
  87402. [
  87403. 65128,
  87404. 65128,
  87405. ],
  87406. [
  87407. 65129,
  87408. 65129,
  87409. ],
  87410. [
  87411. 65130,
  87412. 65131,
  87413. ],
  87414. [
  87415. 65281,
  87416. 65283,
  87417. ],
  87418. [
  87419. 65284,
  87420. 65284,
  87421. ],
  87422. [
  87423. 65285,
  87424. 65287,
  87425. ],
  87426. [
  87427. 65288,
  87428. 65288,
  87429. ],
  87430. [
  87431. 65289,
  87432. 65289,
  87433. ],
  87434. [
  87435. 65290,
  87436. 65290,
  87437. ],
  87438. [
  87439. 65291,
  87440. 65291,
  87441. ],
  87442. [
  87443. 65292,
  87444. 65292,
  87445. ],
  87446. [
  87447. 65293,
  87448. 65293,
  87449. ],
  87450. [
  87451. 65294,
  87452. 65295,
  87453. ],
  87454. [
  87455. 65296,
  87456. 65305,
  87457. ],
  87458. [
  87459. 65306,
  87460. 65307,
  87461. ],
  87462. [
  87463. 65308,
  87464. 65310,
  87465. ],
  87466. [
  87467. 65311,
  87468. 65312,
  87469. ],
  87470. [
  87471. 65313,
  87472. 65338,
  87473. ],
  87474. [
  87475. 65339,
  87476. 65339,
  87477. ],
  87478. [
  87479. 65340,
  87480. 65340,
  87481. ],
  87482. [
  87483. 65341,
  87484. 65341,
  87485. ],
  87486. [
  87487. 65342,
  87488. 65342,
  87489. ],
  87490. [
  87491. 65343,
  87492. 65343,
  87493. ],
  87494. [
  87495. 65344,
  87496. 65344,
  87497. ],
  87498. [
  87499. 65345,
  87500. 65370,
  87501. ],
  87502. [
  87503. 65371,
  87504. 65371,
  87505. ],
  87506. [
  87507. 65372,
  87508. 65372,
  87509. ],
  87510. [
  87511. 65373,
  87512. 65373,
  87513. ],
  87514. [
  87515. 65374,
  87516. 65374,
  87517. ],
  87518. [
  87519. 65375,
  87520. 65375,
  87521. ],
  87522. [
  87523. 65376,
  87524. 65376,
  87525. ],
  87526. [
  87527. 65504,
  87528. 65505,
  87529. ],
  87530. [
  87531. 65506,
  87532. 65506,
  87533. ],
  87534. [
  87535. 65507,
  87536. 65507,
  87537. ],
  87538. [
  87539. 65508,
  87540. 65508,
  87541. ],
  87542. [
  87543. 65509,
  87544. 65510,
  87545. ],
  87546. [
  87547. 94176,
  87548. 94177,
  87549. ],
  87550. [
  87551. 94178,
  87552. 94178,
  87553. ],
  87554. [
  87555. 94179,
  87556. 94179,
  87557. ],
  87558. [
  87559. 94180,
  87560. 94180,
  87561. ],
  87562. [
  87563. 94192,
  87564. 94193,
  87565. ],
  87566. [
  87567. 94208,
  87568. 100343,
  87569. ],
  87570. [
  87571. 100352,
  87572. 101119,
  87573. ],
  87574. [
  87575. 101120,
  87576. 101589,
  87577. ],
  87578. [
  87579. 101632,
  87580. 101640,
  87581. ],
  87582. [
  87583. 110576,
  87584. 110579,
  87585. ],
  87586. [
  87587. 110581,
  87588. 110587,
  87589. ],
  87590. [
  87591. 110589,
  87592. 110590,
  87593. ],
  87594. [
  87595. 110592,
  87596. 110847,
  87597. ],
  87598. [
  87599. 110848,
  87600. 110882,
  87601. ],
  87602. [
  87603. 110898,
  87604. 110898,
  87605. ],
  87606. [
  87607. 110928,
  87608. 110930,
  87609. ],
  87610. [
  87611. 110933,
  87612. 110933,
  87613. ],
  87614. [
  87615. 110948,
  87616. 110951,
  87617. ],
  87618. [
  87619. 110960,
  87620. 111355,
  87621. ],
  87622. [
  87623. 126980,
  87624. 126980,
  87625. ],
  87626. [
  87627. 127183,
  87628. 127183,
  87629. ],
  87630. [
  87631. 127374,
  87632. 127374,
  87633. ],
  87634. [
  87635. 127377,
  87636. 127386,
  87637. ],
  87638. [
  87639. 127488,
  87640. 127490,
  87641. ],
  87642. [
  87643. 127504,
  87644. 127547,
  87645. ],
  87646. [
  87647. 127552,
  87648. 127560,
  87649. ],
  87650. [
  87651. 127568,
  87652. 127569,
  87653. ],
  87654. [
  87655. 127584,
  87656. 127589,
  87657. ],
  87658. [
  87659. 127744,
  87660. 127776,
  87661. ],
  87662. [
  87663. 127789,
  87664. 127797,
  87665. ],
  87666. [
  87667. 127799,
  87668. 127868,
  87669. ],
  87670. [
  87671. 127870,
  87672. 127891,
  87673. ],
  87674. [
  87675. 127904,
  87676. 127946,
  87677. ],
  87678. [
  87679. 127951,
  87680. 127955,
  87681. ],
  87682. [
  87683. 127968,
  87684. 127984,
  87685. ],
  87686. [
  87687. 127988,
  87688. 127988,
  87689. ],
  87690. [
  87691. 127992,
  87692. 127994,
  87693. ],
  87694. [
  87695. 127995,
  87696. 127999,
  87697. ],
  87698. [
  87699. 128000,
  87700. 128062,
  87701. ],
  87702. [
  87703. 128064,
  87704. 128064,
  87705. ],
  87706. [
  87707. 128066,
  87708. 128252,
  87709. ],
  87710. [
  87711. 128255,
  87712. 128317,
  87713. ],
  87714. [
  87715. 128331,
  87716. 128334,
  87717. ],
  87718. [
  87719. 128336,
  87720. 128359,
  87721. ],
  87722. [
  87723. 128378,
  87724. 128378,
  87725. ],
  87726. [
  87727. 128405,
  87728. 128406,
  87729. ],
  87730. [
  87731. 128420,
  87732. 128420,
  87733. ],
  87734. [
  87735. 128507,
  87736. 128511,
  87737. ],
  87738. [
  87739. 128512,
  87740. 128591,
  87741. ],
  87742. [
  87743. 128640,
  87744. 128709,
  87745. ],
  87746. [
  87747. 128716,
  87748. 128716,
  87749. ],
  87750. [
  87751. 128720,
  87752. 128722,
  87753. ],
  87754. [
  87755. 128725,
  87756. 128727,
  87757. ],
  87758. [
  87759. 128732,
  87760. 128735,
  87761. ],
  87762. [
  87763. 128747,
  87764. 128748,
  87765. ],
  87766. [
  87767. 128756,
  87768. 128764,
  87769. ],
  87770. [
  87771. 128992,
  87772. 129003,
  87773. ],
  87774. [
  87775. 129008,
  87776. 129008,
  87777. ],
  87778. [
  87779. 129292,
  87780. 129338,
  87781. ],
  87782. [
  87783. 129340,
  87784. 129349,
  87785. ],
  87786. [
  87787. 129351,
  87788. 129535,
  87789. ],
  87790. [
  87791. 129648,
  87792. 129660,
  87793. ],
  87794. [
  87795. 129664,
  87796. 129672,
  87797. ],
  87798. [
  87799. 129680,
  87800. 129725,
  87801. ],
  87802. [
  87803. 129727,
  87804. 129733,
  87805. ],
  87806. [
  87807. 129742,
  87808. 129755,
  87809. ],
  87810. [
  87811. 129760,
  87812. 129768,
  87813. ],
  87814. [
  87815. 129776,
  87816. 129784,
  87817. ],
  87818. [
  87819. 131072,
  87820. 173791,
  87821. ],
  87822. [
  87823. 173792,
  87824. 173823,
  87825. ],
  87826. [
  87827. 173824,
  87828. 177977,
  87829. ],
  87830. [
  87831. 177978,
  87832. 177983,
  87833. ],
  87834. [
  87835. 177984,
  87836. 178205,
  87837. ],
  87838. [
  87839. 178206,
  87840. 178207,
  87841. ],
  87842. [
  87843. 178208,
  87844. 183969,
  87845. ],
  87846. [
  87847. 183970,
  87848. 183983,
  87849. ],
  87850. [
  87851. 183984,
  87852. 191456,
  87853. ],
  87854. [
  87855. 191457,
  87856. 191471,
  87857. ],
  87858. [
  87859. 191472,
  87860. 192093,
  87861. ],
  87862. [
  87863. 192094,
  87864. 194559,
  87865. ],
  87866. [
  87867. 194560,
  87868. 195101,
  87869. ],
  87870. [
  87871. 195102,
  87872. 195103,
  87873. ],
  87874. [
  87875. 195104,
  87876. 196605,
  87877. ],
  87878. [
  87879. 196608,
  87880. 201546,
  87881. ],
  87882. [
  87883. 201547,
  87884. 201551,
  87885. ],
  87886. [
  87887. 201552,
  87888. 205743,
  87889. ],
  87890. [
  87891. 205744,
  87892. 262141,
  87893. ],
  87894. ];
  87895. <?php
  87896. return [
  87897. [
  87898. 768,
  87899. 879,
  87900. ],
  87901. [
  87902. 1155,
  87903. 1159,
  87904. ],
  87905. [
  87906. 1160,
  87907. 1161,
  87908. ],
  87909. [
  87910. 1425,
  87911. 1469,
  87912. ],
  87913. [
  87914. 1471,
  87915. 1471,
  87916. ],
  87917. [
  87918. 1473,
  87919. 1474,
  87920. ],
  87921. [
  87922. 1476,
  87923. 1477,
  87924. ],
  87925. [
  87926. 1479,
  87927. 1479,
  87928. ],
  87929. [
  87930. 1552,
  87931. 1562,
  87932. ],
  87933. [
  87934. 1611,
  87935. 1631,
  87936. ],
  87937. [
  87938. 1648,
  87939. 1648,
  87940. ],
  87941. [
  87942. 1750,
  87943. 1756,
  87944. ],
  87945. [
  87946. 1759,
  87947. 1764,
  87948. ],
  87949. [
  87950. 1767,
  87951. 1768,
  87952. ],
  87953. [
  87954. 1770,
  87955. 1773,
  87956. ],
  87957. [
  87958. 1809,
  87959. 1809,
  87960. ],
  87961. [
  87962. 1840,
  87963. 1866,
  87964. ],
  87965. [
  87966. 1958,
  87967. 1968,
  87968. ],
  87969. [
  87970. 2027,
  87971. 2035,
  87972. ],
  87973. [
  87974. 2045,
  87975. 2045,
  87976. ],
  87977. [
  87978. 2070,
  87979. 2073,
  87980. ],
  87981. [
  87982. 2075,
  87983. 2083,
  87984. ],
  87985. [
  87986. 2085,
  87987. 2087,
  87988. ],
  87989. [
  87990. 2089,
  87991. 2093,
  87992. ],
  87993. [
  87994. 2137,
  87995. 2139,
  87996. ],
  87997. [
  87998. 2200,
  87999. 2207,
  88000. ],
  88001. [
  88002. 2250,
  88003. 2273,
  88004. ],
  88005. [
  88006. 2275,
  88007. 2306,
  88008. ],
  88009. [
  88010. 2362,
  88011. 2362,
  88012. ],
  88013. [
  88014. 2364,
  88015. 2364,
  88016. ],
  88017. [
  88018. 2369,
  88019. 2376,
  88020. ],
  88021. [
  88022. 2381,
  88023. 2381,
  88024. ],
  88025. [
  88026. 2385,
  88027. 2391,
  88028. ],
  88029. [
  88030. 2402,
  88031. 2403,
  88032. ],
  88033. [
  88034. 2433,
  88035. 2433,
  88036. ],
  88037. [
  88038. 2492,
  88039. 2492,
  88040. ],
  88041. [
  88042. 2497,
  88043. 2500,
  88044. ],
  88045. [
  88046. 2509,
  88047. 2509,
  88048. ],
  88049. [
  88050. 2530,
  88051. 2531,
  88052. ],
  88053. [
  88054. 2558,
  88055. 2558,
  88056. ],
  88057. [
  88058. 2561,
  88059. 2562,
  88060. ],
  88061. [
  88062. 2620,
  88063. 2620,
  88064. ],
  88065. [
  88066. 2625,
  88067. 2626,
  88068. ],
  88069. [
  88070. 2631,
  88071. 2632,
  88072. ],
  88073. [
  88074. 2635,
  88075. 2637,
  88076. ],
  88077. [
  88078. 2641,
  88079. 2641,
  88080. ],
  88081. [
  88082. 2672,
  88083. 2673,
  88084. ],
  88085. [
  88086. 2677,
  88087. 2677,
  88088. ],
  88089. [
  88090. 2689,
  88091. 2690,
  88092. ],
  88093. [
  88094. 2748,
  88095. 2748,
  88096. ],
  88097. [
  88098. 2753,
  88099. 2757,
  88100. ],
  88101. [
  88102. 2759,
  88103. 2760,
  88104. ],
  88105. [
  88106. 2765,
  88107. 2765,
  88108. ],
  88109. [
  88110. 2786,
  88111. 2787,
  88112. ],
  88113. [
  88114. 2810,
  88115. 2815,
  88116. ],
  88117. [
  88118. 2817,
  88119. 2817,
  88120. ],
  88121. [
  88122. 2876,
  88123. 2876,
  88124. ],
  88125. [
  88126. 2879,
  88127. 2879,
  88128. ],
  88129. [
  88130. 2881,
  88131. 2884,
  88132. ],
  88133. [
  88134. 2893,
  88135. 2893,
  88136. ],
  88137. [
  88138. 2901,
  88139. 2902,
  88140. ],
  88141. [
  88142. 2914,
  88143. 2915,
  88144. ],
  88145. [
  88146. 2946,
  88147. 2946,
  88148. ],
  88149. [
  88150. 3008,
  88151. 3008,
  88152. ],
  88153. [
  88154. 3021,
  88155. 3021,
  88156. ],
  88157. [
  88158. 3072,
  88159. 3072,
  88160. ],
  88161. [
  88162. 3076,
  88163. 3076,
  88164. ],
  88165. [
  88166. 3132,
  88167. 3132,
  88168. ],
  88169. [
  88170. 3134,
  88171. 3136,
  88172. ],
  88173. [
  88174. 3142,
  88175. 3144,
  88176. ],
  88177. [
  88178. 3146,
  88179. 3149,
  88180. ],
  88181. [
  88182. 3157,
  88183. 3158,
  88184. ],
  88185. [
  88186. 3170,
  88187. 3171,
  88188. ],
  88189. [
  88190. 3201,
  88191. 3201,
  88192. ],
  88193. [
  88194. 3260,
  88195. 3260,
  88196. ],
  88197. [
  88198. 3263,
  88199. 3263,
  88200. ],
  88201. [
  88202. 3270,
  88203. 3270,
  88204. ],
  88205. [
  88206. 3276,
  88207. 3277,
  88208. ],
  88209. [
  88210. 3298,
  88211. 3299,
  88212. ],
  88213. [
  88214. 3328,
  88215. 3329,
  88216. ],
  88217. [
  88218. 3387,
  88219. 3388,
  88220. ],
  88221. [
  88222. 3393,
  88223. 3396,
  88224. ],
  88225. [
  88226. 3405,
  88227. 3405,
  88228. ],
  88229. [
  88230. 3426,
  88231. 3427,
  88232. ],
  88233. [
  88234. 3457,
  88235. 3457,
  88236. ],
  88237. [
  88238. 3530,
  88239. 3530,
  88240. ],
  88241. [
  88242. 3538,
  88243. 3540,
  88244. ],
  88245. [
  88246. 3542,
  88247. 3542,
  88248. ],
  88249. [
  88250. 3633,
  88251. 3633,
  88252. ],
  88253. [
  88254. 3636,
  88255. 3642,
  88256. ],
  88257. [
  88258. 3655,
  88259. 3662,
  88260. ],
  88261. [
  88262. 3761,
  88263. 3761,
  88264. ],
  88265. [
  88266. 3764,
  88267. 3772,
  88268. ],
  88269. [
  88270. 3784,
  88271. 3790,
  88272. ],
  88273. [
  88274. 3864,
  88275. 3865,
  88276. ],
  88277. [
  88278. 3893,
  88279. 3893,
  88280. ],
  88281. [
  88282. 3895,
  88283. 3895,
  88284. ],
  88285. [
  88286. 3897,
  88287. 3897,
  88288. ],
  88289. [
  88290. 3953,
  88291. 3966,
  88292. ],
  88293. [
  88294. 3968,
  88295. 3972,
  88296. ],
  88297. [
  88298. 3974,
  88299. 3975,
  88300. ],
  88301. [
  88302. 3981,
  88303. 3991,
  88304. ],
  88305. [
  88306. 3993,
  88307. 4028,
  88308. ],
  88309. [
  88310. 4038,
  88311. 4038,
  88312. ],
  88313. [
  88314. 4141,
  88315. 4144,
  88316. ],
  88317. [
  88318. 4146,
  88319. 4151,
  88320. ],
  88321. [
  88322. 4153,
  88323. 4154,
  88324. ],
  88325. [
  88326. 4157,
  88327. 4158,
  88328. ],
  88329. [
  88330. 4184,
  88331. 4185,
  88332. ],
  88333. [
  88334. 4190,
  88335. 4192,
  88336. ],
  88337. [
  88338. 4209,
  88339. 4212,
  88340. ],
  88341. [
  88342. 4226,
  88343. 4226,
  88344. ],
  88345. [
  88346. 4229,
  88347. 4230,
  88348. ],
  88349. [
  88350. 4237,
  88351. 4237,
  88352. ],
  88353. [
  88354. 4253,
  88355. 4253,
  88356. ],
  88357. [
  88358. 4957,
  88359. 4959,
  88360. ],
  88361. [
  88362. 5906,
  88363. 5908,
  88364. ],
  88365. [
  88366. 5938,
  88367. 5939,
  88368. ],
  88369. [
  88370. 5970,
  88371. 5971,
  88372. ],
  88373. [
  88374. 6002,
  88375. 6003,
  88376. ],
  88377. [
  88378. 6068,
  88379. 6069,
  88380. ],
  88381. [
  88382. 6071,
  88383. 6077,
  88384. ],
  88385. [
  88386. 6086,
  88387. 6086,
  88388. ],
  88389. [
  88390. 6089,
  88391. 6099,
  88392. ],
  88393. [
  88394. 6109,
  88395. 6109,
  88396. ],
  88397. [
  88398. 6155,
  88399. 6157,
  88400. ],
  88401. [
  88402. 6159,
  88403. 6159,
  88404. ],
  88405. [
  88406. 6277,
  88407. 6278,
  88408. ],
  88409. [
  88410. 6313,
  88411. 6313,
  88412. ],
  88413. [
  88414. 6432,
  88415. 6434,
  88416. ],
  88417. [
  88418. 6439,
  88419. 6440,
  88420. ],
  88421. [
  88422. 6450,
  88423. 6450,
  88424. ],
  88425. [
  88426. 6457,
  88427. 6459,
  88428. ],
  88429. [
  88430. 6679,
  88431. 6680,
  88432. ],
  88433. [
  88434. 6683,
  88435. 6683,
  88436. ],
  88437. [
  88438. 6742,
  88439. 6742,
  88440. ],
  88441. [
  88442. 6744,
  88443. 6750,
  88444. ],
  88445. [
  88446. 6752,
  88447. 6752,
  88448. ],
  88449. [
  88450. 6754,
  88451. 6754,
  88452. ],
  88453. [
  88454. 6757,
  88455. 6764,
  88456. ],
  88457. [
  88458. 6771,
  88459. 6780,
  88460. ],
  88461. [
  88462. 6783,
  88463. 6783,
  88464. ],
  88465. [
  88466. 6832,
  88467. 6845,
  88468. ],
  88469. [
  88470. 6846,
  88471. 6846,
  88472. ],
  88473. [
  88474. 6847,
  88475. 6862,
  88476. ],
  88477. [
  88478. 6912,
  88479. 6915,
  88480. ],
  88481. [
  88482. 6964,
  88483. 6964,
  88484. ],
  88485. [
  88486. 6966,
  88487. 6970,
  88488. ],
  88489. [
  88490. 6972,
  88491. 6972,
  88492. ],
  88493. [
  88494. 6978,
  88495. 6978,
  88496. ],
  88497. [
  88498. 7019,
  88499. 7027,
  88500. ],
  88501. [
  88502. 7040,
  88503. 7041,
  88504. ],
  88505. [
  88506. 7074,
  88507. 7077,
  88508. ],
  88509. [
  88510. 7080,
  88511. 7081,
  88512. ],
  88513. [
  88514. 7083,
  88515. 7085,
  88516. ],
  88517. [
  88518. 7142,
  88519. 7142,
  88520. ],
  88521. [
  88522. 7144,
  88523. 7145,
  88524. ],
  88525. [
  88526. 7149,
  88527. 7149,
  88528. ],
  88529. [
  88530. 7151,
  88531. 7153,
  88532. ],
  88533. [
  88534. 7212,
  88535. 7219,
  88536. ],
  88537. [
  88538. 7222,
  88539. 7223,
  88540. ],
  88541. [
  88542. 7376,
  88543. 7378,
  88544. ],
  88545. [
  88546. 7380,
  88547. 7392,
  88548. ],
  88549. [
  88550. 7394,
  88551. 7400,
  88552. ],
  88553. [
  88554. 7405,
  88555. 7405,
  88556. ],
  88557. [
  88558. 7412,
  88559. 7412,
  88560. ],
  88561. [
  88562. 7416,
  88563. 7417,
  88564. ],
  88565. [
  88566. 7616,
  88567. 7679,
  88568. ],
  88569. [
  88570. 8400,
  88571. 8412,
  88572. ],
  88573. [
  88574. 8413,
  88575. 8416,
  88576. ],
  88577. [
  88578. 8417,
  88579. 8417,
  88580. ],
  88581. [
  88582. 8418,
  88583. 8420,
  88584. ],
  88585. [
  88586. 8421,
  88587. 8432,
  88588. ],
  88589. [
  88590. 11503,
  88591. 11505,
  88592. ],
  88593. [
  88594. 11647,
  88595. 11647,
  88596. ],
  88597. [
  88598. 11744,
  88599. 11775,
  88600. ],
  88601. [
  88602. 12330,
  88603. 12333,
  88604. ],
  88605. [
  88606. 12441,
  88607. 12442,
  88608. ],
  88609. [
  88610. 42607,
  88611. 42607,
  88612. ],
  88613. [
  88614. 42608,
  88615. 42610,
  88616. ],
  88617. [
  88618. 42612,
  88619. 42621,
  88620. ],
  88621. [
  88622. 42654,
  88623. 42655,
  88624. ],
  88625. [
  88626. 42736,
  88627. 42737,
  88628. ],
  88629. [
  88630. 43010,
  88631. 43010,
  88632. ],
  88633. [
  88634. 43014,
  88635. 43014,
  88636. ],
  88637. [
  88638. 43019,
  88639. 43019,
  88640. ],
  88641. [
  88642. 43045,
  88643. 43046,
  88644. ],
  88645. [
  88646. 43052,
  88647. 43052,
  88648. ],
  88649. [
  88650. 43204,
  88651. 43205,
  88652. ],
  88653. [
  88654. 43232,
  88655. 43249,
  88656. ],
  88657. [
  88658. 43263,
  88659. 43263,
  88660. ],
  88661. [
  88662. 43302,
  88663. 43309,
  88664. ],
  88665. [
  88666. 43335,
  88667. 43345,
  88668. ],
  88669. [
  88670. 43392,
  88671. 43394,
  88672. ],
  88673. [
  88674. 43443,
  88675. 43443,
  88676. ],
  88677. [
  88678. 43446,
  88679. 43449,
  88680. ],
  88681. [
  88682. 43452,
  88683. 43453,
  88684. ],
  88685. [
  88686. 43493,
  88687. 43493,
  88688. ],
  88689. [
  88690. 43561,
  88691. 43566,
  88692. ],
  88693. [
  88694. 43569,
  88695. 43570,
  88696. ],
  88697. [
  88698. 43573,
  88699. 43574,
  88700. ],
  88701. [
  88702. 43587,
  88703. 43587,
  88704. ],
  88705. [
  88706. 43596,
  88707. 43596,
  88708. ],
  88709. [
  88710. 43644,
  88711. 43644,
  88712. ],
  88713. [
  88714. 43696,
  88715. 43696,
  88716. ],
  88717. [
  88718. 43698,
  88719. 43700,
  88720. ],
  88721. [
  88722. 43703,
  88723. 43704,
  88724. ],
  88725. [
  88726. 43710,
  88727. 43711,
  88728. ],
  88729. [
  88730. 43713,
  88731. 43713,
  88732. ],
  88733. [
  88734. 43756,
  88735. 43757,
  88736. ],
  88737. [
  88738. 43766,
  88739. 43766,
  88740. ],
  88741. [
  88742. 44005,
  88743. 44005,
  88744. ],
  88745. [
  88746. 44008,
  88747. 44008,
  88748. ],
  88749. [
  88750. 44013,
  88751. 44013,
  88752. ],
  88753. [
  88754. 64286,
  88755. 64286,
  88756. ],
  88757. [
  88758. 65024,
  88759. 65039,
  88760. ],
  88761. [
  88762. 65056,
  88763. 65071,
  88764. ],
  88765. [
  88766. 66045,
  88767. 66045,
  88768. ],
  88769. [
  88770. 66272,
  88771. 66272,
  88772. ],
  88773. [
  88774. 66422,
  88775. 66426,
  88776. ],
  88777. [
  88778. 68097,
  88779. 68099,
  88780. ],
  88781. [
  88782. 68101,
  88783. 68102,
  88784. ],
  88785. [
  88786. 68108,
  88787. 68111,
  88788. ],
  88789. [
  88790. 68152,
  88791. 68154,
  88792. ],
  88793. [
  88794. 68159,
  88795. 68159,
  88796. ],
  88797. [
  88798. 68325,
  88799. 68326,
  88800. ],
  88801. [
  88802. 68900,
  88803. 68903,
  88804. ],
  88805. [
  88806. 69291,
  88807. 69292,
  88808. ],
  88809. [
  88810. 69373,
  88811. 69375,
  88812. ],
  88813. [
  88814. 69446,
  88815. 69456,
  88816. ],
  88817. [
  88818. 69506,
  88819. 69509,
  88820. ],
  88821. [
  88822. 69633,
  88823. 69633,
  88824. ],
  88825. [
  88826. 69688,
  88827. 69702,
  88828. ],
  88829. [
  88830. 69744,
  88831. 69744,
  88832. ],
  88833. [
  88834. 69747,
  88835. 69748,
  88836. ],
  88837. [
  88838. 69759,
  88839. 69761,
  88840. ],
  88841. [
  88842. 69811,
  88843. 69814,
  88844. ],
  88845. [
  88846. 69817,
  88847. 69818,
  88848. ],
  88849. [
  88850. 69826,
  88851. 69826,
  88852. ],
  88853. [
  88854. 69888,
  88855. 69890,
  88856. ],
  88857. [
  88858. 69927,
  88859. 69931,
  88860. ],
  88861. [
  88862. 69933,
  88863. 69940,
  88864. ],
  88865. [
  88866. 70003,
  88867. 70003,
  88868. ],
  88869. [
  88870. 70016,
  88871. 70017,
  88872. ],
  88873. [
  88874. 70070,
  88875. 70078,
  88876. ],
  88877. [
  88878. 70089,
  88879. 70092,
  88880. ],
  88881. [
  88882. 70095,
  88883. 70095,
  88884. ],
  88885. [
  88886. 70191,
  88887. 70193,
  88888. ],
  88889. [
  88890. 70196,
  88891. 70196,
  88892. ],
  88893. [
  88894. 70198,
  88895. 70199,
  88896. ],
  88897. [
  88898. 70206,
  88899. 70206,
  88900. ],
  88901. [
  88902. 70209,
  88903. 70209,
  88904. ],
  88905. [
  88906. 70367,
  88907. 70367,
  88908. ],
  88909. [
  88910. 70371,
  88911. 70378,
  88912. ],
  88913. [
  88914. 70400,
  88915. 70401,
  88916. ],
  88917. [
  88918. 70459,
  88919. 70460,
  88920. ],
  88921. [
  88922. 70464,
  88923. 70464,
  88924. ],
  88925. [
  88926. 70502,
  88927. 70508,
  88928. ],
  88929. [
  88930. 70512,
  88931. 70516,
  88932. ],
  88933. [
  88934. 70712,
  88935. 70719,
  88936. ],
  88937. [
  88938. 70722,
  88939. 70724,
  88940. ],
  88941. [
  88942. 70726,
  88943. 70726,
  88944. ],
  88945. [
  88946. 70750,
  88947. 70750,
  88948. ],
  88949. [
  88950. 70835,
  88951. 70840,
  88952. ],
  88953. [
  88954. 70842,
  88955. 70842,
  88956. ],
  88957. [
  88958. 70847,
  88959. 70848,
  88960. ],
  88961. [
  88962. 70850,
  88963. 70851,
  88964. ],
  88965. [
  88966. 71090,
  88967. 71093,
  88968. ],
  88969. [
  88970. 71100,
  88971. 71101,
  88972. ],
  88973. [
  88974. 71103,
  88975. 71104,
  88976. ],
  88977. [
  88978. 71132,
  88979. 71133,
  88980. ],
  88981. [
  88982. 71219,
  88983. 71226,
  88984. ],
  88985. [
  88986. 71229,
  88987. 71229,
  88988. ],
  88989. [
  88990. 71231,
  88991. 71232,
  88992. ],
  88993. [
  88994. 71339,
  88995. 71339,
  88996. ],
  88997. [
  88998. 71341,
  88999. 71341,
  89000. ],
  89001. [
  89002. 71344,
  89003. 71349,
  89004. ],
  89005. [
  89006. 71351,
  89007. 71351,
  89008. ],
  89009. [
  89010. 71453,
  89011. 71455,
  89012. ],
  89013. [
  89014. 71458,
  89015. 71461,
  89016. ],
  89017. [
  89018. 71463,
  89019. 71467,
  89020. ],
  89021. [
  89022. 71727,
  89023. 71735,
  89024. ],
  89025. [
  89026. 71737,
  89027. 71738,
  89028. ],
  89029. [
  89030. 71995,
  89031. 71996,
  89032. ],
  89033. [
  89034. 71998,
  89035. 71998,
  89036. ],
  89037. [
  89038. 72003,
  89039. 72003,
  89040. ],
  89041. [
  89042. 72148,
  89043. 72151,
  89044. ],
  89045. [
  89046. 72154,
  89047. 72155,
  89048. ],
  89049. [
  89050. 72160,
  89051. 72160,
  89052. ],
  89053. [
  89054. 72193,
  89055. 72202,
  89056. ],
  89057. [
  89058. 72243,
  89059. 72248,
  89060. ],
  89061. [
  89062. 72251,
  89063. 72254,
  89064. ],
  89065. [
  89066. 72263,
  89067. 72263,
  89068. ],
  89069. [
  89070. 72273,
  89071. 72278,
  89072. ],
  89073. [
  89074. 72281,
  89075. 72283,
  89076. ],
  89077. [
  89078. 72330,
  89079. 72342,
  89080. ],
  89081. [
  89082. 72344,
  89083. 72345,
  89084. ],
  89085. [
  89086. 72752,
  89087. 72758,
  89088. ],
  89089. [
  89090. 72760,
  89091. 72765,
  89092. ],
  89093. [
  89094. 72767,
  89095. 72767,
  89096. ],
  89097. [
  89098. 72850,
  89099. 72871,
  89100. ],
  89101. [
  89102. 72874,
  89103. 72880,
  89104. ],
  89105. [
  89106. 72882,
  89107. 72883,
  89108. ],
  89109. [
  89110. 72885,
  89111. 72886,
  89112. ],
  89113. [
  89114. 73009,
  89115. 73014,
  89116. ],
  89117. [
  89118. 73018,
  89119. 73018,
  89120. ],
  89121. [
  89122. 73020,
  89123. 73021,
  89124. ],
  89125. [
  89126. 73023,
  89127. 73029,
  89128. ],
  89129. [
  89130. 73031,
  89131. 73031,
  89132. ],
  89133. [
  89134. 73104,
  89135. 73105,
  89136. ],
  89137. [
  89138. 73109,
  89139. 73109,
  89140. ],
  89141. [
  89142. 73111,
  89143. 73111,
  89144. ],
  89145. [
  89146. 73459,
  89147. 73460,
  89148. ],
  89149. [
  89150. 73472,
  89151. 73473,
  89152. ],
  89153. [
  89154. 73526,
  89155. 73530,
  89156. ],
  89157. [
  89158. 73536,
  89159. 73536,
  89160. ],
  89161. [
  89162. 73538,
  89163. 73538,
  89164. ],
  89165. [
  89166. 78912,
  89167. 78912,
  89168. ],
  89169. [
  89170. 78919,
  89171. 78933,
  89172. ],
  89173. [
  89174. 92912,
  89175. 92916,
  89176. ],
  89177. [
  89178. 92976,
  89179. 92982,
  89180. ],
  89181. [
  89182. 94031,
  89183. 94031,
  89184. ],
  89185. [
  89186. 94095,
  89187. 94098,
  89188. ],
  89189. [
  89190. 94180,
  89191. 94180,
  89192. ],
  89193. [
  89194. 113821,
  89195. 113822,
  89196. ],
  89197. [
  89198. 118528,
  89199. 118573,
  89200. ],
  89201. [
  89202. 118576,
  89203. 118598,
  89204. ],
  89205. [
  89206. 119143,
  89207. 119145,
  89208. ],
  89209. [
  89210. 119163,
  89211. 119170,
  89212. ],
  89213. [
  89214. 119173,
  89215. 119179,
  89216. ],
  89217. [
  89218. 119210,
  89219. 119213,
  89220. ],
  89221. [
  89222. 119362,
  89223. 119364,
  89224. ],
  89225. [
  89226. 121344,
  89227. 121398,
  89228. ],
  89229. [
  89230. 121403,
  89231. 121452,
  89232. ],
  89233. [
  89234. 121461,
  89235. 121461,
  89236. ],
  89237. [
  89238. 121476,
  89239. 121476,
  89240. ],
  89241. [
  89242. 121499,
  89243. 121503,
  89244. ],
  89245. [
  89246. 121505,
  89247. 121519,
  89248. ],
  89249. [
  89250. 122880,
  89251. 122886,
  89252. ],
  89253. [
  89254. 122888,
  89255. 122904,
  89256. ],
  89257. [
  89258. 122907,
  89259. 122913,
  89260. ],
  89261. [
  89262. 122915,
  89263. 122916,
  89264. ],
  89265. [
  89266. 122918,
  89267. 122922,
  89268. ],
  89269. [
  89270. 123023,
  89271. 123023,
  89272. ],
  89273. [
  89274. 123184,
  89275. 123190,
  89276. ],
  89277. [
  89278. 123566,
  89279. 123566,
  89280. ],
  89281. [
  89282. 123628,
  89283. 123631,
  89284. ],
  89285. [
  89286. 124140,
  89287. 124143,
  89288. ],
  89289. [
  89290. 125136,
  89291. 125142,
  89292. ],
  89293. [
  89294. 125252,
  89295. 125258,
  89296. ],
  89297. [
  89298. 917760,
  89299. 917999,
  89300. ],
  89301. ];
  89302. <?php
  89303. namespace Symfony\Component\String;
  89304. if (!\function_exists(u::class)) {
  89305. function u(?string $string = ''): UnicodeString
  89306. {
  89307. return new UnicodeString($string ?? '');
  89308. }
  89309. }
  89310. if (!\function_exists(b::class)) {
  89311. function b(?string $string = ''): ByteString
  89312. {
  89313. return new ByteString($string ?? '');
  89314. }
  89315. }
  89316. if (!\function_exists(s::class)) {
  89317. function s(?string $string = ''): AbstractString
  89318. {
  89319. $string = $string ?? '';
  89320. return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
  89321. }
  89322. }
  89323. <?php
  89324. namespace Symfony\Component\String\Slugger;
  89325. use Symfony\Component\String\AbstractUnicodeString;
  89326. use Symfony\Component\String\UnicodeString;
  89327. use Symfony\Contracts\Translation\LocaleAwareInterface;
  89328. if (!interface_exists(LocaleAwareInterface::class)) {
  89329. throw new \LogicException('You cannot use the "Symfony\Component\String\Slugger\AsciiSlugger" as the "symfony/translation-contracts" package is not installed. Try running "composer require symfony/translation-contracts".');
  89330. }
  89331. class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
  89332. {
  89333. private const LOCALE_TO_TRANSLITERATOR_ID = [
  89334. 'am' => 'Amharic-Latin',
  89335. 'ar' => 'Arabic-Latin',
  89336. 'az' => 'Azerbaijani-Latin',
  89337. 'be' => 'Belarusian-Latin',
  89338. 'bg' => 'Bulgarian-Latin',
  89339. 'bn' => 'Bengali-Latin',
  89340. 'de' => 'de-ASCII',
  89341. 'el' => 'Greek-Latin',
  89342. 'fa' => 'Persian-Latin',
  89343. 'he' => 'Hebrew-Latin',
  89344. 'hy' => 'Armenian-Latin',
  89345. 'ka' => 'Georgian-Latin',
  89346. 'kk' => 'Kazakh-Latin',
  89347. 'ky' => 'Kirghiz-Latin',
  89348. 'ko' => 'Korean-Latin',
  89349. 'mk' => 'Macedonian-Latin',
  89350. 'mn' => 'Mongolian-Latin',
  89351. 'or' => 'Oriya-Latin',
  89352. 'ps' => 'Pashto-Latin',
  89353. 'ru' => 'Russian-Latin',
  89354. 'sr' => 'Serbian-Latin',
  89355. 'sr_Cyrl' => 'Serbian-Latin',
  89356. 'th' => 'Thai-Latin',
  89357. 'tk' => 'Turkmen-Latin',
  89358. 'uk' => 'Ukrainian-Latin',
  89359. 'uz' => 'Uzbek-Latin',
  89360. 'zh' => 'Han-Latin',
  89361. ];
  89362. private $defaultLocale;
  89363. private $symbolsMap = [
  89364. 'en' => ['@' => 'at', '&' => 'and'],
  89365. ];
  89366. private $transliterators = [];
  89367. public function __construct(?string $defaultLocale = null, $symbolsMap = null)
  89368. {
  89369. if (null !== $symbolsMap && !\is_array($symbolsMap) && !$symbolsMap instanceof \Closure) {
  89370. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be array, Closure or null, "%s" given.', __METHOD__, \gettype($symbolsMap)));
  89371. }
  89372. $this->defaultLocale = $defaultLocale;
  89373. $this->symbolsMap = $symbolsMap ?? $this->symbolsMap;
  89374. }
  89375. public function setLocale($locale)
  89376. {
  89377. $this->defaultLocale = $locale;
  89378. }
  89379. public function getLocale()
  89380. {
  89381. return $this->defaultLocale;
  89382. }
  89383. public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString
  89384. {
  89385. $locale = $locale ?? $this->defaultLocale;
  89386. $transliterator = [];
  89387. if ($locale && ('de' === $locale || 0 === strpos($locale, 'de_'))) {
  89388. $transliterator = ['de-ASCII'];
  89389. } elseif (\function_exists('transliterator_transliterate') && $locale) {
  89390. $transliterator = (array) $this->createTransliterator($locale);
  89391. }
  89392. if ($this->symbolsMap instanceof \Closure) {
  89393. $symbolsMap = $this->symbolsMap;
  89394. array_unshift($transliterator, static function ($s) use ($symbolsMap, $locale) {
  89395. return $symbolsMap($s, $locale);
  89396. });
  89397. }
  89398. $unicodeString = (new UnicodeString($string))->ascii($transliterator);
  89399. if (\is_array($this->symbolsMap)) {
  89400. $map = null;
  89401. if (isset($this->symbolsMap[$locale])) {
  89402. $map = $this->symbolsMap[$locale];
  89403. } else {
  89404. $parent = self::getParentLocale($locale);
  89405. if ($parent && isset($this->symbolsMap[$parent])) {
  89406. $map = $this->symbolsMap[$parent];
  89407. }
  89408. }
  89409. if ($map) {
  89410. foreach ($map as $char => $replace) {
  89411. $unicodeString = $unicodeString->replace($char, ' '.$replace.' ');
  89412. }
  89413. }
  89414. }
  89415. return $unicodeString
  89416. ->replaceMatches('/[^A-Za-z0-9]++/', $separator)
  89417. ->trim($separator)
  89418. ;
  89419. }
  89420. private function createTransliterator(string $locale): ?\Transliterator
  89421. {
  89422. if (\array_key_exists($locale, $this->transliterators)) {
  89423. return $this->transliterators[$locale];
  89424. }
  89425. if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$locale] ?? null) {
  89426. return $this->transliterators[$locale] = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
  89427. }
  89428. if (!$parent = self::getParentLocale($locale)) {
  89429. return $this->transliterators[$locale] = null;
  89430. }
  89431. if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$parent] ?? null) {
  89432. $transliterator = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
  89433. }
  89434. return $this->transliterators[$locale] = $this->transliterators[$parent] = $transliterator ?? null;
  89435. }
  89436. private static function getParentLocale(?string $locale): ?string
  89437. {
  89438. if (!$locale) {
  89439. return null;
  89440. }
  89441. if (false === $str = strrchr($locale, '_')) {
  89442. return null;
  89443. }
  89444. return substr($locale, 0, -\strlen($str));
  89445. }
  89446. }
  89447. <?php
  89448. namespace Symfony\Component\String\Slugger;
  89449. use Symfony\Component\String\AbstractUnicodeString;
  89450. interface SluggerInterface
  89451. {
  89452. public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString;
  89453. }
  89454. <?php
  89455. namespace Symfony\Component\String;
  89456. use Symfony\Component\String\Exception\ExceptionInterface;
  89457. use Symfony\Component\String\Exception\InvalidArgumentException;
  89458. class UnicodeString extends AbstractUnicodeString
  89459. {
  89460. public function __construct(string $string = '')
  89461. {
  89462. $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string);
  89463. if (false === $this->string) {
  89464. throw new InvalidArgumentException('Invalid UTF-8 string.');
  89465. }
  89466. }
  89467. public function append(string ...$suffix): AbstractString
  89468. {
  89469. $str = clone $this;
  89470. $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix));
  89471. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  89472. if (false === $str->string) {
  89473. throw new InvalidArgumentException('Invalid UTF-8 string.');
  89474. }
  89475. return $str;
  89476. }
  89477. public function chunk(int $length = 1): array
  89478. {
  89479. if (1 > $length) {
  89480. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  89481. }
  89482. if ('' === $this->string) {
  89483. return [];
  89484. }
  89485. $rx = '/(';
  89486. while (65535 < $length) {
  89487. $rx .= '\X{65535}';
  89488. $length -= 65535;
  89489. }
  89490. $rx .= '\X{'.$length.'})/u';
  89491. $str = clone $this;
  89492. $chunks = [];
  89493. foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
  89494. $str->string = $chunk;
  89495. $chunks[] = clone $str;
  89496. }
  89497. return $chunks;
  89498. }
  89499. public function endsWith($suffix): bool
  89500. {
  89501. if ($suffix instanceof AbstractString) {
  89502. $suffix = $suffix->string;
  89503. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  89504. return parent::endsWith($suffix);
  89505. } else {
  89506. $suffix = (string) $suffix;
  89507. }
  89508. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  89509. normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form);
  89510. if ('' === $suffix || false === $suffix) {
  89511. return false;
  89512. }
  89513. if ($this->ignoreCase) {
  89514. return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8');
  89515. }
  89516. return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
  89517. }
  89518. public function equalsTo($string): bool
  89519. {
  89520. if ($string instanceof AbstractString) {
  89521. $string = $string->string;
  89522. } elseif (\is_array($string) || $string instanceof \Traversable) {
  89523. return parent::equalsTo($string);
  89524. } else {
  89525. $string = (string) $string;
  89526. }
  89527. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  89528. normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form);
  89529. if ('' !== $string && false !== $string && $this->ignoreCase) {
  89530. return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
  89531. }
  89532. return $string === $this->string;
  89533. }
  89534. public function indexOf($needle, int $offset = 0): ?int
  89535. {
  89536. if ($needle instanceof AbstractString) {
  89537. $needle = $needle->string;
  89538. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  89539. return parent::indexOf($needle, $offset);
  89540. } else {
  89541. $needle = (string) $needle;
  89542. }
  89543. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  89544. normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
  89545. if ('' === $needle || false === $needle) {
  89546. return null;
  89547. }
  89548. try {
  89549. $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);
  89550. } catch (\ValueError $e) {
  89551. return null;
  89552. }
  89553. return false === $i ? null : $i;
  89554. }
  89555. public function indexOfLast($needle, int $offset = 0): ?int
  89556. {
  89557. if ($needle instanceof AbstractString) {
  89558. $needle = $needle->string;
  89559. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  89560. return parent::indexOfLast($needle, $offset);
  89561. } else {
  89562. $needle = (string) $needle;
  89563. }
  89564. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  89565. normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
  89566. if ('' === $needle || false === $needle) {
  89567. return null;
  89568. }
  89569. $string = $this->string;
  89570. if (0 > $offset) {
  89571. if (0 > $offset += grapheme_strlen($needle)) {
  89572. $string = grapheme_substr($string, 0, $offset);
  89573. }
  89574. $offset = 0;
  89575. }
  89576. $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset);
  89577. return false === $i ? null : $i;
  89578. }
  89579. public function join(array $strings, ?string $lastGlue = null): AbstractString
  89580. {
  89581. $str = parent::join($strings, $lastGlue);
  89582. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  89583. return $str;
  89584. }
  89585. public function length(): int
  89586. {
  89587. return grapheme_strlen($this->string);
  89588. }
  89589. public function normalize(int $form = self::NFC): parent
  89590. {
  89591. $str = clone $this;
  89592. if (\in_array($form, [self::NFC, self::NFKC], true)) {
  89593. normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
  89594. } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) {
  89595. throw new InvalidArgumentException('Unsupported normalization form.');
  89596. } elseif (!normalizer_is_normalized($str->string, $form)) {
  89597. $str->string = normalizer_normalize($str->string, $form);
  89598. $str->ignoreCase = null;
  89599. }
  89600. return $str;
  89601. }
  89602. public function prepend(string ...$prefix): AbstractString
  89603. {
  89604. $str = clone $this;
  89605. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
  89606. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  89607. if (false === $str->string) {
  89608. throw new InvalidArgumentException('Invalid UTF-8 string.');
  89609. }
  89610. return $str;
  89611. }
  89612. public function replace(string $from, string $to): AbstractString
  89613. {
  89614. $str = clone $this;
  89615. normalizer_is_normalized($from) ?: $from = normalizer_normalize($from);
  89616. if ('' !== $from && false !== $from) {
  89617. $tail = $str->string;
  89618. $result = '';
  89619. $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
  89620. while ('' !== $tail && false !== $i = $indexOf($tail, $from)) {
  89621. $slice = grapheme_substr($tail, 0, $i);
  89622. $result .= $slice.$to;
  89623. $tail = substr($tail, \strlen($slice) + \strlen($from));
  89624. }
  89625. $str->string = $result.$tail;
  89626. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  89627. if (false === $str->string) {
  89628. throw new InvalidArgumentException('Invalid UTF-8 string.');
  89629. }
  89630. }
  89631. return $str;
  89632. }
  89633. public function replaceMatches(string $fromRegexp, $to): AbstractString
  89634. {
  89635. $str = parent::replaceMatches($fromRegexp, $to);
  89636. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  89637. return $str;
  89638. }
  89639. public function slice(int $start = 0, ?int $length = null): AbstractString
  89640. {
  89641. $str = clone $this;
  89642. if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
  89643. $start = 0;
  89644. }
  89645. $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
  89646. return $str;
  89647. }
  89648. public function splice(string $replacement, int $start = 0, ?int $length = null): AbstractString
  89649. {
  89650. $str = clone $this;
  89651. if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
  89652. $start = 0;
  89653. }
  89654. $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
  89655. $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
  89656. $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
  89657. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  89658. if (false === $str->string) {
  89659. throw new InvalidArgumentException('Invalid UTF-8 string.');
  89660. }
  89661. return $str;
  89662. }
  89663. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  89664. {
  89665. if (1 > $limit = $limit ?? 2147483647) {
  89666. throw new InvalidArgumentException('Split limit must be a positive integer.');
  89667. }
  89668. if ('' === $delimiter) {
  89669. throw new InvalidArgumentException('Split delimiter is empty.');
  89670. }
  89671. if (null !== $flags) {
  89672. return parent::split($delimiter.'u', $limit, $flags);
  89673. }
  89674. normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter);
  89675. if (false === $delimiter) {
  89676. throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
  89677. }
  89678. $str = clone $this;
  89679. $tail = $this->string;
  89680. $chunks = [];
  89681. $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
  89682. while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) {
  89683. $str->string = grapheme_substr($tail, 0, $i);
  89684. $chunks[] = clone $str;
  89685. $tail = substr($tail, \strlen($str->string) + \strlen($delimiter));
  89686. --$limit;
  89687. }
  89688. $str->string = $tail;
  89689. $chunks[] = clone $str;
  89690. return $chunks;
  89691. }
  89692. public function startsWith($prefix): bool
  89693. {
  89694. if ($prefix instanceof AbstractString) {
  89695. $prefix = $prefix->string;
  89696. } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
  89697. return parent::startsWith($prefix);
  89698. } else {
  89699. $prefix = (string) $prefix;
  89700. }
  89701. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  89702. normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form);
  89703. if ('' === $prefix || false === $prefix) {
  89704. return false;
  89705. }
  89706. if ($this->ignoreCase) {
  89707. return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8');
  89708. }
  89709. return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES);
  89710. }
  89711. public function __wakeup()
  89712. {
  89713. if (!\is_string($this->string)) {
  89714. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  89715. }
  89716. normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
  89717. }
  89718. public function __clone()
  89719. {
  89720. if (null === $this->ignoreCase) {
  89721. normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
  89722. }
  89723. $this->ignoreCase = false;
  89724. }
  89725. }
  89726. <?php
  89727. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  89728. if (0 === strpos(__FILE__, 'phar:') && ini_get('register_argc_argv')) {
  89729. echo 'Composer cannot be run safely on non-CLI SAPIs with register_argc_argv=On. Aborting.'.PHP_EOL;
  89730. exit(1);
  89731. }
  89732. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  89733. }
  89734. if (PHP_VERSION_ID < 70205) {
  89735. echo 'Composer 2.3.0 dropped support for PHP <7.2.5 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  89736. exit(1);
  89737. }
  89738. setlocale(LC_ALL, 'C');
  89739. require __DIR__.'/../src/bootstrap.php';
  89740. use Composer\Console\Application;
  89741. use Composer\XdebugHandler\XdebugHandler;
  89742. use Composer\Util\Platform;
  89743. use Composer\Util\ErrorHandler;
  89744. error_reporting(-1);
  89745. // Restart without Xdebug
  89746. $xdebug = new XdebugHandler('Composer');
  89747. $xdebug->check();
  89748. unset($xdebug);
  89749. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  89750. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  89751. exit(1);
  89752. }
  89753. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  89754. echo 'The iconv OR mbstring extension is required and both are missing.'
  89755. .PHP_EOL.'Install either of them or recompile php without --disable-iconv.'
  89756. .PHP_EOL.'Aborting.'.PHP_EOL;
  89757. exit(1);
  89758. }
  89759. if (function_exists('ini_set')) {
  89760. @ini_set('display_errors', '1');
  89761. // Set user defined memory limit
  89762. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  89763. @ini_set('memory_limit', $memoryLimit);
  89764. } else {
  89765. $memoryInBytes = function ($value) {
  89766. $unit = strtolower(substr($value, -1, 1));
  89767. $value = (int) $value;
  89768. switch($unit) {
  89769. case 'g':
  89770. $value *= 1024;
  89771. // no break (cumulative multiplier)
  89772. case 'm':
  89773. $value *= 1024;
  89774. // no break (cumulative multiplier)
  89775. case 'k':
  89776. $value *= 1024;
  89777. }
  89778. return $value;
  89779. };
  89780. $memoryLimit = trim(ini_get('memory_limit'));
  89781. // Increase memory_limit if it is lower than 1.5GB
  89782. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  89783. @ini_set('memory_limit', '1536M');
  89784. }
  89785. unset($memoryInBytes);
  89786. }
  89787. unset($memoryLimit);
  89788. }
  89789. // Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
  89790. // see https://github.com/php/php-src/issues/7896
  89791. if (PHP_VERSION_ID >= 70113 && (PHP_VERSION_ID < 80016 || (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80103)) && Platform::isWindows()) {
  89792. foreach ($_SERVER as $serverVar => $serverVal) {
  89793. if (($serverVal = getenv($serverVar)) !== false) {
  89794. $_SERVER[$serverVar] = $serverVal;
  89795. }
  89796. }
  89797. }
  89798. Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));
  89799. ErrorHandler::register();
  89800. // run the command application
  89801. $application = new Application();
  89802. $application->run();
  89803. Copyright (c) Nils Adermann, Jordi Boggiano
  89804. Permission is hereby granted, free of charge, to any person obtaining a copy
  89805. of this software and associated documentation files (the "Software"), to deal
  89806. in the Software without restriction, including without limitation the rights
  89807. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  89808. copies of the Software, and to permit persons to whom the Software is furnished
  89809. to do so, subject to the following conditions:
  89810. The above copyright notice and this permission notice shall be included in all
  89811. copies or substantial portions of the Software.
  89812. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  89813. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  89814. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  89815. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  89816. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  89817. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  89818. THE SOFTWARE.
  89819. ÇžØwa<ež#oÏË/á¾\¯Y\¾s½W�ý‘5XðëC$šF4Oú8æ†NU$ F*#ª�ÜÈ#|djßgùl���GBMB